@opendata-ai/openchart-engine 2.12.0 → 2.12.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 +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/annotations/compute.ts +6 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opendata-ai/openchart-engine",
|
|
3
|
-
"version": "2.12.
|
|
3
|
+
"version": "2.12.1",
|
|
4
4
|
"description": "Headless compiler for openchart: spec validation, data compilation, scales, and layout",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Riley Hilliard",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"typecheck": "tsc --noEmit"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@opendata-ai/openchart-core": "2.12.
|
|
48
|
+
"@opendata-ai/openchart-core": "2.12.1",
|
|
49
49
|
"d3-array": "^3.2.0",
|
|
50
50
|
"d3-format": "^3.1.2",
|
|
51
51
|
"d3-interpolate": "^3.0.0",
|
|
@@ -410,12 +410,13 @@ function resolveRangeAnnotation(
|
|
|
410
410
|
|
|
411
411
|
// Label positioned within the range, with optional offset.
|
|
412
412
|
// labelAnchor controls horizontal placement:
|
|
413
|
-
// "
|
|
414
|
-
// "
|
|
413
|
+
// "top" (default): horizontally centered, text-anchor middle
|
|
414
|
+
// "left": left edge, text-anchor start
|
|
415
415
|
// "right": right edge, text-anchor end
|
|
416
|
+
// "bottom"/"auto": horizontally centered, text-anchor middle
|
|
416
417
|
let label: ResolvedLabel | undefined;
|
|
417
418
|
if (annotation.label) {
|
|
418
|
-
const anchor = annotation.labelAnchor ?? '
|
|
419
|
+
const anchor = annotation.labelAnchor ?? 'top';
|
|
419
420
|
const centered = anchor === 'top' || anchor === 'bottom' || anchor === 'auto';
|
|
420
421
|
const baseDx = centered ? 0 : anchor === 'right' ? -4 : 4;
|
|
421
422
|
const baseDy = 14;
|
|
@@ -428,6 +429,8 @@ function resolveRangeAnnotation(
|
|
|
428
429
|
style.textAnchor = 'end';
|
|
429
430
|
}
|
|
430
431
|
|
|
432
|
+
// Position label horizontally centered within the range band by default.
|
|
433
|
+
// For left/right anchors, position at the respective edge.
|
|
431
434
|
const baseX = centered ? x + width / 2 : anchor === 'right' ? x + width : x;
|
|
432
435
|
|
|
433
436
|
label = {
|