@opendata-ai/openchart-engine 6.19.0 → 6.19.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opendata-ai/openchart-engine",
3
- "version": "6.19.0",
3
+ "version": "6.19.2",
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": "6.19.0",
48
+ "@opendata-ai/openchart-core": "6.19.2",
49
49
  "d3-array": "^3.2.0",
50
50
  "d3-format": "^3.1.2",
51
51
  "d3-interpolate": "^3.0.0",
@@ -866,8 +866,8 @@ describe('computeAnnotations', () => {
866
866
 
867
867
  // Curve should start from right edge of text, not top edge
868
868
  // Right edge x ≈ label.x + textWidth
869
- // "Curve test" = 10 chars * 12 * 0.55 = 66
870
- expect(connector.from.x).toBeCloseTo(label.x + 66, 1);
869
+ // "Curve test" = 10 chars * 12 * 0.57 = 68.4
870
+ expect(connector.from.x).toBeCloseTo(label.x + 68.4, 1);
871
871
  });
872
872
  });
873
873
 
package/src/compile.ts CHANGED
@@ -240,7 +240,7 @@ export function compileChart(spec: unknown, options: CompileOptions): ChartLayou
240
240
  // Responsive strategy
241
241
  const breakpoint = getBreakpoint(options.width);
242
242
  const heightClass = getHeightClass(options.height);
243
- const strategy = getLayoutStrategy(breakpoint, heightClass);
243
+ let strategy = getLayoutStrategy(breakpoint, heightClass);
244
244
 
245
245
  // Apply breakpoint-conditional overrides from the expanded spec
246
246
  const rawSpec = expandedSpec as Record<string, unknown>;
@@ -286,6 +286,9 @@ export function compileChart(spec: unknown, options: CompileOptions): ChartLayou
286
286
  ...chartSpec,
287
287
  annotations: bp.annotations as NormalizedChartSpec['annotations'],
288
288
  };
289
+ // User explicitly provided annotations at this breakpoint — override the
290
+ // responsive strategy so they render inline instead of being stripped.
291
+ strategy = { ...strategy, annotationPosition: 'inline' };
289
292
  }
290
293
  }
291
294
 
@@ -289,9 +289,11 @@ export function computeLegend(
289
289
  }
290
290
 
291
291
  // Top/bottom-positioned legend: horizontal flow with overflow protection.
292
- // Reserve space on the right so legend entries don't overlap the brand watermark.
292
+ // Reserve space on the right for bottom legends so they don't overlap the brand
293
+ // watermark. Top legends don't need this since the brand renders at the bottom.
294
+ const reserveBrand = watermark && resolvedPosition === 'bottom';
293
295
  const availableWidth =
294
- chartArea.width - LEGEND_PADDING * 2 - (watermark ? BRAND_RESERVE_WIDTH : 0);
296
+ chartArea.width - LEGEND_PADDING * 2 - (reserveBrand ? BRAND_RESERVE_WIDTH : 0);
295
297
 
296
298
  // Apply symbolLimit first if set (minimum 1), then fit remaining entries to available rows.
297
299
  if (spec.legend?.symbolLimit != null) {