@opendata-ai/openchart-engine 6.2.0 → 6.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 +15 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/layout/axes.ts +2 -1
- package/src/layout/dimensions.ts +18 -1
package/dist/index.js
CHANGED
|
@@ -7004,7 +7004,8 @@ function formatTickLabel(value, resolvedScale) {
|
|
|
7004
7004
|
if (TEMPORAL_SCALE_TYPES.has(resolvedScale.type)) {
|
|
7005
7005
|
const temporalFmt = buildTemporalFormatter(formatStr);
|
|
7006
7006
|
if (temporalFmt) return temporalFmt(value);
|
|
7007
|
-
|
|
7007
|
+
const useUtc = resolvedScale.type === "utc";
|
|
7008
|
+
return formatDate(value, void 0, void 0, useUtc);
|
|
7008
7009
|
}
|
|
7009
7010
|
if (NUMERIC_SCALE_TYPES.has(resolvedScale.type)) {
|
|
7010
7011
|
const num = value;
|
|
@@ -7257,7 +7258,19 @@ function computeDimensions(spec, options, legendLayout, theme, strategy) {
|
|
|
7257
7258
|
for (const ann of spec.annotations) {
|
|
7258
7259
|
if (ann.type === "text" && String(ann.x) === maxXStr) {
|
|
7259
7260
|
const textWidth = estimateTextWidth8(ann.text, ann.fontSize ?? 11, ann.fontWeight ?? 600);
|
|
7260
|
-
|
|
7261
|
+
const dx = ann.offset?.dx ?? 0;
|
|
7262
|
+
const anchor = ann.anchor ?? "auto";
|
|
7263
|
+
const baseRightExtent = anchor === "left" ? textWidth : (
|
|
7264
|
+
// text is to the right of anchor
|
|
7265
|
+
anchor === "right" ? 0 : (
|
|
7266
|
+
// text is to the left of anchor
|
|
7267
|
+
textWidth / 2
|
|
7268
|
+
)
|
|
7269
|
+
);
|
|
7270
|
+
const rightOverflow = Math.max(0, baseRightExtent + dx);
|
|
7271
|
+
if (rightOverflow > 0) {
|
|
7272
|
+
margins.right = Math.max(margins.right, padding + rightOverflow + 12);
|
|
7273
|
+
}
|
|
7261
7274
|
}
|
|
7262
7275
|
}
|
|
7263
7276
|
}
|