ooxml-core 1.18.0 → 1.19.0

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.
Files changed (82) hide show
  1. package/dist/{PptxHandler-X6AO6LKJ.mjs → PptxHandler-5GBBVJCR.mjs} +2 -2
  2. package/dist/{PptxHandler-5X4VOWAO.mjs → PptxHandler-H43MAMTO.mjs} +1 -1
  3. package/dist/{PptxHandler-4AHDZDA5.cjs → PptxHandler-ZHPGBSAF.cjs} +2 -2
  4. package/dist/{PresentationBuilder-UY3S4YE2.mjs → PresentationBuilder-7ZSUKCX5.mjs} +1 -1
  5. package/dist/{PresentationBuilder-LRX55PXA.mjs → PresentationBuilder-IJW42L3R.mjs} +2 -2
  6. package/dist/{PresentationBuilder-MJB4LIFS.cjs → PresentationBuilder-O4H4MMWB.cjs} +4 -4
  7. package/dist/automation/index.cjs +535 -266
  8. package/dist/automation/index.mjs +535 -266
  9. package/dist/chart/axis-range-auto.d.ts +10 -0
  10. package/dist/chart/axis-range-auto.d.ts.map +1 -0
  11. package/dist/chart/axis-range-types.d.ts +27 -0
  12. package/dist/chart/axis-range-types.d.ts.map +1 -0
  13. package/dist/chart/axis-range.d.ts +37 -0
  14. package/dist/chart/axis-range.d.ts.map +1 -0
  15. package/dist/chart/axis-ticks.d.ts +8 -0
  16. package/dist/chart/axis-ticks.d.ts.map +1 -0
  17. package/dist/chart/index.cjs +815 -165
  18. package/dist/chart/index.d.ts +6 -0
  19. package/dist/chart/index.d.ts.map +1 -1
  20. package/dist/chart/index.mjs +795 -166
  21. package/dist/chart/line-dash.d.ts +2 -0
  22. package/dist/chart/line-dash.d.ts.map +1 -0
  23. package/dist/chart/marker-shape.d.ts +70 -0
  24. package/dist/chart/marker-shape.d.ts.map +1 -0
  25. package/dist/chart/render/chart-svg-axes.d.ts +9 -0
  26. package/dist/chart/render/chart-svg-axes.d.ts.map +1 -0
  27. package/dist/chart/render/chart-svg-cartesian.d.ts.map +1 -1
  28. package/dist/chart/render/chart-svg-markers.d.ts +6 -0
  29. package/dist/chart/render/chart-svg-markers.d.ts.map +1 -0
  30. package/dist/chart/render/chart-svg-radial.d.ts.map +1 -1
  31. package/dist/chart/render/chart-svg-xy.d.ts.map +1 -1
  32. package/dist/chart/render/chart-view-axes.d.ts +30 -0
  33. package/dist/chart/render/chart-view-axes.d.ts.map +1 -0
  34. package/dist/chart/render/chart-view-markers.d.ts +27 -0
  35. package/dist/chart/render/chart-view-markers.d.ts.map +1 -0
  36. package/dist/chart/render/chart-view-series.d.ts.map +1 -1
  37. package/dist/chart/render/chart-view.d.ts +4 -1
  38. package/dist/chart/render/chart-view.d.ts.map +1 -1
  39. package/dist/chart/render/index.d.ts +2 -0
  40. package/dist/chart/render/index.d.ts.map +1 -1
  41. package/dist/chart/render/summary-from-space.d.ts.map +1 -1
  42. package/dist/chart/render/summary.d.ts +6 -1
  43. package/dist/chart/render/summary.d.ts.map +1 -1
  44. package/dist/{chunk-7NWQUCGX.mjs → chunk-3XFPCZKB.mjs} +1 -1
  45. package/dist/{chunk-Z5Y53IZD.mjs → chunk-75GLSRZE.mjs} +4 -4
  46. package/dist/{chunk-LT7RCEHY.mjs → chunk-BIVNVDAH.mjs} +1 -1
  47. package/dist/{chunk-I5ZE3VLI.mjs → chunk-QBJRB6WW.mjs} +1 -1
  48. package/dist/{chunk-U7IDT6VT.mjs → chunk-RUZEMWDI.mjs} +1 -1
  49. package/dist/docx/index.cjs +695 -168
  50. package/dist/docx/index.mjs +695 -168
  51. package/dist/docx/layout/index.cjs +697 -170
  52. package/dist/docx/layout/index.mjs +697 -170
  53. package/dist/docx/ui/index.cjs +704 -177
  54. package/dist/docx/ui/index.mjs +704 -177
  55. package/dist/index.cjs +912 -262
  56. package/dist/index.mjs +912 -262
  57. package/dist/pptx/automation/index.cjs +54 -0
  58. package/dist/pptx/automation/index.mjs +5 -5
  59. package/dist/pptx/cli/index.cjs +54 -0
  60. package/dist/pptx/cli/index.mjs +4 -4
  61. package/dist/pptx/converter/index.mjs +2 -2
  62. package/dist/pptx/editor/render/slide-operations.cjs +1 -1
  63. package/dist/pptx/editor/render/slide-operations.mjs +1 -1
  64. package/dist/pptx/index.cjs +54 -0
  65. package/dist/pptx/index.mjs +5 -5
  66. package/dist/teams/index.cjs +71 -5
  67. package/dist/teams/index.mjs +71 -5
  68. package/dist/visio/index.cjs +483 -214
  69. package/dist/visio/index.mjs +483 -214
  70. package/dist/visio/ui/index.cjs +504 -235
  71. package/dist/visio/ui/index.mjs +504 -235
  72. package/dist/xlsx/edit/chart-colors.d.ts.map +1 -1
  73. package/dist/xlsx/index.cjs +818 -281
  74. package/dist/xlsx/index.mjs +818 -281
  75. package/dist/xlsx/load/index.cjs +58 -5
  76. package/dist/xlsx/load/index.mjs +58 -5
  77. package/dist/xlsx/read/chart.d.ts.map +1 -1
  78. package/dist/xlsx/ui/index.cjs +835 -298
  79. package/dist/xlsx/ui/index.mjs +835 -298
  80. package/package.json +1 -1
  81. /package/dist/{chunk-C363NN2C.mjs → chunk-H6TNNXJK.mjs} +0 -0
  82. /package/dist/{chunk-R4BCOQHB.cjs → chunk-MHMVD23Y.cjs} +0 -0
@@ -50,11 +50,11 @@ function checkXmlLimits(xml, label, limits = {}) {
50
50
  throw new Error(`${label} XML exceeds the nesting depth limit of ${maxDepth}`);
51
51
  }
52
52
  }
