@opendata-ai/openchart-engine 9.2.0 → 9.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -20149,6 +20149,10 @@ function compileFaceted(chartSpec, renderSpec, facetChannel, facetDirection, the
20149
20149
  const fullScales = computeScales(panelSpec, chartArea, renderSpec.data);
20150
20150
  const sharedXDomain = xResolve === "shared" && fullScales.x ? fullScales.x.scale.domain() : void 0;
20151
20151
  const sharedYDomain = yResolve === "shared" && fullScales.y ? fullScales.y.scale.domain() : void 0;
20152
+ const sharedColorScale = (resolveConfig?.scale?.color ?? "shared") === "shared" ? computeChartScales({ ...panelSpec, data: renderSpec.data }, chartArea, theme, chartSpec).scales.color : void 0;
20153
+ const sizeDefaults = sizeScaleDefaultsFor(chartSpec.markType);
20154
+ const sizeChannel = panelEncoding.size;
20155
+ const sharedSizeDomain = (resolveConfig?.scale?.size ?? "shared") === "shared" && sizeDefaults && sizeChannel && "field" in sizeChannel && !sizeChannel.scale?.domain ? buildSizeScale(sizeChannel, renderSpec.data, sizeDefaults)?.domain : void 0;
20152
20156
  const isRadial = isAxislessMark3(chartSpec.markType);
20153
20157
  const rendererKey = resolveRendererKey(
20154
20158
  renderSpec.markType,
@@ -20178,6 +20182,12 @@ function compileFaceted(chartSpec, renderSpec, facetChannel, facetDirection, the
20178
20182
  y: { ...yCh, scale: { ...yCh.scale ?? {}, domain: sharedYDomain } }
20179
20183
  };
20180
20184
  }
20185
+ if (sharedSizeDomain && sizeChannel) {
20186
+ panelEnc = {
20187
+ ...panelEnc,
20188
+ size: { ...sizeChannel, scale: { ...sizeChannel.scale ?? {}, domain: sharedSizeDomain } }
20189
+ };
20190
+ }
20181
20191
  const panelSpecWithDomains = {
20182
20192
  ...panelSpecLocal,
20183
20193
  encoding: panelEnc
@@ -20188,6 +20198,7 @@ function compileFaceted(chartSpec, renderSpec, facetChannel, facetDirection, the
20188
20198
  theme,
20189
20199
  chartSpec
20190
20200
  );
20201
+ if (sharedColorScale) panelScales.color = sharedColorScale;
20191
20202
  if (options.dev && panelLayouts.length === 0) {
20192
20203
  emitSpecWarnings(
20193
20204
  collectContrastWarnings(panelScales, chartSpec.markType, theme),
@@ -20200,9 +20211,9 @@ function compileFaceted(chartSpec, renderSpec, facetChannel, facetDirection, the
20200
20211
  axisTitleHeader: grid.axisTitleHeader,
20201
20212
  encoding: panelSpecWithDomains.encoding,
20202
20213
  markType: chartSpec.markType,
20203
- // Outside-label cells use figure coordinates throughout, including
20204
- // the tick-label clamp. Keep the legacy path unchanged in 8.x.
20205
- totalWidth: gridPanel.referenceContainer ? gridPanel.area.x + gridPanel.area.width : gridPanel.area.width
20214
+ // Tick positions are figure coordinates, so the label clamp's right
20215
+ // edge is the panel's right edge in figure coordinates too.
20216
+ totalWidth: gridPanel.area.x + gridPanel.area.width
20206
20217
  });
20207
20218
  offsetValueLabelAxes(panelAxes, grid.valueLabelPlan);
20208
20219
  if (!isRadial) {