@opendata-ai/openchart-vanilla 7.0.0 → 7.0.3
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 +18 -8
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/barlist-mount.ts +15 -1
- package/src/interactions/crosshair.ts +12 -7
package/dist/index.js
CHANGED
|
@@ -642,7 +642,16 @@ function createBarList(container, spec, options) {
|
|
|
642
642
|
watermark: options?.watermark,
|
|
643
643
|
measureText
|
|
644
644
|
};
|
|
645
|
-
|
|
645
|
+
const layout = compileBarList(currentSpec, compileOpts);
|
|
646
|
+
if (layout.rows.length > 0) {
|
|
647
|
+
const lastRow = layout.rows[layout.rows.length - 1];
|
|
648
|
+
const contentBottom = lastRow.y + lastRow.height + layout.chrome.bottomHeight + layout.theme.spacing.padding;
|
|
649
|
+
if (contentBottom < layout.height) {
|
|
650
|
+
layout.height = contentBottom;
|
|
651
|
+
layout.area.height = contentBottom - layout.area.y - layout.chrome.bottomHeight - layout.theme.spacing.padding;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
return layout;
|
|
646
655
|
}
|
|
647
656
|
function wireTooltipAndInteraction(svg, layout) {
|
|
648
657
|
const cleanups = [];
|
|
@@ -3853,23 +3862,24 @@ function snapKey(x3) {
|
|
|
3853
3862
|
return Math.round(x3);
|
|
3854
3863
|
}
|
|
3855
3864
|
function collectSeriesGroups(layout) {
|
|
3856
|
-
const
|
|
3865
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
3866
|
+
const markTypeByKey = /* @__PURE__ */ new Map();
|
|
3857
3867
|
for (let i = 0; i < layout.marks.length; i++) {
|
|
3858
3868
|
const mark = layout.marks[i];
|
|
3859
3869
|
if ((mark.type === "line" || mark.type === "area") && mark.dataPoints?.length) {
|
|
3870
|
+
const key = mark.seriesKey ?? "__default__";
|
|
3871
|
+
const existingType = markTypeByKey.get(key);
|
|
3872
|
+
if (existingType === "line" && mark.type === "area") continue;
|
|
3860
3873
|
const color = mark.type === "line" ? mark.stroke : getRepresentativeColor(mark.fill);
|
|
3861
3874
|
const pointsByX = /* @__PURE__ */ new Map();
|
|
3862
3875
|
for (const dp of mark.dataPoints) {
|
|
3863
3876
|
pointsByX.set(snapKey(dp.x), { ...dp });
|
|
3864
3877
|
}
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
color,
|
|
3868
|
-
pointsByX
|
|
3869
|
-
});
|
|
3878
|
+
byKey.set(key, { seriesKey: key, color, pointsByX });
|
|
3879
|
+
markTypeByKey.set(key, mark.type);
|
|
3870
3880
|
}
|
|
3871
3881
|
}
|
|
3872
|
-
return
|
|
3882
|
+
return Array.from(byKey.values());
|
|
3873
3883
|
}
|
|
3874
3884
|
function collectSnapXs(groups) {
|
|
3875
3885
|
const seen = /* @__PURE__ */ new Set();
|