@opendata-ai/openchart-engine 7.1.2 → 7.1.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 CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  adaptTheme as adaptTheme5,
4
4
  computeLabelBounds,
5
- estimateTextWidth as estimateTextWidth21,
5
+ estimateTextWidth as estimateTextWidth20,
6
6
  generateAltText,
7
7
  generateDataTable,
8
8
  getBreakpoint,
@@ -9709,7 +9709,6 @@ import {
9709
9709
  abbreviateNumber as abbreviateNumber2,
9710
9710
  buildD3Formatter as buildD3Formatter5,
9711
9711
  buildTemporalFormatter,
9712
- estimateTextWidth as estimateTextWidth12,
9713
9712
  formatDate,
9714
9713
  formatNumber as formatNumber3
9715
9714
  } from "@opendata-ai/openchart-core";
@@ -9819,35 +9818,16 @@ function scaleSupportsTickCount(resolvedScale) {
9819
9818
  const scale = resolvedScale.scale;
9820
9819
  return "ticks" in scale && typeof scale.ticks === "function";
9821
9820
  }
9822
- function categoricalTicks(resolvedScale, density, orientation = "horizontal", bandwidth, labelAngle, fontSize, fontWeight, measureText, subtitleContext) {
9821
+ function categoricalTicks(resolvedScale, density, orientation = "horizontal", subtitleContext) {
9823
9822
  const scale = resolvedScale.scale;
9824
9823
  const domain = scale.domain();
9825
9824
  const catAxisCfg = resolvedScale.channel.axis || void 0;
9826
9825
  const explicitTickCount = catAxisCfg?.tickCount;
9827
9826
  let selectedValues = domain;
9828
9827
  if (resolvedScale.type === "band" && orientation === "horizontal") {
9829
- if (bandwidth !== void 0 && bandwidth > 0 && fontSize !== void 0) {
9830
- const maxLabelWidth = domain.reduce((max4, v) => {
9831
- const w = measureText ? measureText(v, fontSize, fontWeight ?? 400).width : estimateTextWidth12(v, fontSize, fontWeight ?? 400);
9832
- return Math.max(max4, w);
9833
- }, 0);
9834
- const angleRad = labelAngle !== void 0 ? Math.abs(labelAngle) * Math.PI / 180 : 0;
9835
- const footprint = angleRad > 0 ? maxLabelWidth * Math.abs(Math.cos(angleRad)) : maxLabelWidth;
9836
- const minGap = fontSize * 0.5;
9837
- if (footprint + minGap > bandwidth) {
9838
- const maxFitting = Math.max(1, Math.floor(bandwidth / (footprint + minGap)));
9839
- const cap = explicitTickCount ?? Math.min(domain.length, Math.max(maxFitting, TICK_COUNTS[density]));
9840
- if (domain.length > cap) {
9841
- const step = Math.ceil(domain.length / cap);
9842
- selectedValues = domain.filter((_, i) => i % step === 0);
9843
- }
9844
- }
9845
- } else {
9846
- const maxTicks = explicitTickCount ?? TICK_COUNTS[density];
9847
- if ((explicitTickCount || density !== "full") && domain.length > maxTicks) {
9848
- const step = Math.ceil(domain.length / maxTicks);
9849
- selectedValues = domain.filter((_, i) => i % step === 0);
9850
- }
9828
+ if (explicitTickCount && domain.length > explicitTickCount) {
9829
+ const step = Math.ceil(domain.length / explicitTickCount);
9830
+ selectedValues = domain.filter((_, i) => i % step === 0);
9851
9831
  }
9852
9832
  } else if (resolvedScale.type !== "band") {
9853
9833
  const maxTicks = explicitTickCount ?? TICK_COUNTS[density];
@@ -9958,6 +9938,34 @@ function fitContinuousTicks(scale, initialTicks, initialCount, fontSize, fontWei
9958
9938
  const fallback = bestWithinFloor ?? buildContinuousTicks(scale, floor);
9959
9939
  return thinTicksUntilFit(fallback, fontSize, fontWeight, measureText, orientation);
9960
9940
  }
9941
+ function bandTicksOverlapAtAngle(ticks2, angleDeg, fontSize, fontWeight, measureText) {
9942
+ if (ticks2.length < 2) return false;
9943
+ const angleRad = Math.abs(angleDeg) * Math.PI / 180;
9944
+ const cosA = angleRad > 0 ? Math.abs(Math.cos(angleRad)) : 1;
9945
+ const minGap = fontSize * 0.5;
9946
+ for (let i = 0; i < ticks2.length - 1; i++) {
9947
+ const aWidth = measureLabel(ticks2[i].label, fontSize, fontWeight, measureText) * cosA;
9948
+ const bWidth = measureLabel(ticks2[i + 1].label, fontSize, fontWeight, measureText) * cosA;
9949
+ const aRight = ticks2[i].position + aWidth / 2;
9950
+ const bLeft = ticks2[i + 1].position - bWidth / 2;
9951
+ if (aRight + minGap > bLeft) return true;
9952
+ }
9953
+ return false;
9954
+ }
9955
+ function thinBandTicksIfNeeded(ticks2, angleDeg, fontSize, fontWeight, measureText) {
9956
+ if (!bandTicksOverlapAtAngle(ticks2, angleDeg, fontSize, fontWeight, measureText)) return ticks2;
9957
+ let current = ticks2;
9958
+ while (current.length > 2) {
9959
+ const thinned = [current[0]];
9960
+ for (let i = 2; i < current.length - 1; i += 2) {
9961
+ thinned.push(current[i]);
9962
+ }
9963
+ if (current.length > 1) thinned.push(current[current.length - 1]);
9964
+ current = thinned;
9965
+ if (!bandTicksOverlapAtAngle(current, angleDeg, fontSize, fontWeight, measureText)) break;
9966
+ }
9967
+ return current;
9968
+ }
9961
9969
  function computeAxes(scales, chartArea, strategy, theme, measureText, dataContext) {
9962
9970
  const result = {};
9963
9971
  const baseDensity = strategy.axisLabelDensity;
@@ -9998,17 +10006,7 @@ function computeAxes(scales, chartArea, strategy, theme, measureText, dataContex
9998
10006
  if (axisConfig?.values) {
9999
10007
  allTicks = resolveExplicitTicks(axisConfig.values, scales.x);
10000
10008
  } else if (!isContinuousX) {
10001
- const xBandwidth = scales.x.type === "band" ? scales.x.scale.bandwidth() : void 0;
10002
- allTicks = categoricalTicks(
10003
- scales.x,
10004
- xDensity,
10005
- "horizontal",
10006
- xBandwidth,
10007
- axisConfig?.labelAngle,
10008
- fontSize,
10009
- fontWeight,
10010
- measureText
10011
- );
10009
+ allTicks = categoricalTicks(scales.x, xDensity, "horizontal");
10012
10010
  } else {
10013
10011
  allTicks = continuousTicks(scales.x, xDensity, xTargetCount);
10014
10012
  }
@@ -10016,11 +10014,25 @@ function computeAxes(scales, chartArea, strategy, theme, measureText, dataContex
10016
10014
  position: t.position,
10017
10015
  major: true
10018
10016
  }));
10017
+ let tickAngle = axisConfig?.labelAngle;
10018
+ if (tickAngle === void 0 && scales.x.type === "band" && allTicks.length > 1) {
10019
+ const bandwidth = scales.x.scale.bandwidth();
10020
+ let maxLabelWidth = 0;
10021
+ for (const t of allTicks) {
10022
+ const w = measureLabel(t.label, fontSize, fontWeight, measureText);
10023
+ if (w > maxLabelWidth) maxLabelWidth = w;
10024
+ }
10025
+ if (maxLabelWidth > bandwidth * 0.85) {
10026
+ tickAngle = -45;
10027
+ }
10028
+ }
10019
10029
  const hasExplicitValues = !!axisConfig?.values;
10020
- const shouldThin = scales.x.type !== "band" && !hasExplicitValues;
10021
10030
  let ticks2;
10022
- if (!shouldThin) {
10031
+ if (hasExplicitValues) {
10023
10032
  ticks2 = allTicks;
10033
+ } else if (scales.x.type === "band") {
10034
+ const effectiveAngle = tickAngle ?? 0;
10035
+ ticks2 = thinBandTicksIfNeeded(allTicks, effectiveAngle, fontSize, fontWeight, measureText);
10024
10036
  } else if (isContinuousX) {
10025
10037
  ticks2 = fitContinuousTicks(
10026
10038
  scales.x,
@@ -10035,18 +10047,6 @@ function computeAxes(scales, chartArea, strategy, theme, measureText, dataContex
10035
10047
  } else {
10036
10048
  ticks2 = thinTicksUntilFit(allTicks, fontSize, fontWeight, measureText);
10037
10049
  }
10038
- let tickAngle = axisConfig?.labelAngle;
10039
- if (tickAngle === void 0 && scales.x.type === "band" && ticks2.length > 1) {
10040
- const bandwidth = scales.x.scale.bandwidth();
10041
- let maxLabelWidth = 0;
10042
- for (const t of ticks2) {
10043
- const w = measureLabel(t.label, fontSize, fontWeight, measureText);
10044
- if (w > maxLabelWidth) maxLabelWidth = w;
10045
- }
10046
- if (maxLabelWidth > bandwidth * 0.85) {
10047
- tickAngle = -45;
10048
- }
10049
- }
10050
10050
  const axisTitle = axisConfig?.title;
10051
10051
  const xLabelColor = axisConfig?.labelColor;
10052
10052
  const xTickPosition = axisConfig?.tickPosition ?? "gutter";
@@ -10084,11 +10084,6 @@ function computeAxes(scales, chartArea, strategy, theme, measureText, dataContex
10084
10084
  scales.y,
10085
10085
  yDensity,
10086
10086
  "vertical",
10087
- void 0,
10088
- void 0,
10089
- void 0,
10090
- void 0,
10091
- void 0,
10092
10087
  yFieldName && yLabelField && dataContext ? { data: dataContext.data, fieldName: yFieldName, labelField: yLabelField } : void 0
10093
10088
  );
10094
10089
  } else {
@@ -10153,7 +10148,7 @@ import {
10153
10148
  AXIS_TITLE_TRAILING_PAD as AXIS_TITLE_TRAILING_PAD2,
10154
10149
  BREAKPOINT_COMPACT_MAX as BREAKPOINT_COMPACT_MAX2,
10155
10150
  computeChrome as computeChrome3,
10156
- estimateTextWidth as estimateTextWidth16,
10151
+ estimateTextWidth as estimateTextWidth15,
10157
10152
  getAxisTitleOffset as getAxisTitleOffset2,
10158
10153
  HPAD_COMPACT_FRACTION,
10159
10154
  HPAD_COMPACT_MIN,
@@ -10169,7 +10164,7 @@ import {
10169
10164
  } from "@opendata-ai/openchart-core";
10170
10165
 
10171
10166
  // src/endpoint-labels/predict.ts
10172
- import { estimateTextWidth as estimateTextWidth13, wrapText as wrapText2 } from "@opendata-ai/openchart-core";
10167
+ import { estimateTextWidth as estimateTextWidth12, wrapText as wrapText2 } from "@opendata-ai/openchart-core";
10173
10168
  function predictEndpointLabelsWidth(spec, _theme) {
10174
10169
  if (spec.endpointLabels === false) return 0;
10175
10170
  if (spec.markType !== "line" && spec.markType !== "area") return 0;
@@ -10191,7 +10186,7 @@ function predictEndpointLabelsWidth(spec, _theme) {
10191
10186
  for (const name of seriesNames) {
10192
10187
  const lines = wrapText2(name, ENDPOINT_LABEL_FONT_SIZE, ENDPOINT_LABEL_FONT_WEIGHT, wrapWidth);
10193
10188
  for (const line of lines) {
10194
- const w = estimateTextWidth13(line, ENDPOINT_LABEL_FONT_SIZE, ENDPOINT_LABEL_FONT_WEIGHT);
10189
+ const w = estimateTextWidth12(line, ENDPOINT_LABEL_FONT_SIZE, ENDPOINT_LABEL_FONT_WEIGHT);
10195
10190
  if (w > maxLabelWidth) maxLabelWidth = w;
10196
10191
  }
10197
10192
  }
@@ -10211,14 +10206,14 @@ function predictEndpointLabelsWidth(spec, _theme) {
10211
10206
  else if (maxAbs >= 1e6) sample = "1.5M";
10212
10207
  else if (maxAbs >= 1e3) sample = "1.5K";
10213
10208
  else sample = String(Math.round(maxAbs * 100) / 100);
10214
- valueWidth = estimateTextWidth13(sample, ENDPOINT_VALUE_FONT_SIZE, ENDPOINT_VALUE_FONT_WEIGHT);
10209
+ valueWidth = estimateTextWidth12(sample, ENDPOINT_VALUE_FONT_SIZE, ENDPOINT_VALUE_FONT_WEIGHT);
10215
10210
  }
10216
10211
  const textColumn = Math.max(maxLabelWidth, valueWidth);
10217
10212
  return ENDPOINT_SWATCH_SIZE + ENDPOINT_GAP + textColumn + 4;
10218
10213
  }
10219
10214
 
10220
10215
  // src/legend/wrap.ts
10221
- import { COMPACT_WIDTH, estimateTextWidth as estimateTextWidth14 } from "@opendata-ai/openchart-core";
10216
+ import { COMPACT_WIDTH, estimateTextWidth as estimateTextWidth13 } from "@opendata-ai/openchart-core";
10222
10217
  var SWATCH_SIZE2 = 12;
10223
10218
  var SWATCH_GAP2 = 6;
10224
10219
  var ENTRY_GAP2 = 16;
@@ -10237,7 +10232,7 @@ function measureLegendWrap(entries, maxWidth, labelStyle, maxRows, entryGap = EN
10237
10232
  let fittingCount = entries.length;
10238
10233
  let fittingCountLocked = false;
10239
10234
  for (let i = 0; i < entries.length; i++) {
10240
- const labelWidth = estimateTextWidth14(
10235
+ const labelWidth = estimateTextWidth13(
10241
10236
  entries[i].label,
10242
10237
  labelStyle.fontSize,
10243
10238
  labelStyle.fontWeight
@@ -10260,7 +10255,7 @@ function measureLegendWrap(entries, maxWidth, labelStyle, maxRows, entryGap = EN
10260
10255
  }
10261
10256
 
10262
10257
  // src/layout/metrics.ts
10263
- import { estimateTextWidth as estimateTextWidth15 } from "@opendata-ai/openchart-core";
10258
+ import { estimateTextWidth as estimateTextWidth14 } from "@opendata-ai/openchart-core";
10264
10259
  var LABEL_FONT_SIZE7 = 10;
10265
10260
  var VALUE_FONT_SIZE2 = 22;
10266
10261
  var LABEL_LINE_HEIGHT_RATIO = 1.4;
@@ -10289,7 +10284,7 @@ function computeMetricBar(metrics, metricsTopY, metricsArea, remainingChartHeigh
10289
10284
  const cellWidth = metricsArea.width / metrics.length;
10290
10285
  for (const metric of metrics) {
10291
10286
  const text = valueRunText(metric);
10292
- const measured = measureText ? measureText(text, VALUE_FONT_SIZE2, 510).width : estimateTextWidth15(text, VALUE_FONT_SIZE2, 510);
10287
+ const measured = measureText ? measureText(text, VALUE_FONT_SIZE2, 510).width : estimateTextWidth14(text, VALUE_FONT_SIZE2, 510);
10293
10288
  if (measured > cellWidth - CELL_INNER_PAD) return void 0;
10294
10289
  }
10295
10290
  const labelLine = LABEL_FONT_SIZE7 * LABEL_LINE_HEIGHT_RATIO;
@@ -10421,7 +10416,7 @@ function computeDimensions(spec, options, legendLayout, theme, strategy, waterma
10421
10416
  if (xField) {
10422
10417
  for (const row of spec.data) {
10423
10418
  const label = String(row[xField] ?? "");
10424
- const w = estimateTextWidth16(label, theme.fonts.sizes.axisTick, theme.fonts.weights.normal);
10419
+ const w = estimateTextWidth15(label, theme.fonts.sizes.axisTick, theme.fonts.weights.normal);
10425
10420
  if (w > maxLabelWidth) maxLabelWidth = w;
10426
10421
  }
10427
10422
  }
@@ -10473,7 +10468,7 @@ function computeDimensions(spec, options, legendLayout, theme, strategy, waterma
10473
10468
  const label = String(row[colorField] ?? "");
10474
10469
  if (!seen.has(label)) {
10475
10470
  seen.add(label);
10476
- const w = estimateTextWidth16(label, 11, 600);
10471
+ const w = estimateTextWidth15(label, 11, 600);
10477
10472
  if (w > maxLabelWidth) maxLabelWidth = w;
10478
10473
  }
10479
10474
  }
@@ -10493,7 +10488,7 @@ function computeDimensions(spec, options, legendLayout, theme, strategy, waterma
10493
10488
  const maxXStr = String(maxX);
10494
10489
  for (const ann of spec.annotations) {
10495
10490
  if (ann.type === "text" && String(ann.x) === maxXStr) {
10496
- const textWidth = estimateTextWidth16(ann.text, ann.fontSize ?? 11, ann.fontWeight ?? 600);
10491
+ const textWidth = estimateTextWidth15(ann.text, ann.fontSize ?? 11, ann.fontWeight ?? 600);
10497
10492
  const dx = ann.offset?.dx ?? 0;
10498
10493
  const anchor = ann.anchor ?? "auto";
10499
10494
  const baseRightExtent = anchor === "left" ? textWidth : (
@@ -10524,12 +10519,12 @@ function computeDimensions(spec, options, legendLayout, theme, strategy, waterma
10524
10519
  let maxLabelWidth = 0;
10525
10520
  for (const row of spec.data) {
10526
10521
  const label = String(row[yField] ?? "");
10527
- let w = estimateTextWidth16(label, theme.fonts.sizes.axisTick, theme.fonts.weights.normal);
10522
+ let w = estimateTextWidth15(label, theme.fonts.sizes.axisTick, theme.fonts.weights.normal);
10528
10523
  if (yLabelField) {
10529
10524
  const subtitle = String(row[yLabelField] ?? "");
10530
10525
  if (subtitle) {
10531
10526
  const gap = theme.fonts.sizes.axisTick * 0.6;
10532
- const subtitleWidth = estimateTextWidth16(
10527
+ const subtitleWidth = estimateTextWidth15(
10533
10528
  subtitle,
10534
10529
  theme.fonts.sizes.axisTick,
10535
10530
  theme.fonts.weights.normal
@@ -10572,7 +10567,7 @@ function computeDimensions(spec, options, legendLayout, theme, strategy, waterma
10572
10567
  }
10573
10568
  const negPrefix = spec.data.some((r) => Number(r[yField]) < 0) ? "-" : "";
10574
10569
  const labelEst = negPrefix + sampleLabel;
10575
- const labelWidth = estimateTextWidth16(
10570
+ const labelWidth = estimateTextWidth15(
10576
10571
  labelEst,
10577
10572
  theme.fonts.sizes.axisTick,
10578
10573
  theme.fonts.weights.normal
@@ -10608,7 +10603,7 @@ function computeDimensions(spec, options, legendLayout, theme, strategy, waterma
10608
10603
  else sampleLabelForTitle = "0.0";
10609
10604
  }
10610
10605
  const negPrefixForTitle = spec.data.some((r) => Number(r[yFieldForTitle]) < 0) ? "-" : "";
10611
- estTickLabelWidth = estimateTextWidth16(
10606
+ estTickLabelWidth = estimateTextWidth15(
10612
10607
  negPrefixForTitle + sampleLabelForTitle,
10613
10608
  theme.fonts.sizes.axisTick,
10614
10609
  theme.fonts.weights.normal
@@ -11202,7 +11197,7 @@ function computeScales(spec, chartArea, data) {
11202
11197
  }
11203
11198
 
11204
11199
  // src/legend/compute.ts
11205
- import { BRAND_RESERVE_WIDTH as BRAND_RESERVE_WIDTH2, COMPACT_WIDTH as COMPACT_WIDTH2, estimateTextWidth as estimateTextWidth17 } from "@opendata-ai/openchart-core";
11200
+ import { BRAND_RESERVE_WIDTH as BRAND_RESERVE_WIDTH2, COMPACT_WIDTH as COMPACT_WIDTH2, estimateTextWidth as estimateTextWidth16 } from "@opendata-ai/openchart-core";
11206
11201
  var LEGEND_PADDING = 8;
11207
11202
  var LEGEND_RIGHT_WIDTH = 120;
11208
11203
  var RIGHT_LEGEND_MAX_HEIGHT_RATIO = 0.4;
@@ -11318,7 +11313,7 @@ function computeLegend(spec, strategy, theme, chartArea, watermark = true) {
11318
11313
  }
11319
11314
  if (resolvedPosition === "right" || resolvedPosition === "bottom-right") {
11320
11315
  const maxLabelWidth = Math.max(
11321
- ...entries.map((e) => estimateTextWidth17(e.label, labelStyle.fontSize, labelStyle.fontWeight))
11316
+ ...entries.map((e) => estimateTextWidth16(e.label, labelStyle.fontSize, labelStyle.fontWeight))
11322
11317
  );
11323
11318
  const legendWidth = Math.min(
11324
11319
  LEGEND_RIGHT_WIDTH,
@@ -11381,7 +11376,7 @@ function computeLegend(spec, strategy, theme, chartArea, watermark = true) {
11381
11376
  entries = truncateEntries(entries, fittingCount);
11382
11377
  }
11383
11378
  const totalWidth = entries.reduce((sum2, entry) => {
11384
- const labelWidth = estimateTextWidth17(entry.label, labelStyle.fontSize, labelStyle.fontWeight);
11379
+ const labelWidth = estimateTextWidth16(entry.label, labelStyle.fontSize, labelStyle.fontWeight);
11385
11380
  return sum2 + SWATCH_SIZE2 + SWATCH_GAP2 + labelWidth + effectiveEntryGap;
11386
11381
  }, 0);
11387
11382
  const { rowCount } = measureLegendWrap(
@@ -11418,7 +11413,7 @@ import {
11418
11413
  adaptTheme as adaptTheme3,
11419
11414
  buildD3Formatter as buildD3Formatter6,
11420
11415
  computeChrome as computeChrome4,
11421
- estimateTextWidth as estimateTextWidth18,
11416
+ estimateTextWidth as estimateTextWidth17,
11422
11417
  formatNumber as formatNumber4,
11423
11418
  resolveTheme as resolveTheme4
11424
11419
  } from "@opendata-ai/openchart-core";
@@ -12099,7 +12094,7 @@ function compileSankey(spec, options) {
12099
12094
  if (labelsLeft) continue;
12100
12095
  const labelX = (node.x1 ?? nodeWidth) + LABEL_GAP;
12101
12096
  const labelText = node.label ?? node.id;
12102
- const labelWidth = estimateTextWidth18(labelText, labelFontSize, labelFontWeight);
12097
+ const labelWidth = estimateTextWidth17(labelText, labelFontSize, labelFontWeight);
12103
12098
  const overflow = labelX + labelWidth - rightEdge;
12104
12099
  if (overflow > maxOverflow) maxOverflow = overflow;
12105
12100
  }
@@ -12363,7 +12358,7 @@ function emptyLayout3(area, chrome, theme, options, watermark) {
12363
12358
  }
12364
12359
 
12365
12360
  // src/tables/compile-table.ts
12366
- import { computeChrome as computeChrome5, estimateTextWidth as estimateTextWidth19 } from "@opendata-ai/openchart-core";
12361
+ import { computeChrome as computeChrome5, estimateTextWidth as estimateTextWidth18 } from "@opendata-ai/openchart-core";
12367
12362
 
12368
12363
  // src/tables/bar-column.ts
12369
12364
  var NEGATIVE_BAR_COLOR = "#c44e52";
@@ -12778,13 +12773,13 @@ function estimateColumnWidth(col, data, fontSize) {
12778
12773
  if (col.image) return (col.image.width ?? 24) + PADDING;
12779
12774
  if (col.flag) return 60;
12780
12775
  const label = col.label ?? col.key;
12781
- const headerWidth = estimateTextWidth19(label, fontSize, 600) + PADDING;
12776
+ const headerWidth = estimateTextWidth18(label, fontSize, 600) + PADDING;
12782
12777
  const sampleSize = Math.min(100, data.length);
12783
12778
  let maxDataWidth = 0;
12784
12779
  for (let i = 0; i < sampleSize; i++) {
12785
12780
  const val = data[i][col.key];
12786
12781
  const text = val == null ? "" : String(val);
12787
- const width = estimateTextWidth19(text, fontSize, 400) + PADDING;
12782
+ const width = estimateTextWidth18(text, fontSize, 400) + PADDING;
12788
12783
  if (width > maxDataWidth) maxDataWidth = width;
12789
12784
  }
12790
12785
  return Math.max(MIN_WIDTH, headerWidth, maxDataWidth);
@@ -13013,7 +13008,7 @@ import {
13013
13008
  adaptTheme as adaptTheme4,
13014
13009
  buildD3Formatter as buildD3Formatter8,
13015
13010
  computeChrome as computeChrome6,
13016
- estimateTextWidth as estimateTextWidth20,
13011
+ estimateTextWidth as estimateTextWidth19,
13017
13012
  formatNumber as formatNumber6,
13018
13013
  resolveTheme as resolveTheme5,
13019
13014
  SEQUENTIAL_PALETTES
@@ -13233,7 +13228,7 @@ function compileTileMap(spec, options) {
13233
13228
  height: contentHeight,
13234
13229
  animation: resolvedAnimation,
13235
13230
  watermark,
13236
- measureText: options.measureText ?? ((text, fontSize) => ({ width: estimateTextWidth20(text, fontSize), height: fontSize }))
13231
+ measureText: options.measureText ?? ((text, fontSize) => ({ width: estimateTextWidth19(text, fontSize), height: fontSize }))
13237
13232
  };
13238
13233
  }
13239
13234
  function emptyLayout4(chrome, theme, options, watermark) {
@@ -13268,7 +13263,7 @@ function emptyLayout4(chrome, theme, options, watermark) {
13268
13263
  height: options.height,
13269
13264
  watermark,
13270
13265
  animation: void 0,
13271
- measureText: options.measureText ?? ((text, fontSize) => ({ width: estimateTextWidth20(text, fontSize), height: fontSize }))
13266
+ measureText: options.measureText ?? ((text, fontSize) => ({ width: estimateTextWidth19(text, fontSize), height: fontSize }))
13272
13267
  };
13273
13268
  }
13274
13269
 
@@ -14287,7 +14282,7 @@ function compileChart(spec, options) {
14287
14282
  else sample = "0.0";
14288
14283
  const negPrefix = renderSpec.data.some((r) => Number(r[yField]) < 0) ? "-" : "";
14289
14284
  const labelEst = negPrefix + sample;
14290
- const labelWidth = estimateTextWidth21(
14285
+ const labelWidth = estimateTextWidth20(
14291
14286
  labelEst,
14292
14287
  theme.fonts.sizes.axisTick,
14293
14288
  theme.fonts.weights.normal