@opendata-ai/openchart-engine 8.0.0-rc.1 → 8.0.0-rc.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.d.ts +0 -7
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/compiler/__tests__/keys.test.ts +3 -9
- package/src/compiler/keys.ts +5 -4
- package/src/layout/axes.ts +5 -4
package/dist/index.d.ts
CHANGED
|
@@ -246,13 +246,6 @@ declare function clampStaggerDelay(delay: number, elementCount: number): number;
|
|
|
246
246
|
* - null/undefined -> null sentinel
|
|
247
247
|
*/
|
|
248
248
|
declare function serializeKeyValue(v: unknown): string;
|
|
249
|
-
/**
|
|
250
|
-
* Append occurrence suffixes to duplicate keys, in order.
|
|
251
|
-
*
|
|
252
|
-
* Only keys that appear more than once get suffixed. Unique keys pass
|
|
253
|
-
* through unchanged so keys remain human-readable when possible.
|
|
254
|
-
* Uses SOH (\x01) as separator to avoid collisions with real data values.
|
|
255
|
-
*/
|
|
256
249
|
declare function dedupeKeys(keys: string[]): string[];
|
|
257
250
|
|
|
258
251
|
/**
|
package/dist/index.js
CHANGED
|
@@ -2160,6 +2160,7 @@ function serializeKeyValue(v) {
|
|
|
2160
2160
|
if (v instanceof Date) return String(v.getTime());
|
|
2161
2161
|
return String(v);
|
|
2162
2162
|
}
|
|
2163
|
+
var KEY_DEDUP_SEP = "\u2E31";
|
|
2163
2164
|
function dedupeKeys(keys) {
|
|
2164
2165
|
const counts = /* @__PURE__ */ new Map();
|
|
2165
2166
|
for (const k of keys) {
|
|
@@ -2170,7 +2171,7 @@ function dedupeKeys(keys) {
|
|
|
2170
2171
|
for (const k of keys) {
|
|
2171
2172
|
if (counts.get(k) > 1) {
|
|
2172
2173
|
const idx = seen.get(k) ?? 0;
|
|
2173
|
-
result.push(`${k}
|
|
2174
|
+
result.push(`${k}${KEY_DEDUP_SEP}${idx}`);
|
|
2174
2175
|
seen.set(k, idx + 1);
|
|
2175
2176
|
} else {
|
|
2176
2177
|
result.push(k);
|
|
@@ -13994,6 +13995,7 @@ import {
|
|
|
13994
13995
|
estimateTextWidth as estimateTextWidth15,
|
|
13995
13996
|
getAxisTitleOffset,
|
|
13996
13997
|
truncateRotatedLabel,
|
|
13998
|
+
X_AXIS_TITLE_BAND,
|
|
13997
13999
|
X_AXIS_TITLE_BAND_ROTATED
|
|
13998
14000
|
} from "@opendata-ai/openchart-core";
|
|
13999
14001
|
|
|
@@ -14606,10 +14608,12 @@ function computeAxes(scales, chartArea, strategy, theme, measureText, dataContex
|
|
|
14606
14608
|
measure: (t, fs, fw) => measureLabel(t, fs, fw, measureText)
|
|
14607
14609
|
});
|
|
14608
14610
|
if (result.x.label) {
|
|
14609
|
-
const
|
|
14611
|
+
const titleBand = isRotated ? X_AXIS_TITLE_BAND_ROTATED : X_AXIS_TITLE_BAND;
|
|
14612
|
+
const tickBand = result.x.extent - titleBand;
|
|
14613
|
+
const titleY = isRotated ? tickBand + 14 : tickBand + 9;
|
|
14610
14614
|
result.x.titlePosition = {
|
|
14611
14615
|
x: chartArea.x + chartArea.width / 2,
|
|
14612
|
-
y: chartArea.y + chartArea.height +
|
|
14616
|
+
y: chartArea.y + chartArea.height + titleY
|
|
14613
14617
|
};
|
|
14614
14618
|
}
|
|
14615
14619
|
}
|