@opendata-ai/openchart-engine 6.25.1 → 6.25.2

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
@@ -11544,7 +11544,12 @@ function compileLayer(spec, options) {
11544
11544
  for (const entry of mergedLegendEntries) {
11545
11545
  seenLabels.add(entry.label);
11546
11546
  }
11547
- for (const leaf of leaves) {
11547
+ const indexedLeaves = leaves.map((leaf, i) => ({
11548
+ leaf,
11549
+ zIndex: leaf.zIndex ?? i
11550
+ }));
11551
+ indexedLeaves.sort((a, b) => a.zIndex - b.zIndex);
11552
+ for (const { leaf } of indexedLeaves) {
11548
11553
  const leafLayout = compileChart(leaf, options);
11549
11554
  allMarks.push(...leafLayout.marks);
11550
11555
  for (const entry of leafLayout.legend.entries) {
@@ -11755,6 +11760,9 @@ function compileLayerIndependent(leaves, layerSpec, options) {
11755
11760
  mergedTooltips.set(key, value2);
11756
11761
  }
11757
11762
  }
11763
+ const z0 = leaf0.zIndex ?? 0;
11764
+ const z1 = leaf1.zIndex ?? 1;
11765
+ const marks = z0 <= z1 ? [...adjustedMarks0, ...taggedMarks1] : [...taggedMarks1, ...adjustedMarks0];
11758
11766
  return {
11759
11767
  ...layout0,
11760
11768
  axes: {
@@ -11762,7 +11770,7 @@ function compileLayerIndependent(leaves, layerSpec, options) {
11762
11770
  y: layout0.axes.y,
11763
11771
  y2: y2Axis
11764
11772
  },
11765
- marks: [...adjustedMarks0, ...taggedMarks1],
11773
+ marks,
11766
11774
  legend: {
11767
11775
  ...layout0.legend,
11768
11776
  entries: mergedLegendEntries