53
- function parseXml(xml, options = {}) {
54
- const label = options.label ?? "OOXML";
53
+ function parseXml(xml, options2 = {}) {
54
+ const label = options2.label ?? "OOXML";
55
55
  if (/<!DOCTYPE|<!ENTITY/i.test(xml))
56
56
  throw new Error(`${label} XML with DTD or entity declarations is not supported`);
57
- checkXmlLimits(xml, label, options.limits);
57
+ checkXmlLimits(xml, label, options2.limits);
58
58
  let parseError = "";
59
59
  let parsed;
60
60
  try {
@@ -804,8 +804,8 @@ function rgbToHsl(r, g, b) {
804
804
  }
805
805
  return { h, s: clampUnitInterval(s), l: clampUnitInterval(l) };
806
806
  }
807
- function hslToRgb(h, s, l, roundChannel = Math.round, options) {
808
- const sC = options?.clampSaturation === false ? s : clampUnitInterval(s);
807
+ function hslToRgb(h, s, l, roundChannel = Math.round, options2) {
808
+ const sC = options2?.clampSaturation === false ? s : clampUnitInterval(s);
809
809
  const lC = clampUnitInterval(l);
810
810
  const hN = (h % 360 + 360) % 360;
811
811
  const c = (1 - Math.abs(2 * lC - 1)) * sC;
@@ -1294,13 +1294,13 @@ var APPLIED = /* @__PURE__ */ new Set([
1294
1294
  "lumMod",
1295
1295
  "lumOff"
1296
1296
  ]);
1297
- function resolveDrawingColor(color, theme, options) {
1297
+ function resolveDrawingColor(color, theme, options2) {
1298
1298
  const base = baseHex(color, theme);
1299
1299
  const rgb = base ? hexToRgbChannels(base) : null;
1300
1300
  if (!rgb) return void 0;
1301
- if (options?.transformOrder === "document") {
1301
+ if (options2?.transformOrder === "document") {
1302
1302
  const value = orderedColorTransforms(rgb, color.transforms);
1303
- const round3 = options.hslRounding === "halfDown" ? (channel) => Math.ceil(channel - 0.5) : Math.round;
1303
+ const round3 = options2.hslRounding === "halfDown" ? (channel) => Math.ceil(channel - 0.5) : Math.round;
1304
1304
  return {
1305
1305
  hex: `#${toHex(round3(value.r))}${toHex(round3(value.g))}${toHex(round3(value.b))}`,
1306
1306
  alpha: value.alpha,
@@ -1351,7 +1351,7 @@ function resolveDrawingColor(color, theme, options) {
1351
1351
  if (lumMod !== void 0) hsl.l = clampUnitInterval(hsl.l * lumMod);
1352
1352
  const lumOff = parseDrawingFraction(find("lumOff"));
1353
1353
  if (lumOff !== void 0) hsl.l = clampUnitInterval(hsl.l + lumOff);
1354
- const round3 = options?.hslRounding === "halfDown" ? (value) => Math.ceil(value - 0.5) : Math.round;
1354
+ const round3 = options2?.hslRounding === "halfDown" ? (value) => Math.ceil(value - 0.5) : Math.round;
1355
1355
  ({ r, g, b } = hslToRgb(hsl.h, hsl.s, hsl.l, round3));
1356
1356
  }
1357
1357
  let alpha = parseDrawingPercent(find("alpha")) ?? 1;
@@ -1808,7 +1808,7 @@ function resolveInnerRect(fillToRect, focalPoint) {
1808
1808
  function lerpEdge(inner, outer, t) {
1809
1809
  return inner + (outer - inner) * t;
1810
1810
  }
1811
- function buildRectPathGradientSvg(stops, focalPoint, fillToRect, options) {
1811
+ function buildRectPathGradientSvg(stops, focalPoint, fillToRect, options2) {
1812
1812
  if (stops.length === 0) {
1813
1813
  return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"/>';
1814
1814
  }
@@ -1817,7 +1817,7 @@ function buildRectPathGradientSvg(stops, focalPoint, fillToRect, options) {
1817
1817
  const rects = [];
1818
1818
  const alphaRects = [];
1819
1819
  const masked = sorted.some((stop) => (stop.opacity ?? 1) < 1);
1820
- const bands = options?.bands;
1820
+ const bands = options2?.bands;
1821
1821
  if (!Number.isInteger(bands) || bands < 1) throw new RangeError("Invalid gradient band count");
1822
1822
  for (let i = bands; i >= 0; i -= 1) {
1823
1823
  const t = i / bands;
@@ -11575,6 +11575,9 @@ function formatChartNumberWithColor(value, formatCode) {
11575
11575
  return void 0;
11576
11576
  }
11577
11577
  }
11578
+ function formatChartNumber(value, formatCode) {
11579
+ return formatChartNumberWithColor(value, formatCode)?.text;
11580
+ }
11578
11581
 
11579
11582
  // chart/data-label-text.ts
11580
11583
  var DATA_LABEL_SEPARATOR = ", ";
@@ -11623,12 +11626,12 @@ function composeDataLabelText(input) {
11623
11626
  }
11624
11627
 
11625
11628
  // chart/bubble-radius.ts
11626
- function computeBubbleRadius(sizeVal, maxBubble, medianRadius, options) {
11627
- const scale = (options?.bubbleScale ?? 100) / 100;
11629
+ function computeBubbleRadius(sizeVal, maxBubble, medianRadius, options2) {
11630
+ const scale = (options2?.bubbleScale ?? 100) / 100;
11628
11631
  if (sizeVal === void 0) return medianRadius * scale;
11629
11632
  const denom = maxBubble > 0 ? maxBubble : 1;
11630
11633
  const magnitude = Math.abs(sizeVal);
11631
- const ratio = (options?.sizeRepresents ?? "w") === "area" ? Math.sqrt(magnitude) / Math.sqrt(denom) : magnitude / denom;
11634
+ const ratio = (options2?.sizeRepresents ?? "w") === "area" ? Math.sqrt(magnitude) / Math.sqrt(denom) : magnitude / denom;
11632
11635
  return medianRadius * scale * 0.5 + ratio * medianRadius * scale * 1.5;
11633
11636
  }
11634
11637
  function maxBubbleSize(sizes) {
@@ -11956,14 +11959,14 @@ function scottBinCount(values, min, max) {
11956
11959
  const width = 3.49 * sd * values.length ** (-1 / 3);
11957
11960
  return Math.max(1, Math.ceil((max - min) / width));
11958
11961
  }
11959
- function computeHistogramBins(values, options, format = String) {
11960
- const closed = options.intervalClosed ?? "l";
11962
+ function computeHistogramBins(values, options2, format = String) {
11963
+ const closed = options2.intervalClosed ?? "l";
11961
11964
  const finite2 = values.map((value, sourceIndex) => ({ value, sourceIndex })).filter((item) => Number.isFinite(item.value));
11962
11965
  if (finite2.length === 0) {
11963
11966
  return [];
11964
11967
  }
11965
- const underflow = typeof options.underflow === "number" ? options.underflow : void 0;
11966
- const overflow = typeof options.overflow === "number" ? options.overflow : void 0;
11968
+ const underflow = typeof options2.underflow === "number" ? options2.underflow : void 0;
11969
+ const overflow = typeof options2.overflow === "number" ? options2.overflow : void 0;
11967
11970
  const under = underflow === void 0 ? [] : finite2.filter(
11968
11971
  (item) => closed === "r" ? item.value <= underflow : item.value < underflow
11969
11972
  );
@@ -11980,8 +11983,8 @@ function computeHistogramBins(values, options, format = String) {
11980
11983
  if (regular.length > 0) {
11981
11984
  const min = Math.min(...regular.map((item) => item.value));
11982
11985
  const max = Math.max(...regular.map((item) => item.value));
11983
- const requestedSize = options.binSize && options.binSize > 0 ? options.binSize : void 0;
11984
- const requestedCount = options.binCount && options.binCount > 0 ? options.binCount : void 0;
11986
+ const requestedSize = options2.binSize && options2.binSize > 0 ? options2.binSize : void 0;
11987
+ const requestedCount = options2.binCount && options2.binCount > 0 ? options2.binCount : void 0;
11985
11988
  const start = requestedSize ? Math.floor(min / requestedSize) * requestedSize : min;
11986
11989
  const count = requestedSize ? Math.max(
11987
11990
  closed === "l" ? Math.floor((max - start) / requestedSize) + 1 : Math.ceil((max - start) / requestedSize),
@@ -12032,9 +12035,9 @@ function aggregateByCategory(values, rawCategories) {
12032
12035
  }
12033
12036
 
12034
12037
  // chart/waterfall.ts
12035
- function buildWaterfallSteps(values, options) {
12038
+ function buildWaterfallSteps(values, options2) {
12036
12039
  const subtotalIndices = new Set(
12037
- options?.subtotalIndices ?? (values.length > 0 ? [values.length - 1] : [])
12040
+ options2?.subtotalIndices ?? (values.length > 0 ? [values.length - 1] : [])
12038
12041
  );
12039
12042
  const steps = [];
12040
12043
  let runningTotal = 0;
@@ -12094,13 +12097,13 @@ var noFit = () => ({
12094
12097
  rSquared: 0,
12095
12098
  coefficients: []
12096
12099
  });
12097
- function fitModel(options, xVals, yVals) {
12100
+ function fitModel(options2, xVals, yVals) {
12098
12101
  const xs = [...xVals];
12099
12102
  const ys = [...yVals];
12100
- switch (options.kind) {
12103
+ switch (options2.kind) {
12101
12104
  case "linear": {
12102
12105
  const reg = computeLinearRegression(xs, ys);
12103
- const fixed = options.intercept;
12106
+ const fixed = options2.intercept;
12104
12107
  const slope = fixed !== void 0 ? ys.reduce((s, y, i) => s + (y - fixed) * xs[i], 0) / xs.reduce((s, x) => s + x * x, 0) : reg.slope;
12105
12108
  const b = fixed ?? reg.intercept;
12106
12109
  return {
@@ -12150,7 +12153,7 @@ function fitModel(options, xVals, yVals) {
12150
12153
  };
12151
12154
  }
12152
12155
  case "polynomial": {
12153
- const order = Math.min(options.order ?? 2, 6);
12156
+ const order = Math.min(options2.order ?? 2, 6);
12154
12157
  const coeffs = fitPolynomial(xs, ys, order);
12155
12158
  const evaluate = (x) => coeffs.reduce((s, c, i) => s + c * x ** i, 0);
12156
12159
  return {
@@ -12164,11 +12167,11 @@ function fitModel(options, xVals, yVals) {
12164
12167
  return void 0;
12165
12168
  }
12166
12169
  }
12167
- function fitChartTrendline(options, xVals, yVals) {
12170
+ function fitChartTrendline(options2, xVals, yVals) {
12168
12171
  const count = yVals.length;
12169
12172
  if (count < 2) return noFit();
12170
- if (options.kind === "movingAvg") {
12171
- const period = options.period ?? 2;
12173
+ if (options2.kind === "movingAvg") {
12174
+ const period = options2.period ?? 2;
12172
12175
  const points2 = [];
12173
12176
  for (let i = period - 1; i < count; i++) {
12174
12177
  let sum = 0;
@@ -12177,10 +12180,10 @@ function fitChartTrendline(options, xVals, yVals) {
12177
12180
  }
12178
12181
  return { points: points2, equation: `${period}-period moving average`, rSquared: 0, coefficients: [] };
12179
12182
  }
12180
- const model = fitModel(options, xVals, yVals);
12183
+ const model = fitModel(options2, xVals, yVals);
12181
12184
  if (!model) return noFit();
12182
- const startX = Math.min(...xVals) - (options.backward ?? 0);
12183
- const endX = Math.max(...xVals) + (options.forward ?? 0);
12185
+ const startX = Math.min(...xVals) - (options2.backward ?? 0);
12186
+ const endX = Math.max(...xVals) + (options2.forward ?? 0);
12184
12187
  const steps = Math.max(Math.ceil((endX - startX) * 4), 20);
12185
12188
  const points = [];
12186
12189
  for (let step = 0; step <= steps; step++) {
@@ -12203,18 +12206,18 @@ function chartSampleVariance(values) {
12203
12206
  const mean = values.reduce((sum, value) => sum + value, 0) / count;
12204
12207
  return values.reduce((sum, value) => sum + (value - mean) ** 2, 0) / Math.max(count - 1, 1);
12205
12208
  }
12206
- function chartErrorBarAmount(options, values, displayIndex, sourceIndex, side) {
12207
- switch (options.valueType) {
12209
+ function chartErrorBarAmount(options2, values, displayIndex, sourceIndex, side) {
12210
+ switch (options2.valueType) {
12208
12211
  case "fixedVal":
12209
- return options.value ?? 0;
12212
+ return options2.value ?? 0;
12210
12213
  case "percentage":
12211
- return Math.abs(values[displayIndex] ?? 0) * ((options.value ?? 0) / 100);
12214
+ return Math.abs(values[displayIndex] ?? 0) * ((options2.value ?? 0) / 100);
12212
12215
  case "stdDev":
12213
- return Math.sqrt(chartSampleVariance(values)) * (options.value ?? 1);
12216
+ return Math.sqrt(chartSampleVariance(values)) * (options2.value ?? 1);
12214
12217
  case "stdErr":
12215
12218
  return Math.sqrt(chartSampleVariance(values) / Math.max(values.length, 1));
12216
12219
  case "cust":
12217
- return side === "plus" ? options.customPlus?.[sourceIndex] ?? 0 : options.customMinus?.[sourceIndex] ?? 0;
12220
+ return side === "plus" ? options2.customPlus?.[sourceIndex] ?? 0 : options2.customMinus?.[sourceIndex] ?? 0;
12218
12221
  }
12219
12222
  }
12220
12223
 
@@ -12590,6 +12593,191 @@ function chartCacheValues(cache2) {
12590
12593
  }
12591
12594
  var chartSourceValues = (source) => chartCacheValues(source?.cache ?? source?.levels?.[0]);
12592
12595
 
12596
+ // chart/marker-shape.ts
12597
+ var CHART_PX_PER_PT = 4 / 3;
12598
+ var DEFAULT_MARKER_OUTLINE_PT = 0.75;
12599
+ var AUTOMATIC_MARKER_CYCLE = [
12600
+ "diamond",
12601
+ "square",
12602
+ "triangle",
12603
+ "x",
12604
+ "star",
12605
+ "circle",
12606
+ "plus",
12607
+ "dot",
12608
+ "dash"
12609
+ ];
12610
+ function automaticMarkerSymbol(seriesIdx) {
12611
+ const length = AUTOMATIC_MARKER_CYCLE.length;
12612
+ const normalized = (Math.trunc(seriesIdx) % length + length) % length;
12613
+ return AUTOMATIC_MARKER_CYCLE[Number.isFinite(normalized) ? normalized : 0];
12614
+ }
12615
+ function markerRadius(size, defaultRadius) {
12616
+ if (size === void 0 || !Number.isFinite(size) || size <= 0) {
12617
+ return defaultRadius;
12618
+ }
12619
+ return size / 2;
12620
+ }
12621
+ function polygonPoints(vertices) {
12622
+ return vertices.map(([x, y]) => `${x.toFixed(2)},${y.toFixed(2)}`).join(" ");
12623
+ }
12624
+ function starVertices(cx, cy, r) {
12625
+ const inner = r * 0.5;
12626
+ const out = [];
12627
+ for (let i = 0; i < 10; i++) {
12628
+ const radius = i % 2 === 0 ? r : inner;
12629
+ const angle = -Math.PI / 2 + Math.PI * i / 5;
12630
+ out.push([cx + radius * Math.cos(angle), cy + radius * Math.sin(angle)]);
12631
+ }
12632
+ return out;
12633
+ }
12634
+ function rectPolygon(x, y, w, h) {
12635
+ return polygonPoints([
12636
+ [x, y],
12637
+ [x + w, y],
12638
+ [x + w, y + h],
12639
+ [x, y + h]
12640
+ ]);
12641
+ }
12642
+ function buildMarkerPrimitive(input) {
12643
+ const { symbol, cx, cy, fill } = input;
12644
+ const part = input.part === void 0 ? {} : { part: input.part };
12645
+ if (symbol === "none") {
12646
+ return null;
12647
+ }
12648
+ const r = markerRadius(input.size, input.defaultRadius);
12649
+ const outline = input.stroke ? {
12650
+ stroke: input.stroke,
12651
+ strokeWidth: input.strokeWidth ?? DEFAULT_MARKER_OUTLINE_PT * CHART_PX_PER_PT
12652
+ } : void 0;
12653
+ const polygonStroke = outline ?? { stroke: fill, strokeWidth: 0 };
12654
+ const lineStroke = input.stroke ?? fill;
12655
+ switch (symbol) {
12656
+ case "square":
12657
+ case "dash": {
12658
+ const h = symbol === "dash" ? r * 0.64 : r * 2;
12659
+ const y = cy - h / 2;
12660
+ if (outline) {
12661
+ return {
12662
+ kind: "polygon",
12663
+ points: rectPolygon(cx - r, y, r * 2, h),
12664
+ fill,
12665
+ ...outline,
12666
+ ...part
12667
+ };
12668
+ }
12669
+ return { kind: "rect", x: cx - r, y, w: r * 2, h, fill, ...part };
12670
+ }
12671
+ case "diamond":
12672
+ return {
12673
+ kind: "polygon",
12674
+ points: polygonPoints([
12675
+ [cx, cy - r],
12676
+ [cx + r, cy],
12677
+ [cx, cy + r],
12678
+ [cx - r, cy]
12679
+ ]),
12680
+ fill,
12681
+ ...polygonStroke,
12682
+ ...part
12683
+ };
12684
+ case "triangle":
12685
+ return {
12686
+ kind: "polygon",
12687
+ points: polygonPoints([
12688
+ [cx, cy - r],
12689
+ [cx + r * 0.9, cy + r * 0.75],
12690
+ [cx - r * 0.9, cy + r * 0.75]
12691
+ ]),
12692
+ fill,
12693
+ ...polygonStroke,
12694
+ ...part
12695
+ };
12696
+ case "star":
12697
+ return {
12698
+ kind: "polygon",
12699
+ points: polygonPoints(starVertices(cx, cy, r)),
12700
+ fill,
12701
+ ...polygonStroke,
12702
+ ...part
12703
+ };
12704
+ case "plus":
12705
+ return {
12706
+ kind: "path",
12707
+ d: `M${(cx - r).toFixed(2)},${cy.toFixed(2)} L${(cx + r).toFixed(2)},${cy.toFixed(2)} M${cx.toFixed(2)},${(cy - r).toFixed(2)} L${cx.toFixed(2)},${(cy + r).toFixed(2)}`,
12708
+ fill: "none",
12709
+ stroke: lineStroke,
12710
+ strokeWidth: Math.max(1, r * 0.4),
12711
+ ...part
12712
+ };
12713
+ case "x":
12714
+ return {
12715
+ kind: "path",
12716
+ d: `M${(cx - r).toFixed(2)},${(cy - r).toFixed(2)} L${(cx + r).toFixed(2)},${(cy + r).toFixed(2)} M${(cx + r).toFixed(2)},${(cy - r).toFixed(2)} L${(cx - r).toFixed(2)},${(cy + r).toFixed(2)}`,
12717
+ fill: "none",
12718
+ stroke: lineStroke,
12719
+ strokeWidth: Math.max(1, r * 0.4),
12720
+ ...part
12721
+ };
12722
+ case "dot":
12723
+ return { kind: "circle", cx, cy, r: Math.max(r * 0.6, 1), fill, ...part, ...outline };
12724
+ default:
12725
+ return { kind: "circle", cx, cy, r, fill, ...part, ...outline };
12726
+ }
12727
+ }
12728
+
12729
+ // chart/render/chart-view-markers.ts
12730
+ function summaryMarkers(source, group2, seriesPosition) {
12731
+ if (!["line", "scatter", "radar"].includes(group2.kind)) return {};
12732
+ const enabled = group2.kind === "line" ? group2.marker === true : group2.kind === "radar" ? group2.radarStyle === "marker" : !["line", "smooth", "none"].includes(group2.scatterStyle ?? "marker");
12733
+ const symbol = source.marker?.symbol;
12734
+ const marker = {
12735
+ ...source.marker,
12736
+ symbol: symbol && symbol !== "auto" ? symbol : source.marker || enabled ? automaticMarkerSymbol(source.index ?? seriesPosition) : "none"
12737
+ };
12738
+ const pointMarkers = {};
12739
+ for (const point of source.dataPoints) {
12740
+ if (point.index === void 0 || !point.marker) continue;
12741
+ const override = point.marker;
12742
+ pointMarkers[point.index] = {
12743
+ ...marker,
12744
+ ...override,
12745
+ ...override.symbol === "auto" || !source.marker && override.symbol === void 0 ? { symbol: automaticMarkerSymbol(source.index ?? seriesPosition) } : {},
12746
+ ...marker.spPr || override.spPr ? {
12747
+ spPr: {
12748
+ ...marker.spPr,
12749
+ ...override.spPr,
12750
+ ...marker.spPr?.line || override.spPr?.line ? { line: { ...marker.spPr?.line, ...override.spPr?.line } } : {}
12751
+ }
12752
+ } : {}
12753
+ };
12754
+ }
12755
+ return { marker, ...Object.keys(pointMarkers).length ? { pointMarkers } : {} };
12756
+ }
12757
+ function seriesMarkerViews(source, drawingColor) {
12758
+ const fillColor = (fill) => fill?.kind === "none" ? "none" : fill?.kind === "solid" ? drawingColor(fill.color) : void 0;
12759
+ const resolve = (marker) => {
12760
+ const fill = fillColor(marker.spPr?.fill);
12761
+ const stroke = fillColor(marker.spPr?.line?.fill);
12762
+ const width = marker.spPr?.line?.widthEmu;
12763
+ return {
12764
+ ...marker.symbol !== void 0 ? { symbol: marker.symbol } : {},
12765
+ ...marker.size !== void 0 ? { size: marker.size } : {},
12766
+ ...fill !== void 0 ? { fill } : {},
12767
+ ...stroke !== void 0 ? { stroke } : {},
12768
+ ...width !== void 0 ? { strokeWidth: width / 9525 } : {}
12769
+ };
12770
+ };
12771
+ return {
12772
+ ...source.marker ? { marker: resolve(source.marker) } : {},
12773
+ ...source.pointMarkers ? {
12774
+ pointMarkers: Object.fromEntries(
12775
+ Object.entries(source.pointMarkers).map(([i, marker]) => [i, resolve(marker)])
12776
+ )
12777
+ } : {}
12778
+ };
12779
+ }
12780
+
12593
12781
  // chart/render/summary-analysis.ts
12594
12782
  function summaryTrendline(source) {
12595
12783
  const kind = chartTrendlineKind(source.trendlineType);
@@ -12631,17 +12819,17 @@ function summaryAnalysis(series) {
12631
12819
  }
12632
12820
 
12633
12821
  // chart/render/summary-labels.ts
12634
- function level(options, custom) {
12822
+ function level(options2, custom) {
12635
12823
  const out = {};
12636
- if (options.deleted !== void 0) out.deleted = options.deleted;
12637
- if (options.showValue !== void 0) out.showValue = options.showValue;
12638
- if (options.showCategoryName !== void 0) out.showCategory = options.showCategoryName;
12639
- if (options.showSeriesName !== void 0) out.showSeriesName = options.showSeriesName;
12640
- if (options.showPercent !== void 0) out.showPercent = options.showPercent;
12641
- if (options.showBubbleSize !== void 0) out.showBubbleSize = options.showBubbleSize;
12642
- if (options.separator !== void 0) out.separator = options.separator;
12643
- if (options.position) out.position = options.position;
12644
- if (options.numberFormat?.formatCode) out.numberFormat = options.numberFormat.formatCode;
12824
+ if (options2.deleted !== void 0) out.deleted = options2.deleted;
12825
+ if (options2.showValue !== void 0) out.showValue = options2.showValue;
12826
+ if (options2.showCategoryName !== void 0) out.showCategory = options2.showCategoryName;
12827
+ if (options2.showSeriesName !== void 0) out.showSeriesName = options2.showSeriesName;
12828
+ if (options2.showPercent !== void 0) out.showPercent = options2.showPercent;
12829
+ if (options2.showBubbleSize !== void 0) out.showBubbleSize = options2.showBubbleSize;
12830
+ if (options2.separator !== void 0) out.separator = options2.separator;
12831
+ if (options2.position) out.position = options2.position;
12832
+ if (options2.numberFormat?.formatCode) out.numberFormat = options2.numberFormat.formatCode;
12645
12833
  if (custom?.text !== void 0) out.text = custom.text;
12646
12834
  return out;
12647
12835
  }
@@ -12748,7 +12936,10 @@ function extraGroups(chartSpace, firstType) {
12748
12936
  const type = group2.kind === "bar" ? "column" : group2.kind;
12749
12937
  const entry = {
12750
12938
  chartType: type,
12751
- series: group2.series.map((source) => chartSummarySeries(source, type, group2.dataLabels)),
12939
+ series: group2.series.map((source, index) => ({
12940
+ ...chartSummarySeries(source, type, group2.dataLabels),
12941
+ ...summaryMarkers(source, group2, index)
12942
+ })),
12752
12943
  secondary: valueAxisId(chartSpace, group2.axisIds) !== primary
12753
12944
  };
12754
12945
  if (group2.grouping && GROUPINGS.has(group2.grouping))
@@ -12766,13 +12957,16 @@ function chartSummaryFromSpace(chartSpace, extras = {}) {
12766
12957
  const group2 = chartSpace.plotArea.groups[0];
12767
12958
  let chartType = group2 ? GROUP_TYPES[group2.kind] : "column";
12768
12959
  if (chartType === "bar" && group2?.barDirection !== "bar") chartType = "column";
12769
- const series = (group2?.series ?? []).map(
12770
- (source) => chartSummarySeries(source, chartType, group2?.dataLabels)
12771
- );
12960
+ const series = (group2?.series ?? []).map((source, index) => ({
12961
+ ...chartSummarySeries(source, chartType, group2?.dataLabels),
12962
+ ...group2 ? summaryMarkers(source, group2, index) : {}
12963
+ }));
12772
12964
  const summary = {
12773
12965
  chartType,
12774
12966
  series,
12775
- showLegend: chartSpace.legend !== void 0
12967
+ showLegend: chartSpace.legend !== void 0,
12968
+ axes: chartSpace.plotArea.axes,
12969
+ axisIds: group2?.axisIds ?? []
12776
12970
  };
12777
12971
  const combined = extraGroups(chartSpace, chartType);
12778
12972
  if (combined.length) summary.extraGroups = combined;
@@ -13074,7 +13268,7 @@ function chartTextAttributes(model, part, fallbackSize = FONT_SIZE) {
13074
13268
  function chartStroke(model, part) {
13075
13269
  const entry = model.appearance?.[part];
13076
13270
  return {
13077
- color: entry?.axisVisible === false ? "none" : entry?.lineColor ?? (part === "gridlineMajor" ? GRID_COLOR : AXIS_COLOR),
13271
+ color: entry?.axisVisible === false ? "none" : entry?.lineColor ?? (part.startsWith("gridline") ? GRID_COLOR : AXIS_COLOR),
13078
13272
  width: entry?.lineWidth === void 0 ? 1 : chartPointsToPixels(entry.lineWidth)
13079
13273
  };
13080
13274
  }
@@ -13365,6 +13559,60 @@ function scatterAnalysis(model, px, py, out) {
13365
13559
  });
13366
13560
  }
13367
13561
 
13562
+ // chart/render/chart-svg-markers.ts
13563
+ function chartMarkerRadius(series, index, defaultRadius = 3) {
13564
+ const marker = { ...series.marker, ...series.pointMarkers?.[index] };
13565
+ if (marker.symbol === "none") return 0;
13566
+ const radius = markerRadius(marker.size, defaultRadius);
13567
+ return marker.symbol === "dot" ? Math.max(radius * 0.6, 1) : radius;
13568
+ }
13569
+ function chartSeriesMarkerSvg(series, index, cx, cy, defaultRadius = 3) {
13570
+ const marker = { ...series.marker, ...series.pointMarkers?.[index] };
13571
+ const primitive = buildMarkerPrimitive({
13572
+ ...marker,
13573
+ symbol: marker.symbol,
13574
+ size: marker.size,
13575
+ cx,
13576
+ cy,
13577
+ fill: marker.fill ?? series.pointColors?.[index] ?? series.color,
13578
+ defaultRadius
13579
+ });
13580
+ if (!primitive) return "";
13581
+ let geometry;
13582
+ switch (primitive.kind) {
13583
+ case "circle":
13584
+ geometry = `cx="${n(primitive.cx)}" cy="${n(primitive.cy)}" r="${n(primitive.r)}"`;
13585
+ break;
13586
+ case "rect":
13587
+ geometry = `x="${n(primitive.x)}" y="${n(primitive.y)}" width="${n(primitive.w)}" height="${n(primitive.h)}"`;
13588
+ break;
13589
+ case "path":
13590
+ geometry = `d="${esc(primitive.d)}"`;
13591
+ break;
13592
+ case "polygon":
13593
+ geometry = `points="${esc(primitive.points)}"`;
13594
+ break;
13595
+ }
13596
+ const outline = primitive.stroke ? ` stroke="${esc(primitive.stroke)}" stroke-width="${n(primitive.strokeWidth ?? 1)}"` : "";
13597
+ const filter = series.shadowFilter ? ` filter="${esc(series.shadowFilter)}"` : "";
13598
+ return `<${primitive.kind} ${geometry} fill="${esc(primitive.fill)}"${outline}${filter}/>`;
13599
+ }
13600
+
13601
+ // chart/line-dash.ts
13602
+ function chartLineDashArray(style, width) {
13603
+ if (!style || style === "solid") {
13604
+ return void 0;
13605
+ }
13606
+ const unit = Math.max(width, 1);
13607
+ if (style === "dot" || style === "sysDot") {
13608
+ return `${unit} ${unit * 2}`;
13609
+ }
13610
+ if (style === "lgDash") {
13611
+ return `${unit * 6} ${unit * 3}`;
13612
+ }
13613
+ return `${unit * 3} ${unit * 2}`;
13614
+ }
13615
+
13368
13616
  // chart/render/chart-scale.ts
13369
13617
  var clean = (n2) => Number(n2.toPrecision(12));
13370
13618
  function* units(raw) {
@@ -13375,14 +13623,14 @@ function* units(raw) {
13375
13623
  exp++;
13376
13624
  }
13377
13625
  }
13378
- function niceScale(dataMin, dataMax, options = {}) {
13379
- const maxIntervals = Math.max(1, options.maxIntervals ?? 10);
13626
+ function niceScale(dataMin, dataMax, options2 = {}) {
13627
+ const maxIntervals = Math.max(1, options2.maxIntervals ?? 10);
13380
13628
  let lo = Number.isFinite(dataMin) ? dataMin : 0;
13381
13629
  let hi = Number.isFinite(dataMax) ? dataMax : 0;
13382
13630
  if (lo > hi) [lo, hi] = [hi, lo];
13383
13631
  if (lo === hi) {
13384
13632
  if (lo === 0) hi = 1;
13385
- else if (options.noZero) {
13633
+ else if (options2.noZero) {
13386
13634
  const pad = Math.abs(lo) * 0.1 || 1;
13387
13635
  lo -= pad;
13388
13636
  hi += pad;
@@ -13391,7 +13639,7 @@ function niceScale(dataMin, dataMax, options = {}) {
13391
13639
  }
13392
13640
  let fixedLo = false;
13393
13641
  let fixedHi = false;
13394
- if (!options.noZero) {
13642
+ if (!options2.noZero) {
13395
13643
  if (lo >= 0 && hi - lo >= hi / 6) {
13396
13644
  lo = 0;
13397
13645
  fixedLo = true;
@@ -13431,6 +13679,233 @@ function formatAxisValue(value, percent = false) {
13431
13679
  return `${v < 0 ? "-" : ""}${grouped}${frac ? `.${frac}` : ""}`;
13432
13680
  }
13433
13681
 
13682
+ // chart/render/chart-svg-axes.ts
13683
+ function axisTickText(value, axis, percent = false) {
13684
+ return formatChartNumber(value, axis?.source.numberFormat?.formatCode) ?? formatAxisValue(value, percent);
13685
+ }
13686
+ function axisLine(model, axis, part, x1, y1, x2, y2) {
13687
+ if (axis?.source.deleted) return "";
13688
+ return styledAxisLine(x1, y1, x2, y2, axis?.line, chartStroke(model, part));
13689
+ }
13690
+ function styledAxisLine(x1, y1, x2, y2, paint2, fallback) {
13691
+ const color = paint2?.color ?? fallback.color;
13692
+ const width = paint2?.width ?? fallback.width;
13693
+ if (color === "none" || width === 0) return "";
13694
+ const dash = chartLineDashArray(paint2?.dash, width);
13695
+ return line2(x1, y1, x2, y2, esc(color), width).replace(
13696
+ "/>",
13697
+ dash ? ` stroke-dasharray="${dash}"/>` : "/>"
13698
+ );
13699
+ }
13700
+ function axisGridlines(model, axis, ticks, position, plot, vertical) {
13701
+ const draw2 = (values, paint2, minor2) => {
13702
+ const fallback = chartStroke(model, minor2 ? "gridlineMinor" : "gridlineMajor");
13703
+ return values.map((value) => {
13704
+ const p = position(value);
13705
+ return vertical ? styledAxisLine(p, plot.y, p, plot.y + plot.h, paint2, fallback) : styledAxisLine(plot.x, p, plot.x + plot.w, p, paint2, fallback);
13706
+ }).join("");
13707
+ };
13708
+ const major = !axis || axis.source.majorGridlines ? draw2(ticks, axis?.majorGrid, false) : "";
13709
+ const minor = axis?.source.minorGridlines ? draw2(axis.minorTicks, axis.minorGrid, true) : "";
13710
+ return major + minor;
13711
+ }
13712
+
13713
+ // chart/axis-range.ts
13714
+ function computeLogValueRange(series, logBase) {
13715
+ const allValues = series.flatMap((item) => item.values).filter((value) => value !== null && Number.isFinite(value) && value > 0);
13716
+ if (allValues.length === 0) {
13717
+ return { min: 1, max: logBase, span: 1, logScale: true, logBase };
13718
+ }
13719
+ const dataMin = Math.min(...allValues);
13720
+ const dataMax = Math.max(...allValues);
13721
+ const logMin = Math.floor(Math.log(dataMin) / Math.log(logBase));
13722
+ const logMax = Math.ceil(Math.log(dataMax) / Math.log(logBase));
13723
+ const min = logBase ** logMin;
13724
+ const max = logBase ** Math.max(logMax, logMin + 1);
13725
+ return {
13726
+ min,
13727
+ max,
13728
+ span: Math.max(Math.log(max) / Math.log(logBase) - Math.log(min) / Math.log(logBase), 1),
13729
+ logScale: true,
13730
+ logBase
13731
+ };
13732
+ }
13733
+ function withAxisBounds(automatic, axis, logBase) {
13734
+ const validMin = typeof axis?.min === "number" && Number.isFinite(axis.min) && (!logBase || axis.min > 0) ? axis.min : void 0;
13735
+ const validMax = typeof axis?.max === "number" && Number.isFinite(axis.max) && (!logBase || axis.max > 0) ? axis.max : void 0;
13736
+ const min = validMin ?? automatic.min;
13737
+ let max = validMax ?? automatic.max;
13738
+ const majorUnit = validMin === void 0 && validMax === void 0 ? automatic.majorUnit : void 0;
13739
+ if (max <= min) {
13740
+ max = logBase ? min * logBase : min + 1;
13741
+ }
13742
+ const span = logBase ? Math.log(max) / Math.log(logBase) - Math.log(min) / Math.log(logBase) : max - min;
13743
+ return {
13744
+ min,
13745
+ max,
13746
+ span: Math.max(span, Number.EPSILON),
13747
+ ...majorUnit !== void 0 ? { majorUnit } : {},
13748
+ ...logBase ? { logScale: true, logBase } : {},
13749
+ ...axis?.orientation === "maxMin" ? { reverseOrder: true } : {}
13750
+ };
13751
+ }
13752
+
13753
+ // chart/axis-ticks.ts
13754
+ var LOG_EXPONENT_TOLERANCE = 1e-12;
13755
+ function generateLogTicks(range) {
13756
+ if (!range.logScale || !range.logBase) {
13757
+ return [];
13758
+ }
13759
+ const base = range.logBase;
13760
+ const logMin = Math.log(range.min) / Math.log(base);
13761
+ const logMax = Math.log(range.max) / Math.log(base);
13762
+ const firstExponent = Math.ceil(logMin - LOG_EXPONENT_TOLERANCE);
13763
+ const lastExponent = Math.floor(logMax + LOG_EXPONENT_TOLERANCE);
13764
+ if (lastExponent < firstExponent) {
13765
+ return range.min === range.max ? [range.min] : [range.min, range.max];
13766
+ }
13767
+ return Array.from(
13768
+ { length: lastExponent - firstExponent + 1 },
13769
+ (_unused, index) => base ** (firstExponent + index)
13770
+ );
13771
+ }
13772
+ function generateIntervalTicks(range, unit) {
13773
+ if (!Number.isFinite(unit) || unit <= 0 || range.logScale) {
13774
+ return [];
13775
+ }
13776
+ const tolerance = Math.max(1, Math.abs(range.min), Math.abs(range.max)) * 1e-12;
13777
+ const first3 = Math.ceil((range.min - tolerance) / unit);
13778
+ const last = Math.floor((range.max + tolerance) / unit);
13779
+ const count = Math.min(Math.max(last - first3 + 1, 0), 2e3);
13780
+ return Array.from({ length: count }, (_, index) => (first3 + index) * unit);
13781
+ }
13782
+ function generateAxisTicks(range, axis, defaultIntervals) {
13783
+ if (range.logScale && range.logBase) {
13784
+ return generateLogTicks(range);
13785
+ }
13786
+ const explicit = generateIntervalTicks(range, axis?.majorUnit ?? 0);
13787
+ if (explicit.length > 0) {
13788
+ return explicit;
13789
+ }
13790
+ const automatic = generateIntervalTicks(range, range.majorUnit ?? 0);
13791
+ if (automatic.length > 0) {
13792
+ return automatic;
13793
+ }
13794
+ return Array.from(
13795
+ { length: defaultIntervals + 1 },
13796
+ (_, index) => range.min + range.span / defaultIntervals * index
13797
+ );
13798
+ }
13799
+ function generateMinorAxisTicks(range, axis) {
13800
+ const minor = generateIntervalTicks(range, axis?.minorUnit ?? 0);
13801
+ if (minor.length === 0) {
13802
+ return [];
13803
+ }
13804
+ const majorUnit = axis?.majorUnit;
13805
+ if (!majorUnit || !Number.isFinite(majorUnit) || majorUnit <= 0) {
13806
+ return minor;
13807
+ }
13808
+ const tolerance = Math.max(1, Math.abs(range.min), Math.abs(range.max)) * 1e-10;
13809
+ return minor.filter(
13810
+ (value) => Math.abs(value / majorUnit - Math.round(value / majorUnit)) > tolerance
13811
+ );
13812
+ }
13813
+
13814
+ // chart/render/chart-view-axes.ts
13815
+ function chartAxisRatio(value, scale, axis) {
13816
+ const range = axis?.range;
13817
+ const ratio = range?.logScale ? Math.log(Math.max(value, range.min) / range.min) / Math.log(range.max / range.min) : (value - scale.min) / (scale.max - scale.min || 1);
13818
+ return range?.reverseOrder ? 1 - ratio : ratio;
13819
+ }
13820
+ function chartAxisLabels(axis) {
13821
+ return axis?.source.deleted !== true && axis?.source.tickLabelPosition !== "none";
13822
+ }
13823
+ function options(axis) {
13824
+ return {
13825
+ ...axis.scaling,
13826
+ ...axis.scaling.logBase === void 0 ? {} : { logScale: true },
13827
+ ...axis.majorUnit === void 0 ? {} : { majorUnit: axis.majorUnit },
13828
+ ...axis.minorUnit === void 0 ? {} : { minorUnit: axis.minorUnit }
13829
+ };
13830
+ }
13831
+ function applyChartAxes(model, chart, color) {
13832
+ if (!chart.axes?.length) return;
13833
+ const axes = chart.axes;
13834
+ const linked = axes.filter((axis) => axis.id !== void 0 && chart.axisIds?.includes(axis.id));
13835
+ const candidates = linked.length ? linked : axes;
13836
+ const xy = model.type === "scatter" || model.type === "bubble";
13837
+ const value = candidates.find((axis) => axis.kind === "val" && !["b", "t"].includes(axis.position ?? "")) ?? candidates.find((axis) => axis.kind === "val");
13838
+ const category = candidates.find(
13839
+ (axis) => xy ? axis.kind === "val" && axis !== value : axis.kind === "cat" || axis.kind === "date"
13840
+ );
13841
+ const secondary = axes.find((axis) => axis.kind === "val" && axis !== value && axis !== category);
13842
+ const paint2 = (shape) => {
13843
+ const ln = shape?.line;
13844
+ const fill = ln?.fill;
13845
+ const resolved = fill?.kind === "none" ? "none" : color(fill?.kind === "solid" ? fill.color : void 0);
13846
+ return {
13847
+ ...resolved === void 0 ? {} : { color: resolved },
13848
+ ...ln?.widthEmu === void 0 ? {} : { width: ln.widthEmu / EMU_PER_PIXEL },
13849
+ ...ln?.dash === void 0 ? {} : { dash: ln.dash }
13850
+ };
13851
+ };
13852
+ const bind = (axis, scale, values) => {
13853
+ const opts = options(axis);
13854
+ const automatic = opts.logScale ? computeLogValueRange(
13855
+ [{ values: values ?? [] }],
13856
+ opts.logBase && Number.isFinite(opts.logBase) && opts.logBase > 1 ? opts.logBase : 10
13857
+ ) : {
13858
+ min: scale?.min ?? 0,
13859
+ max: scale?.max ?? 1,
13860
+ span: (scale?.max ?? 1) - (scale?.min ?? 0),
13861
+ ...scale ? { majorUnit: scale.majorUnit } : {}
13862
+ };
13863
+ const logBase = automatic.logBase;
13864
+ const range = withAxisBounds(automatic, opts, logBase);
13865
+ if (scale) {
13866
+ scale.min = range.min;
13867
+ scale.max = range.max;
13868
+ scale.ticks = generateAxisTicks(range, opts, 5);
13869
+ }
13870
+ return {
13871
+ source: axis,
13872
+ range,
13873
+ minorTicks: generateMinorAxisTicks(range, opts),
13874
+ line: paint2(axis.spPr),
13875
+ majorGrid: paint2(axis.majorGridlinesSpPr),
13876
+ minorGrid: paint2(axis.minorGridlinesSpPr)
13877
+ };
13878
+ };
13879
+ const out = {};
13880
+ if (value)
13881
+ out.value = bind(
13882
+ value,
13883
+ model.valueAxis,
13884
+ [
13885
+ ...model.series,
13886
+ ...model.extraGroups?.filter((g) => !g.secondary).flatMap((g) => g.series) ?? []
13887
+ ].flatMap((s) => s.values)
13888
+ );
13889
+ if (category)
13890
+ out.category = bind(
13891
+ category,
13892
+ model.xAxis ?? {
13893
+ min: 0,
13894
+ max: Math.max(1, model.categories.length - 1),
13895
+ majorUnit: 1,
13896
+ ticks: []
13897
+ },
13898
+ model.series.flatMap((s) => s.xValues ?? [])
13899
+ );
13900
+ if (secondary)
13901
+ out.secondary = bind(
13902
+ secondary,
13903
+ model.secondaryAxis,
13904
+ model.extraGroups?.filter((g) => g.secondary).flatMap((g) => g.series.flatMap((s) => s.values))
13905
+ );
13906
+ model.axes = out;
13907
+ }
13908
+
13434
13909
  // chart/render/chart-view-analysis.ts
13435
13910
  function strokeOf(line3, fallback, resolve) {
13436
13911
  if (line3?.fill?.kind === "none") return void 0;
@@ -13480,15 +13955,15 @@ function seriesName(series, index, evaluateRef) {
13480
13955
  const fromRef = resolveRef(series.nameRef, evaluateRef)?.map(toText).filter((t) => t !== "").join(" ");
13481
13956
  return fromRef || series.name || `Series${index + 1}`;
13482
13957
  }
13483
- function seriesContext(chart, theme, options) {
13958
+ function seriesContext(chart, theme, options2) {
13484
13959
  const scheme = chartColorScheme(theme);
13485
13960
  const resolver = { scheme: (name) => scheme[name] };
13486
13961
  return {
13487
13962
  theme,
13488
13963
  scheme,
13489
13964
  palette: chart.colorPalette === void 0 ? void 0 : findChartColorPalette(chart.colorPalette),
13490
- evaluateRef: options.evaluateRef ?? (() => []),
13491
- seriesColor: options.seriesColor,
13965
+ evaluateRef: options2.evaluateRef ?? (() => []),
13966
+ seriesColor: options2.seriesColor,
13492
13967
  drawingColor: (color) => color && drawingColorCss(resolveDrawingColor(color, resolver, { transformOrder: "document" })),
13493
13968
  gradient: (fill) => fill?.kind === "gradient" ? resolveChartGradient(
13494
13969
  fill,
@@ -13514,7 +13989,11 @@ function seriesView(ctx, s, index, total, categoriesOf) {
13514
13989
  })
13515
13990
  );
13516
13991
  if (Object.keys(points).length) view.pointGradients = points;
13517
- Object.assign(view, analysisView(s, color, ctx.drawingColor));
13992
+ Object.assign(
13993
+ view,
13994
+ analysisView(s, color, ctx.drawingColor),
13995
+ seriesMarkerViews(s, ctx.drawingColor)
13996
+ );
13518
13997
  return view;
13519
13998
  }
13520
13999
 
@@ -13814,11 +14293,11 @@ function histogramView(chart, model) {
13814
14293
  const first3 = model.series[0];
13815
14294
  if (!first3) return;
13816
14295
  const raw = first3.values.map((v) => v ?? Number.NaN);
13817
- const options = chart.histogram ?? {};
13818
- const bins = options.aggregateByCategory ? aggregateByCategory(
14296
+ const options2 = chart.histogram ?? {};
14297
+ const bins = options2.aggregateByCategory ? aggregateByCategory(
13819
14298
  first3.values.map((v) => v ?? 0),
13820
14299
  model.categories
13821
- ) : computeHistogramBins(raw, options, formatAxisValue);
14300
+ ) : computeHistogramBins(raw, options2, formatAxisValue);
13822
14301
  model.categories = bins.map((bin) => bin.label);
13823
14302
  first3.values = bins.map((bin) => bin.value);
13824
14303
  model.barGapWidth = 0;
@@ -13842,11 +14321,11 @@ var SUPPORTED = /* @__PURE__ */ new Set([
13842
14321
  "treemap",
13843
14322
  "sunburst"
13844
14323
  ]);
13845
- function chartSummaryView(chart, theme, options = {}) {
14324
+ function chartSummaryView(chart, theme, options2 = {}) {
13846
14325
  const type = chart.chartType;
13847
14326
  const radial = type === "pie" || type === "doughnut";
13848
14327
  const byPoint = radial || type === "treemap" || type === "sunburst";
13849
- const ctx = seriesContext(chart, theme, options);
14328
+ const ctx = seriesContext(chart, theme, options2);
13850
14329
  const { palette, scheme, drawingColor } = ctx;
13851
14330
  const grouping = chart.grouping ?? (type === "bar" || type === "column" ? "clustered" : "standard");
13852
14331
  const rawCategories = [];
@@ -13932,6 +14411,7 @@ function chartSummaryView(chart, theme, options = {}) {
13932
14411
  else if (!byPoint) model.valueAxis = valueAxis(model);
13933
14412
  applyDataLabels(model, chart.series, extra);
13934
14413
  chartExtraAxes(model);
14414
+ applyChartAxes(model, chart, ctx.drawingColor);
13935
14415
  return model;
13936
14416
  }
13937
14417
 
@@ -13939,15 +14419,13 @@ function chartSummaryView(chart, theme, options = {}) {
13939
14419
  function cartesianAxes(model, area, out) {
13940
14420
  const scale = model.valueAxis;
13941
14421
  if (!scale) return void 0;
13942
- const labels = scale.ticks.map((t) => formatAxisValue(t, scale.percent));
14422
+ const labels = scale.ticks.map((t) => axisTickText(t, model.axes?.value, scale.percent));
13943
14423
  const valueAttrs = chartTextAttributes(model, "valueAxis");
13944
14424
  const categoryAttrs = chartTextAttributes(model, "categoryAxis");
13945
14425
  const valueSize = valueAttrs.size ?? 10;
13946
14426
  const categorySize = categoryAttrs.size ?? 10;
13947
- const grid = chartStroke(model, "gridlineMajor");
13948
- const axis = chartStroke(model, "categoryAxis");
13949
- const valueLabels = model.appearance?.valueAxis?.labelsVisible !== false;
13950
- const categoryLabels = model.appearance?.categoryAxis?.labelsVisible !== false;
14427
+ const valueLabels = chartAxisLabels(model.axes?.value) && model.appearance?.valueAxis?.labelsVisible !== false;
14428
+ const categoryLabels = chartAxisLabels(model.axes?.category) && model.appearance?.categoryAxis?.labelsVisible !== false;
13951
14429
  const labelW = valueLabels ? Math.max(...labels.map((l) => textWidth(l, valueSize)), 8) + 6 : 4;
13952
14430
  const horizontal = model.horizontal;
13953
14431
  const cats = Math.max(1, model.categories.length);
@@ -13956,7 +14434,7 @@ function cartesianAxes(model, area, out) {
13956
14434
  Math.max(...model.categories.map((c) => textWidth(c, categorySize)), 8) + 6
13957
14435
  );
13958
14436
  const second = horizontal ? void 0 : model.secondaryAxis;
13959
- const secondLabels = second?.ticks.map((t) => formatAxisValue(t, second.percent)) ?? [];
14437
+ const secondLabels = second?.ticks.map((t) => axisTickText(t, model.axes?.secondary, second.percent)) ?? [];
13960
14438
  const secondW = second ? valueLabels ? Math.max(...secondLabels.map((l) => textWidth(l, valueSize)), 8) + 8 : 4 : 0;
13961
14439
  const plot = horizontal ? {
13962
14440
  x: area.x + catW,
@@ -13969,29 +14447,47 @@ function cartesianAxes(model, area, out) {
13969
14447
  w: Math.max(1, area.w - labelW - 4 - secondW),
13970
14448
  h: Math.max(1, area.h - Math.max(20, categorySize * 1.5))
13971
14449
  };
13972
- const span = scale.max - scale.min || 1;
13973
- const value = horizontal ? (v) => plot.x + (v - scale.min) / span * plot.w : (v) => plot.y + plot.h - (v - scale.min) / span * plot.h;
14450
+ const value = horizontal ? (v) => plot.x + chartAxisRatio(v, scale, model.axes?.value) * plot.w : (v) => plot.y + plot.h - chartAxisRatio(v, scale, model.axes?.value) * plot.h;
13974
14451
  const bandSize = (horizontal ? plot.h : plot.w) / cats;
13975
- const band = horizontal ? (i) => plot.y + plot.h - bandSize * (i + 0.5) : (i) => plot.x + bandSize * (i + 0.5);
14452
+ const index = (i) => model.axes?.category?.range.reverseOrder ? cats - 1 - i : i;
14453
+ const band = horizontal ? (i) => plot.y + plot.h - bandSize * (index(i) + 0.5) : (i) => plot.x + bandSize * (index(i) + 0.5);
13976
14454
  out.push(chartAreaRect(model, "plotArea", plot));
14455
+ out.push(axisGridlines(model, model.axes?.value, scale.ticks, value, plot, horizontal));
14456
+ if (model.axes?.category?.source.majorGridlines || model.axes?.category?.source.minorGridlines)
14457
+ out.push(
14458
+ axisGridlines(
14459
+ model,
14460
+ model.axes.category,
14461
+ model.categories.map((_, i) => i),
14462
+ band,
14463
+ plot,
14464
+ !horizontal
14465
+ )
14466
+ );
13977
14467
  scale.ticks.forEach((t, i) => {
13978
14468
  const p = value(t);
13979
14469
  const label = labels[i] ?? "";
13980
14470
  if (horizontal) {
13981
- out.push(line2(p, plot.y, p, plot.y + plot.h, grid.color, grid.width));
13982
14471
  if (valueLabels)
13983
14472
  out.push(
13984
14473
  text(p, plot.y + plot.h + valueSize + 2, label, { anchor: "middle", ...valueAttrs })
13985
14474
  );
13986
14475
  } else {
13987
- out.push(line2(plot.x, p, plot.x + plot.w, p, grid.color, grid.width));
13988
14476
  if (valueLabels)
13989
14477
  out.push(text(plot.x - 4, p + valueSize * 0.3, label, { anchor: "end", ...valueAttrs }));
13990
14478
  }
13991
14479
  });
13992
- const zero = value(Math.min(Math.max(0, scale.min), scale.max));
13993
- if (horizontal) out.push(line2(zero, plot.y, zero, plot.y + plot.h, axis.color, axis.width));
13994
- else out.push(line2(plot.x, zero, plot.x + plot.w, zero, axis.color, axis.width));
14480
+ const source = model.axes?.value?.source;
14481
+ const crossing = source?.crosses === "max" ? scale.max : source?.crosses === "min" ? scale.min : source?.crossesAt ?? 0;
14482
+ const zero = value(Math.min(Math.max(crossing, scale.min), scale.max));
14483
+ if (horizontal)
14484
+ out.push(
14485
+ axisLine(model, model.axes?.category, "categoryAxis", zero, plot.y, zero, plot.y + plot.h)
14486
+ );
14487
+ else
14488
+ out.push(
14489
+ axisLine(model, model.axes?.category, "categoryAxis", plot.x, zero, plot.x + plot.w, zero)
14490
+ );
13995
14491
  const step = Math.max(
13996
14492
  1,
13997
14493
  Math.ceil(cats / Math.max(1, Math.floor((horizontal ? plot.h : plot.w) / 14)))
@@ -14016,20 +14512,23 @@ function cartesianAxes(model, area, out) {
14016
14512
  });
14017
14513
  const frame2 = { plot, value, band, bandSize };
14018
14514
  if (second) {
14019
- const secondSpan = second.max - second.min || 1;
14020
- frame2.secondary = (v) => plot.y + plot.h - (v - second.min) / secondSpan * plot.h;
14021
- const secondAxis = chartStroke(model, "valueAxis");
14515
+ frame2.secondary = (v) => plot.y + plot.h - chartAxisRatio(v, second, model.axes?.secondary) * plot.h;
14022
14516
  out.push(
14023
- line2(
14517
+ axisLine(
14518
+ model,
14519
+ model.axes?.secondary,
14520
+ "valueAxis",
14024
14521
  plot.x + plot.w,
14025
14522
  plot.y,
14026
14523
  plot.x + plot.w,
14027
- plot.y + plot.h,
14028
- secondAxis.color,
14029
- secondAxis.width
14524
+ plot.y + plot.h
14030
14525
  )
14031
14526
  );
14032
- if (valueLabels)
14527
+ if (model.axes?.secondary?.source.majorGridlines || model.axes?.secondary?.source.minorGridlines)
14528
+ out.push(
14529
+ axisGridlines(model, model.axes.secondary, second.ticks, frame2.secondary, plot, false)
14530
+ );
14531
+ if (chartAxisLabels(model.axes?.secondary))
14033
14532
  second.ticks.forEach(
14034
14533
  (t, i) => out.push(
14035
14534
  text(plot.x + plot.w + 4, frame2.secondary(t) + valueSize * 0.3, secondLabels[i] ?? "", {
@@ -14073,18 +14572,19 @@ function linesAndAreas(model, frame2, out) {
14073
14572
  index: i,
14074
14573
  x: frame2.band(i),
14075
14574
  y: frame2.value(top),
14076
- radius: area ? 0 : 3
14575
+ radius: area ? 0 : chartMarkerRadius(s, i, 2.5)
14077
14576
  });
14078
14577
  lower.push([frame2.band(i), frame2.value(below2)]);
14079
14578
  });
14080
14579
  layers.push({
14580
+ series: s,
14081
14581
  points,
14082
14582
  lower,
14083
14583
  color: s.color,
14084
14584
  filter: s.shadowFilter ? ` filter="${s.shadowFilter}"` : ""
14085
14585
  });
14086
14586
  });
14087
- for (const { points, lower, color, filter } of area ? [...layers].reverse() : layers) {
14587
+ for (const { points, lower, color, filter, series } of area ? [...layers].reverse() : layers) {
14088
14588
  if (area) {
14089
14589
  const poly = [...points, ...[...lower].reverse()].map(([x, y]) => `${n(x)},${n(y)}`).join(" ");
14090
14590
  out.push(`<polygon points="${poly}" fill="${color}" fill-opacity="0.85"${filter}/>`);
@@ -14103,9 +14603,9 @@ function linesAndAreas(model, frame2, out) {
14103
14603
  else segment2.push(`${n(x)},${n(y)}`);
14104
14604
  }
14105
14605
  flush();
14106
- for (const [x, y] of points)
14107
- if (!Number.isNaN(x))
14108
- out.push(`<circle cx="${n(x)}" cy="${n(y)}" r="2.5" fill="${color}"${filter}/>`);
14606
+ points.forEach(([x, y], index) => {
14607
+ if (!Number.isNaN(x)) out.push(chartSeriesMarkerSvg(series, index, x, y, 2.5));
14608
+ });
14109
14609
  }
14110
14610
  pointLabels(model, marks, out);
14111
14611
  }
@@ -14115,16 +14615,14 @@ function scatter(model, area, out) {
14115
14615
  const ys = model.valueAxis;
14116
14616
  const xs = model.xAxis;
14117
14617
  if (!ys || !xs) return;
14118
- const yLabels = ys.ticks.map((t) => formatAxisValue(t));
14618
+ const yLabels = ys.ticks.map((t) => axisTickText(t, model.axes?.value));
14119
14619
  const valueAttrs = chartTextAttributes(model, "valueAxis");
14120
14620
  const categoryAttrs = chartTextAttributes(model, "categoryAxis");
14121
14621
  const valueSize = valueAttrs.size ?? 10;
14122
14622
  const categorySize = categoryAttrs.size ?? 10;
14123
- const grid = chartStroke(model, "gridlineMajor");
14124
14623
  const xAxis = chartStroke(model, "categoryAxis");
14125
- const yAxis = chartStroke(model, "valueAxis");
14126
- const valueLabels = model.appearance?.valueAxis?.labelsVisible !== false;
14127
- const categoryLabels = model.appearance?.categoryAxis?.labelsVisible !== false;
14624
+ const valueLabels = chartAxisLabels(model.axes?.value) && model.appearance?.valueAxis?.labelsVisible !== false;
14625
+ const categoryLabels = chartAxisLabels(model.axes?.category) && model.appearance?.categoryAxis?.labelsVisible !== false;
14128
14626
  const labelW = valueLabels ? Math.max(...yLabels.map((l) => textWidth(l, valueSize)), 8) + 6 : 4;
14129
14627
  const plot = {
14130
14628
  x: area.x + labelW,
@@ -14144,17 +14642,24 @@ function scatter(model, area, out) {
14144
14642
  s.values.forEach((_, i) => {
14145
14643
  reach = Math.max(reach, radiusOf(s.sizes?.[i] ?? void 0) ?? 0);
14146
14644
  });
14147
- const widen = (s, length) => {
14645
+ const widen = (s, length, axis) => {
14646
+ if (axis?.range.logScale) return s;
14148
14647
  const pad = reach * (s.max - s.min || 1) / Math.max(1, length - 2 * reach);
14149
- return { ...s, min: s.min - pad, max: s.max + pad };
14648
+ return {
14649
+ ...s,
14650
+ min: axis?.source.scaling.min === void 0 ? s.min - pad : s.min,
14651
+ max: axis?.source.scaling.max === void 0 ? s.max + pad : s.max
14652
+ };
14150
14653
  };
14151
- const xView = widen(xs, plot.w);
14152
- const yView = widen(ys, plot.h);
14153
- const px = (v) => plot.x + (v - xView.min) / (xView.max - xView.min || 1) * plot.w;
14154
- const py = (v) => plot.y + plot.h - (v - yView.min) / (yView.max - yView.min || 1) * plot.h;
14654
+ const xView = widen(xs, plot.w, model.axes?.category);
14655
+ const yView = widen(ys, plot.h, model.axes?.value);
14656
+ const px = (v) => plot.x + chartAxisRatio(v, xView, model.axes?.category) * plot.w;
14657
+ const py = (v) => plot.y + plot.h - chartAxisRatio(v, yView, model.axes?.value) * plot.h;
14155
14658
  out.push(chartAreaRect(model, "plotArea", plot));
14659
+ out.push(axisGridlines(model, model.axes?.value, ys.ticks, py, plot, false));
14660
+ if (model.axes?.category)
14661
+ out.push(axisGridlines(model, model.axes.category, xs.ticks, px, plot, true));
14156
14662
  ys.ticks.forEach((t, i) => {
14157
- out.push(line2(plot.x, py(t), plot.x + plot.w, py(t), grid.color, grid.width));
14158
14663
  if (valueLabels)
14159
14664
  out.push(
14160
14665
  text(plot.x - 4, py(t) + valueSize * 0.3, yLabels[i] ?? "", {
@@ -14164,19 +14669,30 @@ function scatter(model, area, out) {
14164
14669
  );
14165
14670
  });
14166
14671
  for (const t of xs.ticks) {
14167
- out.push(line2(px(t), plot.y + plot.h, px(t), plot.y + plot.h + 3, xAxis.color, xAxis.width));
14672
+ if (!model.axes?.category?.source.deleted)
14673
+ out.push(line2(px(t), plot.y + plot.h, px(t), plot.y + plot.h + 3, xAxis.color, xAxis.width));
14168
14674
  if (categoryLabels)
14169
14675
  out.push(
14170
- text(px(t), plot.y + plot.h + categorySize + 3, formatAxisValue(t), {
14676
+ text(px(t), plot.y + plot.h + categorySize + 3, axisTickText(t, model.axes?.category), {
14171
14677
  anchor: "middle",
14172
14678
  ...categoryAttrs
14173
14679
  })
14174
14680
  );
14175
14681
  }
14176
14682
  out.push(
14177
- line2(plot.x, plot.y + plot.h, plot.x + plot.w, plot.y + plot.h, xAxis.color, xAxis.width)
14683
+ axisLine(
14684
+ model,
14685
+ model.axes?.category,
14686
+ "categoryAxis",
14687
+ plot.x,
14688
+ plot.y + plot.h,
14689
+ plot.x + plot.w,
14690
+ plot.y + plot.h
14691
+ )
14692
+ );
14693
+ out.push(
14694
+ axisLine(model, model.axes?.value, "valueAxis", plot.x, plot.y, plot.x, plot.y + plot.h)
14178
14695
  );
14179
- out.push(line2(plot.x, plot.y, plot.x, plot.y + plot.h, yAxis.color, yAxis.width));
14180
14696
  const marks = [];
14181
14697
  for (const [si, s] of model.series.entries())
14182
14698
  s.values.forEach((v, i) => {
@@ -14185,8 +14701,8 @@ function scatter(model, area, out) {
14185
14701
  const filter = s.shadowFilter ? ` filter="${s.shadowFilter}"` : "";
14186
14702
  const fill = s.pointColors?.[i] ?? s.color;
14187
14703
  if (!bubble) {
14188
- out.push(`<circle cx="${n(px(x))}" cy="${n(py(v))}" r="3" fill="${fill}"${filter}/>`);
14189
- marks.push({ series: s, index: i, x: px(x), y: py(v), radius: 3 });
14704
+ out.push(chartSeriesMarkerSvg(s, i, px(x), py(v)));
14705
+ marks.push({ series: s, index: i, x: px(x), y: py(v), radius: chartMarkerRadius(s, i) });
14190
14706
  return;
14191
14707
  }
14192
14708
  const r = radiusOf(s.sizes?.[i] ?? void 0);
@@ -14406,32 +14922,37 @@ function radarSvg(model, area) {
14406
14922
  const valueSize = valueAttrs.size ?? 9;
14407
14923
  const categorySize = categoryAttrs.size ?? 10;
14408
14924
  const grid = chartStroke(model, "gridlineMajor");
14409
- const axis = chartStroke(model, "categoryAxis");
14410
14925
  const cx = area.x + area.w / 2;
14411
14926
  const cy = area.y + area.h / 2 + 4;
14412
14927
  const radius = Math.max(1, Math.min(area.w, area.h) / 2 - Math.max(18, categorySize * 1.8));
14413
14928
  const angle = (i) => i / count * Math.PI * 2;
14414
- const r = (v) => (v - scale.min) / (scale.max - scale.min || 1) * radius;
14929
+ const r = (v) => chartAxisRatio(v, scale, model.axes?.value) * radius;
14415
14930
  const labelEvery = Math.max(
14416
14931
  1,
14417
14932
  Math.ceil(12 / Math.max(1, radius / Math.max(1, scale.ticks.length - 1)))
14418
14933
  );
14419
14934
  for (const [k, t] of scale.ticks.entries()) {
14420
14935
  const ring = Array.from({ length: count }, (_, i) => polar(cx, cy, r(t), angle(i))).map(([x, y]) => `${n(x)},${n(y)}`).join(" ");
14421
- out.push(
14422
- `<polygon points="${ring}" fill="none" stroke="${grid.color}" stroke-width="${n(grid.width)}"/>`
14423
- );
14424
- if (model.appearance?.valueAxis?.labelsVisible !== false && k % labelEvery === 0)
14936
+ if (!model.axes?.value || model.axes.value.source.majorGridlines)
14425
14937
  out.push(
14426
- text(cx + 3, cy - r(t) + valueSize * 0.3, formatAxisValue(t, scale.percent), valueAttrs)
14938
+ `<polygon points="${ring}" fill="none" stroke="${grid.color}" stroke-width="${n(grid.width)}"/>`
14939
+ );
14940
+ if (chartAxisLabels(model.axes?.value) && model.appearance?.valueAxis?.labelsVisible !== false && k % labelEvery === 0)
14941
+ out.push(
14942
+ text(
14943
+ cx + 3,
14944
+ cy - r(t) + valueSize * 0.3,
14945
+ axisTickText(t, model.axes?.value, scale.percent),
14946
+ valueAttrs
14947
+ )
14427
14948
  );
14428
14949
  }
14429
14950
  model.categories.forEach((c, i) => {
14430
14951
  const [x, y] = polar(cx, cy, radius, angle(i));
14431
- out.push(line2(cx, cy, x, y, axis.color, axis.width));
14952
+ out.push(axisLine(model, model.axes?.category, "categoryAxis", cx, cy, x, y));
14432
14953
  const [lx, ly] = polar(cx, cy, radius + 10, angle(i));
14433
14954
  const anchor = Math.abs(lx - cx) < 2 ? "middle" : lx > cx ? "start" : "end";
14434
- if (model.appearance?.categoryAxis?.labelsVisible !== false)
14955
+ if (chartAxisLabels(model.axes?.category) && model.appearance?.categoryAxis?.labelsVisible !== false)
14435
14956
  out.push(
14436
14957
  text(lx, ly + categorySize * 0.3, fit(c, area.w / 4, categorySize), {
14437
14958
  anchor,
@@ -14442,7 +14963,13 @@ function radarSvg(model, area) {
14442
14963
  const marks = [];
14443
14964
  for (const s of model.series) {
14444
14965
  const vertices = s.values.slice(0, count).map((v, i) => polar(cx, cy, r(v ?? scale.min), angle(i)));
14445
- vertices.forEach(([x, y], i) => marks.push({ series: s, index: i, x, y, radius: 3 }));
14966
+ vertices.forEach(([x, y], i) => {
14967
+ if (s.values[i] === null) return;
14968
+ const markerSeries = s;
14969
+ if (markerSeries.marker || markerSeries.pointMarkers)
14970
+ out.push(chartSeriesMarkerSvg(s, i, x, y));
14971
+ marks.push({ series: s, index: i, x, y, radius: chartMarkerRadius(s, i) });
14972
+ });
14446
14973
  const points = vertices.map(([x, y]) => `${n(x)},${n(y)}`).join(" ");
14447
14974
  out.push(
14448
14975
  `<polygon points="${points}" fill="none" stroke="${s.color}" stroke-width="2"${s.shadowFilter ? ` filter="${s.shadowFilter}"` : ""}/>`
@@ -14539,33 +15066,33 @@ var CHART_FONT_FAMILY = "Calibri, Carlito, Arial, sans-serif";
14539
15066
  function cssFont(attrs) {
14540
15067
  return `${attrs.italic ? "italic" : "normal"} ${attrs.weight ?? "normal"} ${attrs.size ?? 10}px ${attrs.family ?? CHART_FONT_FAMILY}`;
14541
15068
  }
14542
- function chartFontMetrics(attrs, options) {
14543
- const metrics = options.measureFont?.(cssFont(attrs));
15069
+ function chartFontMetrics(attrs, options2) {
15070
+ const metrics = options2.measureFont?.(cssFont(attrs));
14544
15071
  return metrics && Number.isFinite(metrics.ascent) && Number.isFinite(metrics.descent) && metrics.ascent >= 0 && metrics.descent >= 0 && metrics.ascent + metrics.descent > 0 ? metrics : void 0;
14545
15072
  }
14546
- function chartTextWidth(content, attrs, options) {
14547
- const width = options.measureText?.(content, cssFont(attrs));
15073
+ function chartTextWidth(content, attrs, options2) {
15074
+ const width = options2.measureText?.(content, cssFont(attrs));
14548
15075
  return width !== void 0 && Number.isFinite(width) && width >= 0 ? width : textWidth(content, attrs.size);
14549
15076
  }
14550
- function fitChartText(content, maxWidth, attrs, options) {
14551
- if (!options.measureText) return fit(content, maxWidth, attrs.size);
14552
- if (chartTextWidth(content, attrs, options) <= maxWidth) return content;
15077
+ function fitChartText(content, maxWidth, attrs, options2) {
15078
+ if (!options2.measureText) return fit(content, maxWidth, attrs.size);
15079
+ if (chartTextWidth(content, attrs, options2) <= maxWidth) return content;
14553
15080
  const points = [...content];
14554
15081
  let low = 0;
14555
15082
  let high = points.length;
14556
15083
  while (low < high) {
14557
15084
  const mid = Math.ceil((low + high) / 2);
14558
- if (chartTextWidth(`${points.slice(0, mid).join("")}\u2026`, attrs, options) <= maxWidth) low = mid;
15085
+ if (chartTextWidth(`${points.slice(0, mid).join("")}\u2026`, attrs, options2) <= maxWidth) low = mid;
14559
15086
  else high = mid - 1;
14560
15087
  }
14561
15088
  return `${points.slice(0, low).join("")}\u2026`;
14562
15089
  }
14563
15090
 
14564
15091
  // chart/render/chart-svg-legend.ts
14565
- function chartLegendSvg(model, area, frame2, options) {
15092
+ function chartLegendSvg(model, area, frame2, options2) {
14566
15093
  const automatic = [];
14567
15094
  const bounds = {};
14568
- const reserved = automaticLegend(model, area, automatic, options, bounds);
15095
+ const reserved = automaticLegend(model, area, automatic, options2, bounds);
14569
15096
  const plot = model.legendOverlay ? area : reserved;
14570
15097
  const box = bounds.box;
14571
15098
  if (!box) return { plot, markup: "", foreground: false };
@@ -14579,11 +15106,11 @@ function chartLegendSvg(model, area, frame2, options) {
14579
15106
  const entries = legendEntries(model);
14580
15107
  const attrs = chartTextAttributes(model, "legend");
14581
15108
  const size = attrs.size ?? 10;
14582
- const font = chartFontMetrics(attrs, options);
15109
+ const font = chartFontMetrics(attrs, options2);
14583
15110
  const keySize = size / 2;
14584
15111
  const keyGap = size / 4;
14585
15112
  const widths = entries.map(
14586
- (entry) => chartTextWidth(entry.label, attrs, options) + keySize + keyGap
15113
+ (entry) => chartTextWidth(entry.label, attrs, options2) + keySize + keyGap
14587
15114
  );
14588
15115
  const horizontal = manual.width > manual.height && widths.reduce((sum, width) => sum + width, 0) + size <= manual.width;
14589
15116
  const rowWidth = horizontal ? manual.width / entries.length : manual.width;
@@ -14598,8 +15125,8 @@ function chartLegendSvg(model, area, frame2, options) {
14598
15125
  ];
14599
15126
  const baselineOffset = font ? (font.ascent - font.descent) / 2 : size * 0.35;
14600
15127
  entries.forEach((entry, i) => {
14601
- const available = horizontal ? chartTextWidth(entry.label, attrs, options) : Math.max(0, rowWidth - size / 2 - keySize - keyGap);
14602
- const label = fitChartText(entry.label, available, attrs, options);
15128
+ const available = horizontal ? chartTextWidth(entry.label, attrs, options2) : Math.max(0, rowWidth - size / 2 - keySize - keyGap);
15129
+ const label = fitChartText(entry.label, available, attrs, options2);
14603
15130
  const contentWidth = Math.min(
14604
15131
  horizontal ? widths[i] ?? 0 : Math.max(...widths),
14605
15132
  rowWidth - size / 2
@@ -14642,7 +15169,7 @@ function legendEntries(model) {
14642
15169
  color: s.color
14643
15170
  }));
14644
15171
  }
14645
- function automaticLegend(model, area, out, options, bounds) {
15172
+ function automaticLegend(model, area, out, options2, bounds) {
14646
15173
  const entries = legendEntries(model);
14647
15174
  if (!model.showLegend || entries.length === 0) return area;
14648
15175
  const pos = model.legendPosition;
@@ -14651,7 +15178,7 @@ function automaticLegend(model, area, out, options, bounds) {
14651
15178
  const rowH = Math.max(16, size * 1.4);
14652
15179
  if (pos === "t" || pos === "b") {
14653
15180
  const widths = entries.map(
14654
- (e) => Math.min(chartTextWidth(e.label, attrs, options) + 20, area.w / 2)
15181
+ (e) => Math.min(chartTextWidth(e.label, attrs, options2) + 20, area.w / 2)
14655
15182
  );
14656
15183
  const total = widths.reduce((a, b) => a + b, 0);
14657
15184
  let x2 = area.x + Math.max(0, (area.w - total) / 2);
@@ -14668,14 +15195,14 @@ function automaticLegend(model, area, out, options, bounds) {
14668
15195
  entries.forEach((e, i) => {
14669
15196
  const w = widths[i] ?? 0;
14670
15197
  out.push(rect2(x2, y, 8, 8, e.color));
14671
- out.push(text(x2 + 12, y + 8, fitChartText(e.label, w - 16, attrs, options), attrs));
15198
+ out.push(text(x2 + 12, y + 8, fitChartText(e.label, w - 16, attrs, options2), attrs));
14672
15199
  x2 += w;
14673
15200
  });
14674
15201
  return pos === "t" ? { x: area.x, y: area.y + rowH + 4, w: area.w, h: area.h - rowH - 4 } : { x: area.x, y: area.y, w: area.w, h: area.h - rowH - 4 };
14675
15202
  }
14676
15203
  const width = Math.min(
14677
15204
  area.w * 0.35,
14678
- Math.max(...entries.map((e) => chartTextWidth(e.label, attrs, options))) + 22
15205
+ Math.max(...entries.map((e) => chartTextWidth(e.label, attrs, options2))) + 22
14679
15206
  );
14680
15207
  const height = entries.length * rowH;
14681
15208
  const x = pos === "l" ? area.x + 4 : area.x + area.w - width;
@@ -14693,14 +15220,14 @@ function automaticLegend(model, area, out, options, bounds) {
14693
15220
  const y = y0 + i * rowH;
14694
15221
  if (y + rowH > area.y + area.h + 2) return;
14695
15222
  out.push(rect2(x, y + 3, 8, 8, e.color));
14696
- out.push(text(x + 12, y + 11, fitChartText(e.label, width - 16, attrs, options), attrs));
15223
+ out.push(text(x + 12, y + 11, fitChartText(e.label, width - 16, attrs, options2), attrs));
14697
15224
  });
14698
15225
  return pos === "l" ? { x: area.x + width + 8, y: area.y, w: area.w - width - 8, h: area.h } : { x: area.x, y: area.y, w: area.w - width - 8, h: area.h };
14699
15226
  }
14700
15227
 
14701
15228
  // text/wrap-styled-runs.ts
14702
15229
  var graphemes = new Intl.Segmenter(void 0, { granularity: "grapheme" });
14703
- function wrapStyledRuns(runs, maxWidth, measure2, options = {}) {
15230
+ function wrapStyledRuns(runs, maxWidth, measure2, options2 = {}) {
14704
15231
  const groups = [];
14705
15232
  for (const [source, run] of runs.entries()) {
14706
15233
  for (const token of run.text.split(/(\r\n|[\r\n]|[ \t]+)/u).filter(Boolean)) {
@@ -14748,7 +15275,7 @@ function wrapStyledRuns(runs, maxWidth, measure2, options = {}) {
14748
15275
  if (line3.length && width(merged(line3, [...separator, ...group2.pieces])) > maxWidth) flush();
14749
15276
  else line3 = merged(line3, separator);
14750
15277
  spaces = [];
14751
- if (options.breakWords && wordWidth > maxWidth) {
15278
+ if (options2.breakWords && wordWidth > maxWidth) {
14752
15279
  for (const piece of group2.pieces) {
14753
15280
  for (const { segment: segment2 } of graphemes.segment(piece.text)) {
14754
15281
  const next = { ...piece, text: segment2 };
@@ -14766,11 +15293,11 @@ function wrapStyledRuns(runs, maxWidth, measure2, options = {}) {
14766
15293
  function spacing(value, naturalHeight, fallback) {
14767
15294
  return value ? value.unit === "points" ? chartPointsToPixels(value.value) : naturalHeight * value.value : fallback;
14768
15295
  }
14769
- function chartRichTitleSvg(model, width, options = {}, frameHeight = 400) {
15296
+ function chartRichTitleSvg(model, width, options2 = {}, frameHeight = 400) {
14770
15297
  if (!model.title) return void 0;
14771
15298
  const base = chartTextAttributes(model, "title", 14);
14772
15299
  const capacity = Math.max(1, width * 0.8 - 8);
14773
- if (!model.titleText && !hasManualLayoutFields(model.titleLayout) && !model.titleOverlay && !model.title.includes("\n") && chartTextWidth(model.title, base, options) <= capacity)
15300
+ if (!model.titleText && !hasManualLayoutFields(model.titleLayout) && !model.titleOverlay && !model.title.includes("\n") && chartTextWidth(model.title, base, options2) <= capacity)
14774
15301
  return void 0;
14775
15302
  const paragraphs = model.titleText?.paragraphs ?? [
14776
15303
  {
@@ -14806,7 +15333,7 @@ function chartRichTitleSvg(model, width, options = {}, frameHeight = 400) {
14806
15333
  "title",
14807
15334
  base.size
14808
15335
  ),
14809
- options
15336
+ options2
14810
15337
  ),
14811
15338
  { breakWords: true }
14812
15339
  );
@@ -14830,10 +15357,10 @@ function chartRichTitleSvg(model, width, options = {}, frameHeight = 400) {
14830
15357
  return {
14831
15358
  ...line3,
14832
15359
  runs,
14833
- width: runs.reduce((sum, run) => sum + chartTextWidth(run.text, run.attrs, options), 0),
15360
+ width: runs.reduce((sum, run) => sum + chartTextWidth(run.text, run.attrs, options2), 0),
14834
15361
  size: runs.length ? Math.max(...runs.map((run) => run.attrs.size ?? 14)) : base.size ?? 14,
14835
15362
  fontMetrics: (runs.length ? runs.map((run) => run.attrs) : [base]).map(
14836
- (attrs) => chartFontMetrics(attrs, options)
15363
+ (attrs) => chartFontMetrics(attrs, options2)
14837
15364
  )
14838
15365
  };
14839
15366
  });
@@ -14871,7 +15398,7 @@ function chartRichTitleSvg(model, width, options = {}, frameHeight = 400) {
14871
15398
  anchor: "start"
14872
15399
  }).replace("<text ", '<tspan data-chart-title-run="true" ').replace("</text>", "</tspan>")
14873
15400
  );
14874
- x += chartTextWidth(run.text, run.attrs, options);
15401
+ x += chartTextWidth(run.text, run.attrs, options2);
14875
15402
  }
14876
15403
  }
14877
15404
  const parent = text(0, 0, "", { ...base, underline: false }).replace(
@@ -14897,7 +15424,7 @@ function chartRichTitleSvg(model, width, options = {}, frameHeight = 400) {
14897
15424
  }
14898
15425
 
14899
15426
  // chart/render/chart-svg.ts
14900
- function renderChartSvg(model, width, height, options = {}) {
15427
+ function renderChartSvg(model, width, height, options2 = {}) {
14901
15428
  const paint2 = chartGradientPaint(model, Math.max(1, width), Math.max(1, height));
14902
15429
  model = paint2.model;
14903
15430
  const w = Math.max(1, width);
@@ -14911,7 +15438,7 @@ function renderChartSvg(model, width, height, options = {}) {
14911
15438
  if (paint2.defs) out.push(paint2.defs);
14912
15439
  out.push(chartAreaRect(model, "chartArea", { x: 0, y: 0, w, h }));
14913
15440
  let area = { x: 8, y: 8, w: w - 16, h: h - 16 };
14914
- const richTitle = chartRichTitleSvg(model, w, options, h);
15441
+ const richTitle = chartRichTitleSvg(model, w, options2, h);
14915
15442
  if (richTitle) {
14916
15443
  if (model.titleLayout || model.titleOverlay) foregroundTitle = richTitle.markup;
14917
15444
  else out.push(richTitle.markup);
@@ -14920,9 +15447,9 @@ function renderChartSvg(model, width, height, options = {}) {
14920
15447
  } else if (model.title) {
14921
15448
  const attrs = chartTextAttributes(model, "title", 14);
14922
15449
  const size = attrs.size ?? 14;
14923
- const label = fitChartText(model.title, w - 16, attrs, options);
14924
- const titleWidth = Math.min(w - 16, chartTextWidth(label, attrs, options) + 8);
14925
- const font = chartFontMetrics(attrs, options);
15450
+ const label = fitChartText(model.title, w - 16, attrs, options2);
15451
+ const titleWidth = Math.min(w - 16, chartTextWidth(label, attrs, options2) + 8);
15452
+ const font = chartFontMetrics(attrs, options2);
14926
15453
  const titleHeight = Math.max(24, font ? font.ascent + font.descent + 4 : size * 1.4 + 4);
14927
15454
  out.push(
14928
15455
  chartAreaRect(model, "title", {
@@ -14950,7 +15477,7 @@ function renderChartSvg(model, width, height, options = {}) {
14950
15477
  out.push("</svg>");
14951
15478
  return out.join("");
14952
15479
  }
14953
- const legend = chartLegendSvg(model, area, { width: w, height: h }, options);
15480
+ const legend = chartLegendSvg(model, area, { width: w, height: h }, options2);
14954
15481
  area = legend.plot;
14955
15482
  if (!legend.foreground) out.push(legend.markup);
14956
15483
  if (area.w > 4 && area.h > 4) {
@@ -14997,8 +15524,8 @@ function chartSpaceKind(space) {
14997
15524
  const type = chartSummaryFromSpace(space).chartType;
14998
15525
  return { type, drawn: DRAWN_CHART_TYPES.has(type) };
14999
15526
  }
15000
- function renderChartSpaceSvg(space, options) {
15001
- const { width, height, theme, fonts, formatting, colorPalette, styleDefinition, ...svg } = options;
15527
+ function renderChartSpaceSvg(space, options2) {
15528
+ const { width, height, theme, fonts, formatting, colorPalette, styleDefinition, ...svg } = options2;
15002
15529
  const summary = chartSummaryFromSpace(space, {
15003
15530
  ...formatting ? { formatting } : {},
15004
15531
  ...colorPalette !== void 0 ? { colorPalette } : {},
@@ -15007,8 +15534,8 @@ function renderChartSpaceSvg(space, options) {
15007
15534
  const view = chartSummaryView(summary, chartThemePalette(theme, fonts));
15008
15535
  return renderChartSvg(view, width, height, svg);
15009
15536
  }
15010
- function renderChartSummarySvg(summary, options) {
15011
- const { width, height, theme, fonts, ...svg } = options;
15537
+ function renderChartSummarySvg(summary, options2) {
15538
+ const { width, height, theme, fonts, ...svg } = options2;
15012
15539
  const view = chartSummaryView(summary, chartThemePalette(theme, fonts));
15013
15540
  return renderChartSvg(view, width, height, svg);
15014
15541
  }
@@ -15745,7 +16272,7 @@ function datePicture(instr) {
15745
16272
  }
15746
16273
  var TOKENS = /yyyy|yy|MMMM|MMM|MM|M|dddd|ddd|dd|d|HH|H|hh|h|mm|ss|am\/pm|AM\/PM|'[^']*'/g;
15747
16274
  function formatWordDate(date, picture, locale = "en-US") {
15748
- const name = (options) => new Intl.DateTimeFormat(locale, options).format(date);
16275
+ const name = (options2) => new Intl.DateTimeFormat(locale, options2).format(date);
15749
16276
  const pad = (value) => String(value).padStart(2, "0");
15750
16277
  const hours12 = date.getHours() % 12 || 12;
15751
16278
  return picture.replace(TOKENS, (token) => {
@@ -15944,9 +16471,9 @@ function fontMetrics(measurer, font) {
15944
16471
  const ascent = Math.min(height, measurer.ascentOf?.(font) ?? height * 0.8);
15945
16472
  return { ascent, descent: height - ascent };
15946
16473
  }
15947
- function createFakeMeasurer(options = {}) {
15948
- const charWidthFactor = options.charWidthFactor ?? 0.6;
15949
- const lineHeightFactor = options.lineHeightFactor ?? 1.15;
16474
+ function createFakeMeasurer(options2 = {}) {
16475
+ const charWidthFactor = options2.charWidthFactor ?? 0.6;
16476
+ const lineHeightFactor = options2.lineHeightFactor ?? 1.15;
15950
16477
  return {
15951
16478
  widthOf(text2, font) {
15952
16479
  let width = 0;
@@ -20368,8 +20895,8 @@ function sectionBreak(type, note) {
20368
20895
  return type;
20369
20896
  }
20370
20897
  function adaptDocumentModel(model, note = () => {
20371
- }, options = {}) {
20372
- const reviewMode = options.reviewDisplayMode ?? "all";
20898
+ }, options2 = {}) {
20899
+ const reviewMode = options2.reviewDisplayMode ?? "all";
20373
20900
  const visibleModel = visibleReviewModel(model, reviewMode);
20374
20901
  const catalog = model.paragraphStyles;
20375
20902
  const noted = /* @__PURE__ */ new Set();
@@ -20762,13 +21289,13 @@ function layoutDocument(input, measurer) {
20762
21289
  }
20763
21290
  return { ...result, approximations: [.../* @__PURE__ */ new Set([...result.approximations, FLOAT_WRAP_NOTE])] };
20764
21291
  }
20765
- function layoutDocumentModel(model, measurer, options = {}, layout = layoutDocument) {
20766
- const projected = reviewDocumentFormatting(model, options.reviewDisplayMode ?? "all");
21292
+ function layoutDocumentModel(model, measurer, options2 = {}, layout = layoutDocument) {
21293
+ const projected = reviewDocumentFormatting(model, options2.reviewDisplayMode ?? "all");
20767
21294
  const approximations = reviewFormattingWarnings(projected.diagnostics);
20768
21295
  const input = adaptDocumentModel(
20769
21296
  projected.model,
20770
21297
  (message) => approximations.push(message),
20771
- options
21298
+ options2
20772
21299
  );
20773
21300
  const result = layout(input, measurer);
20774
21301
  return {
@@ -20951,7 +21478,7 @@ function layoutDocumentIncremental(input, measurer, memory) {
20951
21478
  }
20952
21479
 
20953
21480
  // docx/layout/layout-session.ts
20954
- function createLayoutSession(measurer, options = {}) {
21481
+ function createLayoutSession(measurer, options2 = {}) {
20955
21482
  const sessionMeasurer = {
20956
21483
  widthOf: (text2, font) => measurer.widthOf(text2, font),
20957
21484
  lineHeightOf: (font) => measurer.lineHeightOf(font),
@@ -20959,7 +21486,7 @@ function createLayoutSession(measurer, options = {}) {
20959
21486
  };
20960
21487
  registerParagraphCache(sessionMeasurer);
20961
21488
  const memory = {};
20962
- const paginate = options.incremental ? (input, sessionMeasure) => layoutDocumentIncremental(input, sessionMeasure, memory) : layoutDocument;
21489
+ const paginate = options2.incremental ? (input, sessionMeasure) => layoutDocumentIncremental(input, sessionMeasure, memory) : layoutDocument;
20963
21490
  return {
20964
21491
  layoutDocument: (input) => paginate(input, sessionMeasurer),
20965
21492
  layoutDocumentModel: (model, review = {}) => layoutDocumentModel(model, sessionMeasurer, review, paginate),