ooxml-core 1.17.0 → 1.18.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.
- package/dist/{PptxHandler-U6EFO73T.cjs → PptxHandler-4AHDZDA5.cjs} +2 -2
- package/dist/{PptxHandler-L3JPWOBN.mjs → PptxHandler-5X4VOWAO.mjs} +1 -1
- package/dist/{PptxHandler-K7GMS2ST.mjs → PptxHandler-X6AO6LKJ.mjs} +2 -2
- package/dist/{PresentationBuilder-OK526SZ4.mjs → PresentationBuilder-LRX55PXA.mjs} +2 -2
- package/dist/{PresentationBuilder-LUR6LGHU.cjs → PresentationBuilder-MJB4LIFS.cjs} +4 -4
- package/dist/{PresentationBuilder-XC3F3OPY.mjs → PresentationBuilder-UY3S4YE2.mjs} +1 -1
- package/dist/automation/index.cjs +4710 -3016
- package/dist/automation/index.mjs +4710 -3016
- package/dist/chart/data-label-text.d.ts +70 -0
- package/dist/chart/data-label-text.d.ts.map +1 -0
- package/dist/chart/formatting-nodes.d.ts +6 -0
- package/dist/chart/formatting-nodes.d.ts.map +1 -1
- package/dist/chart/index.cjs +690 -375
- package/dist/chart/index.d.ts +1 -0
- package/dist/chart/index.d.ts.map +1 -1
- package/dist/chart/index.mjs +687 -376
- package/dist/chart/read-formatting.d.ts.map +1 -1
- package/dist/chart/render/chart-svg-bars.d.ts.map +1 -1
- package/dist/chart/render/chart-svg-cartesian.d.ts.map +1 -1
- package/dist/chart/render/chart-svg-labels.d.ts +42 -0
- package/dist/chart/render/chart-svg-labels.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-radial.d.ts.map +1 -1
- package/dist/chart/render/chart-svg-xy.d.ts.map +1 -1
- package/dist/chart/render/chart-view-labels.d.ts +16 -0
- package/dist/chart/render/chart-view-labels.d.ts.map +1 -0
- package/dist/chart/render/chart-view.d.ts +3 -0
- package/dist/chart/render/chart-view.d.ts.map +1 -1
- package/dist/chart/render/summary-from-space.d.ts +2 -2
- package/dist/chart/render/summary-from-space.d.ts.map +1 -1
- package/dist/chart/render/summary-labels.d.ts +9 -0
- package/dist/chart/render/summary-labels.d.ts.map +1 -0
- package/dist/chart/render/summary.d.ts +23 -0
- package/dist/chart/render/summary.d.ts.map +1 -1
- package/dist/{chunk-IM5LFEA2.mjs → chunk-7NWQUCGX.mjs} +1 -1
- package/dist/{chunk-UFGJNXRG.mjs → chunk-I5ZE3VLI.mjs} +1 -1
- package/dist/{chunk-A7S2NYAU.mjs → chunk-LT7RCEHY.mjs} +1 -1
- package/dist/{chunk-HLZIALC5.mjs → chunk-U7IDT6VT.mjs} +1 -1
- package/dist/{chunk-YS43OMM3.mjs → chunk-Z5Y53IZD.mjs} +4 -4
- package/dist/docx/embedded.cjs +15 -0
- package/dist/docx/embedded.mjs +15 -0
- package/dist/docx/index.cjs +1261 -656
- package/dist/docx/index.mjs +1261 -656
- package/dist/docx/layout/index.cjs +1129 -539
- package/dist/docx/layout/index.mjs +1129 -539
- package/dist/docx/load/index.cjs +15 -0
- package/dist/docx/load/index.mjs +15 -0
- package/dist/docx/ui/index.cjs +1119 -529
- package/dist/docx/ui/index.mjs +1119 -529
- package/dist/index.cjs +757 -442
- package/dist/index.mjs +757 -442
- package/dist/pptx/automation/index.cjs +7 -0
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/cli/index.cjs +7 -0
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/slide-operations.cjs +1 -1
- package/dist/pptx/editor/render/slide-operations.mjs +1 -1
- package/dist/pptx/index.cjs +7 -0
- package/dist/pptx/index.mjs +5 -5
- package/dist/teams/index.cjs +145 -49
- package/dist/teams/index.mjs +145 -49
- package/dist/visio/edit-chart-object-commands.d.ts +36 -0
- package/dist/visio/edit-chart-object-commands.d.ts.map +1 -0
- package/dist/visio/edit-chart-object.d.ts +7 -0
- package/dist/visio/edit-chart-object.d.ts.map +1 -0
- package/dist/visio/edit-commands.d.ts +2 -1
- package/dist/visio/edit-commands.d.ts.map +1 -1
- package/dist/visio/edit-foreign-frame.d.ts +8 -0
- package/dist/visio/edit-foreign-frame.d.ts.map +1 -0
- package/dist/visio/edit-metadata-commands.d.ts +7 -0
- package/dist/visio/edit-metadata-commands.d.ts.map +1 -1
- package/dist/visio/edit-picture.d.ts +8 -0
- package/dist/visio/edit-picture.d.ts.map +1 -1
- package/dist/visio/edit.d.ts.map +1 -1
- package/dist/visio/emf-bitmap.d.ts +8 -0
- package/dist/visio/emf-bitmap.d.ts.map +1 -0
- package/dist/visio/index.cjs +17093 -6136
- package/dist/visio/index.d.ts +2 -0
- package/dist/visio/index.d.ts.map +1 -1
- package/dist/visio/index.mjs +17091 -6137
- package/dist/visio/model.d.ts +18 -0
- package/dist/visio/model.d.ts.map +1 -1
- package/dist/visio/prepare-embedded.d.ts +10 -0
- package/dist/visio/prepare-embedded.d.ts.map +1 -0
- package/dist/visio/prepare-images.d.ts.map +1 -1
- package/dist/visio/shapes.d.ts.map +1 -1
- package/dist/visio/sheet.d.ts +2 -1
- package/dist/visio/sheet.d.ts.map +1 -1
- package/dist/visio/ui/edit-commands.d.ts.map +1 -1
- package/dist/visio/ui/index.cjs +33320 -22884
- package/dist/visio/ui/index.mjs +33318 -22884
- package/dist/visio/ui/insert.d.ts +11 -0
- package/dist/visio/ui/insert.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +1175 -564
- package/dist/xlsx/index.mjs +1175 -564
- package/dist/xlsx/load/index.cjs +136 -50
- package/dist/xlsx/load/index.mjs +136 -50
- package/dist/xlsx/model.d.ts +5 -0
- package/dist/xlsx/model.d.ts.map +1 -1
- package/dist/xlsx/read/load.d.ts.map +1 -1
- package/dist/xlsx/read/workbook-part.d.ts +2 -0
- package/dist/xlsx/read/workbook-part.d.ts.map +1 -1
- package/dist/xlsx/ui/dialogs/grid-chart.d.ts +22 -1
- package/dist/xlsx/ui/dialogs/grid-chart.d.ts.map +1 -1
- package/dist/xlsx/ui/index.cjs +16820 -4239
- package/dist/xlsx/ui/index.mjs +16810 -4237
- package/dist/xlsx/write/workbook-part.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/visio/edit-foreign-bitmap.d.ts +0 -7
- package/dist/visio/edit-foreign-bitmap.d.ts.map +0 -1
- /package/dist/{chunk-KU3SMBFU.mjs → chunk-C363NN2C.mjs} +0 -0
- /package/dist/{chunk-UWWS6VVJ.cjs → chunk-R4BCOQHB.cjs} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -630,6 +630,8 @@ __export(chart_exports, {
|
|
|
630
630
|
CHART_ERROR_VALUE_TYPES: () => CHART_ERROR_VALUE_TYPES,
|
|
631
631
|
CHART_GROUP_ELEMENTS: () => CHART_GROUP_ELEMENTS,
|
|
632
632
|
CHART_STYLE_PARTS: () => CHART_STYLE_PARTS,
|
|
633
|
+
DATA_LABEL_CATEGORY_PERCENT_SEPARATOR: () => DATA_LABEL_CATEGORY_PERCENT_SEPARATOR,
|
|
634
|
+
DATA_LABEL_SEPARATOR: () => DATA_LABEL_SEPARATOR,
|
|
633
635
|
DEFAULT_BAR_GAP_WIDTH: () => DEFAULT_BAR_GAP_WIDTH,
|
|
634
636
|
DEFAULT_CHART_PALETTE: () => DEFAULT_CHART_PALETTE,
|
|
635
637
|
DEFAULT_THEME_COLORS: () => DEFAULT_THEME_COLORS,
|
|
@@ -671,6 +673,7 @@ __export(chart_exports, {
|
|
|
671
673
|
chartTrendlineKind: () => chartTrendlineKind,
|
|
672
674
|
chartTrendlineType: () => chartTrendlineType,
|
|
673
675
|
clusteredBarGeometry: () => clusteredBarGeometry,
|
|
676
|
+
composeDataLabelText: () => composeDataLabelText,
|
|
674
677
|
computeBoxStats: () => computeBoxStats,
|
|
675
678
|
computeBubbleRadius: () => computeBubbleRadius,
|
|
676
679
|
computeHierarchicalSunburstArcs: () => computeHierarchicalSunburstArcs,
|
|
@@ -725,6 +728,7 @@ __export(chart_exports, {
|
|
|
725
728
|
resolveBlankDisplay: () => resolveBlankDisplay,
|
|
726
729
|
resolveChartGradient: () => resolveChartGradient,
|
|
727
730
|
resolveChartStyleDefinition: () => resolveChartStyleDefinition,
|
|
731
|
+
resolveDataLabelFlags: () => resolveDataLabelFlags,
|
|
728
732
|
resolveManualLayoutRect: () => resolveManualLayoutRect,
|
|
729
733
|
scottBinCount: () => scottBinCount,
|
|
730
734
|
shade: () => shade,
|
|
@@ -1271,6 +1275,52 @@ function formatChartNumber(value, formatCode) {
|
|
|
1271
1275
|
return formatChartNumberWithColor(value, formatCode)?.text;
|
|
1272
1276
|
}
|
|
1273
1277
|
|
|
1278
|
+
// chart/data-label-text.ts
|
|
1279
|
+
var DATA_LABEL_SEPARATOR = ", ";
|
|
1280
|
+
var DATA_LABEL_CATEGORY_PERCENT_SEPARATOR = "\n";
|
|
1281
|
+
var FLAG_KEYS = [
|
|
1282
|
+
"showValue",
|
|
1283
|
+
"showCategory",
|
|
1284
|
+
"showSeriesName",
|
|
1285
|
+
"showPercent",
|
|
1286
|
+
"showBubbleSize"
|
|
1287
|
+
];
|
|
1288
|
+
function resolveDataLabelFlags(levels) {
|
|
1289
|
+
const { point, series, chart } = levels;
|
|
1290
|
+
const picked = {};
|
|
1291
|
+
for (const key of FLAG_KEYS) picked[key] = point?.[key] ?? series?.[key] ?? chart?.[key];
|
|
1292
|
+
const anyDeclared = FLAG_KEYS.some((key) => picked[key] !== void 0);
|
|
1293
|
+
return {
|
|
1294
|
+
showValue: anyDeclared ? picked.showValue === true : levels.siblingOwnsLabels !== true,
|
|
1295
|
+
showCategory: picked.showCategory === true,
|
|
1296
|
+
showSeriesName: picked.showSeriesName === true,
|
|
1297
|
+
showPercent: picked.showPercent === true,
|
|
1298
|
+
showBubbleSize: picked.showBubbleSize === true,
|
|
1299
|
+
separator: point?.separator ?? series?.separator ?? chart?.separator ?? (picked.showCategory === true && picked.showPercent === true ? DATA_LABEL_CATEGORY_PERCENT_SEPARATOR : DATA_LABEL_SEPARATOR)
|
|
1300
|
+
};
|
|
1301
|
+
}
|
|
1302
|
+
function composeDataLabelText(input) {
|
|
1303
|
+
const { flags, value, numberFormat: numberFormat2 } = input;
|
|
1304
|
+
const parts = [];
|
|
1305
|
+
let valueColor;
|
|
1306
|
+
if (flags.showSeriesName && input.seriesName) parts.push(input.seriesName);
|
|
1307
|
+
if (flags.showCategory && input.category) parts.push(input.category);
|
|
1308
|
+
if (flags.showValue) {
|
|
1309
|
+
const formatted = formatChartNumberWithColor(value, numberFormat2);
|
|
1310
|
+
parts.push(formatted?.text ?? (input.formatValue ?? String)(value, numberFormat2));
|
|
1311
|
+
valueColor = formatted?.color;
|
|
1312
|
+
}
|
|
1313
|
+
if (flags.showPercent) {
|
|
1314
|
+
const base = input.percentBase;
|
|
1315
|
+
parts.push(base > 0 ? `${Math.round(Math.abs(value) / base * 100)}%` : "0%");
|
|
1316
|
+
}
|
|
1317
|
+
if (flags.showBubbleSize && input.bubbleSize !== void 0)
|
|
1318
|
+
parts.push((input.formatBubbleSize ?? String)(input.bubbleSize));
|
|
1319
|
+
const text4 = parts.join(flags.separator);
|
|
1320
|
+
if (text4.length === 0) return void 0;
|
|
1321
|
+
return { text: text4, color: parts.length === 1 && flags.showValue ? valueColor : void 0 };
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1274
1324
|
// chart/auto-title.ts
|
|
1275
1325
|
var CHART_AUTO_TITLE = "Chart Title";
|
|
1276
1326
|
var CHARTEX_ONLY_TYPES = /* @__PURE__ */ new Set([
|
|
@@ -1418,10 +1468,10 @@ function squarify(nodes, box) {
|
|
|
1418
1468
|
|
|
1419
1469
|
// chart/hierarchy.ts
|
|
1420
1470
|
function normalizeLevels(levels, pointCount) {
|
|
1421
|
-
return levels.map((
|
|
1471
|
+
return levels.map((level3) => {
|
|
1422
1472
|
let previous = "";
|
|
1423
1473
|
return Array.from({ length: pointCount }, (_, index) => {
|
|
1424
|
-
const label =
|
|
1474
|
+
const label = level3[index]?.trim() ?? "";
|
|
1425
1475
|
if (label) previous = label;
|
|
1426
1476
|
return label || previous;
|
|
1427
1477
|
});
|
|
@@ -1579,12 +1629,12 @@ function computeSunburstArcs(series, cx2, cy, maxR) {
|
|
|
1579
1629
|
});
|
|
1580
1630
|
return out;
|
|
1581
1631
|
}
|
|
1582
|
-
function hierarchyKey(levels,
|
|
1583
|
-
return levels.slice(
|
|
1632
|
+
function hierarchyKey(levels, level3, index) {
|
|
1633
|
+
return levels.slice(level3).map((labels) => labels[index] ?? "").join("\0");
|
|
1584
1634
|
}
|
|
1585
1635
|
function computeHierarchicalSunburstArcs(categoryLevels2, values, cx2, cy, maxR) {
|
|
1586
|
-
const levels = categoryLevels2.filter((
|
|
1587
|
-
const leafCount = Math.max(values.length, ...levels.map((
|
|
1636
|
+
const levels = categoryLevels2.filter((level3) => level3.length > 0);
|
|
1637
|
+
const leafCount = Math.max(values.length, ...levels.map((level3) => level3.length), 0);
|
|
1588
1638
|
if (levels.length === 0 || leafCount === 0) return [];
|
|
1589
1639
|
const rawWeights = Array.from({ length: leafCount }, (_, index) => Math.abs(values[index] ?? 0));
|
|
1590
1640
|
const weights = rawWeights.some((value) => value !== 0) ? rawWeights : rawWeights.map(() => 1);
|
|
@@ -1595,15 +1645,15 @@ function computeHierarchicalSunburstArcs(categoryLevels2, values, cx2, cy, maxR)
|
|
|
1595
1645
|
const rootLabels = levels[levels.length - 1] ?? [];
|
|
1596
1646
|
const rootColors = /* @__PURE__ */ new Map();
|
|
1597
1647
|
const out = [];
|
|
1598
|
-
for (let
|
|
1599
|
-
const ringIndex = levels.length - 1 -
|
|
1648
|
+
for (let level3 = levels.length - 1; level3 >= 0; level3--) {
|
|
1649
|
+
const ringIndex = levels.length - 1 - level3;
|
|
1600
1650
|
const innerRadius = ringWidth * (ringIndex + 0.5);
|
|
1601
1651
|
const outerRadius = ringWidth * (ringIndex + 1.5);
|
|
1602
1652
|
let start = 0;
|
|
1603
1653
|
while (start < leafCount) {
|
|
1604
|
-
const key = hierarchyKey(levels,
|
|
1654
|
+
const key = hierarchyKey(levels, level3, start);
|
|
1605
1655
|
let end = start + 1;
|
|
1606
|
-
while (end < leafCount && hierarchyKey(levels,
|
|
1656
|
+
while (end < leafCount && hierarchyKey(levels, level3, end) === key) end++;
|
|
1607
1657
|
const startAngle = -Math.PI / 2 + (prefix[start] ?? 0) / total * Math.PI * 2;
|
|
1608
1658
|
const endAngle = -Math.PI / 2 + (prefix[end] ?? 0) / total * Math.PI * 2;
|
|
1609
1659
|
const rootLabel = rootLabels[start] ?? "";
|
|
@@ -1613,8 +1663,8 @@ function computeHierarchicalSunburstArcs(categoryLevels2, values, cx2, cy, maxR)
|
|
|
1613
1663
|
colorIndex: rootColors.get(rootLabel) ?? start,
|
|
1614
1664
|
opacity: Math.max(0.1, 0.9 - ringIndex * 0.1),
|
|
1615
1665
|
level: ringIndex,
|
|
1616
|
-
label: levels[
|
|
1617
|
-
...
|
|
1666
|
+
label: levels[level3]?.[start] ?? "",
|
|
1667
|
+
...level3 === 0 && end === start + 1 ? { pointIndex: start } : {},
|
|
1618
1668
|
...arcLabelPlacement(cx2, cy, (innerRadius + outerRadius) / 2, startAngle, endAngle)
|
|
1619
1669
|
});
|
|
1620
1670
|
start = end;
|
|
@@ -2267,8 +2317,8 @@ function parseXml(xml, options = {}) {
|
|
|
2267
2317
|
let parsed;
|
|
2268
2318
|
try {
|
|
2269
2319
|
parsed = new DOMParser({
|
|
2270
|
-
onError: (
|
|
2271
|
-
if (
|
|
2320
|
+
onError: (level3, message) => {
|
|
2321
|
+
if (level3 !== "warning") parseError = message;
|
|
2272
2322
|
}
|
|
2273
2323
|
}).parseFromString(xml, "application/xml");
|
|
2274
2324
|
} catch (error) {
|
|
@@ -3093,6 +3143,19 @@ function readChartStyle(xml) {
|
|
|
3093
3143
|
}
|
|
3094
3144
|
|
|
3095
3145
|
// chart/formatting-nodes.ts
|
|
3146
|
+
function chartDataLabelNode(root) {
|
|
3147
|
+
const plot = first(first(root, "chart", NS.c), "plotArea", NS.c);
|
|
3148
|
+
const groups = plot ? elements(plot).filter((node) => node.localName.endsWith("Chart")) : [];
|
|
3149
|
+
const candidates = groups.flatMap((group2) => [
|
|
3150
|
+
...children(group2, "ser", NS.c).map((ser) => first(ser, "dLbls", NS.c)),
|
|
3151
|
+
first(group2, "dLbls", NS.c)
|
|
3152
|
+
]);
|
|
3153
|
+
return candidates.find(
|
|
3154
|
+
(node) => node !== void 0 && (first(node, "txPr", NS.c) !== void 0 || elements(node).some(
|
|
3155
|
+
(child3) => child3.localName.startsWith("show") && child3.getAttribute("val") === "1"
|
|
3156
|
+
))
|
|
3157
|
+
);
|
|
3158
|
+
}
|
|
3096
3159
|
function chartFormattingNodes(root) {
|
|
3097
3160
|
const chart = first(root, "chart", NS.c);
|
|
3098
3161
|
const plot = first(chart, "plotArea", NS.c);
|
|
@@ -3267,6 +3330,8 @@ function readChartFormatting(root) {
|
|
|
3267
3330
|
const entries = Object.fromEntries(
|
|
3268
3331
|
Object.entries(nodes).flatMap(([name, node]) => node ? [[name, entry2(node)]] : [])
|
|
3269
3332
|
);
|
|
3333
|
+
const labels = chartDataLabelNode(root);
|
|
3334
|
+
if (labels) entries["dataLabel"] = entry2(labels);
|
|
3270
3335
|
const builtInStyle = readBuiltInChartStyle(root);
|
|
3271
3336
|
const textBody = c(root, "txPr");
|
|
3272
3337
|
const textDefaults = textBody ? {
|
|
@@ -5135,7 +5200,7 @@ function dataSourceInner(source) {
|
|
|
5135
5200
|
case "multiLvlStrRef": {
|
|
5136
5201
|
const levels = source.levels ? elementXml(
|
|
5137
5202
|
"multiLvlStrCache",
|
|
5138
|
-
valXml("ptCount", source.levelPointCount) + source.levels.map((
|
|
5203
|
+
valXml("ptCount", source.levelPointCount) + source.levels.map((level3) => elementXml("lvl", cachePoints(level3))).join("")
|
|
5139
5204
|
) : "";
|
|
5140
5205
|
return `<c:multiLvlStrRef>${formula}${levels}</c:multiLvlStrRef>`;
|
|
5141
5206
|
}
|
|
@@ -5398,6 +5463,41 @@ function summaryAnalysis(series) {
|
|
|
5398
5463
|
};
|
|
5399
5464
|
}
|
|
5400
5465
|
|
|
5466
|
+
// chart/render/summary-labels.ts
|
|
5467
|
+
function level(options, custom) {
|
|
5468
|
+
const out = {};
|
|
5469
|
+
if (options.deleted !== void 0) out.deleted = options.deleted;
|
|
5470
|
+
if (options.showValue !== void 0) out.showValue = options.showValue;
|
|
5471
|
+
if (options.showCategoryName !== void 0) out.showCategory = options.showCategoryName;
|
|
5472
|
+
if (options.showSeriesName !== void 0) out.showSeriesName = options.showSeriesName;
|
|
5473
|
+
if (options.showPercent !== void 0) out.showPercent = options.showPercent;
|
|
5474
|
+
if (options.showBubbleSize !== void 0) out.showBubbleSize = options.showBubbleSize;
|
|
5475
|
+
if (options.separator !== void 0) out.separator = options.separator;
|
|
5476
|
+
if (options.position) out.position = options.position;
|
|
5477
|
+
if (options.numberFormat?.formatCode) out.numberFormat = options.numberFormat.formatCode;
|
|
5478
|
+
if (custom?.text !== void 0) out.text = custom.text;
|
|
5479
|
+
return out;
|
|
5480
|
+
}
|
|
5481
|
+
function shows(levels, point) {
|
|
5482
|
+
const flags = resolveDataLabelFlags({ ...levels, ...point ? { point } : {} });
|
|
5483
|
+
return point?.text !== void 0 || Object.values(flags).some((value) => value === true);
|
|
5484
|
+
}
|
|
5485
|
+
function summaryDataLabels(series, group2) {
|
|
5486
|
+
const own = series.dataLabels;
|
|
5487
|
+
if (!own && !group2) return void 0;
|
|
5488
|
+
const out = {};
|
|
5489
|
+
if (group2) out.chart = level(group2);
|
|
5490
|
+
if (own) out.series = level(own);
|
|
5491
|
+
const points = {};
|
|
5492
|
+
for (const labels of [group2, own])
|
|
5493
|
+
for (const label of labels?.labels ?? [])
|
|
5494
|
+
if (label.index !== void 0)
|
|
5495
|
+
points[label.index] = { ...points[label.index], ...level(label, label.tx) };
|
|
5496
|
+
if (Object.keys(points).length) out.points = points;
|
|
5497
|
+
if (!shows(out) && !Object.values(points).some((point) => shows(out, point))) return void 0;
|
|
5498
|
+
return out;
|
|
5499
|
+
}
|
|
5500
|
+
|
|
5401
5501
|
// chart/render/summary-from-space.ts
|
|
5402
5502
|
var solidColor = (fill) => fill?.kind === "solid" ? fill.color : void 0;
|
|
5403
5503
|
var isSolidFill = (fill) => fill?.kind === "solid" || fill?.kind === "unsupported" && fill.element === "solidFill";
|
|
@@ -5415,7 +5515,7 @@ var GROUP_TYPES = {
|
|
|
5415
5515
|
surface: "surface"
|
|
5416
5516
|
};
|
|
5417
5517
|
var GROUPINGS = /* @__PURE__ */ new Set(["clustered", "stacked", "percentStacked", "standard"]);
|
|
5418
|
-
function chartSummarySeries(source, chartType) {
|
|
5518
|
+
function chartSummarySeries(source, chartType, groupLabels) {
|
|
5419
5519
|
const categories = source.categories ?? source.xValues;
|
|
5420
5520
|
const values = source.values ?? source.yValues;
|
|
5421
5521
|
const numeric = (v) => typeof v === "number" ? v : v === "" ? null : Number.isFinite(Number(v)) ? Number(v) : null;
|
|
@@ -5423,6 +5523,7 @@ function chartSummarySeries(source, chartType) {
|
|
|
5423
5523
|
categories: chartSourceValues(categories),
|
|
5424
5524
|
values: chartSourceValues(values).map(numeric)
|
|
5425
5525
|
};
|
|
5526
|
+
if (values?.cache?.formatCode !== void 0) out.numberFormat = values.cache.formatCode;
|
|
5426
5527
|
if (source.bubbleSizes) {
|
|
5427
5528
|
out.bubbleSizes = chartSourceValues(source.bubbleSizes).map(numeric);
|
|
5428
5529
|
if (source.bubbleSizes.formula) out.bubbleSizesRef = source.bubbleSizes.formula;
|
|
@@ -5451,6 +5552,8 @@ function chartSummarySeries(source, chartType) {
|
|
|
5451
5552
|
}
|
|
5452
5553
|
if (Object.keys(points).length) out.pointColors = points;
|
|
5453
5554
|
if (Object.keys(pointFills).length) out.pointFills = pointFills;
|
|
5555
|
+
const dataLabels = summaryDataLabels(source, groupLabels);
|
|
5556
|
+
if (dataLabels) out.dataLabels = dataLabels;
|
|
5454
5557
|
Object.assign(out, summaryAnalysis(source));
|
|
5455
5558
|
return out;
|
|
5456
5559
|
}
|
|
@@ -5478,7 +5581,7 @@ function extraGroups(chartSpace, firstType) {
|
|
|
5478
5581
|
const type = group2.kind === "bar" ? "column" : group2.kind;
|
|
5479
5582
|
const entry3 = {
|
|
5480
5583
|
chartType: type,
|
|
5481
|
-
series: group2.series.map((source) => chartSummarySeries(source, type)),
|
|
5584
|
+
series: group2.series.map((source) => chartSummarySeries(source, type, group2.dataLabels)),
|
|
5482
5585
|
secondary: valueAxisId(chartSpace, group2.axisIds) !== primary
|
|
5483
5586
|
};
|
|
5484
5587
|
if (group2.grouping && GROUPINGS.has(group2.grouping))
|
|
@@ -5496,7 +5599,9 @@ function chartSummaryFromSpace(chartSpace, extras = {}) {
|
|
|
5496
5599
|
const group2 = chartSpace.plotArea.groups[0];
|
|
5497
5600
|
let chartType = group2 ? GROUP_TYPES[group2.kind] : "column";
|
|
5498
5601
|
if (chartType === "bar" && group2?.barDirection !== "bar") chartType = "column";
|
|
5499
|
-
const series = (group2?.series ?? []).map(
|
|
5602
|
+
const series = (group2?.series ?? []).map(
|
|
5603
|
+
(source) => chartSummarySeries(source, chartType, group2?.dataLabels)
|
|
5604
|
+
);
|
|
5500
5605
|
const summary = {
|
|
5501
5606
|
chartType,
|
|
5502
5607
|
series,
|
|
@@ -5562,9 +5667,9 @@ function dimension(data, kind, type) {
|
|
|
5562
5667
|
const out = { points: [] };
|
|
5563
5668
|
const formula = text(cx(element2, "f"));
|
|
5564
5669
|
if (formula) out.formula = formula;
|
|
5565
|
-
const
|
|
5566
|
-
const count = Number(
|
|
5567
|
-
for (const point of
|
|
5670
|
+
const level3 = cx(element2, "lvl");
|
|
5671
|
+
const count = Number(level3?.getAttribute("ptCount") ?? 0);
|
|
5672
|
+
for (const point of level3 ? children(level3, "pt", NS.cx) : []) {
|
|
5568
5673
|
const index = Number(point.getAttribute("idx") ?? out.points.length);
|
|
5569
5674
|
if (Number.isInteger(index) && index >= 0) out.points[index] = text(point);
|
|
5570
5675
|
}
|
|
@@ -5573,10 +5678,10 @@ function dimension(data, kind, type) {
|
|
|
5573
5678
|
}
|
|
5574
5679
|
function categoryLevels(data) {
|
|
5575
5680
|
const element2 = data ? children(data, "strDim", NS.cx).find((d) => (d.getAttribute("type") ?? "") === "cat") : void 0;
|
|
5576
|
-
return (element2 ? children(element2, "lvl", NS.cx) : []).map((
|
|
5681
|
+
return (element2 ? children(element2, "lvl", NS.cx) : []).map((level3) => {
|
|
5577
5682
|
const points = [];
|
|
5578
|
-
const count = Number(
|
|
5579
|
-
for (const point of children(
|
|
5683
|
+
const count = Number(level3.getAttribute("ptCount") ?? 0);
|
|
5684
|
+
for (const point of children(level3, "pt", NS.cx)) {
|
|
5580
5685
|
const index = Number(point.getAttribute("idx") ?? points.length);
|
|
5581
5686
|
if (Number.isInteger(index) && index >= 0) points[index] = text(point);
|
|
5582
5687
|
}
|
|
@@ -5877,218 +5982,6 @@ function chartBarSpacing(chart) {
|
|
|
5877
5982
|
};
|
|
5878
5983
|
}
|
|
5879
5984
|
|
|
5880
|
-
// chart/render/chart-svg-bars.ts
|
|
5881
|
-
function barLayout(model, frame2) {
|
|
5882
|
-
const count = Math.max(1, model.series.length);
|
|
5883
|
-
const geometry = clusteredBarGeometry(frame2.bandSize, count, chartBarSpacing(model));
|
|
5884
|
-
const barSize = geometry.singleBarWidth;
|
|
5885
|
-
const offset = (si) => model.horizontal ? geometry.clusterWidth / 2 - barSize - si * geometry.step : -geometry.clusterWidth / 2 + si * geometry.step;
|
|
5886
|
-
return { barSize, offset };
|
|
5887
|
-
}
|
|
5888
|
-
function bars(model, frame2, out, values) {
|
|
5889
|
-
const stacked = model.grouping === "stacked" || model.grouping === "percentStacked";
|
|
5890
|
-
const { barSize, offset: barOffset } = barLayout(model, frame2);
|
|
5891
|
-
const base = frame2.value(0);
|
|
5892
|
-
const pos = new Array(model.categories.length).fill(0);
|
|
5893
|
-
const neg = new Array(model.categories.length).fill(0);
|
|
5894
|
-
model.series.forEach((s2, si) => {
|
|
5895
|
-
values[si]?.forEach((v, i2) => {
|
|
5896
|
-
if (v === null || i2 >= model.categories.length) return;
|
|
5897
|
-
let from = 0;
|
|
5898
|
-
let to = v;
|
|
5899
|
-
if (stacked) {
|
|
5900
|
-
const acc = v >= 0 ? pos : neg;
|
|
5901
|
-
from = acc[i2] ?? 0;
|
|
5902
|
-
to = from + v;
|
|
5903
|
-
acc[i2] = to;
|
|
5904
|
-
}
|
|
5905
|
-
const a2 = stacked ? frame2.value(from) : base;
|
|
5906
|
-
const b = frame2.value(to);
|
|
5907
|
-
const offset = barOffset(si);
|
|
5908
|
-
const center = frame2.band(i2);
|
|
5909
|
-
const width = model.horizontal ? Math.abs(b - a2) : barSize;
|
|
5910
|
-
const height = model.horizontal ? barSize : Math.abs(b - a2);
|
|
5911
|
-
let color = s2.pointColors?.[i2] ?? s2.color;
|
|
5912
|
-
const gradient = s2.pointGradients?.[i2] ?? (s2.pointColors?.[i2] === void 0 ? s2.gradient : void 0);
|
|
5913
|
-
if (gradient && (gradient.path === "circle" || gradient.path === "shape")) {
|
|
5914
|
-
const baseId = color.match(/^url\(#(.+)\)$/)?.[1];
|
|
5915
|
-
if (baseId) {
|
|
5916
|
-
const id = baseId.replace(/(-s\d+(?:-p\d+)?)$/, `-mark${i2}$1`);
|
|
5917
|
-
const def = buildChartGradientDef(id, gradient, {
|
|
5918
|
-
width: Number(n(width)),
|
|
5919
|
-
height: Number(n(height)),
|
|
5920
|
-
shape: "rect"
|
|
5921
|
-
});
|
|
5922
|
-
out.push(`<defs>${chartGradientMarkup(def)}</defs>`);
|
|
5923
|
-
color = `url(#${id})`;
|
|
5924
|
-
}
|
|
5925
|
-
}
|
|
5926
|
-
out.push(`<g data-chart-series="${si}" data-chart-point="${i2}">`);
|
|
5927
|
-
if (model.horizontal)
|
|
5928
|
-
out.push(
|
|
5929
|
-
rect(Math.min(a2, b), center + offset, Math.abs(b - a2), barSize, color, s2.shadowFilter)
|
|
5930
|
-
);
|
|
5931
|
-
else
|
|
5932
|
-
out.push(
|
|
5933
|
-
rect(center + offset, Math.min(a2, b), barSize, Math.abs(b - a2), color, s2.shadowFilter)
|
|
5934
|
-
);
|
|
5935
|
-
out.push("</g>");
|
|
5936
|
-
});
|
|
5937
|
-
});
|
|
5938
|
-
}
|
|
5939
|
-
|
|
5940
|
-
// chart/render/chart-svg-analysis.ts
|
|
5941
|
-
var DASHES = {
|
|
5942
|
-
dot: [1, 3],
|
|
5943
|
-
dash: [4, 3],
|
|
5944
|
-
lgDash: [8, 3],
|
|
5945
|
-
dashDot: [4, 3, 1, 3],
|
|
5946
|
-
lgDashDot: [8, 3, 1, 3],
|
|
5947
|
-
lgDashDotDot: [8, 3, 1, 3, 1, 3],
|
|
5948
|
-
sysDash: [3, 1],
|
|
5949
|
-
sysDot: [1, 1],
|
|
5950
|
-
sysDashDot: [3, 1, 1, 1],
|
|
5951
|
-
sysDashDotDot: [3, 1, 1, 1, 1, 1]
|
|
5952
|
-
};
|
|
5953
|
-
var CAP = 4;
|
|
5954
|
-
function strokeAttributes(stroke) {
|
|
5955
|
-
const pattern = stroke.dash ? DASHES[stroke.dash] : void 0;
|
|
5956
|
-
const dash = pattern ? ` stroke-dasharray="${pattern.map((step) => n(step * stroke.width)).join(" ")}"` : "";
|
|
5957
|
-
return `stroke="${esc(stroke.color)}" stroke-width="${n(stroke.width)}"${dash}`;
|
|
5958
|
-
}
|
|
5959
|
-
var segment = (x1, y1, x2, y2, stroke) => `<line x1="${n(x1)}" y1="${n(y1)}" x2="${n(x2)}" y2="${n(y2)}" ${stroke}/>`;
|
|
5960
|
-
function trendlines(series, si, xs, ys, plane, out) {
|
|
5961
|
-
for (const trendline of series.trendlines ?? []) {
|
|
5962
|
-
const fit2 = fitChartTrendline(trendline.fit, xs, ys);
|
|
5963
|
-
if (fit2.points.length < 2) continue;
|
|
5964
|
-
const points = fit2.points.map(({ x, y }) => plane(x, y).map(n).join(",")).join(" ");
|
|
5965
|
-
out.push(
|
|
5966
|
-
`<polyline points="${points}" fill="none" ${strokeAttributes(trendline.stroke)} data-chart-part="trendline" data-chart-series="${si}"/>`
|
|
5967
|
-
);
|
|
5968
|
-
}
|
|
5969
|
-
}
|
|
5970
|
-
function errorBar(bars2, at2, values, plane, out) {
|
|
5971
|
-
const stroke = strokeAttributes(bars2.stroke);
|
|
5972
|
-
for (const side of ["plus", "minus"]) {
|
|
5973
|
-
if (bars2.barType !== side && bars2.barType !== "both") continue;
|
|
5974
|
-
const amount = chartErrorBarAmount(bars2.amount, values, at2.displayIndex, at2.sourceIndex, side);
|
|
5975
|
-
const sign = side === "plus" ? 1 : -1;
|
|
5976
|
-
const [x1, y1] = plane(at2.x, at2.y);
|
|
5977
|
-
const [x2, y2] = bars2.direction === "x" ? plane(at2.x + sign * amount, at2.y) : plane(at2.x, at2.y + sign * amount);
|
|
5978
|
-
out.push(segment(x1, y1, x2, y2, stroke));
|
|
5979
|
-
if (!bars2.endCap) continue;
|
|
5980
|
-
if (x1 === x2) out.push(segment(x2 - CAP, y2, x2 + CAP, y2, stroke));
|
|
5981
|
-
else out.push(segment(x2, y2 - CAP, x2, y2 + CAP, stroke));
|
|
5982
|
-
}
|
|
5983
|
-
}
|
|
5984
|
-
function plottedPoints(series, xOf) {
|
|
5985
|
-
return series.values.flatMap((y, index) => {
|
|
5986
|
-
const x = xOf(index);
|
|
5987
|
-
return y === null || x === null ? [] : [{ x, y, index }];
|
|
5988
|
-
});
|
|
5989
|
-
}
|
|
5990
|
-
function seriesAnalysis(series, si, xOf, plane, barPlane, categoryAxis, out) {
|
|
5991
|
-
const points = plottedPoints(series, xOf);
|
|
5992
|
-
const xs = points.map((p) => p.x);
|
|
5993
|
-
const ys = points.map((p) => p.y);
|
|
5994
|
-
trendlines(series, si, xs, ys, plane, out);
|
|
5995
|
-
for (const bars2 of series.errorBars ?? []) {
|
|
5996
|
-
if (categoryAxis && bars2.direction === "x") continue;
|
|
5997
|
-
const values = bars2.direction === "x" ? xs : ys;
|
|
5998
|
-
points.forEach(
|
|
5999
|
-
(p, displayIndex) => errorBar(bars2, { x: p.x, y: p.y, displayIndex, sourceIndex: p.index }, values, barPlane, out)
|
|
6000
|
-
);
|
|
6001
|
-
}
|
|
6002
|
-
}
|
|
6003
|
-
function categoryAnalysis(model, frame2, out) {
|
|
6004
|
-
if (model.grouping === "stacked" || model.grouping === "percentStacked") return;
|
|
6005
|
-
const plane = (x, y) => model.horizontal ? [frame2.value(y), frame2.band(x - 1)] : [frame2.band(x - 1), frame2.value(y)];
|
|
6006
|
-
const barred = model.type === "bar" || model.type === "column";
|
|
6007
|
-
const layout = barred ? barLayout(model, frame2) : void 0;
|
|
6008
|
-
model.series.forEach((series, si) => {
|
|
6009
|
-
if (!series.trendlines && !series.errorBars) return;
|
|
6010
|
-
const shift = layout ? layout.offset(si) + layout.barSize / 2 : 0;
|
|
6011
|
-
const barPlane = (x, y) => {
|
|
6012
|
-
const [px3, py] = plane(x, y);
|
|
6013
|
-
return model.horizontal ? [px3, py + shift] : [px3 + shift, py];
|
|
6014
|
-
};
|
|
6015
|
-
seriesAnalysis(series, si, (i2) => i2 + 1, plane, barPlane, true, out);
|
|
6016
|
-
});
|
|
6017
|
-
}
|
|
6018
|
-
function scatterAnalysis(model, px3, py, out) {
|
|
6019
|
-
const plane = (x, y) => [px3(x), py(y)];
|
|
6020
|
-
model.series.forEach((series, si) => {
|
|
6021
|
-
if (!series.trendlines && !series.errorBars) return;
|
|
6022
|
-
seriesAnalysis(series, si, (i2) => series.xValues?.[i2] ?? null, plane, plane, false, out);
|
|
6023
|
-
});
|
|
6024
|
-
}
|
|
6025
|
-
|
|
6026
|
-
// chart/render/chart-scale.ts
|
|
6027
|
-
var clean = (n2) => Number(n2.toPrecision(12));
|
|
6028
|
-
function* units(raw2) {
|
|
6029
|
-
let exp = Math.floor(Math.log10(raw2)) - 1;
|
|
6030
|
-
for (; ; ) {
|
|
6031
|
-
const base = 10 ** exp;
|
|
6032
|
-
for (const m of [1, 2, 5]) yield clean(m * base);
|
|
6033
|
-
exp++;
|
|
6034
|
-
}
|
|
6035
|
-
}
|
|
6036
|
-
function niceScale(dataMin, dataMax, options = {}) {
|
|
6037
|
-
const maxIntervals = Math.max(1, options.maxIntervals ?? 10);
|
|
6038
|
-
let lo = Number.isFinite(dataMin) ? dataMin : 0;
|
|
6039
|
-
let hi = Number.isFinite(dataMax) ? dataMax : 0;
|
|
6040
|
-
if (lo > hi) [lo, hi] = [hi, lo];
|
|
6041
|
-
if (lo === hi) {
|
|
6042
|
-
if (lo === 0) hi = 1;
|
|
6043
|
-
else if (options.noZero) {
|
|
6044
|
-
const pad2 = Math.abs(lo) * 0.1 || 1;
|
|
6045
|
-
lo -= pad2;
|
|
6046
|
-
hi += pad2;
|
|
6047
|
-
} else if (lo > 0) lo = 0;
|
|
6048
|
-
else hi = 0;
|
|
6049
|
-
}
|
|
6050
|
-
let fixedLo = false;
|
|
6051
|
-
let fixedHi = false;
|
|
6052
|
-
if (!options.noZero) {
|
|
6053
|
-
if (lo >= 0 && hi - lo >= hi / 6) {
|
|
6054
|
-
lo = 0;
|
|
6055
|
-
fixedLo = true;
|
|
6056
|
-
} else if (hi <= 0 && hi - lo >= -lo / 6) {
|
|
6057
|
-
hi = 0;
|
|
6058
|
-
fixedHi = true;
|
|
6059
|
-
}
|
|
6060
|
-
}
|
|
6061
|
-
const range = hi - lo;
|
|
6062
|
-
const top = fixedHi ? hi : hi + range * 0.05;
|
|
6063
|
-
const bottom = fixedLo ? lo : lo - range * 0.05;
|
|
6064
|
-
for (const unit of units(range / maxIntervals)) {
|
|
6065
|
-
const min = fixedLo ? lo : Math.floor(clean(bottom / unit)) * unit;
|
|
6066
|
-
const max = fixedHi ? hi : Math.ceil(clean(top / unit)) * unit;
|
|
6067
|
-
const intervals = Math.round((max - min) / unit);
|
|
6068
|
-
if (intervals <= maxIntervals && intervals > 0) {
|
|
6069
|
-
const ticks = [];
|
|
6070
|
-
for (let i2 = 0; i2 <= intervals; i2++) ticks.push(clean(min + i2 * unit));
|
|
6071
|
-
return { min: clean(min), max: clean(max), majorUnit: unit, ticks };
|
|
6072
|
-
}
|
|
6073
|
-
}
|
|
6074
|
-
return { min: lo, max: hi, majorUnit: range, ticks: [lo, hi] };
|
|
6075
|
-
}
|
|
6076
|
-
var PERCENT_SCALE = {
|
|
6077
|
-
min: 0,
|
|
6078
|
-
max: 1,
|
|
6079
|
-
majorUnit: 0.1,
|
|
6080
|
-
ticks: [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]
|
|
6081
|
-
};
|
|
6082
|
-
function formatAxisValue(value, percent = false) {
|
|
6083
|
-
if (percent) return `${clean(value * 100)}%`;
|
|
6084
|
-
const v = clean(value);
|
|
6085
|
-
if (Math.abs(v) >= 1e15 || v !== 0 && Math.abs(v) < 1e-6)
|
|
6086
|
-
return v.toExponential(2).replace("e+", "E+").replace("e-", "E-");
|
|
6087
|
-
const [int2 = "0", frac] = String(Math.abs(v)).split(".");
|
|
6088
|
-
const grouped2 = int2.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
6089
|
-
return `${v < 0 ? "-" : ""}${grouped2}${frac ? `.${frac}` : ""}`;
|
|
6090
|
-
}
|
|
6091
|
-
|
|
6092
5985
|
// drawingml/drawing-color-css.ts
|
|
6093
5986
|
function drawingColorCss(value) {
|
|
6094
5987
|
if (!value || value.alpha === 1) return value?.hex;
|
|
@@ -6106,36 +5999,6 @@ var TWIPS_PER_POINT = 20;
|
|
|
6106
5999
|
var TWIPS_PER_INCH = 1440;
|
|
6107
6000
|
var PIXELS_PER_INCH = 96;
|
|
6108
6001
|
|
|
6109
|
-
// drawingml/drawing-shadow.ts
|
|
6110
|
-
function resolveDrawingShadow(effects, theme) {
|
|
6111
|
-
const node = first(effects, "outerShdw", NS.a);
|
|
6112
|
-
if (!node) return void 0;
|
|
6113
|
-
const value = (key, fallback) => Number(node.getAttribute(key) ?? fallback);
|
|
6114
|
-
if (value("sx", 1e5) !== 1e5 || value("sy", 1e5) !== 1e5 || value("kx", 0) !== 0 || value("ky", 0) !== 0)
|
|
6115
|
-
return void 0;
|
|
6116
|
-
const color = parseDrawingColorIn(node);
|
|
6117
|
-
const resolved = color && resolveDrawingColor(color, theme, { transformOrder: "document" });
|
|
6118
|
-
const blur = value("blurRad", 0) / EMU_PER_PIXEL;
|
|
6119
|
-
const distance = value("dist", 0) / EMU_PER_PIXEL;
|
|
6120
|
-
const angle = value("dir", 0) / 6e4 * Math.PI / 180;
|
|
6121
|
-
if (!resolved || ![blur, distance, angle].every(Number.isFinite) || blur < 0 || distance < 0)
|
|
6122
|
-
return void 0;
|
|
6123
|
-
return {
|
|
6124
|
-
color: resolved.hex,
|
|
6125
|
-
opacity: resolved.alpha,
|
|
6126
|
-
blur,
|
|
6127
|
-
dx: Math.cos(angle) * distance,
|
|
6128
|
-
dy: Math.sin(angle) * distance
|
|
6129
|
-
};
|
|
6130
|
-
}
|
|
6131
|
-
function resolveDrawingShadowXml(xml, theme) {
|
|
6132
|
-
return xml ? resolveDrawingShadow(parseXml(xml).documentElement, theme) : void 0;
|
|
6133
|
-
}
|
|
6134
|
-
function svgDropShadowElement(s2, format) {
|
|
6135
|
-
const num2 = format.number;
|
|
6136
|
-
return `<feDropShadow dx="${num2(s2.dx)}" dy="${num2(s2.dy)}" stdDeviation="${num2(s2.blur / 2)}" flood-color="${format.color(s2.color, "#000000")}" flood-opacity="${num2(s2.opacity)}" result="shadow"/>`;
|
|
6137
|
-
}
|
|
6138
|
-
|
|
6139
6002
|
// chart/render/theme-palette.ts
|
|
6140
6003
|
var THEME_SLOTS = [
|
|
6141
6004
|
"lt1",
|
|
@@ -6197,6 +6060,36 @@ function autoSeriesColor(theme, index) {
|
|
|
6197
6060
|
return chartPaletteSeriesColor(findChartColorPalette(10), i2, i2 + 1, chartColorScheme(theme));
|
|
6198
6061
|
}
|
|
6199
6062
|
|
|
6063
|
+
// drawingml/drawing-shadow.ts
|
|
6064
|
+
function resolveDrawingShadow(effects, theme) {
|
|
6065
|
+
const node = first(effects, "outerShdw", NS.a);
|
|
6066
|
+
if (!node) return void 0;
|
|
6067
|
+
const value = (key, fallback) => Number(node.getAttribute(key) ?? fallback);
|
|
6068
|
+
if (value("sx", 1e5) !== 1e5 || value("sy", 1e5) !== 1e5 || value("kx", 0) !== 0 || value("ky", 0) !== 0)
|
|
6069
|
+
return void 0;
|
|
6070
|
+
const color = parseDrawingColorIn(node);
|
|
6071
|
+
const resolved = color && resolveDrawingColor(color, theme, { transformOrder: "document" });
|
|
6072
|
+
const blur = value("blurRad", 0) / EMU_PER_PIXEL;
|
|
6073
|
+
const distance = value("dist", 0) / EMU_PER_PIXEL;
|
|
6074
|
+
const angle = value("dir", 0) / 6e4 * Math.PI / 180;
|
|
6075
|
+
if (!resolved || ![blur, distance, angle].every(Number.isFinite) || blur < 0 || distance < 0)
|
|
6076
|
+
return void 0;
|
|
6077
|
+
return {
|
|
6078
|
+
color: resolved.hex,
|
|
6079
|
+
opacity: resolved.alpha,
|
|
6080
|
+
blur,
|
|
6081
|
+
dx: Math.cos(angle) * distance,
|
|
6082
|
+
dy: Math.sin(angle) * distance
|
|
6083
|
+
};
|
|
6084
|
+
}
|
|
6085
|
+
function resolveDrawingShadowXml(xml, theme) {
|
|
6086
|
+
return xml ? resolveDrawingShadow(parseXml(xml).documentElement, theme) : void 0;
|
|
6087
|
+
}
|
|
6088
|
+
function svgDropShadowElement(s2, format) {
|
|
6089
|
+
const num2 = format.number;
|
|
6090
|
+
return `<feDropShadow dx="${num2(s2.dx)}" dy="${num2(s2.dy)}" stdDeviation="${num2(s2.blur / 2)}" flood-color="${format.color(s2.color, "#000000")}" flood-opacity="${num2(s2.opacity)}" result="shadow"/>`;
|
|
6091
|
+
}
|
|
6092
|
+
|
|
6200
6093
|
// chart/text-inheritance.ts
|
|
6201
6094
|
var TEXT_KEYS = [
|
|
6202
6095
|
"fontSize",
|
|
@@ -6285,6 +6178,444 @@ function chartAppearance(chart, theme) {
|
|
|
6285
6178
|
return out;
|
|
6286
6179
|
}
|
|
6287
6180
|
|
|
6181
|
+
// text/css-font-family.ts
|
|
6182
|
+
var FALLBACKS = {
|
|
6183
|
+
calibri: '"Calibri", "Carlito", "Segoe UI", Arial, sans-serif',
|
|
6184
|
+
"calibri light": '"Calibri Light", "Calibri", "Carlito", "Segoe UI", Arial, sans-serif',
|
|
6185
|
+
cambria: '"Cambria", "Caladea", Georgia, serif',
|
|
6186
|
+
arial: 'Arial, "Liberation Sans", Helvetica, sans-serif',
|
|
6187
|
+
"times new roman": '"Times New Roman", "Liberation Serif", Times, serif',
|
|
6188
|
+
"courier new": '"Courier New", "Liberation Mono", monospace',
|
|
6189
|
+
aptos: '"Aptos", "Calibri", "Carlito", "Segoe UI", sans-serif'
|
|
6190
|
+
};
|
|
6191
|
+
function cssFontFamily(name) {
|
|
6192
|
+
const known = FALLBACKS[name.toLowerCase()];
|
|
6193
|
+
if (known) return known;
|
|
6194
|
+
const quoted = `"${name.replace(/["\\]/g, "")}"`;
|
|
6195
|
+
return `${quoted}, "Calibri", "Carlito", "Segoe UI", sans-serif`;
|
|
6196
|
+
}
|
|
6197
|
+
|
|
6198
|
+
// chart/render/chart-svg-appearance.ts
|
|
6199
|
+
var nextPaintId = 0;
|
|
6200
|
+
function chartGradientPaint(model, width = 1024, height = 768) {
|
|
6201
|
+
const prefix = `xlsx-chart-${++nextPaintId}`;
|
|
6202
|
+
const appearance = { ...model.appearance };
|
|
6203
|
+
const defs = [];
|
|
6204
|
+
const shadowPaint = (shadow, suffix) => {
|
|
6205
|
+
const id = `${prefix}-${suffix}`;
|
|
6206
|
+
const pad2 = Math.max(4, shadow.blur * 3 + Math.abs(shadow.dx) + Math.abs(shadow.dy));
|
|
6207
|
+
defs.push(
|
|
6208
|
+
`<filter id="${id}" filterUnits="userSpaceOnUse" x="${n(-pad2)}" y="${n(-pad2)}" width="${n(width + pad2 * 2)}" height="${n(height + pad2 * 2)}" color-interpolation-filters="sRGB">${svgDropShadowElement(shadow, { number: n, color: (value) => esc(value) })}</filter>`
|
|
6209
|
+
);
|
|
6210
|
+
return `url(#${id})`;
|
|
6211
|
+
};
|
|
6212
|
+
for (const [part, entry3] of Object.entries(appearance)) {
|
|
6213
|
+
if (entry3?.textShadow)
|
|
6214
|
+
appearance[part] = {
|
|
6215
|
+
...entry3,
|
|
6216
|
+
textShadowFilter: shadowPaint(entry3.textShadow, `${part}-text-shadow`)
|
|
6217
|
+
};
|
|
6218
|
+
}
|
|
6219
|
+
const paint2 = (gradient, suffix, bounds2) => {
|
|
6220
|
+
const def = buildChartGradientDef(`${prefix}-${suffix}`, gradient, bounds2);
|
|
6221
|
+
defs.push(chartGradientMarkup(def));
|
|
6222
|
+
return `url(#${def.id})`;
|
|
6223
|
+
};
|
|
6224
|
+
for (const part of ["chartArea", "plotArea"]) {
|
|
6225
|
+
const entry3 = appearance[part];
|
|
6226
|
+
if (!entry3?.gradient) continue;
|
|
6227
|
+
if (part === "plotArea" && ["circle", "shape"].includes(entry3.gradient.path ?? "")) continue;
|
|
6228
|
+
appearance[part] = {
|
|
6229
|
+
...entry3,
|
|
6230
|
+
fillColor: paint2(entry3.gradient, part, { width, height, shape: "rect" })
|
|
6231
|
+
};
|
|
6232
|
+
}
|
|
6233
|
+
const series = model.series.map((source, index) => {
|
|
6234
|
+
const view = { ...source };
|
|
6235
|
+
if (source.shadow) view.shadowFilter = shadowPaint(source.shadow, `s${index}-shadow`);
|
|
6236
|
+
const bounds2 = model.type === "bar" || model.type === "column" ? { width: 1, height: 1, shape: "rect" } : void 0;
|
|
6237
|
+
if (source.gradient) view.color = paint2(source.gradient, `s${index}`, bounds2);
|
|
6238
|
+
if (source.pointGradients) {
|
|
6239
|
+
view.pointColors = [...source.pointColors ?? []];
|
|
6240
|
+
for (const [key, gradient] of Object.entries(source.pointGradients))
|
|
6241
|
+
view.pointColors[Number(key)] = paint2(gradient, `s${index}-p${key}`, bounds2);
|
|
6242
|
+
}
|
|
6243
|
+
return view;
|
|
6244
|
+
});
|
|
6245
|
+
return defs.length ? { model: { ...model, appearance, series }, defs: `<defs>${defs.join("")}</defs>` } : { model, defs: "" };
|
|
6246
|
+
}
|
|
6247
|
+
function chartTextAttributes(model, part, fallbackSize = FONT_SIZE) {
|
|
6248
|
+
const entry3 = model.appearance?.[part];
|
|
6249
|
+
return {
|
|
6250
|
+
size: entry3?.fontSize === void 0 ? fallbackSize : chartPointsToPixels(entry3.fontSize),
|
|
6251
|
+
...entry3?.color === void 0 ? {} : { fill: entry3.color },
|
|
6252
|
+
...entry3?.bold === void 0 ? {} : { weight: entry3.bold ? "bold" : "normal" },
|
|
6253
|
+
...entry3?.italic === void 0 ? {} : { italic: entry3.italic },
|
|
6254
|
+
...entry3?.underline === void 0 ? {} : { underline: entry3.underline },
|
|
6255
|
+
...entry3?.typeface === void 0 ? {} : { family: cssFontFamily(entry3.typeface) },
|
|
6256
|
+
...entry3?.textShadowFilter === void 0 ? {} : { filter: entry3.textShadowFilter }
|
|
6257
|
+
};
|
|
6258
|
+
}
|
|
6259
|
+
function chartStroke(model, part) {
|
|
6260
|
+
const entry3 = model.appearance?.[part];
|
|
6261
|
+
return {
|
|
6262
|
+
color: entry3?.axisVisible === false ? "none" : entry3?.lineColor ?? (part === "gridlineMajor" ? GRID_COLOR : AXIS_COLOR),
|
|
6263
|
+
width: entry3?.lineWidth === void 0 ? 1 : chartPointsToPixels(entry3.lineWidth)
|
|
6264
|
+
};
|
|
6265
|
+
}
|
|
6266
|
+
function chartAreaRect(model, part, area) {
|
|
6267
|
+
if (area.w <= 0 || area.h <= 0) return "";
|
|
6268
|
+
const entry3 = model.appearance?.[part];
|
|
6269
|
+
let fill = entry3?.fillColor ?? (part === "chartArea" ? "#FFFFFF" : "none");
|
|
6270
|
+
let defs = "";
|
|
6271
|
+
if (part !== "chartArea" && entry3?.gradient && (part !== "plotArea" || ["circle", "shape"].includes(entry3.gradient.path ?? ""))) {
|
|
6272
|
+
const def = buildChartGradientDef(`xlsx-chart-${++nextPaintId}-${part}`, entry3.gradient, {
|
|
6273
|
+
width: area.w,
|
|
6274
|
+
height: area.h,
|
|
6275
|
+
shape: "rect"
|
|
6276
|
+
});
|
|
6277
|
+
defs = `<defs>${chartGradientMarkup(def)}</defs>`;
|
|
6278
|
+
fill = `url(#${def.id})`;
|
|
6279
|
+
}
|
|
6280
|
+
const stroke = entry3?.lineColor ?? "none";
|
|
6281
|
+
if (fill === "none" && stroke === "none") return "";
|
|
6282
|
+
const width = entry3?.lineWidth === void 0 ? 1 : chartPointsToPixels(entry3.lineWidth);
|
|
6283
|
+
return `${defs}<rect x="${n(area.x)}" y="${n(area.y)}" width="${n(area.w)}" height="${n(area.h)}" fill="${esc(fill)}" stroke="${esc(stroke)}" stroke-width="${n(width)}" data-chart-part="${part}"/>`;
|
|
6284
|
+
}
|
|
6285
|
+
|
|
6286
|
+
// chart/render/chart-svg-labels.ts
|
|
6287
|
+
var GAP = 3;
|
|
6288
|
+
var LINE = 1.2;
|
|
6289
|
+
var NAMED_COLORS = /^(black|blue|cyan|green|magenta|red|white|yellow)$/iu;
|
|
6290
|
+
function measure(model, label) {
|
|
6291
|
+
const attrs = chartTextAttributes(model, "dataLabel", 10);
|
|
6292
|
+
const size = attrs.size ?? 10;
|
|
6293
|
+
const lines = label.text.split("\n");
|
|
6294
|
+
return {
|
|
6295
|
+
lines,
|
|
6296
|
+
size,
|
|
6297
|
+
w: Math.max(...lines.map((l) => textWidth(l, size))),
|
|
6298
|
+
h: lines.length * size * LINE,
|
|
6299
|
+
attrs
|
|
6300
|
+
};
|
|
6301
|
+
}
|
|
6302
|
+
function draw(m, label, x, y, anchor, out) {
|
|
6303
|
+
const fill = label.color && NAMED_COLORS.test(label.color) ? label.color.toLowerCase() : void 0;
|
|
6304
|
+
m.lines.forEach((line3, k) => {
|
|
6305
|
+
const lineY = y - m.h / 2 + (k + 0.5) * m.size * LINE + m.size * 0.35;
|
|
6306
|
+
out.push(text2(x, lineY, line3, { ...m.attrs, ...fill ? { fill } : {}, anchor }));
|
|
6307
|
+
});
|
|
6308
|
+
}
|
|
6309
|
+
function barLabels(model, marks, out) {
|
|
6310
|
+
const stacked = model.grouping === "stacked" || model.grouping === "percentStacked";
|
|
6311
|
+
for (const mark of marks) {
|
|
6312
|
+
const label = mark.series.labels?.[mark.index];
|
|
6313
|
+
if (!label) continue;
|
|
6314
|
+
const m = measure(model, label);
|
|
6315
|
+
let position = label.position ?? (stacked ? "ctr" : "outEnd");
|
|
6316
|
+
if (stacked && position === "outEnd") position = "ctr";
|
|
6317
|
+
const cx2 = mark.x + mark.w / 2;
|
|
6318
|
+
const cy = mark.y + mark.h / 2;
|
|
6319
|
+
if (model.horizontal) {
|
|
6320
|
+
const end = mark.negative ? mark.x : mark.x + mark.w;
|
|
6321
|
+
const base = mark.negative ? mark.x + mark.w : mark.x;
|
|
6322
|
+
const dir2 = mark.negative ? -1 : 1;
|
|
6323
|
+
const side = (at2, outward) => [
|
|
6324
|
+
at2 + (outward ? dir2 : -dir2) * GAP,
|
|
6325
|
+
(outward ? dir2 : -dir2) > 0 ? "start" : "end"
|
|
6326
|
+
];
|
|
6327
|
+
const [x, anchor] = position === "ctr" ? [cx2, "middle"] : position === "inEnd" ? side(end, false) : position === "inBase" ? side(base, true) : side(end, true);
|
|
6328
|
+
draw(m, label, x, cy, anchor, out);
|
|
6329
|
+
continue;
|
|
6330
|
+
}
|
|
6331
|
+
const top = mark.negative ? mark.y + mark.h : mark.y;
|
|
6332
|
+
const bottom = mark.negative ? mark.y : mark.y + mark.h;
|
|
6333
|
+
const dir = mark.negative ? 1 : -1;
|
|
6334
|
+
const y = position === "ctr" ? cy : position === "inEnd" ? top - dir * (GAP + m.h / 2) : position === "inBase" ? bottom + dir * (GAP + m.h / 2) : top + dir * (GAP + m.h / 2);
|
|
6335
|
+
draw(m, label, cx2, y, "middle", out);
|
|
6336
|
+
}
|
|
6337
|
+
}
|
|
6338
|
+
function pointLabels(model, marks, out) {
|
|
6339
|
+
for (const mark of marks) {
|
|
6340
|
+
const label = mark.series.labels?.[mark.index];
|
|
6341
|
+
if (!label) continue;
|
|
6342
|
+
const m = measure(model, label);
|
|
6343
|
+
const reach = mark.radius + GAP;
|
|
6344
|
+
switch (model.type === "area" ? "ctr" : label.position ?? "r") {
|
|
6345
|
+
case "ctr":
|
|
6346
|
+
draw(m, label, mark.x, mark.y, "middle", out);
|
|
6347
|
+
break;
|
|
6348
|
+
case "t":
|
|
6349
|
+
draw(m, label, mark.x, mark.y - reach - m.h / 2, "middle", out);
|
|
6350
|
+
break;
|
|
6351
|
+
case "b":
|
|
6352
|
+
draw(m, label, mark.x, mark.y + reach + m.h / 2, "middle", out);
|
|
6353
|
+
break;
|
|
6354
|
+
case "l":
|
|
6355
|
+
draw(m, label, mark.x - reach, mark.y, "end", out);
|
|
6356
|
+
break;
|
|
6357
|
+
default:
|
|
6358
|
+
draw(m, label, mark.x + reach, mark.y, "start", out);
|
|
6359
|
+
}
|
|
6360
|
+
}
|
|
6361
|
+
}
|
|
6362
|
+
function sliceLabels(model, marks, out) {
|
|
6363
|
+
for (const mark of marks) {
|
|
6364
|
+
const label = mark.series.labels?.[mark.index];
|
|
6365
|
+
if (!label) continue;
|
|
6366
|
+
const m = measure(model, label);
|
|
6367
|
+
const mid = (mark.start + mark.end) / 2;
|
|
6368
|
+
const ux = Math.sin(mid);
|
|
6369
|
+
const uy = -Math.cos(mid);
|
|
6370
|
+
const place = (radius) => [
|
|
6371
|
+
mark.cx + radius * ux,
|
|
6372
|
+
mark.cy + radius * uy
|
|
6373
|
+
];
|
|
6374
|
+
const position = model.type === "doughnut" ? "ctr" : label.position ?? "bestFit";
|
|
6375
|
+
let x;
|
|
6376
|
+
let y;
|
|
6377
|
+
if (position === "ctr") [x, y] = place(mark.inner + (mark.outer - mark.inner) / 2);
|
|
6378
|
+
else if (position === "inEnd") {
|
|
6379
|
+
const extent = Math.abs(ux) * m.w / 2 + Math.abs(uy) * m.h / 2;
|
|
6380
|
+
[x, y] = place(Math.max(0, mark.outer - GAP - extent));
|
|
6381
|
+
} else if (position === "outEnd") {
|
|
6382
|
+
const extent = Math.abs(ux) * m.w / 2 + Math.abs(uy) * m.h / 2;
|
|
6383
|
+
[x, y] = place(mark.outer + GAP + extent);
|
|
6384
|
+
} else {
|
|
6385
|
+
const placed2 = placeBestFitLabel(
|
|
6386
|
+
{
|
|
6387
|
+
cx: mark.cx,
|
|
6388
|
+
cy: mark.cy,
|
|
6389
|
+
outerR: mark.outer,
|
|
6390
|
+
startAngle: mark.start - Math.PI / 2,
|
|
6391
|
+
endAngle: mark.end - Math.PI / 2
|
|
6392
|
+
},
|
|
6393
|
+
m.w,
|
|
6394
|
+
m.h
|
|
6395
|
+
);
|
|
6396
|
+
x = placed2.x;
|
|
6397
|
+
y = placed2.y;
|
|
6398
|
+
}
|
|
6399
|
+
draw(m, label, x, y, "middle", out);
|
|
6400
|
+
}
|
|
6401
|
+
}
|
|
6402
|
+
function hasOutsideLabels(model) {
|
|
6403
|
+
return model.series.some(
|
|
6404
|
+
(s2) => s2.labels?.some(
|
|
6405
|
+
(l) => l !== void 0 && ["bestFit", "outEnd"].includes(l.position ?? "bestFit")
|
|
6406
|
+
)
|
|
6407
|
+
);
|
|
6408
|
+
}
|
|
6409
|
+
|
|
6410
|
+
// chart/render/chart-svg-bars.ts
|
|
6411
|
+
function barLayout(model, frame2) {
|
|
6412
|
+
const count = Math.max(1, model.series.length);
|
|
6413
|
+
const geometry = clusteredBarGeometry(frame2.bandSize, count, chartBarSpacing(model));
|
|
6414
|
+
const barSize = geometry.singleBarWidth;
|
|
6415
|
+
const offset = (si) => model.horizontal ? geometry.clusterWidth / 2 - barSize - si * geometry.step : -geometry.clusterWidth / 2 + si * geometry.step;
|
|
6416
|
+
return { barSize, offset };
|
|
6417
|
+
}
|
|
6418
|
+
function bars(model, frame2, out, values) {
|
|
6419
|
+
const stacked = model.grouping === "stacked" || model.grouping === "percentStacked";
|
|
6420
|
+
const { barSize, offset: barOffset } = barLayout(model, frame2);
|
|
6421
|
+
const base = frame2.value(0);
|
|
6422
|
+
const pos = new Array(model.categories.length).fill(0);
|
|
6423
|
+
const neg = new Array(model.categories.length).fill(0);
|
|
6424
|
+
const marks = [];
|
|
6425
|
+
model.series.forEach((s2, si) => {
|
|
6426
|
+
values[si]?.forEach((v, i2) => {
|
|
6427
|
+
if (v === null || i2 >= model.categories.length) return;
|
|
6428
|
+
let from = 0;
|
|
6429
|
+
let to = v;
|
|
6430
|
+
if (stacked) {
|
|
6431
|
+
const acc = v >= 0 ? pos : neg;
|
|
6432
|
+
from = acc[i2] ?? 0;
|
|
6433
|
+
to = from + v;
|
|
6434
|
+
acc[i2] = to;
|
|
6435
|
+
}
|
|
6436
|
+
const a2 = stacked ? frame2.value(from) : base;
|
|
6437
|
+
const b = frame2.value(to);
|
|
6438
|
+
const offset = barOffset(si);
|
|
6439
|
+
const center = frame2.band(i2);
|
|
6440
|
+
const width = model.horizontal ? Math.abs(b - a2) : barSize;
|
|
6441
|
+
const height = model.horizontal ? barSize : Math.abs(b - a2);
|
|
6442
|
+
let color = s2.pointColors?.[i2] ?? s2.color;
|
|
6443
|
+
const gradient = s2.pointGradients?.[i2] ?? (s2.pointColors?.[i2] === void 0 ? s2.gradient : void 0);
|
|
6444
|
+
if (gradient && (gradient.path === "circle" || gradient.path === "shape")) {
|
|
6445
|
+
const baseId = color.match(/^url\(#(.+)\)$/)?.[1];
|
|
6446
|
+
if (baseId) {
|
|
6447
|
+
const id = baseId.replace(/(-s\d+(?:-p\d+)?)$/, `-mark${i2}$1`);
|
|
6448
|
+
const def = buildChartGradientDef(id, gradient, {
|
|
6449
|
+
width: Number(n(width)),
|
|
6450
|
+
height: Number(n(height)),
|
|
6451
|
+
shape: "rect"
|
|
6452
|
+
});
|
|
6453
|
+
out.push(`<defs>${chartGradientMarkup(def)}</defs>`);
|
|
6454
|
+
color = `url(#${id})`;
|
|
6455
|
+
}
|
|
6456
|
+
}
|
|
6457
|
+
out.push(`<g data-chart-series="${si}" data-chart-point="${i2}">`);
|
|
6458
|
+
const box = model.horizontal ? { x: Math.min(a2, b), y: center + offset, w: Math.abs(b - a2), h: barSize } : { x: center + offset, y: Math.min(a2, b), w: barSize, h: Math.abs(b - a2) };
|
|
6459
|
+
out.push(rect(box.x, box.y, box.w, box.h, color, s2.shadowFilter));
|
|
6460
|
+
out.push("</g>");
|
|
6461
|
+
marks.push({ series: s2, index: i2, ...box, negative: v < 0 });
|
|
6462
|
+
});
|
|
6463
|
+
});
|
|
6464
|
+
barLabels(model, marks, out);
|
|
6465
|
+
}
|
|
6466
|
+
|
|
6467
|
+
// chart/render/chart-svg-analysis.ts
|
|
6468
|
+
var DASHES = {
|
|
6469
|
+
dot: [1, 3],
|
|
6470
|
+
dash: [4, 3],
|
|
6471
|
+
lgDash: [8, 3],
|
|
6472
|
+
dashDot: [4, 3, 1, 3],
|
|
6473
|
+
lgDashDot: [8, 3, 1, 3],
|
|
6474
|
+
lgDashDotDot: [8, 3, 1, 3, 1, 3],
|
|
6475
|
+
sysDash: [3, 1],
|
|
6476
|
+
sysDot: [1, 1],
|
|
6477
|
+
sysDashDot: [3, 1, 1, 1],
|
|
6478
|
+
sysDashDotDot: [3, 1, 1, 1, 1, 1]
|
|
6479
|
+
};
|
|
6480
|
+
var CAP = 4;
|
|
6481
|
+
function strokeAttributes(stroke) {
|
|
6482
|
+
const pattern = stroke.dash ? DASHES[stroke.dash] : void 0;
|
|
6483
|
+
const dash = pattern ? ` stroke-dasharray="${pattern.map((step) => n(step * stroke.width)).join(" ")}"` : "";
|
|
6484
|
+
return `stroke="${esc(stroke.color)}" stroke-width="${n(stroke.width)}"${dash}`;
|
|
6485
|
+
}
|
|
6486
|
+
var segment = (x1, y1, x2, y2, stroke) => `<line x1="${n(x1)}" y1="${n(y1)}" x2="${n(x2)}" y2="${n(y2)}" ${stroke}/>`;
|
|
6487
|
+
function trendlines(series, si, xs, ys, plane, out) {
|
|
6488
|
+
for (const trendline of series.trendlines ?? []) {
|
|
6489
|
+
const fit2 = fitChartTrendline(trendline.fit, xs, ys);
|
|
6490
|
+
if (fit2.points.length < 2) continue;
|
|
6491
|
+
const points = fit2.points.map(({ x, y }) => plane(x, y).map(n).join(",")).join(" ");
|
|
6492
|
+
out.push(
|
|
6493
|
+
`<polyline points="${points}" fill="none" ${strokeAttributes(trendline.stroke)} data-chart-part="trendline" data-chart-series="${si}"/>`
|
|
6494
|
+
);
|
|
6495
|
+
}
|
|
6496
|
+
}
|
|
6497
|
+
function errorBar(bars2, at2, values, plane, out) {
|
|
6498
|
+
const stroke = strokeAttributes(bars2.stroke);
|
|
6499
|
+
for (const side of ["plus", "minus"]) {
|
|
6500
|
+
if (bars2.barType !== side && bars2.barType !== "both") continue;
|
|
6501
|
+
const amount = chartErrorBarAmount(bars2.amount, values, at2.displayIndex, at2.sourceIndex, side);
|
|
6502
|
+
const sign = side === "plus" ? 1 : -1;
|
|
6503
|
+
const [x1, y1] = plane(at2.x, at2.y);
|
|
6504
|
+
const [x2, y2] = bars2.direction === "x" ? plane(at2.x + sign * amount, at2.y) : plane(at2.x, at2.y + sign * amount);
|
|
6505
|
+
out.push(segment(x1, y1, x2, y2, stroke));
|
|
6506
|
+
if (!bars2.endCap) continue;
|
|
6507
|
+
if (x1 === x2) out.push(segment(x2 - CAP, y2, x2 + CAP, y2, stroke));
|
|
6508
|
+
else out.push(segment(x2, y2 - CAP, x2, y2 + CAP, stroke));
|
|
6509
|
+
}
|
|
6510
|
+
}
|
|
6511
|
+
function plottedPoints(series, xOf) {
|
|
6512
|
+
return series.values.flatMap((y, index) => {
|
|
6513
|
+
const x = xOf(index);
|
|
6514
|
+
return y === null || x === null ? [] : [{ x, y, index }];
|
|
6515
|
+
});
|
|
6516
|
+
}
|
|
6517
|
+
function seriesAnalysis(series, si, xOf, plane, barPlane, categoryAxis, out) {
|
|
6518
|
+
const points = plottedPoints(series, xOf);
|
|
6519
|
+
const xs = points.map((p) => p.x);
|
|
6520
|
+
const ys = points.map((p) => p.y);
|
|
6521
|
+
trendlines(series, si, xs, ys, plane, out);
|
|
6522
|
+
for (const bars2 of series.errorBars ?? []) {
|
|
6523
|
+
if (categoryAxis && bars2.direction === "x") continue;
|
|
6524
|
+
const values = bars2.direction === "x" ? xs : ys;
|
|
6525
|
+
points.forEach(
|
|
6526
|
+
(p, displayIndex) => errorBar(bars2, { x: p.x, y: p.y, displayIndex, sourceIndex: p.index }, values, barPlane, out)
|
|
6527
|
+
);
|
|
6528
|
+
}
|
|
6529
|
+
}
|
|
6530
|
+
function categoryAnalysis(model, frame2, out) {
|
|
6531
|
+
if (model.grouping === "stacked" || model.grouping === "percentStacked") return;
|
|
6532
|
+
const plane = (x, y) => model.horizontal ? [frame2.value(y), frame2.band(x - 1)] : [frame2.band(x - 1), frame2.value(y)];
|
|
6533
|
+
const barred = model.type === "bar" || model.type === "column";
|
|
6534
|
+
const layout = barred ? barLayout(model, frame2) : void 0;
|
|
6535
|
+
model.series.forEach((series, si) => {
|
|
6536
|
+
if (!series.trendlines && !series.errorBars) return;
|
|
6537
|
+
const shift = layout ? layout.offset(si) + layout.barSize / 2 : 0;
|
|
6538
|
+
const barPlane = (x, y) => {
|
|
6539
|
+
const [px3, py] = plane(x, y);
|
|
6540
|
+
return model.horizontal ? [px3, py + shift] : [px3 + shift, py];
|
|
6541
|
+
};
|
|
6542
|
+
seriesAnalysis(series, si, (i2) => i2 + 1, plane, barPlane, true, out);
|
|
6543
|
+
});
|
|
6544
|
+
}
|
|
6545
|
+
function scatterAnalysis(model, px3, py, out) {
|
|
6546
|
+
const plane = (x, y) => [px3(x), py(y)];
|
|
6547
|
+
model.series.forEach((series, si) => {
|
|
6548
|
+
if (!series.trendlines && !series.errorBars) return;
|
|
6549
|
+
seriesAnalysis(series, si, (i2) => series.xValues?.[i2] ?? null, plane, plane, false, out);
|
|
6550
|
+
});
|
|
6551
|
+
}
|
|
6552
|
+
|
|
6553
|
+
// chart/render/chart-scale.ts
|
|
6554
|
+
var clean = (n2) => Number(n2.toPrecision(12));
|
|
6555
|
+
function* units(raw2) {
|
|
6556
|
+
let exp = Math.floor(Math.log10(raw2)) - 1;
|
|
6557
|
+
for (; ; ) {
|
|
6558
|
+
const base = 10 ** exp;
|
|
6559
|
+
for (const m of [1, 2, 5]) yield clean(m * base);
|
|
6560
|
+
exp++;
|
|
6561
|
+
}
|
|
6562
|
+
}
|
|
6563
|
+
function niceScale(dataMin, dataMax, options = {}) {
|
|
6564
|
+
const maxIntervals = Math.max(1, options.maxIntervals ?? 10);
|
|
6565
|
+
let lo = Number.isFinite(dataMin) ? dataMin : 0;
|
|
6566
|
+
let hi = Number.isFinite(dataMax) ? dataMax : 0;
|
|
6567
|
+
if (lo > hi) [lo, hi] = [hi, lo];
|
|
6568
|
+
if (lo === hi) {
|
|
6569
|
+
if (lo === 0) hi = 1;
|
|
6570
|
+
else if (options.noZero) {
|
|
6571
|
+
const pad2 = Math.abs(lo) * 0.1 || 1;
|
|
6572
|
+
lo -= pad2;
|
|
6573
|
+
hi += pad2;
|
|
6574
|
+
} else if (lo > 0) lo = 0;
|
|
6575
|
+
else hi = 0;
|
|
6576
|
+
}
|
|
6577
|
+
let fixedLo = false;
|
|
6578
|
+
let fixedHi = false;
|
|
6579
|
+
if (!options.noZero) {
|
|
6580
|
+
if (lo >= 0 && hi - lo >= hi / 6) {
|
|
6581
|
+
lo = 0;
|
|
6582
|
+
fixedLo = true;
|
|
6583
|
+
} else if (hi <= 0 && hi - lo >= -lo / 6) {
|
|
6584
|
+
hi = 0;
|
|
6585
|
+
fixedHi = true;
|
|
6586
|
+
}
|
|
6587
|
+
}
|
|
6588
|
+
const range = hi - lo;
|
|
6589
|
+
const top = fixedHi ? hi : hi + range * 0.05;
|
|
6590
|
+
const bottom = fixedLo ? lo : lo - range * 0.05;
|
|
6591
|
+
for (const unit of units(range / maxIntervals)) {
|
|
6592
|
+
const min = fixedLo ? lo : Math.floor(clean(bottom / unit)) * unit;
|
|
6593
|
+
const max = fixedHi ? hi : Math.ceil(clean(top / unit)) * unit;
|
|
6594
|
+
const intervals = Math.round((max - min) / unit);
|
|
6595
|
+
if (intervals <= maxIntervals && intervals > 0) {
|
|
6596
|
+
const ticks = [];
|
|
6597
|
+
for (let i2 = 0; i2 <= intervals; i2++) ticks.push(clean(min + i2 * unit));
|
|
6598
|
+
return { min: clean(min), max: clean(max), majorUnit: unit, ticks };
|
|
6599
|
+
}
|
|
6600
|
+
}
|
|
6601
|
+
return { min: lo, max: hi, majorUnit: range, ticks: [lo, hi] };
|
|
6602
|
+
}
|
|
6603
|
+
var PERCENT_SCALE = {
|
|
6604
|
+
min: 0,
|
|
6605
|
+
max: 1,
|
|
6606
|
+
majorUnit: 0.1,
|
|
6607
|
+
ticks: [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]
|
|
6608
|
+
};
|
|
6609
|
+
function formatAxisValue(value, percent = false) {
|
|
6610
|
+
if (percent) return `${clean(value * 100)}%`;
|
|
6611
|
+
const v = clean(value);
|
|
6612
|
+
if (Math.abs(v) >= 1e15 || v !== 0 && Math.abs(v) < 1e-6)
|
|
6613
|
+
return v.toExponential(2).replace("e+", "E+").replace("e-", "E-");
|
|
6614
|
+
const [int2 = "0", frac] = String(Math.abs(v)).split(".");
|
|
6615
|
+
const grouped2 = int2.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
6616
|
+
return `${v < 0 ? "-" : ""}${grouped2}${frac ? `.${frac}` : ""}`;
|
|
6617
|
+
}
|
|
6618
|
+
|
|
6288
6619
|
// chart/render/chart-view-analysis.ts
|
|
6289
6620
|
function strokeOf(line3, fallback, resolve) {
|
|
6290
6621
|
if (line3?.fill?.kind === "none") return void 0;
|
|
@@ -6541,6 +6872,64 @@ function chartTitleText(chart, theme) {
|
|
|
6541
6872
|
};
|
|
6542
6873
|
}
|
|
6543
6874
|
|
|
6875
|
+
// chart/render/chart-view-labels.ts
|
|
6876
|
+
function labelsOf(source, view, categories, numberFormat2) {
|
|
6877
|
+
const { chart, series, points } = source;
|
|
6878
|
+
if ((series?.deleted ?? chart?.deleted) === true) return void 0;
|
|
6879
|
+
const percentBase = view.values.reduce(
|
|
6880
|
+
(sum, v) => sum + (v === null ? 0 : Math.abs(v)),
|
|
6881
|
+
0
|
|
6882
|
+
);
|
|
6883
|
+
const out = [];
|
|
6884
|
+
let any = false;
|
|
6885
|
+
view.values.forEach((value, i2) => {
|
|
6886
|
+
const point = points?.[i2];
|
|
6887
|
+
if (value === null || point?.deleted === true) return;
|
|
6888
|
+
const position = point?.position ?? series?.position ?? chart?.position;
|
|
6889
|
+
const x = view.xValues?.[i2];
|
|
6890
|
+
const category = x === void 0 || x === null ? categories[i2] : formatAxisValue(x);
|
|
6891
|
+
let built;
|
|
6892
|
+
if (point?.text !== void 0) built = { text: point.text };
|
|
6893
|
+
else {
|
|
6894
|
+
const flags = resolveDataLabelFlags({
|
|
6895
|
+
...point ? { point } : {},
|
|
6896
|
+
...series ? { series } : {},
|
|
6897
|
+
...chart ? { chart } : {}
|
|
6898
|
+
});
|
|
6899
|
+
built = composeDataLabelText({
|
|
6900
|
+
flags,
|
|
6901
|
+
seriesName: view.name,
|
|
6902
|
+
category,
|
|
6903
|
+
value,
|
|
6904
|
+
numberFormat: point?.numberFormat ?? series?.numberFormat ?? chart?.numberFormat ?? numberFormat2,
|
|
6905
|
+
percentBase,
|
|
6906
|
+
bubbleSize: view.sizes?.[i2] ?? void 0,
|
|
6907
|
+
formatValue: (v) => formatAxisValue(v),
|
|
6908
|
+
formatBubbleSize: (size) => formatAxisValue(size)
|
|
6909
|
+
});
|
|
6910
|
+
}
|
|
6911
|
+
if (!built) return;
|
|
6912
|
+
any = true;
|
|
6913
|
+
out[i2] = {
|
|
6914
|
+
text: built.text,
|
|
6915
|
+
...position ? { position } : {},
|
|
6916
|
+
...built.color ? { color: built.color } : {}
|
|
6917
|
+
};
|
|
6918
|
+
});
|
|
6919
|
+
return any ? out : void 0;
|
|
6920
|
+
}
|
|
6921
|
+
function applyDataLabels(model, sources, extra) {
|
|
6922
|
+
const apply = (source, view) => {
|
|
6923
|
+
if (!source?.dataLabels) return;
|
|
6924
|
+
const labels = labelsOf(source.dataLabels, view, model.categories, source.numberFormat);
|
|
6925
|
+
if (labels) view.labels = labels;
|
|
6926
|
+
};
|
|
6927
|
+
model.series.forEach((view, i2) => apply(sources[i2], view));
|
|
6928
|
+
model.extraGroups?.forEach(
|
|
6929
|
+
(group2, g2) => group2.series.forEach((view, i2) => apply(extra[g2]?.series[i2], view))
|
|
6930
|
+
);
|
|
6931
|
+
}
|
|
6932
|
+
|
|
6544
6933
|
// chart/render/chart-view-ex.ts
|
|
6545
6934
|
function groupsAxis(groups, categories) {
|
|
6546
6935
|
let min = Infinity;
|
|
@@ -6726,115 +7115,11 @@ function chartSummaryView(chart, theme, options = {}) {
|
|
|
6726
7115
|
chartExtraView(chart, model, ctx, total, collect);
|
|
6727
7116
|
if (type === "waterfall") waterfallView(chart, model, ctx);
|
|
6728
7117
|
else if (!byPoint) model.valueAxis = valueAxis(model);
|
|
7118
|
+
applyDataLabels(model, chart.series, extra);
|
|
6729
7119
|
chartExtraAxes(model);
|
|
6730
7120
|
return model;
|
|
6731
7121
|
}
|
|
6732
7122
|
|
|
6733
|
-
// text/css-font-family.ts
|
|
6734
|
-
var FALLBACKS = {
|
|
6735
|
-
calibri: '"Calibri", "Carlito", "Segoe UI", Arial, sans-serif',
|
|
6736
|
-
"calibri light": '"Calibri Light", "Calibri", "Carlito", "Segoe UI", Arial, sans-serif',
|
|
6737
|
-
cambria: '"Cambria", "Caladea", Georgia, serif',
|
|
6738
|
-
arial: 'Arial, "Liberation Sans", Helvetica, sans-serif',
|
|
6739
|
-
"times new roman": '"Times New Roman", "Liberation Serif", Times, serif',
|
|
6740
|
-
"courier new": '"Courier New", "Liberation Mono", monospace',
|
|
6741
|
-
aptos: '"Aptos", "Calibri", "Carlito", "Segoe UI", sans-serif'
|
|
6742
|
-
};
|
|
6743
|
-
function cssFontFamily(name) {
|
|
6744
|
-
const known = FALLBACKS[name.toLowerCase()];
|
|
6745
|
-
if (known) return known;
|
|
6746
|
-
const quoted = `"${name.replace(/["\\]/g, "")}"`;
|
|
6747
|
-
return `${quoted}, "Calibri", "Carlito", "Segoe UI", sans-serif`;
|
|
6748
|
-
}
|
|
6749
|
-
|
|
6750
|
-
// chart/render/chart-svg-appearance.ts
|
|
6751
|
-
var nextPaintId = 0;
|
|
6752
|
-
function chartGradientPaint(model, width = 1024, height = 768) {
|
|
6753
|
-
const prefix = `xlsx-chart-${++nextPaintId}`;
|
|
6754
|
-
const appearance = { ...model.appearance };
|
|
6755
|
-
const defs = [];
|
|
6756
|
-
const shadowPaint = (shadow, suffix) => {
|
|
6757
|
-
const id = `${prefix}-${suffix}`;
|
|
6758
|
-
const pad2 = Math.max(4, shadow.blur * 3 + Math.abs(shadow.dx) + Math.abs(shadow.dy));
|
|
6759
|
-
defs.push(
|
|
6760
|
-
`<filter id="${id}" filterUnits="userSpaceOnUse" x="${n(-pad2)}" y="${n(-pad2)}" width="${n(width + pad2 * 2)}" height="${n(height + pad2 * 2)}" color-interpolation-filters="sRGB">${svgDropShadowElement(shadow, { number: n, color: (value) => esc(value) })}</filter>`
|
|
6761
|
-
);
|
|
6762
|
-
return `url(#${id})`;
|
|
6763
|
-
};
|
|
6764
|
-
for (const [part, entry3] of Object.entries(appearance)) {
|
|
6765
|
-
if (entry3?.textShadow)
|
|
6766
|
-
appearance[part] = {
|
|
6767
|
-
...entry3,
|
|
6768
|
-
textShadowFilter: shadowPaint(entry3.textShadow, `${part}-text-shadow`)
|
|
6769
|
-
};
|
|
6770
|
-
}
|
|
6771
|
-
const paint2 = (gradient, suffix, bounds2) => {
|
|
6772
|
-
const def = buildChartGradientDef(`${prefix}-${suffix}`, gradient, bounds2);
|
|
6773
|
-
defs.push(chartGradientMarkup(def));
|
|
6774
|
-
return `url(#${def.id})`;
|
|
6775
|
-
};
|
|
6776
|
-
for (const part of ["chartArea", "plotArea"]) {
|
|
6777
|
-
const entry3 = appearance[part];
|
|
6778
|
-
if (!entry3?.gradient) continue;
|
|
6779
|
-
if (part === "plotArea" && ["circle", "shape"].includes(entry3.gradient.path ?? "")) continue;
|
|
6780
|
-
appearance[part] = {
|
|
6781
|
-
...entry3,
|
|
6782
|
-
fillColor: paint2(entry3.gradient, part, { width, height, shape: "rect" })
|
|
6783
|
-
};
|
|
6784
|
-
}
|
|
6785
|
-
const series = model.series.map((source, index) => {
|
|
6786
|
-
const view = { ...source };
|
|
6787
|
-
if (source.shadow) view.shadowFilter = shadowPaint(source.shadow, `s${index}-shadow`);
|
|
6788
|
-
const bounds2 = model.type === "bar" || model.type === "column" ? { width: 1, height: 1, shape: "rect" } : void 0;
|
|
6789
|
-
if (source.gradient) view.color = paint2(source.gradient, `s${index}`, bounds2);
|
|
6790
|
-
if (source.pointGradients) {
|
|
6791
|
-
view.pointColors = [...source.pointColors ?? []];
|
|
6792
|
-
for (const [key, gradient] of Object.entries(source.pointGradients))
|
|
6793
|
-
view.pointColors[Number(key)] = paint2(gradient, `s${index}-p${key}`, bounds2);
|
|
6794
|
-
}
|
|
6795
|
-
return view;
|
|
6796
|
-
});
|
|
6797
|
-
return defs.length ? { model: { ...model, appearance, series }, defs: `<defs>${defs.join("")}</defs>` } : { model, defs: "" };
|
|
6798
|
-
}
|
|
6799
|
-
function chartTextAttributes(model, part, fallbackSize = FONT_SIZE) {
|
|
6800
|
-
const entry3 = model.appearance?.[part];
|
|
6801
|
-
return {
|
|
6802
|
-
size: entry3?.fontSize === void 0 ? fallbackSize : chartPointsToPixels(entry3.fontSize),
|
|
6803
|
-
...entry3?.color === void 0 ? {} : { fill: entry3.color },
|
|
6804
|
-
...entry3?.bold === void 0 ? {} : { weight: entry3.bold ? "bold" : "normal" },
|
|
6805
|
-
...entry3?.italic === void 0 ? {} : { italic: entry3.italic },
|
|
6806
|
-
...entry3?.underline === void 0 ? {} : { underline: entry3.underline },
|
|
6807
|
-
...entry3?.typeface === void 0 ? {} : { family: cssFontFamily(entry3.typeface) },
|
|
6808
|
-
...entry3?.textShadowFilter === void 0 ? {} : { filter: entry3.textShadowFilter }
|
|
6809
|
-
};
|
|
6810
|
-
}
|
|
6811
|
-
function chartStroke(model, part) {
|
|
6812
|
-
const entry3 = model.appearance?.[part];
|
|
6813
|
-
return {
|
|
6814
|
-
color: entry3?.axisVisible === false ? "none" : entry3?.lineColor ?? (part === "gridlineMajor" ? GRID_COLOR : AXIS_COLOR),
|
|
6815
|
-
width: entry3?.lineWidth === void 0 ? 1 : chartPointsToPixels(entry3.lineWidth)
|
|
6816
|
-
};
|
|
6817
|
-
}
|
|
6818
|
-
function chartAreaRect(model, part, area) {
|
|
6819
|
-
if (area.w <= 0 || area.h <= 0) return "";
|
|
6820
|
-
const entry3 = model.appearance?.[part];
|
|
6821
|
-
let fill = entry3?.fillColor ?? (part === "chartArea" ? "#FFFFFF" : "none");
|
|
6822
|
-
let defs = "";
|
|
6823
|
-
if (part !== "chartArea" && entry3?.gradient && (part !== "plotArea" || ["circle", "shape"].includes(entry3.gradient.path ?? ""))) {
|
|
6824
|
-
const def = buildChartGradientDef(`xlsx-chart-${++nextPaintId}-${part}`, entry3.gradient, {
|
|
6825
|
-
width: area.w,
|
|
6826
|
-
height: area.h,
|
|
6827
|
-
shape: "rect"
|
|
6828
|
-
});
|
|
6829
|
-
defs = `<defs>${chartGradientMarkup(def)}</defs>`;
|
|
6830
|
-
fill = `url(#${def.id})`;
|
|
6831
|
-
}
|
|
6832
|
-
const stroke = entry3?.lineColor ?? "none";
|
|
6833
|
-
if (fill === "none" && stroke === "none") return "";
|
|
6834
|
-
const width = entry3?.lineWidth === void 0 ? 1 : chartPointsToPixels(entry3.lineWidth);
|
|
6835
|
-
return `${defs}<rect x="${n(area.x)}" y="${n(area.y)}" width="${n(area.w)}" height="${n(area.h)}" fill="${esc(fill)}" stroke="${esc(stroke)}" stroke-width="${n(width)}" data-chart-part="${part}"/>`;
|
|
6836
|
-
}
|
|
6837
|
-
|
|
6838
7123
|
// chart/render/chart-svg-cartesian.ts
|
|
6839
7124
|
function cartesianAxes(model, area, out) {
|
|
6840
7125
|
const scale = model.valueAxis;
|
|
@@ -6953,6 +7238,7 @@ function linesAndAreas(model, frame2, out) {
|
|
|
6953
7238
|
const stacked = model.grouping === "stacked" || model.grouping === "percentStacked";
|
|
6954
7239
|
const acc = new Array(model.categories.length).fill(0);
|
|
6955
7240
|
const area = model.type === "area";
|
|
7241
|
+
const marks = [];
|
|
6956
7242
|
const layers2 = [];
|
|
6957
7243
|
model.series.forEach((s2, si) => {
|
|
6958
7244
|
const points = [];
|
|
@@ -6967,6 +7253,13 @@ function linesAndAreas(model, frame2, out) {
|
|
|
6967
7253
|
const top = below2 + (v ?? 0);
|
|
6968
7254
|
if (stacked) acc[i2] = top;
|
|
6969
7255
|
points.push([frame2.band(i2), frame2.value(top)]);
|
|
7256
|
+
marks.push({
|
|
7257
|
+
series: s2,
|
|
7258
|
+
index: i2,
|
|
7259
|
+
x: frame2.band(i2),
|
|
7260
|
+
y: frame2.value(top),
|
|
7261
|
+
radius: area ? 0 : 3
|
|
7262
|
+
});
|
|
6970
7263
|
lower.push([frame2.band(i2), frame2.value(below2)]);
|
|
6971
7264
|
});
|
|
6972
7265
|
layers2.push({
|
|
@@ -6999,6 +7292,7 @@ function linesAndAreas(model, frame2, out) {
|
|
|
6999
7292
|
if (!Number.isNaN(x))
|
|
7000
7293
|
out.push(`<circle cx="${n(x)}" cy="${n(y)}" r="2.5" fill="${color}"${filter}/>`);
|
|
7001
7294
|
}
|
|
7295
|
+
pointLabels(model, marks, out);
|
|
7002
7296
|
}
|
|
7003
7297
|
|
|
7004
7298
|
// chart/render/chart-svg-xy.ts
|
|
@@ -7068,6 +7362,7 @@ function scatter(model, area, out) {
|
|
|
7068
7362
|
line(plot.x, plot.y + plot.h, plot.x + plot.w, plot.y + plot.h, xAxis.color, xAxis.width)
|
|
7069
7363
|
);
|
|
7070
7364
|
out.push(line(plot.x, plot.y, plot.x, plot.y + plot.h, yAxis.color, yAxis.width));
|
|
7365
|
+
const marks = [];
|
|
7071
7366
|
for (const [si, s2] of model.series.entries())
|
|
7072
7367
|
s2.values.forEach((v, i2) => {
|
|
7073
7368
|
const x = s2.xValues?.[i2] ?? null;
|
|
@@ -7076,14 +7371,17 @@ function scatter(model, area, out) {
|
|
|
7076
7371
|
const fill = s2.pointColors?.[i2] ?? s2.color;
|
|
7077
7372
|
if (!bubble) {
|
|
7078
7373
|
out.push(`<circle cx="${n(px3(x))}" cy="${n(py(v))}" r="3" fill="${fill}"${filter}/>`);
|
|
7374
|
+
marks.push({ series: s2, index: i2, x: px3(x), y: py(v), radius: 3 });
|
|
7079
7375
|
return;
|
|
7080
7376
|
}
|
|
7081
7377
|
const r = radiusOf(s2.sizes?.[i2] ?? void 0);
|
|
7082
7378
|
if (r === void 0) return;
|
|
7379
|
+
marks.push({ series: s2, index: i2, x: px3(x), y: py(v), radius: r });
|
|
7083
7380
|
out.push(
|
|
7084
7381
|
`<circle cx="${n(px3(x))}" cy="${n(py(v))}" r="${n(r)}" fill="${fill}" fill-opacity="0.6" data-chart-series="${si}" data-chart-point="${i2}"${filter}/>`
|
|
7085
7382
|
);
|
|
7086
7383
|
});
|
|
7384
|
+
pointLabels(model, marks, out);
|
|
7087
7385
|
scatterAnalysis(model, px3, py, out);
|
|
7088
7386
|
}
|
|
7089
7387
|
|
|
@@ -7248,7 +7546,9 @@ function pieSvg(model, area) {
|
|
|
7248
7546
|
const out = [chartAreaRect(model, "plotArea", area)];
|
|
7249
7547
|
const cx2 = area.x + area.w / 2;
|
|
7250
7548
|
const cy = area.y + area.h / 2;
|
|
7251
|
-
const
|
|
7549
|
+
const margin = hasOutsideLabels(model) ? Math.min(area.w, area.h) * 0.12 : 0;
|
|
7550
|
+
const radius = Math.max(1, Math.min(area.w, area.h) / 2 - 4 - margin);
|
|
7551
|
+
const slices = [];
|
|
7252
7552
|
const rings = model.type === "doughnut" ? model.series : model.series.slice(0, 1);
|
|
7253
7553
|
const hole = model.type === "doughnut" ? radius * 0.5 : 0;
|
|
7254
7554
|
const ringSize = (radius - hole) / Math.max(1, rings.length);
|
|
@@ -7265,9 +7565,20 @@ function pieSvg(model, area) {
|
|
|
7265
7565
|
out.push(
|
|
7266
7566
|
`<path d="${slicePath(cx2, cy, outer, inner, angle, angle + sweep)}" fill="${color}" stroke="#FFFFFF" stroke-width="1"${s2.shadowFilter ? ` filter="${s2.shadowFilter}"` : ""}/>`
|
|
7267
7567
|
);
|
|
7568
|
+
slices.push({
|
|
7569
|
+
series: s2,
|
|
7570
|
+
index: i2,
|
|
7571
|
+
cx: cx2,
|
|
7572
|
+
cy,
|
|
7573
|
+
outer,
|
|
7574
|
+
inner,
|
|
7575
|
+
start: angle,
|
|
7576
|
+
end: angle + sweep
|
|
7577
|
+
});
|
|
7268
7578
|
angle += sweep;
|
|
7269
7579
|
});
|
|
7270
7580
|
});
|
|
7581
|
+
sliceLabels(model, slices, out);
|
|
7271
7582
|
return out.join("");
|
|
7272
7583
|
}
|
|
7273
7584
|
function radarSvg(model, area) {
|
|
@@ -7313,12 +7624,16 @@ function radarSvg(model, area) {
|
|
|
7313
7624
|
})
|
|
7314
7625
|
);
|
|
7315
7626
|
});
|
|
7627
|
+
const marks = [];
|
|
7316
7628
|
for (const s2 of model.series) {
|
|
7317
|
-
const
|
|
7629
|
+
const vertices = s2.values.slice(0, count).map((v, i2) => polar(cx2, cy, r(v ?? scale.min), angle(i2)));
|
|
7630
|
+
vertices.forEach(([x, y], i2) => marks.push({ series: s2, index: i2, x, y, radius: 3 }));
|
|
7631
|
+
const points = vertices.map(([x, y]) => `${n(x)},${n(y)}`).join(" ");
|
|
7318
7632
|
out.push(
|
|
7319
7633
|
`<polygon points="${points}" fill="none" stroke="${s2.color}" stroke-width="2"${s2.shadowFilter ? ` filter="${s2.shadowFilter}"` : ""}/>`
|
|
7320
7634
|
);
|
|
7321
7635
|
}
|
|
7636
|
+
pointLabels(model, marks, out);
|
|
7322
7637
|
return out.join("");
|
|
7323
7638
|
}
|
|
7324
7639
|
|
|
@@ -7570,7 +7885,7 @@ function automaticLegend(model, area, out, options, bounds2) {
|
|
|
7570
7885
|
|
|
7571
7886
|
// text/wrap-styled-runs.ts
|
|
7572
7887
|
var graphemes = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
7573
|
-
function wrapStyledRuns(runs, maxWidth,
|
|
7888
|
+
function wrapStyledRuns(runs, maxWidth, measure4, options = {}) {
|
|
7574
7889
|
const groups = [];
|
|
7575
7890
|
for (const [source, run2] of runs.entries()) {
|
|
7576
7891
|
for (const token of run2.text.split(/(\r\n|[\r\n]|[ \t]+)/u).filter(Boolean)) {
|
|
@@ -7593,7 +7908,7 @@ function wrapStyledRuns(runs, maxWidth, measure3, options = {}) {
|
|
|
7593
7908
|
return result2;
|
|
7594
7909
|
};
|
|
7595
7910
|
const width = (pieces) => pieces.reduce((sum, piece) => {
|
|
7596
|
-
const advance =
|
|
7911
|
+
const advance = measure4(piece.text, piece.run);
|
|
7597
7912
|
return sum + (Number.isFinite(advance) && advance >= 0 ? advance : 0);
|
|
7598
7913
|
}, 0);
|
|
7599
7914
|
const result = [];
|
|
@@ -20784,9 +21099,9 @@ function paragraphsAt(text4, sizePt) {
|
|
|
20784
21099
|
const afterParent = (text4.spaceAfterParent ?? DEFAULT_SPACE_AFTER_PARENT) / 100;
|
|
20785
21100
|
const afterChild = (text4.spaceAfterChild ?? DEFAULT_SPACE_AFTER_CHILD) / 100;
|
|
20786
21101
|
const { secondary } = paragraphSizesPt(text4, sizePt);
|
|
20787
|
-
const paragraph2 = (value,
|
|
20788
|
-
const bullet = bulletLevel > 0 &&
|
|
20789
|
-
const size = bullet ||
|
|
21102
|
+
const paragraph2 = (value, level3) => {
|
|
21103
|
+
const bullet = bulletLevel > 0 && level3 >= bulletLevel;
|
|
21104
|
+
const size = bullet || level3 >= 2 ? secondary : sizePt;
|
|
20790
21105
|
return {
|
|
20791
21106
|
text: value,
|
|
20792
21107
|
size,
|
|
@@ -22220,7 +22535,7 @@ function arrangeHierRoot(node) {
|
|
|
22220
22535
|
}
|
|
22221
22536
|
|
|
22222
22537
|
// diagram/engine/alg-linear.ts
|
|
22223
|
-
function
|
|
22538
|
+
function measure2(node, box, horizontal, scale, uniform = false) {
|
|
22224
22539
|
const refW = horizontal || uniform ? box.w * scale : box.w;
|
|
22225
22540
|
const refH = !horizontal || uniform ? box.h * scale : box.h;
|
|
22226
22541
|
evaluateWithReference(node, refW, refH);
|
|
@@ -22287,7 +22602,7 @@ function fitLinear(node, box, horizontal) {
|
|
|
22287
22602
|
const along = horizontal ? box.w : box.h;
|
|
22288
22603
|
const across = horizontal ? box.h : box.w;
|
|
22289
22604
|
let scale = 1;
|
|
22290
|
-
let current =
|
|
22605
|
+
let current = measure2(node, box, horizontal, scale);
|
|
22291
22606
|
const full = current;
|
|
22292
22607
|
let crossLimited = true;
|
|
22293
22608
|
for (let iteration = 0; iteration < 12; iteration++) {
|
|
@@ -22297,10 +22612,10 @@ function fitLinear(node, box, horizontal) {
|
|
|
22297
22612
|
if (factor >= 0.99999) {
|
|
22298
22613
|
break;
|
|
22299
22614
|
}
|
|
22300
|
-
const next =
|
|
22615
|
+
const next = measure2(node, box, horizontal, scale * factor);
|
|
22301
22616
|
if (factor === fitAcross && next.cross >= current.cross - 1e-6) {
|
|
22302
22617
|
crossLimited = false;
|
|
22303
|
-
current =
|
|
22618
|
+
current = measure2(node, box, horizontal, scale);
|
|
22304
22619
|
continue;
|
|
22305
22620
|
}
|
|
22306
22621
|
scale *= factor;
|
|
@@ -22317,9 +22632,9 @@ function fitLinear(node, box, horizontal) {
|
|
|
22317
22632
|
function fitUniform(node, box, horizontal, stuck) {
|
|
22318
22633
|
const along = horizontal ? box.w : box.h;
|
|
22319
22634
|
let scale = 1;
|
|
22320
|
-
let current =
|
|
22635
|
+
let current = measure2(node, box, horizontal, 1, true);
|
|
22321
22636
|
for (let iteration = 0; iteration < 12 && current.total > along + 1e-3; iteration++) {
|
|
22322
|
-
const next =
|
|
22637
|
+
const next = measure2(node, box, horizontal, scale * (along / current.total), true);
|
|
22323
22638
|
if (next.total >= current.total - 1e-6) {
|
|
22324
22639
|
break;
|
|
22325
22640
|
}
|
|
@@ -22341,7 +22656,7 @@ function refineAlong(node, box, horizontal, scale, current, full, crossLimited)
|
|
|
22341
22656
|
let t1 = current.total;
|
|
22342
22657
|
for (let i2 = 0; i2 < 6 && s1 < 1 && Math.abs(t1 - along) > 1e-3 && Math.abs(t0 - t1) > 1e-9; i2++) {
|
|
22343
22658
|
const next = Math.min(1, Math.max(1e-6, s1 + (along - t1) * (s0 - s1) / (t0 - t1)));
|
|
22344
|
-
const measured =
|
|
22659
|
+
const measured = measure2(node, box, horizontal, next);
|
|
22345
22660
|
if (measured.total > along + 1e-3 || crossLimited && measured.cross > across + 1e-6) {
|
|
22346
22661
|
break;
|
|
22347
22662
|
}
|
|
@@ -22354,7 +22669,7 @@ function refineAlong(node, box, horizontal, scale, current, full, crossLimited)
|
|
|
22354
22669
|
if (best !== current) {
|
|
22355
22670
|
return best;
|
|
22356
22671
|
}
|
|
22357
|
-
return
|
|
22672
|
+
return measure2(node, box, horizontal, scale);
|
|
22358
22673
|
}
|
|
22359
22674
|
function alignOffset(free, align, start, end) {
|
|
22360
22675
|
if (align === start) {
|
|
@@ -22539,7 +22854,7 @@ function contentHeight(cell, w, h2) {
|
|
|
22539
22854
|
cell.values = saved;
|
|
22540
22855
|
return bottom;
|
|
22541
22856
|
}
|
|
22542
|
-
function
|
|
22857
|
+
function measure3(node, box, cells, spacer, row2) {
|
|
22543
22858
|
const cellW = Math.max(...cells.map((c2) => c2.values.get("w") ?? box.w));
|
|
22544
22859
|
const assignedH = Math.max(...cells.map((c2) => c2.values.get("h") ?? box.h));
|
|
22545
22860
|
const cellH = Math.max(...cells.map((c2) => contentHeight(c2, cellW, assignedH)));
|
|
@@ -22574,7 +22889,7 @@ function fitSnakeByRule(node, box, cells, spacers, row2) {
|
|
|
22574
22889
|
const floor = rule.val * POINTS_PER_MM2;
|
|
22575
22890
|
const at2 = (value) => {
|
|
22576
22891
|
evaluateAt(node, box, rule, targets, value);
|
|
22577
|
-
return
|
|
22892
|
+
return measure3(node, box, cells, spacers[0], row2);
|
|
22578
22893
|
};
|
|
22579
22894
|
let best = at2(start);
|
|
22580
22895
|
if (fits2(best, cells.length, box, row2) || !(start > floor)) {
|
|
@@ -22879,7 +23194,7 @@ function depthOf(point) {
|
|
|
22879
23194
|
}
|
|
22880
23195
|
return depth;
|
|
22881
23196
|
}
|
|
22882
|
-
function
|
|
23197
|
+
function level2(depth) {
|
|
22883
23198
|
return Math.max(0, Math.min(MAX_LEVEL, depth));
|
|
22884
23199
|
}
|
|
22885
23200
|
function connectorDim(node) {
|
|
@@ -22893,11 +23208,11 @@ function derivedStyleLabel(node) {
|
|
|
22893
23208
|
switch (point.type) {
|
|
22894
23209
|
case "node":
|
|
22895
23210
|
case "asst":
|
|
22896
|
-
return `node${
|
|
23211
|
+
return `node${level2(depthOf(point))}`;
|
|
22897
23212
|
case "sibTrans":
|
|
22898
23213
|
return `sibTrans${connectorDim(node)}1`;
|
|
22899
23214
|
case "parTrans":
|
|
22900
|
-
return `parChTrans${connectorDim(node)}${
|
|
23215
|
+
return `parChTrans${connectorDim(node)}${level2(depthOf(point))}`;
|
|
22901
23216
|
default:
|
|
22902
23217
|
return void 0;
|
|
22903
23218
|
}
|
|
@@ -29651,18 +29966,18 @@ function fanContinues(t, perRow, orgChart, siblingCount, normalCount) {
|
|
|
29651
29966
|
const spanW = effectiveWidth(t, orgChart);
|
|
29652
29967
|
return chPrefFanEligible || isSoloChainLink && normalCount > 1 && spanW === normalCount;
|
|
29653
29968
|
}
|
|
29654
|
-
function walk2(t,
|
|
29969
|
+
function walk2(t, level3, perRow, orgChart, siblingCount) {
|
|
29655
29970
|
const { normal } = partitionChildren(t, orgChart);
|
|
29656
29971
|
if (normal.length === 0) {
|
|
29657
|
-
return { deepestFanLevel:
|
|
29972
|
+
return { deepestFanLevel: level3, maxHangDepth: 0, maxHangRows: 0, hangingColumns: 0 };
|
|
29658
29973
|
}
|
|
29659
|
-
if (
|
|
29660
|
-
let deepestFan =
|
|
29974
|
+
if (level3 === 0) {
|
|
29975
|
+
let deepestFan = level3;
|
|
29661
29976
|
let maxHang = 0;
|
|
29662
29977
|
let maxRows = 0;
|
|
29663
29978
|
let hangingColumns = 0;
|
|
29664
29979
|
for (const child3 of normal) {
|
|
29665
|
-
const r = walk2(child3,
|
|
29980
|
+
const r = walk2(child3, level3 + 1, perRow, orgChart, normal.length);
|
|
29666
29981
|
deepestFan = Math.max(deepestFan, r.deepestFanLevel);
|
|
29667
29982
|
maxHang = Math.max(maxHang, r.maxHangDepth);
|
|
29668
29983
|
maxRows = Math.max(maxRows, r.maxHangRows);
|
|
@@ -29676,12 +29991,12 @@ function walk2(t, level2, perRow, orgChart, siblingCount) {
|
|
|
29676
29991
|
};
|
|
29677
29992
|
}
|
|
29678
29993
|
if (fanContinues(t, perRow, orgChart, siblingCount, normal.length)) {
|
|
29679
|
-
let deepestFan =
|
|
29994
|
+
let deepestFan = level3 + 1;
|
|
29680
29995
|
let maxHang = 0;
|
|
29681
29996
|
let maxRows = 0;
|
|
29682
29997
|
let hangingColumns = 0;
|
|
29683
29998
|
for (const child3 of normal) {
|
|
29684
|
-
const r = walk2(child3,
|
|
29999
|
+
const r = walk2(child3, level3 + 1, perRow, orgChart, void 0);
|
|
29685
30000
|
deepestFan = Math.max(deepestFan, r.deepestFanLevel);
|
|
29686
30001
|
maxHang = Math.max(maxHang, r.maxHangDepth);
|
|
29687
30002
|
maxRows = Math.max(maxRows, r.maxHangRows);
|
|
@@ -29695,7 +30010,7 @@ function walk2(t, level2, perRow, orgChart, siblingCount) {
|
|
|
29695
30010
|
};
|
|
29696
30011
|
}
|
|
29697
30012
|
return {
|
|
29698
|
-
deepestFanLevel:
|
|
30013
|
+
deepestFanLevel: level3,
|
|
29699
30014
|
maxHangDepth: treeDepth(t) - 1,
|
|
29700
30015
|
maxHangRows: countDescendants(t, orgChart),
|
|
29701
30016
|
hangingColumns: 1
|
|
@@ -29734,20 +30049,20 @@ function computeHangShape(roots2, orgChart, perRow) {
|
|
|
29734
30049
|
}
|
|
29735
30050
|
|
|
29736
30051
|
// diagram/hierarchy/smartart-hierarchy-fan-aware-width.ts
|
|
29737
|
-
function widthWalk(t,
|
|
30052
|
+
function widthWalk(t, level3, perRow, orgChart, siblingCount, map) {
|
|
29738
30053
|
const { normal } = partitionChildren(t, orgChart);
|
|
29739
30054
|
let width;
|
|
29740
30055
|
if (normal.length === 0) {
|
|
29741
30056
|
width = 1;
|
|
29742
|
-
} else if (
|
|
30057
|
+
} else if (level3 === 0) {
|
|
29743
30058
|
width = 0;
|
|
29744
30059
|
for (const child3 of normal) {
|
|
29745
|
-
width += widthWalk(child3,
|
|
30060
|
+
width += widthWalk(child3, level3 + 1, perRow, orgChart, normal.length, map);
|
|
29746
30061
|
}
|
|
29747
30062
|
} else if (fanContinues(t, perRow, orgChart, siblingCount, normal.length)) {
|
|
29748
30063
|
width = 0;
|
|
29749
30064
|
for (const child3 of normal) {
|
|
29750
|
-
width += widthWalk(child3,
|
|
30065
|
+
width += widthWalk(child3, level3 + 1, perRow, orgChart, void 0, map);
|
|
29751
30066
|
}
|
|
29752
30067
|
} else {
|
|
29753
30068
|
width = 1;
|
|
@@ -29941,7 +30256,7 @@ function placeAssistants(hc, x, parentBottom, assistants, options, cursor) {
|
|
|
29941
30256
|
stubConnector(hc, assistant.node.id, x + hc.boxH / 2, parentBottom, x + width / 2, y);
|
|
29942
30257
|
}
|
|
29943
30258
|
}
|
|
29944
|
-
function placeHangingTree(hc, t, x, options, cursor, size,
|
|
30259
|
+
function placeHangingTree(hc, t, x, options, cursor, size, level3 = 0) {
|
|
29945
30260
|
const y = cursor.y;
|
|
29946
30261
|
const boxW = size?.w ?? hc.boxW;
|
|
29947
30262
|
const boxH = size?.h ?? hc.boxH;
|
|
@@ -29954,7 +30269,7 @@ function placeHangingTree(hc, t, x, options, cursor, size, level2 = 0) {
|
|
|
29954
30269
|
if (normal.length === 0) {
|
|
29955
30270
|
return;
|
|
29956
30271
|
}
|
|
29957
|
-
if (options.foldDeeperGenerations &&
|
|
30272
|
+
if (options.foldDeeperGenerations && level3 >= 1) {
|
|
29958
30273
|
return;
|
|
29959
30274
|
}
|
|
29960
30275
|
const childX = align ? placeX : options.direction === "left" ? x - options.indent : x + options.indent;
|
|
@@ -29969,7 +30284,7 @@ function placeHangingTree(hc, t, x, options, cursor, size, level2 = 0) {
|
|
|
29969
30284
|
childY,
|
|
29970
30285
|
child3.node.id
|
|
29971
30286
|
);
|
|
29972
|
-
placeHangingTree(hc, child3, childX, options, cursor, void 0,
|
|
30287
|
+
placeHangingTree(hc, child3, childX, options, cursor, void 0, level3 + 1);
|
|
29973
30288
|
}
|
|
29974
30289
|
}
|
|
29975
30290
|
function placeHangingForest(hc, roots2, startX, startY, options, rootSize) {
|
|
@@ -30042,17 +30357,17 @@ function fitHangingBox(view, algorithmNode, index, w, h2, rows, nodeCount, presL
|
|
|
30042
30357
|
}
|
|
30043
30358
|
|
|
30044
30359
|
// diagram/hierarchy/smartart-hierarchy-hanging-fold.ts
|
|
30045
|
-
function countRows(t,
|
|
30360
|
+
function countRows(t, level3, orgChart, fold) {
|
|
30046
30361
|
const { assistants, normal } = partitionChildren(t, orgChart);
|
|
30047
30362
|
let count = 1 + assistants.length;
|
|
30048
30363
|
if (normal.length === 0) {
|
|
30049
30364
|
return count;
|
|
30050
30365
|
}
|
|
30051
|
-
if (fold &&
|
|
30366
|
+
if (fold && level3 >= 1) {
|
|
30052
30367
|
return count;
|
|
30053
30368
|
}
|
|
30054
30369
|
for (const child3 of normal) {
|
|
30055
|
-
count += countRows(child3,
|
|
30370
|
+
count += countRows(child3, level3 + 1, orgChart, fold);
|
|
30056
30371
|
}
|
|
30057
30372
|
return count;
|
|
30058
30373
|
}
|
|
@@ -30609,8 +30924,8 @@ function planFan(childCount, perRow, siblingCxs) {
|
|
|
30609
30924
|
}
|
|
30610
30925
|
return { columns: siblingCxs, overflow: childCount - siblingCxs.length };
|
|
30611
30926
|
}
|
|
30612
|
-
function placeFannedRow(hc, t, normal, plan, cx2, cy,
|
|
30613
|
-
const fanCy = (
|
|
30927
|
+
function placeFannedRow(hc, t, normal, plan, cx2, cy, level3, cellW, cellH, options, placeAtFn) {
|
|
30928
|
+
const fanCy = (level3 + 1) * cellH + cellH / 2;
|
|
30614
30929
|
const fanned = normal.slice(0, plan.columns.length);
|
|
30615
30930
|
for (let i2 = 0; i2 < fanned.length; i2++) {
|
|
30616
30931
|
const child3 = fanned[i2];
|
|
@@ -30624,7 +30939,7 @@ function placeFannedRow(hc, t, normal, plan, cx2, cy, level2, cellW, cellH, opti
|
|
|
30624
30939
|
fanCy - hc.boxH / 2,
|
|
30625
30940
|
child3.node.id
|
|
30626
30941
|
);
|
|
30627
|
-
placeAtFn(hc, child3, childCx, fanCy, 0, 1,
|
|
30942
|
+
placeAtFn(hc, child3, childCx, fanCy, 0, 1, level3 + 1, cellW, cellH, options);
|
|
30628
30943
|
}
|
|
30629
30944
|
if (plan.overflow <= 0 || !options.hangingPlacer) {
|
|
30630
30945
|
return;
|
|
@@ -30632,7 +30947,7 @@ function placeFannedRow(hc, t, normal, plan, cx2, cy, level2, cellW, cellH, opti
|
|
|
30632
30947
|
const remainder = normal.slice(plan.columns.length);
|
|
30633
30948
|
const columnOffset = hc.boxW * HIER_TAIL_OFFSET_RATIO;
|
|
30634
30949
|
const anchorX = plan.columns[0] - hc.boxW / 2 + columnOffset;
|
|
30635
|
-
const anchorY = (
|
|
30950
|
+
const anchorY = (level3 + 2) * cellH;
|
|
30636
30951
|
for (const child3 of remainder) {
|
|
30637
30952
|
elbowConnector(
|
|
30638
30953
|
hc,
|
|
@@ -30669,7 +30984,7 @@ function placeAssistantRow(hc, parentId, cx2, cy, assistants) {
|
|
|
30669
30984
|
x += assistW + ASSISTANT_GAP;
|
|
30670
30985
|
}
|
|
30671
30986
|
}
|
|
30672
|
-
function placeFlatChildren(hc, parentId, normal, cx2, cy, xOffset,
|
|
30987
|
+
function placeFlatChildren(hc, parentId, normal, cx2, cy, xOffset, level3, cellW, cellH, options, placeChild) {
|
|
30673
30988
|
const siblingCxs = [];
|
|
30674
30989
|
{
|
|
30675
30990
|
let offset = xOffset;
|
|
@@ -30679,12 +30994,12 @@ function placeFlatChildren(hc, parentId, normal, cx2, cy, xOffset, level2, cellW
|
|
|
30679
30994
|
offset += childW;
|
|
30680
30995
|
}
|
|
30681
30996
|
}
|
|
30682
|
-
const cascadeShift = options.cascadeOffsetX &&
|
|
30997
|
+
const cascadeShift = options.cascadeOffsetX && level3 + 1 >= options.cascadeOffsetX.fromLevel ? options.cascadeOffsetX.offsetPx : 0;
|
|
30683
30998
|
let childOffset = xOffset;
|
|
30684
30999
|
for (const child3 of normal) {
|
|
30685
31000
|
const childW = spanOf(child3, options);
|
|
30686
31001
|
const childCx = (childOffset + childW / 2) * cellW + cascadeShift;
|
|
30687
|
-
const childCy = (
|
|
31002
|
+
const childCy = (level3 + 1) * cellH + cellH / 2;
|
|
30688
31003
|
elbowConnector(
|
|
30689
31004
|
hc,
|
|
30690
31005
|
parentId,
|
|
@@ -30701,7 +31016,7 @@ function placeFlatChildren(hc, parentId, normal, cx2, cy, xOffset, level2, cellW
|
|
|
30701
31016
|
childCy,
|
|
30702
31017
|
childOffset,
|
|
30703
31018
|
childW,
|
|
30704
|
-
|
|
31019
|
+
level3 + 1,
|
|
30705
31020
|
cellW,
|
|
30706
31021
|
cellH,
|
|
30707
31022
|
options,
|
|
@@ -30727,13 +31042,13 @@ function wrappedGroupSlotCount(group2, orgChart) {
|
|
|
30727
31042
|
}
|
|
30728
31043
|
return group2.members.reduce((sum, m) => sum + effectiveWidth(m, orgChart), 0);
|
|
30729
31044
|
}
|
|
30730
|
-
function placeWrappedChildren(hc, parentId, normal, cx2, cy, xOffset, spanW,
|
|
31045
|
+
function placeWrappedChildren(hc, parentId, normal, cx2, cy, xOffset, spanW, level3, cellW, cellH, options, placeAtFn) {
|
|
30731
31046
|
const groups = planWrappedGroups(normal, options.perRow, options.orgChart);
|
|
30732
31047
|
const totalSlots = groups.reduce((sum, g2) => sum + wrappedGroupSlotCount(g2, options.orgChart), 0);
|
|
30733
31048
|
const totalW = spanW * cellW;
|
|
30734
31049
|
const leftX = xOffset * cellW;
|
|
30735
31050
|
const unitW = totalW / Math.max(1, totalSlots);
|
|
30736
|
-
const rowCy = (
|
|
31051
|
+
const rowCy = (level3 + 1) * cellH + cellH / 2;
|
|
30737
31052
|
let slot2 = 0;
|
|
30738
31053
|
for (const group2 of groups) {
|
|
30739
31054
|
slot2 = group2.fansAsRow ? placeRowFanGroup(
|
|
@@ -30746,7 +31061,7 @@ function placeWrappedChildren(hc, parentId, normal, cx2, cy, xOffset, spanW, lev
|
|
|
30746
31061
|
unitW,
|
|
30747
31062
|
slot2,
|
|
30748
31063
|
rowCy,
|
|
30749
|
-
|
|
31064
|
+
level3,
|
|
30750
31065
|
cellW,
|
|
30751
31066
|
cellH,
|
|
30752
31067
|
options,
|
|
@@ -30763,25 +31078,25 @@ function placeWrappedChildren(hc, parentId, normal, cx2, cy, xOffset, spanW, lev
|
|
|
30763
31078
|
rowCy,
|
|
30764
31079
|
cellW,
|
|
30765
31080
|
cellH,
|
|
30766
|
-
|
|
31081
|
+
level3,
|
|
30767
31082
|
options,
|
|
30768
31083
|
placeAtFn
|
|
30769
31084
|
);
|
|
30770
31085
|
}
|
|
30771
31086
|
}
|
|
30772
|
-
function placeRowFanGroup(hc, parentId, group2, cx2, cy, leftX, unitW, slot2, rowCy,
|
|
31087
|
+
function placeRowFanGroup(hc, parentId, group2, cx2, cy, leftX, unitW, slot2, rowCy, level3, cellW, cellH, options, placeAtFn) {
|
|
30773
31088
|
let cursor = slot2;
|
|
30774
31089
|
for (const child3 of group2.members) {
|
|
30775
31090
|
const childW = effectiveWidth(child3, options.orgChart);
|
|
30776
31091
|
const childCx = leftX + unitW * (cursor + childW / 2);
|
|
30777
31092
|
elbowConnector(hc, parentId, cx2, cy + hc.boxH / 2, childCx, rowCy - hc.boxH / 2, child3.node.id);
|
|
30778
31093
|
const virtualOffset = childCx / cellW - childW / 2;
|
|
30779
|
-
placeAtFn(hc, child3, childCx, rowCy, virtualOffset, childW,
|
|
31094
|
+
placeAtFn(hc, child3, childCx, rowCy, virtualOffset, childW, level3 + 1, cellW, cellH, options);
|
|
30780
31095
|
cursor += childW;
|
|
30781
31096
|
}
|
|
30782
31097
|
return cursor;
|
|
30783
31098
|
}
|
|
30784
|
-
function placeColumnGroup(hc, parentId, group2, cx2, cy, leftX, unitW, slot2, rowCy, cellW, cellH,
|
|
31099
|
+
function placeColumnGroup(hc, parentId, group2, cx2, cy, leftX, unitW, slot2, rowCy, cellW, cellH, level3, options, placeAtFn) {
|
|
30785
31100
|
const groupCx = leftX + unitW * (slot2 + 0.5);
|
|
30786
31101
|
const subRowH = cellH / group2.members.length;
|
|
30787
31102
|
let fromId = parentId;
|
|
@@ -30793,7 +31108,7 @@ function placeColumnGroup(hc, parentId, group2, cx2, cy, leftX, unitW, slot2, ro
|
|
|
30793
31108
|
elbowConnector(hc, fromId, fromX, fromY, groupCx, childCy - hc.boxH / 2, child3.node.id);
|
|
30794
31109
|
const childW = effectiveWidth(child3, options.orgChart);
|
|
30795
31110
|
const virtualOffset = groupCx / cellW - childW / 2;
|
|
30796
|
-
placeAtFn(hc, child3, groupCx, childCy, virtualOffset, childW,
|
|
31111
|
+
placeAtFn(hc, child3, groupCx, childCy, virtualOffset, childW, level3 + 1, cellW, cellH, options);
|
|
30797
31112
|
fromId = child3.node.id;
|
|
30798
31113
|
fromX = groupCx;
|
|
30799
31114
|
fromY = childCy + hc.boxH / 2;
|
|
@@ -30802,7 +31117,7 @@ function placeColumnGroup(hc, parentId, group2, cx2, cy, leftX, unitW, slot2, ro
|
|
|
30802
31117
|
}
|
|
30803
31118
|
|
|
30804
31119
|
// diagram/hierarchy/smartart-hierarchy-standard.ts
|
|
30805
|
-
function placeFlatChildren2(hc, parentId, normal, cx2, cy, xOffset,
|
|
31120
|
+
function placeFlatChildren2(hc, parentId, normal, cx2, cy, xOffset, level3, cellW, cellH, options) {
|
|
30806
31121
|
placeFlatChildren(
|
|
30807
31122
|
hc,
|
|
30808
31123
|
parentId,
|
|
@@ -30810,14 +31125,14 @@ function placeFlatChildren2(hc, parentId, normal, cx2, cy, xOffset, level2, cell
|
|
|
30810
31125
|
cx2,
|
|
30811
31126
|
cy,
|
|
30812
31127
|
xOffset,
|
|
30813
|
-
|
|
31128
|
+
level3,
|
|
30814
31129
|
cellW,
|
|
30815
31130
|
cellH,
|
|
30816
31131
|
options,
|
|
30817
31132
|
placeAt
|
|
30818
31133
|
);
|
|
30819
31134
|
}
|
|
30820
|
-
function placeWrappedChildren2(hc, parentId, normal, cx2, cy, xOffset, spanW,
|
|
31135
|
+
function placeWrappedChildren2(hc, parentId, normal, cx2, cy, xOffset, spanW, level3, cellW, cellH, options) {
|
|
30821
31136
|
placeWrappedChildren(
|
|
30822
31137
|
hc,
|
|
30823
31138
|
parentId,
|
|
@@ -30826,32 +31141,32 @@ function placeWrappedChildren2(hc, parentId, normal, cx2, cy, xOffset, spanW, le
|
|
|
30826
31141
|
cy,
|
|
30827
31142
|
xOffset,
|
|
30828
31143
|
spanW,
|
|
30829
|
-
|
|
31144
|
+
level3,
|
|
30830
31145
|
cellW,
|
|
30831
31146
|
cellH,
|
|
30832
31147
|
options,
|
|
30833
31148
|
placeAt
|
|
30834
31149
|
);
|
|
30835
31150
|
}
|
|
30836
|
-
function placeAt(hc, t, cx2, cy, xOffset, spanW,
|
|
31151
|
+
function placeAt(hc, t, cx2, cy, xOffset, spanW, level3, cellW, cellH, options, siblingCxs) {
|
|
30837
31152
|
pushNode(hc, t.node, cx2 - hc.boxW / 2, cy - hc.boxH / 2);
|
|
30838
31153
|
const { assistants, normal } = partitionChildren(t, options.orgChart);
|
|
30839
31154
|
placeAssistantRow(hc, t.node.id, cx2, cy, assistants);
|
|
30840
31155
|
if (normal.length === 0) {
|
|
30841
31156
|
return;
|
|
30842
31157
|
}
|
|
30843
|
-
if (options.foldDeeperGenerations &&
|
|
31158
|
+
if (options.foldDeeperGenerations && level3 >= 1) {
|
|
30844
31159
|
return;
|
|
30845
31160
|
}
|
|
30846
|
-
if (options.hangingPlacer &&
|
|
31161
|
+
if (options.hangingPlacer && level3 >= 1) {
|
|
30847
31162
|
const plan = planFan(normal.length, options.perRow, siblingCxs);
|
|
30848
31163
|
if (plan) {
|
|
30849
|
-
placeFannedRow(hc, t, normal, plan, cx2, cy,
|
|
31164
|
+
placeFannedRow(hc, t, normal, plan, cx2, cy, level3, cellW, cellH, options, placeAt);
|
|
30850
31165
|
return;
|
|
30851
31166
|
}
|
|
30852
31167
|
const isSoloChainLink = !siblingCxs || siblingCxs.length === 1;
|
|
30853
31168
|
if (isSoloChainLink && normal.length > 1 && spanW === normal.length) {
|
|
30854
|
-
placeFlatChildren2(hc, t.node.id, normal, cx2, cy, xOffset,
|
|
31169
|
+
placeFlatChildren2(hc, t.node.id, normal, cx2, cy, xOffset, level3, cellW, cellH, options);
|
|
30855
31170
|
return;
|
|
30856
31171
|
}
|
|
30857
31172
|
const anchorY = cy + hc.boxH / 2 + (options.hangHeightRatio ?? HANG_HEIGHT_RATIO) * hc.boxH;
|
|
@@ -30879,21 +31194,21 @@ function placeAt(hc, t, cx2, cy, xOffset, spanW, level2, cellW, cellH, options,
|
|
|
30879
31194
|
cy,
|
|
30880
31195
|
xOffset,
|
|
30881
31196
|
spanW,
|
|
30882
|
-
|
|
31197
|
+
level3,
|
|
30883
31198
|
cellW,
|
|
30884
31199
|
cellH,
|
|
30885
31200
|
options
|
|
30886
31201
|
);
|
|
30887
31202
|
} else {
|
|
30888
|
-
placeFlatChildren2(hc, t.node.id, normal, cx2, cy, xOffset,
|
|
31203
|
+
placeFlatChildren2(hc, t.node.id, normal, cx2, cy, xOffset, level3, cellW, cellH, options);
|
|
30889
31204
|
}
|
|
30890
31205
|
}
|
|
30891
|
-
function placeStandardTree(hc, t, xOffset,
|
|
31206
|
+
function placeStandardTree(hc, t, xOffset, level3, cellW, cellH, options) {
|
|
30892
31207
|
const spanW = spanOf(t, options);
|
|
30893
|
-
const cascadeShift = options.cascadeOffsetX &&
|
|
31208
|
+
const cascadeShift = options.cascadeOffsetX && level3 >= options.cascadeOffsetX.fromLevel ? options.cascadeOffsetX.offsetPx : 0;
|
|
30894
31209
|
const cx2 = (xOffset + spanW / 2) * cellW + cascadeShift;
|
|
30895
|
-
const cy =
|
|
30896
|
-
placeAt(hc, t, cx2, cy, xOffset, spanW,
|
|
31210
|
+
const cy = level3 * cellH + cellH / 2;
|
|
31211
|
+
placeAt(hc, t, cx2, cy, xOffset, spanW, level3, cellW, cellH, options);
|
|
30897
31212
|
}
|
|
30898
31213
|
|
|
30899
31214
|
// diagram/hierarchy/smartart-hierarchy-tailed-placer.ts
|
|
@@ -42696,8 +43011,8 @@ function layers(ids, forward, shortest) {
|
|
|
42696
43011
|
}
|
|
42697
43012
|
const result = [];
|
|
42698
43013
|
for (const id of ids) {
|
|
42699
|
-
const
|
|
42700
|
-
(result[
|
|
43014
|
+
const level3 = rank.get(id) ?? 0;
|
|
43015
|
+
(result[level3] ??= []).push(id);
|
|
42701
43016
|
}
|
|
42702
43017
|
return result.filter((layer) => layer.length);
|
|
42703
43018
|
}
|