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.cjs
CHANGED
|
@@ -636,6 +636,8 @@ __export(chart_exports, {
|
|
|
636
636
|
CHART_ERROR_VALUE_TYPES: () => CHART_ERROR_VALUE_TYPES,
|
|
637
637
|
CHART_GROUP_ELEMENTS: () => CHART_GROUP_ELEMENTS,
|
|
638
638
|
CHART_STYLE_PARTS: () => CHART_STYLE_PARTS,
|
|
639
|
+
DATA_LABEL_CATEGORY_PERCENT_SEPARATOR: () => DATA_LABEL_CATEGORY_PERCENT_SEPARATOR,
|
|
640
|
+
DATA_LABEL_SEPARATOR: () => DATA_LABEL_SEPARATOR,
|
|
639
641
|
DEFAULT_BAR_GAP_WIDTH: () => DEFAULT_BAR_GAP_WIDTH,
|
|
640
642
|
DEFAULT_CHART_PALETTE: () => DEFAULT_CHART_PALETTE,
|
|
641
643
|
DEFAULT_THEME_COLORS: () => DEFAULT_THEME_COLORS,
|
|
@@ -677,6 +679,7 @@ __export(chart_exports, {
|
|
|
677
679
|
chartTrendlineKind: () => chartTrendlineKind,
|
|
678
680
|
chartTrendlineType: () => chartTrendlineType,
|
|
679
681
|
clusteredBarGeometry: () => clusteredBarGeometry,
|
|
682
|
+
composeDataLabelText: () => composeDataLabelText,
|
|
680
683
|
computeBoxStats: () => computeBoxStats,
|
|
681
684
|
computeBubbleRadius: () => computeBubbleRadius,
|
|
682
685
|
computeHierarchicalSunburstArcs: () => computeHierarchicalSunburstArcs,
|
|
@@ -731,6 +734,7 @@ __export(chart_exports, {
|
|
|
731
734
|
resolveBlankDisplay: () => resolveBlankDisplay,
|
|
732
735
|
resolveChartGradient: () => resolveChartGradient,
|
|
733
736
|
resolveChartStyleDefinition: () => resolveChartStyleDefinition,
|
|
737
|
+
resolveDataLabelFlags: () => resolveDataLabelFlags,
|
|
734
738
|
resolveManualLayoutRect: () => resolveManualLayoutRect,
|
|
735
739
|
scottBinCount: () => scottBinCount,
|
|
736
740
|
shade: () => shade,
|
|
@@ -1277,6 +1281,52 @@ function formatChartNumber(value, formatCode) {
|
|
|
1277
1281
|
return formatChartNumberWithColor(value, formatCode)?.text;
|
|
1278
1282
|
}
|
|
1279
1283
|
|
|
1284
|
+
// chart/data-label-text.ts
|
|
1285
|
+
var DATA_LABEL_SEPARATOR = ", ";
|
|
1286
|
+
var DATA_LABEL_CATEGORY_PERCENT_SEPARATOR = "\n";
|
|
1287
|
+
var FLAG_KEYS = [
|
|
1288
|
+
"showValue",
|
|
1289
|
+
"showCategory",
|
|
1290
|
+
"showSeriesName",
|
|
1291
|
+
"showPercent",
|
|
1292
|
+
"showBubbleSize"
|
|
1293
|
+
];
|
|
1294
|
+
function resolveDataLabelFlags(levels) {
|
|
1295
|
+
const { point, series, chart } = levels;
|
|
1296
|
+
const picked = {};
|
|
1297
|
+
for (const key of FLAG_KEYS) picked[key] = point?.[key] ?? series?.[key] ?? chart?.[key];
|
|
1298
|
+
const anyDeclared = FLAG_KEYS.some((key) => picked[key] !== void 0);
|
|
1299
|
+
return {
|
|
1300
|
+
showValue: anyDeclared ? picked.showValue === true : levels.siblingOwnsLabels !== true,
|
|
1301
|
+
showCategory: picked.showCategory === true,
|
|
1302
|
+
showSeriesName: picked.showSeriesName === true,
|
|
1303
|
+
showPercent: picked.showPercent === true,
|
|
1304
|
+
showBubbleSize: picked.showBubbleSize === true,
|
|
1305
|
+
separator: point?.separator ?? series?.separator ?? chart?.separator ?? (picked.showCategory === true && picked.showPercent === true ? DATA_LABEL_CATEGORY_PERCENT_SEPARATOR : DATA_LABEL_SEPARATOR)
|
|
1306
|
+
};
|
|
1307
|
+
}
|
|
1308
|
+
function composeDataLabelText(input) {
|
|
1309
|
+
const { flags, value, numberFormat: numberFormat2 } = input;
|
|
1310
|
+
const parts = [];
|
|
1311
|
+
let valueColor;
|
|
1312
|
+
if (flags.showSeriesName && input.seriesName) parts.push(input.seriesName);
|
|
1313
|
+
if (flags.showCategory && input.category) parts.push(input.category);
|
|
1314
|
+
if (flags.showValue) {
|
|
1315
|
+
const formatted = formatChartNumberWithColor(value, numberFormat2);
|
|
1316
|
+
parts.push(formatted?.text ?? (input.formatValue ?? String)(value, numberFormat2));
|
|
1317
|
+
valueColor = formatted?.color;
|
|
1318
|
+
}
|
|
1319
|
+
if (flags.showPercent) {
|
|
1320
|
+
const base = input.percentBase;
|
|
1321
|
+
parts.push(base > 0 ? `${Math.round(Math.abs(value) / base * 100)}%` : "0%");
|
|
1322
|
+
}
|
|
1323
|
+
if (flags.showBubbleSize && input.bubbleSize !== void 0)
|
|
1324
|
+
parts.push((input.formatBubbleSize ?? String)(input.bubbleSize));
|
|
1325
|
+
const text4 = parts.join(flags.separator);
|
|
1326
|
+
if (text4.length === 0) return void 0;
|
|
1327
|
+
return { text: text4, color: parts.length === 1 && flags.showValue ? valueColor : void 0 };
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1280
1330
|
// chart/auto-title.ts
|
|
1281
1331
|
var CHART_AUTO_TITLE = "Chart Title";
|
|
1282
1332
|
var CHARTEX_ONLY_TYPES = /* @__PURE__ */ new Set([
|
|
@@ -1424,10 +1474,10 @@ function squarify(nodes, box) {
|
|
|
1424
1474
|
|
|
1425
1475
|
// chart/hierarchy.ts
|
|
1426
1476
|
function normalizeLevels(levels, pointCount) {
|
|
1427
|
-
return levels.map((
|
|
1477
|
+
return levels.map((level3) => {
|
|
1428
1478
|
let previous = "";
|
|
1429
1479
|
return Array.from({ length: pointCount }, (_, index) => {
|
|
1430
|
-
const label =
|
|
1480
|
+
const label = level3[index]?.trim() ?? "";
|
|
1431
1481
|
if (label) previous = label;
|
|
1432
1482
|
return label || previous;
|
|
1433
1483
|
});
|
|
@@ -1585,12 +1635,12 @@ function computeSunburstArcs(series, cx2, cy, maxR) {
|
|
|
1585
1635
|
});
|
|
1586
1636
|
return out;
|
|
1587
1637
|
}
|
|
1588
|
-
function hierarchyKey(levels,
|
|
1589
|
-
return levels.slice(
|
|
1638
|
+
function hierarchyKey(levels, level3, index) {
|
|
1639
|
+
return levels.slice(level3).map((labels) => labels[index] ?? "").join("\0");
|
|
1590
1640
|
}
|
|
1591
1641
|
function computeHierarchicalSunburstArcs(categoryLevels2, values, cx2, cy, maxR) {
|
|
1592
|
-
const levels = categoryLevels2.filter((
|
|
1593
|
-
const leafCount = Math.max(values.length, ...levels.map((
|
|
1642
|
+
const levels = categoryLevels2.filter((level3) => level3.length > 0);
|
|
1643
|
+
const leafCount = Math.max(values.length, ...levels.map((level3) => level3.length), 0);
|
|
1594
1644
|
if (levels.length === 0 || leafCount === 0) return [];
|
|
1595
1645
|
const rawWeights = Array.from({ length: leafCount }, (_, index) => Math.abs(values[index] ?? 0));
|
|
1596
1646
|
const weights = rawWeights.some((value) => value !== 0) ? rawWeights : rawWeights.map(() => 1);
|
|
@@ -1601,15 +1651,15 @@ function computeHierarchicalSunburstArcs(categoryLevels2, values, cx2, cy, maxR)
|
|
|
1601
1651
|
const rootLabels = levels[levels.length - 1] ?? [];
|
|
1602
1652
|
const rootColors = /* @__PURE__ */ new Map();
|
|
1603
1653
|
const out = [];
|
|
1604
|
-
for (let
|
|
1605
|
-
const ringIndex = levels.length - 1 -
|
|
1654
|
+
for (let level3 = levels.length - 1; level3 >= 0; level3--) {
|
|
1655
|
+
const ringIndex = levels.length - 1 - level3;
|
|
1606
1656
|
const innerRadius = ringWidth * (ringIndex + 0.5);
|
|
1607
1657
|
const outerRadius = ringWidth * (ringIndex + 1.5);
|
|
1608
1658
|
let start = 0;
|
|
1609
1659
|
while (start < leafCount) {
|
|
1610
|
-
const key = hierarchyKey(levels,
|
|
1660
|
+
const key = hierarchyKey(levels, level3, start);
|
|
1611
1661
|
let end = start + 1;
|
|
1612
|
-
while (end < leafCount && hierarchyKey(levels,
|
|
1662
|
+
while (end < leafCount && hierarchyKey(levels, level3, end) === key) end++;
|
|
1613
1663
|
const startAngle = -Math.PI / 2 + (prefix[start] ?? 0) / total * Math.PI * 2;
|
|
1614
1664
|
const endAngle = -Math.PI / 2 + (prefix[end] ?? 0) / total * Math.PI * 2;
|
|
1615
1665
|
const rootLabel = rootLabels[start] ?? "";
|
|
@@ -1619,8 +1669,8 @@ function computeHierarchicalSunburstArcs(categoryLevels2, values, cx2, cy, maxR)
|
|
|
1619
1669
|
colorIndex: rootColors.get(rootLabel) ?? start,
|
|
1620
1670
|
opacity: Math.max(0.1, 0.9 - ringIndex * 0.1),
|
|
1621
1671
|
level: ringIndex,
|
|
1622
|
-
label: levels[
|
|
1623
|
-
...
|
|
1672
|
+
label: levels[level3]?.[start] ?? "",
|
|
1673
|
+
...level3 === 0 && end === start + 1 ? { pointIndex: start } : {},
|
|
1624
1674
|
...arcLabelPlacement(cx2, cy, (innerRadius + outerRadius) / 2, startAngle, endAngle)
|
|
1625
1675
|
});
|
|
1626
1676
|
start = end;
|
|
@@ -2273,8 +2323,8 @@ function parseXml(xml, options = {}) {
|
|
|
2273
2323
|
let parsed;
|
|
2274
2324
|
try {
|
|
2275
2325
|
parsed = new xmldom.DOMParser({
|
|
2276
|
-
onError: (
|
|
2277
|
-
if (
|
|
2326
|
+
onError: (level3, message) => {
|
|
2327
|
+
if (level3 !== "warning") parseError = message;
|
|
2278
2328
|
}
|
|
2279
2329
|
}).parseFromString(xml, "application/xml");
|
|
2280
2330
|
} catch (error) {
|
|
@@ -3099,6 +3149,19 @@ function readChartStyle(xml) {
|
|
|
3099
3149
|
}
|
|
3100
3150
|
|
|
3101
3151
|
// chart/formatting-nodes.ts
|
|
3152
|
+
function chartDataLabelNode(root) {
|
|
3153
|
+
const plot = first(first(root, "chart", NS.c), "plotArea", NS.c);
|
|
3154
|
+
const groups = plot ? elements(plot).filter((node) => node.localName.endsWith("Chart")) : [];
|
|
3155
|
+
const candidates = groups.flatMap((group2) => [
|
|
3156
|
+
...children(group2, "ser", NS.c).map((ser) => first(ser, "dLbls", NS.c)),
|
|
3157
|
+
first(group2, "dLbls", NS.c)
|
|
3158
|
+
]);
|
|
3159
|
+
return candidates.find(
|
|
3160
|
+
(node) => node !== void 0 && (first(node, "txPr", NS.c) !== void 0 || elements(node).some(
|
|
3161
|
+
(child3) => child3.localName.startsWith("show") && child3.getAttribute("val") === "1"
|
|
3162
|
+
))
|
|
3163
|
+
);
|
|
3164
|
+
}
|
|
3102
3165
|
function chartFormattingNodes(root) {
|
|
3103
3166
|
const chart = first(root, "chart", NS.c);
|
|
3104
3167
|
const plot = first(chart, "plotArea", NS.c);
|
|
@@ -3273,6 +3336,8 @@ function readChartFormatting(root) {
|
|
|
3273
3336
|
const entries = Object.fromEntries(
|
|
3274
3337
|
Object.entries(nodes).flatMap(([name, node]) => node ? [[name, entry2(node)]] : [])
|
|
3275
3338
|
);
|
|
3339
|
+
const labels = chartDataLabelNode(root);
|
|
3340
|
+
if (labels) entries["dataLabel"] = entry2(labels);
|
|
3276
3341
|
const builtInStyle = readBuiltInChartStyle(root);
|
|
3277
3342
|
const textBody = c(root, "txPr");
|
|
3278
3343
|
const textDefaults = textBody ? {
|
|
@@ -5141,7 +5206,7 @@ function dataSourceInner(source) {
|
|
|
5141
5206
|
case "multiLvlStrRef": {
|
|
5142
5207
|
const levels = source.levels ? elementXml(
|
|
5143
5208
|
"multiLvlStrCache",
|
|
5144
|
-
valXml("ptCount", source.levelPointCount) + source.levels.map((
|
|
5209
|
+
valXml("ptCount", source.levelPointCount) + source.levels.map((level3) => elementXml("lvl", cachePoints(level3))).join("")
|
|
5145
5210
|
) : "";
|
|
5146
5211
|
return `<c:multiLvlStrRef>${formula}${levels}</c:multiLvlStrRef>`;
|
|
5147
5212
|
}
|
|
@@ -5404,6 +5469,41 @@ function summaryAnalysis(series) {
|
|
|
5404
5469
|
};
|
|
5405
5470
|
}
|
|
5406
5471
|
|
|
5472
|
+
// chart/render/summary-labels.ts
|
|
5473
|
+
function level(options, custom) {
|
|
5474
|
+
const out = {};
|
|
5475
|
+
if (options.deleted !== void 0) out.deleted = options.deleted;
|
|
5476
|
+
if (options.showValue !== void 0) out.showValue = options.showValue;
|
|
5477
|
+
if (options.showCategoryName !== void 0) out.showCategory = options.showCategoryName;
|
|
5478
|
+
if (options.showSeriesName !== void 0) out.showSeriesName = options.showSeriesName;
|
|
5479
|
+
if (options.showPercent !== void 0) out.showPercent = options.showPercent;
|
|
5480
|
+
if (options.showBubbleSize !== void 0) out.showBubbleSize = options.showBubbleSize;
|
|
5481
|
+
if (options.separator !== void 0) out.separator = options.separator;
|
|
5482
|
+
if (options.position) out.position = options.position;
|
|
5483
|
+
if (options.numberFormat?.formatCode) out.numberFormat = options.numberFormat.formatCode;
|
|
5484
|
+
if (custom?.text !== void 0) out.text = custom.text;
|
|
5485
|
+
return out;
|
|
5486
|
+
}
|
|
5487
|
+
function shows(levels, point) {
|
|
5488
|
+
const flags = resolveDataLabelFlags({ ...levels, ...point ? { point } : {} });
|
|
5489
|
+
return point?.text !== void 0 || Object.values(flags).some((value) => value === true);
|
|
5490
|
+
}
|
|
5491
|
+
function summaryDataLabels(series, group2) {
|
|
5492
|
+
const own = series.dataLabels;
|
|
5493
|
+
if (!own && !group2) return void 0;
|
|
5494
|
+
const out = {};
|
|
5495
|
+
if (group2) out.chart = level(group2);
|
|
5496
|
+
if (own) out.series = level(own);
|
|
5497
|
+
const points = {};
|
|
5498
|
+
for (const labels of [group2, own])
|
|
5499
|
+
for (const label of labels?.labels ?? [])
|
|
5500
|
+
if (label.index !== void 0)
|
|
5501
|
+
points[label.index] = { ...points[label.index], ...level(label, label.tx) };
|
|
5502
|
+
if (Object.keys(points).length) out.points = points;
|
|
5503
|
+
if (!shows(out) && !Object.values(points).some((point) => shows(out, point))) return void 0;
|
|
5504
|
+
return out;
|
|
5505
|
+
}
|
|
5506
|
+
|
|
5407
5507
|
// chart/render/summary-from-space.ts
|
|
5408
5508
|
var solidColor = (fill) => fill?.kind === "solid" ? fill.color : void 0;
|
|
5409
5509
|
var isSolidFill = (fill) => fill?.kind === "solid" || fill?.kind === "unsupported" && fill.element === "solidFill";
|
|
@@ -5421,7 +5521,7 @@ var GROUP_TYPES = {
|
|
|
5421
5521
|
surface: "surface"
|
|
5422
5522
|
};
|
|
5423
5523
|
var GROUPINGS = /* @__PURE__ */ new Set(["clustered", "stacked", "percentStacked", "standard"]);
|
|
5424
|
-
function chartSummarySeries(source, chartType) {
|
|
5524
|
+
function chartSummarySeries(source, chartType, groupLabels) {
|
|
5425
5525
|
const categories = source.categories ?? source.xValues;
|
|
5426
5526
|
const values = source.values ?? source.yValues;
|
|
5427
5527
|
const numeric = (v) => typeof v === "number" ? v : v === "" ? null : Number.isFinite(Number(v)) ? Number(v) : null;
|
|
@@ -5429,6 +5529,7 @@ function chartSummarySeries(source, chartType) {
|
|
|
5429
5529
|
categories: chartSourceValues(categories),
|
|
5430
5530
|
values: chartSourceValues(values).map(numeric)
|
|
5431
5531
|
};
|
|
5532
|
+
if (values?.cache?.formatCode !== void 0) out.numberFormat = values.cache.formatCode;
|
|
5432
5533
|
if (source.bubbleSizes) {
|
|
5433
5534
|
out.bubbleSizes = chartSourceValues(source.bubbleSizes).map(numeric);
|
|
5434
5535
|
if (source.bubbleSizes.formula) out.bubbleSizesRef = source.bubbleSizes.formula;
|
|
@@ -5457,6 +5558,8 @@ function chartSummarySeries(source, chartType) {
|
|
|
5457
5558
|
}
|
|
5458
5559
|
if (Object.keys(points).length) out.pointColors = points;
|
|
5459
5560
|
if (Object.keys(pointFills).length) out.pointFills = pointFills;
|
|
5561
|
+
const dataLabels = summaryDataLabels(source, groupLabels);
|
|
5562
|
+
if (dataLabels) out.dataLabels = dataLabels;
|
|
5460
5563
|
Object.assign(out, summaryAnalysis(source));
|
|
5461
5564
|
return out;
|
|
5462
5565
|
}
|
|
@@ -5484,7 +5587,7 @@ function extraGroups(chartSpace, firstType) {
|
|
|
5484
5587
|
const type = group2.kind === "bar" ? "column" : group2.kind;
|
|
5485
5588
|
const entry3 = {
|
|
5486
5589
|
chartType: type,
|
|
5487
|
-
series: group2.series.map((source) => chartSummarySeries(source, type)),
|
|
5590
|
+
series: group2.series.map((source) => chartSummarySeries(source, type, group2.dataLabels)),
|
|
5488
5591
|
secondary: valueAxisId(chartSpace, group2.axisIds) !== primary
|
|
5489
5592
|
};
|
|
5490
5593
|
if (group2.grouping && GROUPINGS.has(group2.grouping))
|
|
@@ -5502,7 +5605,9 @@ function chartSummaryFromSpace(chartSpace, extras = {}) {
|
|
|
5502
5605
|
const group2 = chartSpace.plotArea.groups[0];
|
|
5503
5606
|
let chartType = group2 ? GROUP_TYPES[group2.kind] : "column";
|
|
5504
5607
|
if (chartType === "bar" && group2?.barDirection !== "bar") chartType = "column";
|
|
5505
|
-
const series = (group2?.series ?? []).map(
|
|
5608
|
+
const series = (group2?.series ?? []).map(
|
|
5609
|
+
(source) => chartSummarySeries(source, chartType, group2?.dataLabels)
|
|
5610
|
+
);
|
|
5506
5611
|
const summary = {
|
|
5507
5612
|
chartType,
|
|
5508
5613
|
series,
|
|
@@ -5568,9 +5673,9 @@ function dimension(data, kind, type) {
|
|
|
5568
5673
|
const out = { points: [] };
|
|
5569
5674
|
const formula = text(cx(element2, "f"));
|
|
5570
5675
|
if (formula) out.formula = formula;
|
|
5571
|
-
const
|
|
5572
|
-
const count = Number(
|
|
5573
|
-
for (const point of
|
|
5676
|
+
const level3 = cx(element2, "lvl");
|
|
5677
|
+
const count = Number(level3?.getAttribute("ptCount") ?? 0);
|
|
5678
|
+
for (const point of level3 ? children(level3, "pt", NS.cx) : []) {
|
|
5574
5679
|
const index = Number(point.getAttribute("idx") ?? out.points.length);
|
|
5575
5680
|
if (Number.isInteger(index) && index >= 0) out.points[index] = text(point);
|
|
5576
5681
|
}
|
|
@@ -5579,10 +5684,10 @@ function dimension(data, kind, type) {
|
|
|
5579
5684
|
}
|
|
5580
5685
|
function categoryLevels(data) {
|
|
5581
5686
|
const element2 = data ? children(data, "strDim", NS.cx).find((d) => (d.getAttribute("type") ?? "") === "cat") : void 0;
|
|
5582
|
-
return (element2 ? children(element2, "lvl", NS.cx) : []).map((
|
|
5687
|
+
return (element2 ? children(element2, "lvl", NS.cx) : []).map((level3) => {
|
|
5583
5688
|
const points = [];
|
|
5584
|
-
const count = Number(
|
|
5585
|
-
for (const point of children(
|
|
5689
|
+
const count = Number(level3.getAttribute("ptCount") ?? 0);
|
|
5690
|
+
for (const point of children(level3, "pt", NS.cx)) {
|
|
5586
5691
|
const index = Number(point.getAttribute("idx") ?? points.length);
|
|
5587
5692
|
if (Number.isInteger(index) && index >= 0) points[index] = text(point);
|
|
5588
5693
|
}
|
|
@@ -5883,218 +5988,6 @@ function chartBarSpacing(chart) {
|
|
|
5883
5988
|
};
|
|
5884
5989
|
}
|
|
5885
5990
|
|
|
5886
|
-
// chart/render/chart-svg-bars.ts
|
|
5887
|
-
function barLayout(model, frame2) {
|
|
5888
|
-
const count = Math.max(1, model.series.length);
|
|
5889
|
-
const geometry = clusteredBarGeometry(frame2.bandSize, count, chartBarSpacing(model));
|
|
5890
|
-
const barSize = geometry.singleBarWidth;
|
|
5891
|
-
const offset = (si) => model.horizontal ? geometry.clusterWidth / 2 - barSize - si * geometry.step : -geometry.clusterWidth / 2 + si * geometry.step;
|
|
5892
|
-
return { barSize, offset };
|
|
5893
|
-
}
|
|
5894
|
-
function bars(model, frame2, out, values) {
|
|
5895
|
-
const stacked = model.grouping === "stacked" || model.grouping === "percentStacked";
|
|
5896
|
-
const { barSize, offset: barOffset } = barLayout(model, frame2);
|
|
5897
|
-
const base = frame2.value(0);
|
|
5898
|
-
const pos = new Array(model.categories.length).fill(0);
|
|
5899
|
-
const neg = new Array(model.categories.length).fill(0);
|
|
5900
|
-
model.series.forEach((s2, si) => {
|
|
5901
|
-
values[si]?.forEach((v, i2) => {
|
|
5902
|
-
if (v === null || i2 >= model.categories.length) return;
|
|
5903
|
-
let from = 0;
|
|
5904
|
-
let to = v;
|
|
5905
|
-
if (stacked) {
|
|
5906
|
-
const acc = v >= 0 ? pos : neg;
|
|
5907
|
-
from = acc[i2] ?? 0;
|
|
5908
|
-
to = from + v;
|
|
5909
|
-
acc[i2] = to;
|
|
5910
|
-
}
|
|
5911
|
-
const a2 = stacked ? frame2.value(from) : base;
|
|
5912
|
-
const b = frame2.value(to);
|
|
5913
|
-
const offset = barOffset(si);
|
|
5914
|
-
const center = frame2.band(i2);
|
|
5915
|
-
const width = model.horizontal ? Math.abs(b - a2) : barSize;
|
|
5916
|
-
const height = model.horizontal ? barSize : Math.abs(b - a2);
|
|
5917
|
-
let color = s2.pointColors?.[i2] ?? s2.color;
|
|
5918
|
-
const gradient = s2.pointGradients?.[i2] ?? (s2.pointColors?.[i2] === void 0 ? s2.gradient : void 0);
|
|
5919
|
-
if (gradient && (gradient.path === "circle" || gradient.path === "shape")) {
|
|
5920
|
-
const baseId = color.match(/^url\(#(.+)\)$/)?.[1];
|
|
5921
|
-
if (baseId) {
|
|
5922
|
-
const id = baseId.replace(/(-s\d+(?:-p\d+)?)$/, `-mark${i2}$1`);
|
|
5923
|
-
const def = buildChartGradientDef(id, gradient, {
|
|
5924
|
-
width: Number(n(width)),
|
|
5925
|
-
height: Number(n(height)),
|
|
5926
|
-
shape: "rect"
|
|
5927
|
-
});
|
|
5928
|
-
out.push(`<defs>${chartGradientMarkup(def)}</defs>`);
|
|
5929
|
-
color = `url(#${id})`;
|
|
5930
|
-
}
|
|
5931
|
-
}
|
|
5932
|
-
out.push(`<g data-chart-series="${si}" data-chart-point="${i2}">`);
|
|
5933
|
-
if (model.horizontal)
|
|
5934
|
-
out.push(
|
|
5935
|
-
rect(Math.min(a2, b), center + offset, Math.abs(b - a2), barSize, color, s2.shadowFilter)
|
|
5936
|
-
);
|
|
5937
|
-
else
|
|
5938
|
-
out.push(
|
|
5939
|
-
rect(center + offset, Math.min(a2, b), barSize, Math.abs(b - a2), color, s2.shadowFilter)
|
|
5940
|
-
);
|
|
5941
|
-
out.push("</g>");
|
|
5942
|
-
});
|
|
5943
|
-
});
|
|
5944
|
-
}
|
|
5945
|
-
|
|
5946
|
-
// chart/render/chart-svg-analysis.ts
|
|
5947
|
-
var DASHES = {
|
|
5948
|
-
dot: [1, 3],
|
|
5949
|
-
dash: [4, 3],
|
|
5950
|
-
lgDash: [8, 3],
|
|
5951
|
-
dashDot: [4, 3, 1, 3],
|
|
5952
|
-
lgDashDot: [8, 3, 1, 3],
|
|
5953
|
-
lgDashDotDot: [8, 3, 1, 3, 1, 3],
|
|
5954
|
-
sysDash: [3, 1],
|
|
5955
|
-
sysDot: [1, 1],
|
|
5956
|
-
sysDashDot: [3, 1, 1, 1],
|
|
5957
|
-
sysDashDotDot: [3, 1, 1, 1, 1, 1]
|
|
5958
|
-
};
|
|
5959
|
-
var CAP = 4;
|
|
5960
|
-
function strokeAttributes(stroke) {
|
|
5961
|
-
const pattern = stroke.dash ? DASHES[stroke.dash] : void 0;
|
|
5962
|
-
const dash = pattern ? ` stroke-dasharray="${pattern.map((step) => n(step * stroke.width)).join(" ")}"` : "";
|
|
5963
|
-
return `stroke="${esc(stroke.color)}" stroke-width="${n(stroke.width)}"${dash}`;
|
|
5964
|
-
}
|
|
5965
|
-
var segment = (x1, y1, x2, y2, stroke) => `<line x1="${n(x1)}" y1="${n(y1)}" x2="${n(x2)}" y2="${n(y2)}" ${stroke}/>`;
|
|
5966
|
-
function trendlines(series, si, xs, ys, plane, out) {
|
|
5967
|
-
for (const trendline of series.trendlines ?? []) {
|
|
5968
|
-
const fit2 = fitChartTrendline(trendline.fit, xs, ys);
|
|
5969
|
-
if (fit2.points.length < 2) continue;
|
|
5970
|
-
const points = fit2.points.map(({ x, y }) => plane(x, y).map(n).join(",")).join(" ");
|
|
5971
|
-
out.push(
|
|
5972
|
-
`<polyline points="${points}" fill="none" ${strokeAttributes(trendline.stroke)} data-chart-part="trendline" data-chart-series="${si}"/>`
|
|
5973
|
-
);
|
|
5974
|
-
}
|
|
5975
|
-
}
|
|
5976
|
-
function errorBar(bars2, at2, values, plane, out) {
|
|
5977
|
-
const stroke = strokeAttributes(bars2.stroke);
|
|
5978
|
-
for (const side of ["plus", "minus"]) {
|
|
5979
|
-
if (bars2.barType !== side && bars2.barType !== "both") continue;
|
|
5980
|
-
const amount = chartErrorBarAmount(bars2.amount, values, at2.displayIndex, at2.sourceIndex, side);
|
|
5981
|
-
const sign = side === "plus" ? 1 : -1;
|
|
5982
|
-
const [x1, y1] = plane(at2.x, at2.y);
|
|
5983
|
-
const [x2, y2] = bars2.direction === "x" ? plane(at2.x + sign * amount, at2.y) : plane(at2.x, at2.y + sign * amount);
|
|
5984
|
-
out.push(segment(x1, y1, x2, y2, stroke));
|
|
5985
|
-
if (!bars2.endCap) continue;
|
|
5986
|
-
if (x1 === x2) out.push(segment(x2 - CAP, y2, x2 + CAP, y2, stroke));
|
|
5987
|
-
else out.push(segment(x2, y2 - CAP, x2, y2 + CAP, stroke));
|
|
5988
|
-
}
|
|
5989
|
-
}
|
|
5990
|
-
function plottedPoints(series, xOf) {
|
|
5991
|
-
return series.values.flatMap((y, index) => {
|
|
5992
|
-
const x = xOf(index);
|
|
5993
|
-
return y === null || x === null ? [] : [{ x, y, index }];
|
|
5994
|
-
});
|
|
5995
|
-
}
|
|
5996
|
-
function seriesAnalysis(series, si, xOf, plane, barPlane, categoryAxis, out) {
|
|
5997
|
-
const points = plottedPoints(series, xOf);
|
|
5998
|
-
const xs = points.map((p) => p.x);
|
|
5999
|
-
const ys = points.map((p) => p.y);
|
|
6000
|
-
trendlines(series, si, xs, ys, plane, out);
|
|
6001
|
-
for (const bars2 of series.errorBars ?? []) {
|
|
6002
|
-
if (categoryAxis && bars2.direction === "x") continue;
|
|
6003
|
-
const values = bars2.direction === "x" ? xs : ys;
|
|
6004
|
-
points.forEach(
|
|
6005
|
-
(p, displayIndex) => errorBar(bars2, { x: p.x, y: p.y, displayIndex, sourceIndex: p.index }, values, barPlane, out)
|
|
6006
|
-
);
|
|
6007
|
-
}
|
|
6008
|
-
}
|
|
6009
|
-
function categoryAnalysis(model, frame2, out) {
|
|
6010
|
-
if (model.grouping === "stacked" || model.grouping === "percentStacked") return;
|
|
6011
|
-
const plane = (x, y) => model.horizontal ? [frame2.value(y), frame2.band(x - 1)] : [frame2.band(x - 1), frame2.value(y)];
|
|
6012
|
-
const barred = model.type === "bar" || model.type === "column";
|
|
6013
|
-
const layout = barred ? barLayout(model, frame2) : void 0;
|
|
6014
|
-
model.series.forEach((series, si) => {
|
|
6015
|
-
if (!series.trendlines && !series.errorBars) return;
|
|
6016
|
-
const shift = layout ? layout.offset(si) + layout.barSize / 2 : 0;
|
|
6017
|
-
const barPlane = (x, y) => {
|
|
6018
|
-
const [px3, py] = plane(x, y);
|
|
6019
|
-
return model.horizontal ? [px3, py + shift] : [px3 + shift, py];
|
|
6020
|
-
};
|
|
6021
|
-
seriesAnalysis(series, si, (i2) => i2 + 1, plane, barPlane, true, out);
|
|
6022
|
-
});
|
|
6023
|
-
}
|
|
6024
|
-
function scatterAnalysis(model, px3, py, out) {
|
|
6025
|
-
const plane = (x, y) => [px3(x), py(y)];
|
|
6026
|
-
model.series.forEach((series, si) => {
|
|
6027
|
-
if (!series.trendlines && !series.errorBars) return;
|
|
6028
|
-
seriesAnalysis(series, si, (i2) => series.xValues?.[i2] ?? null, plane, plane, false, out);
|
|
6029
|
-
});
|
|
6030
|
-
}
|
|
6031
|
-
|
|
6032
|
-
// chart/render/chart-scale.ts
|
|
6033
|
-
var clean = (n2) => Number(n2.toPrecision(12));
|
|
6034
|
-
function* units(raw2) {
|
|
6035
|
-
let exp = Math.floor(Math.log10(raw2)) - 1;
|
|
6036
|
-
for (; ; ) {
|
|
6037
|
-
const base = 10 ** exp;
|
|
6038
|
-
for (const m of [1, 2, 5]) yield clean(m * base);
|
|
6039
|
-
exp++;
|
|
6040
|
-
}
|
|
6041
|
-
}
|
|
6042
|
-
function niceScale(dataMin, dataMax, options = {}) {
|
|
6043
|
-
const maxIntervals = Math.max(1, options.maxIntervals ?? 10);
|
|
6044
|
-
let lo = Number.isFinite(dataMin) ? dataMin : 0;
|
|
6045
|
-
let hi = Number.isFinite(dataMax) ? dataMax : 0;
|
|
6046
|
-
if (lo > hi) [lo, hi] = [hi, lo];
|
|
6047
|
-
if (lo === hi) {
|
|
6048
|
-
if (lo === 0) hi = 1;
|
|
6049
|
-
else if (options.noZero) {
|
|
6050
|
-
const pad2 = Math.abs(lo) * 0.1 || 1;
|
|
6051
|
-
lo -= pad2;
|
|
6052
|
-
hi += pad2;
|
|
6053
|
-
} else if (lo > 0) lo = 0;
|
|
6054
|
-
else hi = 0;
|
|
6055
|
-
}
|
|
6056
|
-
let fixedLo = false;
|
|
6057
|
-
let fixedHi = false;
|
|
6058
|
-
if (!options.noZero) {
|
|
6059
|
-
if (lo >= 0 && hi - lo >= hi / 6) {
|
|
6060
|
-
lo = 0;
|
|
6061
|
-
fixedLo = true;
|
|
6062
|
-
} else if (hi <= 0 && hi - lo >= -lo / 6) {
|
|
6063
|
-
hi = 0;
|
|
6064
|
-
fixedHi = true;
|
|
6065
|
-
}
|
|
6066
|
-
}
|
|
6067
|
-
const range = hi - lo;
|
|
6068
|
-
const top = fixedHi ? hi : hi + range * 0.05;
|
|
6069
|
-
const bottom = fixedLo ? lo : lo - range * 0.05;
|
|
6070
|
-
for (const unit of units(range / maxIntervals)) {
|
|
6071
|
-
const min = fixedLo ? lo : Math.floor(clean(bottom / unit)) * unit;
|
|
6072
|
-
const max = fixedHi ? hi : Math.ceil(clean(top / unit)) * unit;
|
|
6073
|
-
const intervals = Math.round((max - min) / unit);
|
|
6074
|
-
if (intervals <= maxIntervals && intervals > 0) {
|
|
6075
|
-
const ticks = [];
|
|
6076
|
-
for (let i2 = 0; i2 <= intervals; i2++) ticks.push(clean(min + i2 * unit));
|
|
6077
|
-
return { min: clean(min), max: clean(max), majorUnit: unit, ticks };
|
|
6078
|
-
}
|
|
6079
|
-
}
|
|
6080
|
-
return { min: lo, max: hi, majorUnit: range, ticks: [lo, hi] };
|
|
6081
|
-
}
|
|
6082
|
-
var PERCENT_SCALE = {
|
|
6083
|
-
min: 0,
|
|
6084
|
-
max: 1,
|
|
6085
|
-
majorUnit: 0.1,
|
|
6086
|
-
ticks: [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]
|
|
6087
|
-
};
|
|
6088
|
-
function formatAxisValue(value, percent = false) {
|
|
6089
|
-
if (percent) return `${clean(value * 100)}%`;
|
|
6090
|
-
const v = clean(value);
|
|
6091
|
-
if (Math.abs(v) >= 1e15 || v !== 0 && Math.abs(v) < 1e-6)
|
|
6092
|
-
return v.toExponential(2).replace("e+", "E+").replace("e-", "E-");
|
|
6093
|
-
const [int2 = "0", frac] = String(Math.abs(v)).split(".");
|
|
6094
|
-
const grouped2 = int2.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
6095
|
-
return `${v < 0 ? "-" : ""}${grouped2}${frac ? `.${frac}` : ""}`;
|
|
6096
|
-
}
|
|
6097
|
-
|
|
6098
5991
|
// drawingml/drawing-color-css.ts
|
|
6099
5992
|
function drawingColorCss(value) {
|
|
6100
5993
|
if (!value || value.alpha === 1) return value?.hex;
|
|
@@ -6112,36 +6005,6 @@ var TWIPS_PER_POINT = 20;
|
|
|
6112
6005
|
var TWIPS_PER_INCH = 1440;
|
|
6113
6006
|
var PIXELS_PER_INCH = 96;
|
|
6114
6007
|
|
|
6115
|
-
// drawingml/drawing-shadow.ts
|
|
6116
|
-
function resolveDrawingShadow(effects, theme) {
|
|
6117
|
-
const node = first(effects, "outerShdw", NS.a);
|
|
6118
|
-
if (!node) return void 0;
|
|
6119
|
-
const value = (key, fallback) => Number(node.getAttribute(key) ?? fallback);
|
|
6120
|
-
if (value("sx", 1e5) !== 1e5 || value("sy", 1e5) !== 1e5 || value("kx", 0) !== 0 || value("ky", 0) !== 0)
|
|
6121
|
-
return void 0;
|
|
6122
|
-
const color = parseDrawingColorIn(node);
|
|
6123
|
-
const resolved = color && resolveDrawingColor(color, theme, { transformOrder: "document" });
|
|
6124
|
-
const blur = value("blurRad", 0) / EMU_PER_PIXEL;
|
|
6125
|
-
const distance = value("dist", 0) / EMU_PER_PIXEL;
|
|
6126
|
-
const angle = value("dir", 0) / 6e4 * Math.PI / 180;
|
|
6127
|
-
if (!resolved || ![blur, distance, angle].every(Number.isFinite) || blur < 0 || distance < 0)
|
|
6128
|
-
return void 0;
|
|
6129
|
-
return {
|
|
6130
|
-
color: resolved.hex,
|
|
6131
|
-
opacity: resolved.alpha,
|
|
6132
|
-
blur,
|
|
6133
|
-
dx: Math.cos(angle) * distance,
|
|
6134
|
-
dy: Math.sin(angle) * distance
|
|
6135
|
-
};
|
|
6136
|
-
}
|
|
6137
|
-
function resolveDrawingShadowXml(xml, theme) {
|
|
6138
|
-
return xml ? resolveDrawingShadow(parseXml(xml).documentElement, theme) : void 0;
|
|
6139
|
-
}
|
|
6140
|
-
function svgDropShadowElement(s2, format) {
|
|
6141
|
-
const num2 = format.number;
|
|
6142
|
-
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"/>`;
|
|
6143
|
-
}
|
|
6144
|
-
|
|
6145
6008
|
// chart/render/theme-palette.ts
|
|
6146
6009
|
var THEME_SLOTS = [
|
|
6147
6010
|
"lt1",
|
|
@@ -6203,6 +6066,36 @@ function autoSeriesColor(theme, index) {
|
|
|
6203
6066
|
return chartPaletteSeriesColor(findChartColorPalette(10), i2, i2 + 1, chartColorScheme(theme));
|
|
6204
6067
|
}
|
|
6205
6068
|
|
|
6069
|
+
// drawingml/drawing-shadow.ts
|
|
6070
|
+
function resolveDrawingShadow(effects, theme) {
|
|
6071
|
+
const node = first(effects, "outerShdw", NS.a);
|
|
6072
|
+
if (!node) return void 0;
|
|
6073
|
+
const value = (key, fallback) => Number(node.getAttribute(key) ?? fallback);
|
|
6074
|
+
if (value("sx", 1e5) !== 1e5 || value("sy", 1e5) !== 1e5 || value("kx", 0) !== 0 || value("ky", 0) !== 0)
|
|
6075
|
+
return void 0;
|
|
6076
|
+
const color = parseDrawingColorIn(node);
|
|
6077
|
+
const resolved = color && resolveDrawingColor(color, theme, { transformOrder: "document" });
|
|
6078
|
+
const blur = value("blurRad", 0) / EMU_PER_PIXEL;
|
|
6079
|
+
const distance = value("dist", 0) / EMU_PER_PIXEL;
|
|
6080
|
+
const angle = value("dir", 0) / 6e4 * Math.PI / 180;
|
|
6081
|
+
if (!resolved || ![blur, distance, angle].every(Number.isFinite) || blur < 0 || distance < 0)
|
|
6082
|
+
return void 0;
|
|
6083
|
+
return {
|
|
6084
|
+
color: resolved.hex,
|
|
6085
|
+
opacity: resolved.alpha,
|
|
6086
|
+
blur,
|
|
6087
|
+
dx: Math.cos(angle) * distance,
|
|
6088
|
+
dy: Math.sin(angle) * distance
|
|
6089
|
+
};
|
|
6090
|
+
}
|
|
6091
|
+
function resolveDrawingShadowXml(xml, theme) {
|
|
6092
|
+
return xml ? resolveDrawingShadow(parseXml(xml).documentElement, theme) : void 0;
|
|
6093
|
+
}
|
|
6094
|
+
function svgDropShadowElement(s2, format) {
|
|
6095
|
+
const num2 = format.number;
|
|
6096
|
+
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"/>`;
|
|
6097
|
+
}
|
|
6098
|
+
|
|
6206
6099
|
// chart/text-inheritance.ts
|
|
6207
6100
|
var TEXT_KEYS = [
|
|
6208
6101
|
"fontSize",
|
|
@@ -6291,6 +6184,444 @@ function chartAppearance(chart, theme) {
|
|
|
6291
6184
|
return out;
|
|
6292
6185
|
}
|
|
6293
6186
|
|
|
6187
|
+
// text/css-font-family.ts
|
|
6188
|
+
var FALLBACKS = {
|
|
6189
|
+
calibri: '"Calibri", "Carlito", "Segoe UI", Arial, sans-serif',
|
|
6190
|
+
"calibri light": '"Calibri Light", "Calibri", "Carlito", "Segoe UI", Arial, sans-serif',
|
|
6191
|
+
cambria: '"Cambria", "Caladea", Georgia, serif',
|
|
6192
|
+
arial: 'Arial, "Liberation Sans", Helvetica, sans-serif',
|
|
6193
|
+
"times new roman": '"Times New Roman", "Liberation Serif", Times, serif',
|
|
6194
|
+
"courier new": '"Courier New", "Liberation Mono", monospace',
|
|
6195
|
+
aptos: '"Aptos", "Calibri", "Carlito", "Segoe UI", sans-serif'
|
|
6196
|
+
};
|
|
6197
|
+
function cssFontFamily(name) {
|
|
6198
|
+
const known = FALLBACKS[name.toLowerCase()];
|
|
6199
|
+
if (known) return known;
|
|
6200
|
+
const quoted = `"${name.replace(/["\\]/g, "")}"`;
|
|
6201
|
+
return `${quoted}, "Calibri", "Carlito", "Segoe UI", sans-serif`;
|
|
6202
|
+
}
|
|
6203
|
+
|
|
6204
|
+
// chart/render/chart-svg-appearance.ts
|
|
6205
|
+
var nextPaintId = 0;
|
|
6206
|
+
function chartGradientPaint(model, width = 1024, height = 768) {
|
|
6207
|
+
const prefix = `xlsx-chart-${++nextPaintId}`;
|
|
6208
|
+
const appearance = { ...model.appearance };
|
|
6209
|
+
const defs = [];
|
|
6210
|
+
const shadowPaint = (shadow, suffix) => {
|
|
6211
|
+
const id = `${prefix}-${suffix}`;
|
|
6212
|
+
const pad2 = Math.max(4, shadow.blur * 3 + Math.abs(shadow.dx) + Math.abs(shadow.dy));
|
|
6213
|
+
defs.push(
|
|
6214
|
+
`<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>`
|
|
6215
|
+
);
|
|
6216
|
+
return `url(#${id})`;
|
|
6217
|
+
};
|
|
6218
|
+
for (const [part, entry3] of Object.entries(appearance)) {
|
|
6219
|
+
if (entry3?.textShadow)
|
|
6220
|
+
appearance[part] = {
|
|
6221
|
+
...entry3,
|
|
6222
|
+
textShadowFilter: shadowPaint(entry3.textShadow, `${part}-text-shadow`)
|
|
6223
|
+
};
|
|
6224
|
+
}
|
|
6225
|
+
const paint2 = (gradient, suffix, bounds2) => {
|
|
6226
|
+
const def = buildChartGradientDef(`${prefix}-${suffix}`, gradient, bounds2);
|
|
6227
|
+
defs.push(chartGradientMarkup(def));
|
|
6228
|
+
return `url(#${def.id})`;
|
|
6229
|
+
};
|
|
6230
|
+
for (const part of ["chartArea", "plotArea"]) {
|
|
6231
|
+
const entry3 = appearance[part];
|
|
6232
|
+
if (!entry3?.gradient) continue;
|
|
6233
|
+
if (part === "plotArea" && ["circle", "shape"].includes(entry3.gradient.path ?? "")) continue;
|
|
6234
|
+
appearance[part] = {
|
|
6235
|
+
...entry3,
|
|
6236
|
+
fillColor: paint2(entry3.gradient, part, { width, height, shape: "rect" })
|
|
6237
|
+
};
|
|
6238
|
+
}
|
|
6239
|
+
const series = model.series.map((source, index) => {
|
|
6240
|
+
const view = { ...source };
|
|
6241
|
+
if (source.shadow) view.shadowFilter = shadowPaint(source.shadow, `s${index}-shadow`);
|
|
6242
|
+
const bounds2 = model.type === "bar" || model.type === "column" ? { width: 1, height: 1, shape: "rect" } : void 0;
|
|
6243
|
+
if (source.gradient) view.color = paint2(source.gradient, `s${index}`, bounds2);
|
|
6244
|
+
if (source.pointGradients) {
|
|
6245
|
+
view.pointColors = [...source.pointColors ?? []];
|
|
6246
|
+
for (const [key, gradient] of Object.entries(source.pointGradients))
|
|
6247
|
+
view.pointColors[Number(key)] = paint2(gradient, `s${index}-p${key}`, bounds2);
|
|
6248
|
+
}
|
|
6249
|
+
return view;
|
|
6250
|
+
});
|
|
6251
|
+
return defs.length ? { model: { ...model, appearance, series }, defs: `<defs>${defs.join("")}</defs>` } : { model, defs: "" };
|
|
6252
|
+
}
|
|
6253
|
+
function chartTextAttributes(model, part, fallbackSize = FONT_SIZE) {
|
|
6254
|
+
const entry3 = model.appearance?.[part];
|
|
6255
|
+
return {
|
|
6256
|
+
size: entry3?.fontSize === void 0 ? fallbackSize : chartPointsToPixels(entry3.fontSize),
|
|
6257
|
+
...entry3?.color === void 0 ? {} : { fill: entry3.color },
|
|
6258
|
+
...entry3?.bold === void 0 ? {} : { weight: entry3.bold ? "bold" : "normal" },
|
|
6259
|
+
...entry3?.italic === void 0 ? {} : { italic: entry3.italic },
|
|
6260
|
+
...entry3?.underline === void 0 ? {} : { underline: entry3.underline },
|
|
6261
|
+
...entry3?.typeface === void 0 ? {} : { family: cssFontFamily(entry3.typeface) },
|
|
6262
|
+
...entry3?.textShadowFilter === void 0 ? {} : { filter: entry3.textShadowFilter }
|
|
6263
|
+
};
|
|
6264
|
+
}
|
|
6265
|
+
function chartStroke(model, part) {
|
|
6266
|
+
const entry3 = model.appearance?.[part];
|
|
6267
|
+
return {
|
|
6268
|
+
color: entry3?.axisVisible === false ? "none" : entry3?.lineColor ?? (part === "gridlineMajor" ? GRID_COLOR : AXIS_COLOR),
|
|
6269
|
+
width: entry3?.lineWidth === void 0 ? 1 : chartPointsToPixels(entry3.lineWidth)
|
|
6270
|
+
};
|
|
6271
|
+
}
|
|
6272
|
+
function chartAreaRect(model, part, area) {
|
|
6273
|
+
if (area.w <= 0 || area.h <= 0) return "";
|
|
6274
|
+
const entry3 = model.appearance?.[part];
|
|
6275
|
+
let fill = entry3?.fillColor ?? (part === "chartArea" ? "#FFFFFF" : "none");
|
|
6276
|
+
let defs = "";
|
|
6277
|
+
if (part !== "chartArea" && entry3?.gradient && (part !== "plotArea" || ["circle", "shape"].includes(entry3.gradient.path ?? ""))) {
|
|
6278
|
+
const def = buildChartGradientDef(`xlsx-chart-${++nextPaintId}-${part}`, entry3.gradient, {
|
|
6279
|
+
width: area.w,
|
|
6280
|
+
height: area.h,
|
|
6281
|
+
shape: "rect"
|
|
6282
|
+
});
|
|
6283
|
+
defs = `<defs>${chartGradientMarkup(def)}</defs>`;
|
|
6284
|
+
fill = `url(#${def.id})`;
|
|
6285
|
+
}
|
|
6286
|
+
const stroke = entry3?.lineColor ?? "none";
|
|
6287
|
+
if (fill === "none" && stroke === "none") return "";
|
|
6288
|
+
const width = entry3?.lineWidth === void 0 ? 1 : chartPointsToPixels(entry3.lineWidth);
|
|
6289
|
+
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}"/>`;
|
|
6290
|
+
}
|
|
6291
|
+
|
|
6292
|
+
// chart/render/chart-svg-labels.ts
|
|
6293
|
+
var GAP = 3;
|
|
6294
|
+
var LINE = 1.2;
|
|
6295
|
+
var NAMED_COLORS = /^(black|blue|cyan|green|magenta|red|white|yellow)$/iu;
|
|
6296
|
+
function measure(model, label) {
|
|
6297
|
+
const attrs = chartTextAttributes(model, "dataLabel", 10);
|
|
6298
|
+
const size = attrs.size ?? 10;
|
|
6299
|
+
const lines = label.text.split("\n");
|
|
6300
|
+
return {
|
|
6301
|
+
lines,
|
|
6302
|
+
size,
|
|
6303
|
+
w: Math.max(...lines.map((l) => textWidth(l, size))),
|
|
6304
|
+
h: lines.length * size * LINE,
|
|
6305
|
+
attrs
|
|
6306
|
+
};
|
|
6307
|
+
}
|
|
6308
|
+
function draw(m, label, x, y, anchor, out) {
|
|
6309
|
+
const fill = label.color && NAMED_COLORS.test(label.color) ? label.color.toLowerCase() : void 0;
|
|
6310
|
+
m.lines.forEach((line3, k) => {
|
|
6311
|
+
const lineY = y - m.h / 2 + (k + 0.5) * m.size * LINE + m.size * 0.35;
|
|
6312
|
+
out.push(text2(x, lineY, line3, { ...m.attrs, ...fill ? { fill } : {}, anchor }));
|
|
6313
|
+
});
|
|
6314
|
+
}
|
|
6315
|
+
function barLabels(model, marks, out) {
|
|
6316
|
+
const stacked = model.grouping === "stacked" || model.grouping === "percentStacked";
|
|
6317
|
+
for (const mark of marks) {
|
|
6318
|
+
const label = mark.series.labels?.[mark.index];
|
|
6319
|
+
if (!label) continue;
|
|
6320
|
+
const m = measure(model, label);
|
|
6321
|
+
let position = label.position ?? (stacked ? "ctr" : "outEnd");
|
|
6322
|
+
if (stacked && position === "outEnd") position = "ctr";
|
|
6323
|
+
const cx2 = mark.x + mark.w / 2;
|
|
6324
|
+
const cy = mark.y + mark.h / 2;
|
|
6325
|
+
if (model.horizontal) {
|
|
6326
|
+
const end = mark.negative ? mark.x : mark.x + mark.w;
|
|
6327
|
+
const base = mark.negative ? mark.x + mark.w : mark.x;
|
|
6328
|
+
const dir2 = mark.negative ? -1 : 1;
|
|
6329
|
+
const side = (at2, outward) => [
|
|
6330
|
+
at2 + (outward ? dir2 : -dir2) * GAP,
|
|
6331
|
+
(outward ? dir2 : -dir2) > 0 ? "start" : "end"
|
|
6332
|
+
];
|
|
6333
|
+
const [x, anchor] = position === "ctr" ? [cx2, "middle"] : position === "inEnd" ? side(end, false) : position === "inBase" ? side(base, true) : side(end, true);
|
|
6334
|
+
draw(m, label, x, cy, anchor, out);
|
|
6335
|
+
continue;
|
|
6336
|
+
}
|
|
6337
|
+
const top = mark.negative ? mark.y + mark.h : mark.y;
|
|
6338
|
+
const bottom = mark.negative ? mark.y : mark.y + mark.h;
|
|
6339
|
+
const dir = mark.negative ? 1 : -1;
|
|
6340
|
+
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);
|
|
6341
|
+
draw(m, label, cx2, y, "middle", out);
|
|
6342
|
+
}
|
|
6343
|
+
}
|
|
6344
|
+
function pointLabels(model, marks, out) {
|
|
6345
|
+
for (const mark of marks) {
|
|
6346
|
+
const label = mark.series.labels?.[mark.index];
|
|
6347
|
+
if (!label) continue;
|
|
6348
|
+
const m = measure(model, label);
|
|
6349
|
+
const reach = mark.radius + GAP;
|
|
6350
|
+
switch (model.type === "area" ? "ctr" : label.position ?? "r") {
|
|
6351
|
+
case "ctr":
|
|
6352
|
+
draw(m, label, mark.x, mark.y, "middle", out);
|
|
6353
|
+
break;
|
|
6354
|
+
case "t":
|
|
6355
|
+
draw(m, label, mark.x, mark.y - reach - m.h / 2, "middle", out);
|
|
6356
|
+
break;
|
|
6357
|
+
case "b":
|
|
6358
|
+
draw(m, label, mark.x, mark.y + reach + m.h / 2, "middle", out);
|
|
6359
|
+
break;
|
|
6360
|
+
case "l":
|
|
6361
|
+
draw(m, label, mark.x - reach, mark.y, "end", out);
|
|
6362
|
+
break;
|
|
6363
|
+
default:
|
|
6364
|
+
draw(m, label, mark.x + reach, mark.y, "start", out);
|
|
6365
|
+
}
|
|
6366
|
+
}
|
|
6367
|
+
}
|
|
6368
|
+
function sliceLabels(model, marks, out) {
|
|
6369
|
+
for (const mark of marks) {
|
|
6370
|
+
const label = mark.series.labels?.[mark.index];
|
|
6371
|
+
if (!label) continue;
|
|
6372
|
+
const m = measure(model, label);
|
|
6373
|
+
const mid = (mark.start + mark.end) / 2;
|
|
6374
|
+
const ux = Math.sin(mid);
|
|
6375
|
+
const uy = -Math.cos(mid);
|
|
6376
|
+
const place = (radius) => [
|
|
6377
|
+
mark.cx + radius * ux,
|
|
6378
|
+
mark.cy + radius * uy
|
|
6379
|
+
];
|
|
6380
|
+
const position = model.type === "doughnut" ? "ctr" : label.position ?? "bestFit";
|
|
6381
|
+
let x;
|
|
6382
|
+
let y;
|
|
6383
|
+
if (position === "ctr") [x, y] = place(mark.inner + (mark.outer - mark.inner) / 2);
|
|
6384
|
+
else if (position === "inEnd") {
|
|
6385
|
+
const extent = Math.abs(ux) * m.w / 2 + Math.abs(uy) * m.h / 2;
|
|
6386
|
+
[x, y] = place(Math.max(0, mark.outer - GAP - extent));
|
|
6387
|
+
} else if (position === "outEnd") {
|
|
6388
|
+
const extent = Math.abs(ux) * m.w / 2 + Math.abs(uy) * m.h / 2;
|
|
6389
|
+
[x, y] = place(mark.outer + GAP + extent);
|
|
6390
|
+
} else {
|
|
6391
|
+
const placed2 = placeBestFitLabel(
|
|
6392
|
+
{
|
|
6393
|
+
cx: mark.cx,
|
|
6394
|
+
cy: mark.cy,
|
|
6395
|
+
outerR: mark.outer,
|
|
6396
|
+
startAngle: mark.start - Math.PI / 2,
|
|
6397
|
+
endAngle: mark.end - Math.PI / 2
|
|
6398
|
+
},
|
|
6399
|
+
m.w,
|
|
6400
|
+
m.h
|
|
6401
|
+
);
|
|
6402
|
+
x = placed2.x;
|
|
6403
|
+
y = placed2.y;
|
|
6404
|
+
}
|
|
6405
|
+
draw(m, label, x, y, "middle", out);
|
|
6406
|
+
}
|
|
6407
|
+
}
|
|
6408
|
+
function hasOutsideLabels(model) {
|
|
6409
|
+
return model.series.some(
|
|
6410
|
+
(s2) => s2.labels?.some(
|
|
6411
|
+
(l) => l !== void 0 && ["bestFit", "outEnd"].includes(l.position ?? "bestFit")
|
|
6412
|
+
)
|
|
6413
|
+
);
|
|
6414
|
+
}
|
|
6415
|
+
|
|
6416
|
+
// chart/render/chart-svg-bars.ts
|
|
6417
|
+
function barLayout(model, frame2) {
|
|
6418
|
+
const count = Math.max(1, model.series.length);
|
|
6419
|
+
const geometry = clusteredBarGeometry(frame2.bandSize, count, chartBarSpacing(model));
|
|
6420
|
+
const barSize = geometry.singleBarWidth;
|
|
6421
|
+
const offset = (si) => model.horizontal ? geometry.clusterWidth / 2 - barSize - si * geometry.step : -geometry.clusterWidth / 2 + si * geometry.step;
|
|
6422
|
+
return { barSize, offset };
|
|
6423
|
+
}
|
|
6424
|
+
function bars(model, frame2, out, values) {
|
|
6425
|
+
const stacked = model.grouping === "stacked" || model.grouping === "percentStacked";
|
|
6426
|
+
const { barSize, offset: barOffset } = barLayout(model, frame2);
|
|
6427
|
+
const base = frame2.value(0);
|
|
6428
|
+
const pos = new Array(model.categories.length).fill(0);
|
|
6429
|
+
const neg = new Array(model.categories.length).fill(0);
|
|
6430
|
+
const marks = [];
|
|
6431
|
+
model.series.forEach((s2, si) => {
|
|
6432
|
+
values[si]?.forEach((v, i2) => {
|
|
6433
|
+
if (v === null || i2 >= model.categories.length) return;
|
|
6434
|
+
let from = 0;
|
|
6435
|
+
let to = v;
|
|
6436
|
+
if (stacked) {
|
|
6437
|
+
const acc = v >= 0 ? pos : neg;
|
|
6438
|
+
from = acc[i2] ?? 0;
|
|
6439
|
+
to = from + v;
|
|
6440
|
+
acc[i2] = to;
|
|
6441
|
+
}
|
|
6442
|
+
const a2 = stacked ? frame2.value(from) : base;
|
|
6443
|
+
const b = frame2.value(to);
|
|
6444
|
+
const offset = barOffset(si);
|
|
6445
|
+
const center = frame2.band(i2);
|
|
6446
|
+
const width = model.horizontal ? Math.abs(b - a2) : barSize;
|
|
6447
|
+
const height = model.horizontal ? barSize : Math.abs(b - a2);
|
|
6448
|
+
let color = s2.pointColors?.[i2] ?? s2.color;
|
|
6449
|
+
const gradient = s2.pointGradients?.[i2] ?? (s2.pointColors?.[i2] === void 0 ? s2.gradient : void 0);
|
|
6450
|
+
if (gradient && (gradient.path === "circle" || gradient.path === "shape")) {
|
|
6451
|
+
const baseId = color.match(/^url\(#(.+)\)$/)?.[1];
|
|
6452
|
+
if (baseId) {
|
|
6453
|
+
const id = baseId.replace(/(-s\d+(?:-p\d+)?)$/, `-mark${i2}$1`);
|
|
6454
|
+
const def = buildChartGradientDef(id, gradient, {
|
|
6455
|
+
width: Number(n(width)),
|
|
6456
|
+
height: Number(n(height)),
|
|
6457
|
+
shape: "rect"
|
|
6458
|
+
});
|
|
6459
|
+
out.push(`<defs>${chartGradientMarkup(def)}</defs>`);
|
|
6460
|
+
color = `url(#${id})`;
|
|
6461
|
+
}
|
|
6462
|
+
}
|
|
6463
|
+
out.push(`<g data-chart-series="${si}" data-chart-point="${i2}">`);
|
|
6464
|
+
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) };
|
|
6465
|
+
out.push(rect(box.x, box.y, box.w, box.h, color, s2.shadowFilter));
|
|
6466
|
+
out.push("</g>");
|
|
6467
|
+
marks.push({ series: s2, index: i2, ...box, negative: v < 0 });
|
|
6468
|
+
});
|
|
6469
|
+
});
|
|
6470
|
+
barLabels(model, marks, out);
|
|
6471
|
+
}
|
|
6472
|
+
|
|
6473
|
+
// chart/render/chart-svg-analysis.ts
|
|
6474
|
+
var DASHES = {
|
|
6475
|
+
dot: [1, 3],
|
|
6476
|
+
dash: [4, 3],
|
|
6477
|
+
lgDash: [8, 3],
|
|
6478
|
+
dashDot: [4, 3, 1, 3],
|
|
6479
|
+
lgDashDot: [8, 3, 1, 3],
|
|
6480
|
+
lgDashDotDot: [8, 3, 1, 3, 1, 3],
|
|
6481
|
+
sysDash: [3, 1],
|
|
6482
|
+
sysDot: [1, 1],
|
|
6483
|
+
sysDashDot: [3, 1, 1, 1],
|
|
6484
|
+
sysDashDotDot: [3, 1, 1, 1, 1, 1]
|
|
6485
|
+
};
|
|
6486
|
+
var CAP = 4;
|
|
6487
|
+
function strokeAttributes(stroke) {
|
|
6488
|
+
const pattern = stroke.dash ? DASHES[stroke.dash] : void 0;
|
|
6489
|
+
const dash = pattern ? ` stroke-dasharray="${pattern.map((step) => n(step * stroke.width)).join(" ")}"` : "";
|
|
6490
|
+
return `stroke="${esc(stroke.color)}" stroke-width="${n(stroke.width)}"${dash}`;
|
|
6491
|
+
}
|
|
6492
|
+
var segment = (x1, y1, x2, y2, stroke) => `<line x1="${n(x1)}" y1="${n(y1)}" x2="${n(x2)}" y2="${n(y2)}" ${stroke}/>`;
|
|
6493
|
+
function trendlines(series, si, xs, ys, plane, out) {
|
|
6494
|
+
for (const trendline of series.trendlines ?? []) {
|
|
6495
|
+
const fit2 = fitChartTrendline(trendline.fit, xs, ys);
|
|
6496
|
+
if (fit2.points.length < 2) continue;
|
|
6497
|
+
const points = fit2.points.map(({ x, y }) => plane(x, y).map(n).join(",")).join(" ");
|
|
6498
|
+
out.push(
|
|
6499
|
+
`<polyline points="${points}" fill="none" ${strokeAttributes(trendline.stroke)} data-chart-part="trendline" data-chart-series="${si}"/>`
|
|
6500
|
+
);
|
|
6501
|
+
}
|
|
6502
|
+
}
|
|
6503
|
+
function errorBar(bars2, at2, values, plane, out) {
|
|
6504
|
+
const stroke = strokeAttributes(bars2.stroke);
|
|
6505
|
+
for (const side of ["plus", "minus"]) {
|
|
6506
|
+
if (bars2.barType !== side && bars2.barType !== "both") continue;
|
|
6507
|
+
const amount = chartErrorBarAmount(bars2.amount, values, at2.displayIndex, at2.sourceIndex, side);
|
|
6508
|
+
const sign = side === "plus" ? 1 : -1;
|
|
6509
|
+
const [x1, y1] = plane(at2.x, at2.y);
|
|
6510
|
+
const [x2, y2] = bars2.direction === "x" ? plane(at2.x + sign * amount, at2.y) : plane(at2.x, at2.y + sign * amount);
|
|
6511
|
+
out.push(segment(x1, y1, x2, y2, stroke));
|
|
6512
|
+
if (!bars2.endCap) continue;
|
|
6513
|
+
if (x1 === x2) out.push(segment(x2 - CAP, y2, x2 + CAP, y2, stroke));
|
|
6514
|
+
else out.push(segment(x2, y2 - CAP, x2, y2 + CAP, stroke));
|
|
6515
|
+
}
|
|
6516
|
+
}
|
|
6517
|
+
function plottedPoints(series, xOf) {
|
|
6518
|
+
return series.values.flatMap((y, index) => {
|
|
6519
|
+
const x = xOf(index);
|
|
6520
|
+
return y === null || x === null ? [] : [{ x, y, index }];
|
|
6521
|
+
});
|
|
6522
|
+
}
|
|
6523
|
+
function seriesAnalysis(series, si, xOf, plane, barPlane, categoryAxis, out) {
|
|
6524
|
+
const points = plottedPoints(series, xOf);
|
|
6525
|
+
const xs = points.map((p) => p.x);
|
|
6526
|
+
const ys = points.map((p) => p.y);
|
|
6527
|
+
trendlines(series, si, xs, ys, plane, out);
|
|
6528
|
+
for (const bars2 of series.errorBars ?? []) {
|
|
6529
|
+
if (categoryAxis && bars2.direction === "x") continue;
|
|
6530
|
+
const values = bars2.direction === "x" ? xs : ys;
|
|
6531
|
+
points.forEach(
|
|
6532
|
+
(p, displayIndex) => errorBar(bars2, { x: p.x, y: p.y, displayIndex, sourceIndex: p.index }, values, barPlane, out)
|
|
6533
|
+
);
|
|
6534
|
+
}
|
|
6535
|
+
}
|
|
6536
|
+
function categoryAnalysis(model, frame2, out) {
|
|
6537
|
+
if (model.grouping === "stacked" || model.grouping === "percentStacked") return;
|
|
6538
|
+
const plane = (x, y) => model.horizontal ? [frame2.value(y), frame2.band(x - 1)] : [frame2.band(x - 1), frame2.value(y)];
|
|
6539
|
+
const barred = model.type === "bar" || model.type === "column";
|
|
6540
|
+
const layout = barred ? barLayout(model, frame2) : void 0;
|
|
6541
|
+
model.series.forEach((series, si) => {
|
|
6542
|
+
if (!series.trendlines && !series.errorBars) return;
|
|
6543
|
+
const shift = layout ? layout.offset(si) + layout.barSize / 2 : 0;
|
|
6544
|
+
const barPlane = (x, y) => {
|
|
6545
|
+
const [px3, py] = plane(x, y);
|
|
6546
|
+
return model.horizontal ? [px3, py + shift] : [px3 + shift, py];
|
|
6547
|
+
};
|
|
6548
|
+
seriesAnalysis(series, si, (i2) => i2 + 1, plane, barPlane, true, out);
|
|
6549
|
+
});
|
|
6550
|
+
}
|
|
6551
|
+
function scatterAnalysis(model, px3, py, out) {
|
|
6552
|
+
const plane = (x, y) => [px3(x), py(y)];
|
|
6553
|
+
model.series.forEach((series, si) => {
|
|
6554
|
+
if (!series.trendlines && !series.errorBars) return;
|
|
6555
|
+
seriesAnalysis(series, si, (i2) => series.xValues?.[i2] ?? null, plane, plane, false, out);
|
|
6556
|
+
});
|
|
6557
|
+
}
|
|
6558
|
+
|
|
6559
|
+
// chart/render/chart-scale.ts
|
|
6560
|
+
var clean = (n2) => Number(n2.toPrecision(12));
|
|
6561
|
+
function* units(raw2) {
|
|
6562
|
+
let exp = Math.floor(Math.log10(raw2)) - 1;
|
|
6563
|
+
for (; ; ) {
|
|
6564
|
+
const base = 10 ** exp;
|
|
6565
|
+
for (const m of [1, 2, 5]) yield clean(m * base);
|
|
6566
|
+
exp++;
|
|
6567
|
+
}
|
|
6568
|
+
}
|
|
6569
|
+
function niceScale(dataMin, dataMax, options = {}) {
|
|
6570
|
+
const maxIntervals = Math.max(1, options.maxIntervals ?? 10);
|
|
6571
|
+
let lo = Number.isFinite(dataMin) ? dataMin : 0;
|
|
6572
|
+
let hi = Number.isFinite(dataMax) ? dataMax : 0;
|
|
6573
|
+
if (lo > hi) [lo, hi] = [hi, lo];
|
|
6574
|
+
if (lo === hi) {
|
|
6575
|
+
if (lo === 0) hi = 1;
|
|
6576
|
+
else if (options.noZero) {
|
|
6577
|
+
const pad2 = Math.abs(lo) * 0.1 || 1;
|
|
6578
|
+
lo -= pad2;
|
|
6579
|
+
hi += pad2;
|
|
6580
|
+
} else if (lo > 0) lo = 0;
|
|
6581
|
+
else hi = 0;
|
|
6582
|
+
}
|
|
6583
|
+
let fixedLo = false;
|
|
6584
|
+
let fixedHi = false;
|
|
6585
|
+
if (!options.noZero) {
|
|
6586
|
+
if (lo >= 0 && hi - lo >= hi / 6) {
|
|
6587
|
+
lo = 0;
|
|
6588
|
+
fixedLo = true;
|
|
6589
|
+
} else if (hi <= 0 && hi - lo >= -lo / 6) {
|
|
6590
|
+
hi = 0;
|
|
6591
|
+
fixedHi = true;
|
|
6592
|
+
}
|
|
6593
|
+
}
|
|
6594
|
+
const range = hi - lo;
|
|
6595
|
+
const top = fixedHi ? hi : hi + range * 0.05;
|
|
6596
|
+
const bottom = fixedLo ? lo : lo - range * 0.05;
|
|
6597
|
+
for (const unit of units(range / maxIntervals)) {
|
|
6598
|
+
const min = fixedLo ? lo : Math.floor(clean(bottom / unit)) * unit;
|
|
6599
|
+
const max = fixedHi ? hi : Math.ceil(clean(top / unit)) * unit;
|
|
6600
|
+
const intervals = Math.round((max - min) / unit);
|
|
6601
|
+
if (intervals <= maxIntervals && intervals > 0) {
|
|
6602
|
+
const ticks = [];
|
|
6603
|
+
for (let i2 = 0; i2 <= intervals; i2++) ticks.push(clean(min + i2 * unit));
|
|
6604
|
+
return { min: clean(min), max: clean(max), majorUnit: unit, ticks };
|
|
6605
|
+
}
|
|
6606
|
+
}
|
|
6607
|
+
return { min: lo, max: hi, majorUnit: range, ticks: [lo, hi] };
|
|
6608
|
+
}
|
|
6609
|
+
var PERCENT_SCALE = {
|
|
6610
|
+
min: 0,
|
|
6611
|
+
max: 1,
|
|
6612
|
+
majorUnit: 0.1,
|
|
6613
|
+
ticks: [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]
|
|
6614
|
+
};
|
|
6615
|
+
function formatAxisValue(value, percent = false) {
|
|
6616
|
+
if (percent) return `${clean(value * 100)}%`;
|
|
6617
|
+
const v = clean(value);
|
|
6618
|
+
if (Math.abs(v) >= 1e15 || v !== 0 && Math.abs(v) < 1e-6)
|
|
6619
|
+
return v.toExponential(2).replace("e+", "E+").replace("e-", "E-");
|
|
6620
|
+
const [int2 = "0", frac] = String(Math.abs(v)).split(".");
|
|
6621
|
+
const grouped2 = int2.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
6622
|
+
return `${v < 0 ? "-" : ""}${grouped2}${frac ? `.${frac}` : ""}`;
|
|
6623
|
+
}
|
|
6624
|
+
|
|
6294
6625
|
// chart/render/chart-view-analysis.ts
|
|
6295
6626
|
function strokeOf(line3, fallback, resolve) {
|
|
6296
6627
|
if (line3?.fill?.kind === "none") return void 0;
|
|
@@ -6547,6 +6878,64 @@ function chartTitleText(chart, theme) {
|
|
|
6547
6878
|
};
|
|
6548
6879
|
}
|
|
6549
6880
|
|
|
6881
|
+
// chart/render/chart-view-labels.ts
|
|
6882
|
+
function labelsOf(source, view, categories, numberFormat2) {
|
|
6883
|
+
const { chart, series, points } = source;
|
|
6884
|
+
if ((series?.deleted ?? chart?.deleted) === true) return void 0;
|
|
6885
|
+
const percentBase = view.values.reduce(
|
|
6886
|
+
(sum, v) => sum + (v === null ? 0 : Math.abs(v)),
|
|
6887
|
+
0
|
|
6888
|
+
);
|
|
6889
|
+
const out = [];
|
|
6890
|
+
let any = false;
|
|
6891
|
+
view.values.forEach((value, i2) => {
|
|
6892
|
+
const point = points?.[i2];
|
|
6893
|
+
if (value === null || point?.deleted === true) return;
|
|
6894
|
+
const position = point?.position ?? series?.position ?? chart?.position;
|
|
6895
|
+
const x = view.xValues?.[i2];
|
|
6896
|
+
const category = x === void 0 || x === null ? categories[i2] : formatAxisValue(x);
|
|
6897
|
+
let built;
|
|
6898
|
+
if (point?.text !== void 0) built = { text: point.text };
|
|
6899
|
+
else {
|
|
6900
|
+
const flags = resolveDataLabelFlags({
|
|
6901
|
+
...point ? { point } : {},
|
|
6902
|
+
...series ? { series } : {},
|
|
6903
|
+
...chart ? { chart } : {}
|
|
6904
|
+
});
|
|
6905
|
+
built = composeDataLabelText({
|
|
6906
|
+
flags,
|
|
6907
|
+
seriesName: view.name,
|
|
6908
|
+
category,
|
|
6909
|
+
value,
|
|
6910
|
+
numberFormat: point?.numberFormat ?? series?.numberFormat ?? chart?.numberFormat ?? numberFormat2,
|
|
6911
|
+
percentBase,
|
|
6912
|
+
bubbleSize: view.sizes?.[i2] ?? void 0,
|
|
6913
|
+
formatValue: (v) => formatAxisValue(v),
|
|
6914
|
+
formatBubbleSize: (size) => formatAxisValue(size)
|
|
6915
|
+
});
|
|
6916
|
+
}
|
|
6917
|
+
if (!built) return;
|
|
6918
|
+
any = true;
|
|
6919
|
+
out[i2] = {
|
|
6920
|
+
text: built.text,
|
|
6921
|
+
...position ? { position } : {},
|
|
6922
|
+
...built.color ? { color: built.color } : {}
|
|
6923
|
+
};
|
|
6924
|
+
});
|
|
6925
|
+
return any ? out : void 0;
|
|
6926
|
+
}
|
|
6927
|
+
function applyDataLabels(model, sources, extra) {
|
|
6928
|
+
const apply = (source, view) => {
|
|
6929
|
+
if (!source?.dataLabels) return;
|
|
6930
|
+
const labels = labelsOf(source.dataLabels, view, model.categories, source.numberFormat);
|
|
6931
|
+
if (labels) view.labels = labels;
|
|
6932
|
+
};
|
|
6933
|
+
model.series.forEach((view, i2) => apply(sources[i2], view));
|
|
6934
|
+
model.extraGroups?.forEach(
|
|
6935
|
+
(group2, g2) => group2.series.forEach((view, i2) => apply(extra[g2]?.series[i2], view))
|
|
6936
|
+
);
|
|
6937
|
+
}
|
|
6938
|
+
|
|
6550
6939
|
// chart/render/chart-view-ex.ts
|
|
6551
6940
|
function groupsAxis(groups, categories) {
|
|
6552
6941
|
let min = Infinity;
|
|
@@ -6732,115 +7121,11 @@ function chartSummaryView(chart, theme, options = {}) {
|
|
|
6732
7121
|
chartExtraView(chart, model, ctx, total, collect);
|
|
6733
7122
|
if (type === "waterfall") waterfallView(chart, model, ctx);
|
|
6734
7123
|
else if (!byPoint) model.valueAxis = valueAxis(model);
|
|
7124
|
+
applyDataLabels(model, chart.series, extra);
|
|
6735
7125
|
chartExtraAxes(model);
|
|
6736
7126
|
return model;
|
|
6737
7127
|
}
|
|
6738
7128
|
|
|
6739
|
-
// text/css-font-family.ts
|
|
6740
|
-
var FALLBACKS = {
|
|
6741
|
-
calibri: '"Calibri", "Carlito", "Segoe UI", Arial, sans-serif',
|
|
6742
|
-
"calibri light": '"Calibri Light", "Calibri", "Carlito", "Segoe UI", Arial, sans-serif',
|
|
6743
|
-
cambria: '"Cambria", "Caladea", Georgia, serif',
|
|
6744
|
-
arial: 'Arial, "Liberation Sans", Helvetica, sans-serif',
|
|
6745
|
-
"times new roman": '"Times New Roman", "Liberation Serif", Times, serif',
|
|
6746
|
-
"courier new": '"Courier New", "Liberation Mono", monospace',
|
|
6747
|
-
aptos: '"Aptos", "Calibri", "Carlito", "Segoe UI", sans-serif'
|
|
6748
|
-
};
|
|
6749
|
-
function cssFontFamily(name) {
|
|
6750
|
-
const known = FALLBACKS[name.toLowerCase()];
|
|
6751
|
-
if (known) return known;
|
|
6752
|
-
const quoted = `"${name.replace(/["\\]/g, "")}"`;
|
|
6753
|
-
return `${quoted}, "Calibri", "Carlito", "Segoe UI", sans-serif`;
|
|
6754
|
-
}
|
|
6755
|
-
|
|
6756
|
-
// chart/render/chart-svg-appearance.ts
|
|
6757
|
-
var nextPaintId = 0;
|
|
6758
|
-
function chartGradientPaint(model, width = 1024, height = 768) {
|
|
6759
|
-
const prefix = `xlsx-chart-${++nextPaintId}`;
|
|
6760
|
-
const appearance = { ...model.appearance };
|
|
6761
|
-
const defs = [];
|
|
6762
|
-
const shadowPaint = (shadow, suffix) => {
|
|
6763
|
-
const id = `${prefix}-${suffix}`;
|
|
6764
|
-
const pad2 = Math.max(4, shadow.blur * 3 + Math.abs(shadow.dx) + Math.abs(shadow.dy));
|
|
6765
|
-
defs.push(
|
|
6766
|
-
`<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>`
|
|
6767
|
-
);
|
|
6768
|
-
return `url(#${id})`;
|
|
6769
|
-
};
|
|
6770
|
-
for (const [part, entry3] of Object.entries(appearance)) {
|
|
6771
|
-
if (entry3?.textShadow)
|
|
6772
|
-
appearance[part] = {
|
|
6773
|
-
...entry3,
|
|
6774
|
-
textShadowFilter: shadowPaint(entry3.textShadow, `${part}-text-shadow`)
|
|
6775
|
-
};
|
|
6776
|
-
}
|
|
6777
|
-
const paint2 = (gradient, suffix, bounds2) => {
|
|
6778
|
-
const def = buildChartGradientDef(`${prefix}-${suffix}`, gradient, bounds2);
|
|
6779
|
-
defs.push(chartGradientMarkup(def));
|
|
6780
|
-
return `url(#${def.id})`;
|
|
6781
|
-
};
|
|
6782
|
-
for (const part of ["chartArea", "plotArea"]) {
|
|
6783
|
-
const entry3 = appearance[part];
|
|
6784
|
-
if (!entry3?.gradient) continue;
|
|
6785
|
-
if (part === "plotArea" && ["circle", "shape"].includes(entry3.gradient.path ?? "")) continue;
|
|
6786
|
-
appearance[part] = {
|
|
6787
|
-
...entry3,
|
|
6788
|
-
fillColor: paint2(entry3.gradient, part, { width, height, shape: "rect" })
|
|
6789
|
-
};
|
|
6790
|
-
}
|
|
6791
|
-
const series = model.series.map((source, index) => {
|
|
6792
|
-
const view = { ...source };
|
|
6793
|
-
if (source.shadow) view.shadowFilter = shadowPaint(source.shadow, `s${index}-shadow`);
|
|
6794
|
-
const bounds2 = model.type === "bar" || model.type === "column" ? { width: 1, height: 1, shape: "rect" } : void 0;
|
|
6795
|
-
if (source.gradient) view.color = paint2(source.gradient, `s${index}`, bounds2);
|
|
6796
|
-
if (source.pointGradients) {
|
|
6797
|
-
view.pointColors = [...source.pointColors ?? []];
|
|
6798
|
-
for (const [key, gradient] of Object.entries(source.pointGradients))
|
|
6799
|
-
view.pointColors[Number(key)] = paint2(gradient, `s${index}-p${key}`, bounds2);
|
|
6800
|
-
}
|
|
6801
|
-
return view;
|
|
6802
|
-
});
|
|
6803
|
-
return defs.length ? { model: { ...model, appearance, series }, defs: `<defs>${defs.join("")}</defs>` } : { model, defs: "" };
|
|
6804
|
-
}
|
|
6805
|
-
function chartTextAttributes(model, part, fallbackSize = FONT_SIZE) {
|
|
6806
|
-
const entry3 = model.appearance?.[part];
|
|
6807
|
-
return {
|
|
6808
|
-
size: entry3?.fontSize === void 0 ? fallbackSize : chartPointsToPixels(entry3.fontSize),
|
|
6809
|
-
...entry3?.color === void 0 ? {} : { fill: entry3.color },
|
|
6810
|
-
...entry3?.bold === void 0 ? {} : { weight: entry3.bold ? "bold" : "normal" },
|
|
6811
|
-
...entry3?.italic === void 0 ? {} : { italic: entry3.italic },
|
|
6812
|
-
...entry3?.underline === void 0 ? {} : { underline: entry3.underline },
|
|
6813
|
-
...entry3?.typeface === void 0 ? {} : { family: cssFontFamily(entry3.typeface) },
|
|
6814
|
-
...entry3?.textShadowFilter === void 0 ? {} : { filter: entry3.textShadowFilter }
|
|
6815
|
-
};
|
|
6816
|
-
}
|
|
6817
|
-
function chartStroke(model, part) {
|
|
6818
|
-
const entry3 = model.appearance?.[part];
|
|
6819
|
-
return {
|
|
6820
|
-
color: entry3?.axisVisible === false ? "none" : entry3?.lineColor ?? (part === "gridlineMajor" ? GRID_COLOR : AXIS_COLOR),
|
|
6821
|
-
width: entry3?.lineWidth === void 0 ? 1 : chartPointsToPixels(entry3.lineWidth)
|
|
6822
|
-
};
|
|
6823
|
-
}
|
|
6824
|
-
function chartAreaRect(model, part, area) {
|
|
6825
|
-
if (area.w <= 0 || area.h <= 0) return "";
|
|
6826
|
-
const entry3 = model.appearance?.[part];
|
|
6827
|
-
let fill = entry3?.fillColor ?? (part === "chartArea" ? "#FFFFFF" : "none");
|
|
6828
|
-
let defs = "";
|
|
6829
|
-
if (part !== "chartArea" && entry3?.gradient && (part !== "plotArea" || ["circle", "shape"].includes(entry3.gradient.path ?? ""))) {
|
|
6830
|
-
const def = buildChartGradientDef(`xlsx-chart-${++nextPaintId}-${part}`, entry3.gradient, {
|
|
6831
|
-
width: area.w,
|
|
6832
|
-
height: area.h,
|
|
6833
|
-
shape: "rect"
|
|
6834
|
-
});
|
|
6835
|
-
defs = `<defs>${chartGradientMarkup(def)}</defs>`;
|
|
6836
|
-
fill = `url(#${def.id})`;
|
|
6837
|
-
}
|
|
6838
|
-
const stroke = entry3?.lineColor ?? "none";
|
|
6839
|
-
if (fill === "none" && stroke === "none") return "";
|
|
6840
|
-
const width = entry3?.lineWidth === void 0 ? 1 : chartPointsToPixels(entry3.lineWidth);
|
|
6841
|
-
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}"/>`;
|
|
6842
|
-
}
|
|
6843
|
-
|
|
6844
7129
|
// chart/render/chart-svg-cartesian.ts
|
|
6845
7130
|
function cartesianAxes(model, area, out) {
|
|
6846
7131
|
const scale = model.valueAxis;
|
|
@@ -6959,6 +7244,7 @@ function linesAndAreas(model, frame2, out) {
|
|
|
6959
7244
|
const stacked = model.grouping === "stacked" || model.grouping === "percentStacked";
|
|
6960
7245
|
const acc = new Array(model.categories.length).fill(0);
|
|
6961
7246
|
const area = model.type === "area";
|
|
7247
|
+
const marks = [];
|
|
6962
7248
|
const layers2 = [];
|
|
6963
7249
|
model.series.forEach((s2, si) => {
|
|
6964
7250
|
const points = [];
|
|
@@ -6973,6 +7259,13 @@ function linesAndAreas(model, frame2, out) {
|
|
|
6973
7259
|
const top = below2 + (v ?? 0);
|
|
6974
7260
|
if (stacked) acc[i2] = top;
|
|
6975
7261
|
points.push([frame2.band(i2), frame2.value(top)]);
|
|
7262
|
+
marks.push({
|
|
7263
|
+
series: s2,
|
|
7264
|
+
index: i2,
|
|
7265
|
+
x: frame2.band(i2),
|
|
7266
|
+
y: frame2.value(top),
|
|
7267
|
+
radius: area ? 0 : 3
|
|
7268
|
+
});
|
|
6976
7269
|
lower.push([frame2.band(i2), frame2.value(below2)]);
|
|
6977
7270
|
});
|
|
6978
7271
|
layers2.push({
|
|
@@ -7005,6 +7298,7 @@ function linesAndAreas(model, frame2, out) {
|
|
|
7005
7298
|
if (!Number.isNaN(x))
|
|
7006
7299
|
out.push(`<circle cx="${n(x)}" cy="${n(y)}" r="2.5" fill="${color}"${filter}/>`);
|
|
7007
7300
|
}
|
|
7301
|
+
pointLabels(model, marks, out);
|
|
7008
7302
|
}
|
|
7009
7303
|
|
|
7010
7304
|
// chart/render/chart-svg-xy.ts
|
|
@@ -7074,6 +7368,7 @@ function scatter(model, area, out) {
|
|
|
7074
7368
|
line(plot.x, plot.y + plot.h, plot.x + plot.w, plot.y + plot.h, xAxis.color, xAxis.width)
|
|
7075
7369
|
);
|
|
7076
7370
|
out.push(line(plot.x, plot.y, plot.x, plot.y + plot.h, yAxis.color, yAxis.width));
|
|
7371
|
+
const marks = [];
|
|
7077
7372
|
for (const [si, s2] of model.series.entries())
|
|
7078
7373
|
s2.values.forEach((v, i2) => {
|
|
7079
7374
|
const x = s2.xValues?.[i2] ?? null;
|
|
@@ -7082,14 +7377,17 @@ function scatter(model, area, out) {
|
|
|
7082
7377
|
const fill = s2.pointColors?.[i2] ?? s2.color;
|
|
7083
7378
|
if (!bubble) {
|
|
7084
7379
|
out.push(`<circle cx="${n(px3(x))}" cy="${n(py(v))}" r="3" fill="${fill}"${filter}/>`);
|
|
7380
|
+
marks.push({ series: s2, index: i2, x: px3(x), y: py(v), radius: 3 });
|
|
7085
7381
|
return;
|
|
7086
7382
|
}
|
|
7087
7383
|
const r = radiusOf(s2.sizes?.[i2] ?? void 0);
|
|
7088
7384
|
if (r === void 0) return;
|
|
7385
|
+
marks.push({ series: s2, index: i2, x: px3(x), y: py(v), radius: r });
|
|
7089
7386
|
out.push(
|
|
7090
7387
|
`<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}/>`
|
|
7091
7388
|
);
|
|
7092
7389
|
});
|
|
7390
|
+
pointLabels(model, marks, out);
|
|
7093
7391
|
scatterAnalysis(model, px3, py, out);
|
|
7094
7392
|
}
|
|
7095
7393
|
|
|
@@ -7254,7 +7552,9 @@ function pieSvg(model, area) {
|
|
|
7254
7552
|
const out = [chartAreaRect(model, "plotArea", area)];
|
|
7255
7553
|
const cx2 = area.x + area.w / 2;
|
|
7256
7554
|
const cy = area.y + area.h / 2;
|
|
7257
|
-
const
|
|
7555
|
+
const margin = hasOutsideLabels(model) ? Math.min(area.w, area.h) * 0.12 : 0;
|
|
7556
|
+
const radius = Math.max(1, Math.min(area.w, area.h) / 2 - 4 - margin);
|
|
7557
|
+
const slices = [];
|
|
7258
7558
|
const rings = model.type === "doughnut" ? model.series : model.series.slice(0, 1);
|
|
7259
7559
|
const hole = model.type === "doughnut" ? radius * 0.5 : 0;
|
|
7260
7560
|
const ringSize = (radius - hole) / Math.max(1, rings.length);
|
|
@@ -7271,9 +7571,20 @@ function pieSvg(model, area) {
|
|
|
7271
7571
|
out.push(
|
|
7272
7572
|
`<path d="${slicePath(cx2, cy, outer, inner, angle, angle + sweep)}" fill="${color}" stroke="#FFFFFF" stroke-width="1"${s2.shadowFilter ? ` filter="${s2.shadowFilter}"` : ""}/>`
|
|
7273
7573
|
);
|
|
7574
|
+
slices.push({
|
|
7575
|
+
series: s2,
|
|
7576
|
+
index: i2,
|
|
7577
|
+
cx: cx2,
|
|
7578
|
+
cy,
|
|
7579
|
+
outer,
|
|
7580
|
+
inner,
|
|
7581
|
+
start: angle,
|
|
7582
|
+
end: angle + sweep
|
|
7583
|
+
});
|
|
7274
7584
|
angle += sweep;
|
|
7275
7585
|
});
|
|
7276
7586
|
});
|
|
7587
|
+
sliceLabels(model, slices, out);
|
|
7277
7588
|
return out.join("");
|
|
7278
7589
|
}
|
|
7279
7590
|
function radarSvg(model, area) {
|
|
@@ -7319,12 +7630,16 @@ function radarSvg(model, area) {
|
|
|
7319
7630
|
})
|
|
7320
7631
|
);
|
|
7321
7632
|
});
|
|
7633
|
+
const marks = [];
|
|
7322
7634
|
for (const s2 of model.series) {
|
|
7323
|
-
const
|
|
7635
|
+
const vertices = s2.values.slice(0, count).map((v, i2) => polar(cx2, cy, r(v ?? scale.min), angle(i2)));
|
|
7636
|
+
vertices.forEach(([x, y], i2) => marks.push({ series: s2, index: i2, x, y, radius: 3 }));
|
|
7637
|
+
const points = vertices.map(([x, y]) => `${n(x)},${n(y)}`).join(" ");
|
|
7324
7638
|
out.push(
|
|
7325
7639
|
`<polygon points="${points}" fill="none" stroke="${s2.color}" stroke-width="2"${s2.shadowFilter ? ` filter="${s2.shadowFilter}"` : ""}/>`
|
|
7326
7640
|
);
|
|
7327
7641
|
}
|
|
7642
|
+
pointLabels(model, marks, out);
|
|
7328
7643
|
return out.join("");
|
|
7329
7644
|
}
|
|
7330
7645
|
|
|
@@ -7576,7 +7891,7 @@ function automaticLegend(model, area, out, options, bounds2) {
|
|
|
7576
7891
|
|
|
7577
7892
|
// text/wrap-styled-runs.ts
|
|
7578
7893
|
var graphemes = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
7579
|
-
function wrapStyledRuns(runs, maxWidth,
|
|
7894
|
+
function wrapStyledRuns(runs, maxWidth, measure4, options = {}) {
|
|
7580
7895
|
const groups = [];
|
|
7581
7896
|
for (const [source, run2] of runs.entries()) {
|
|
7582
7897
|
for (const token of run2.text.split(/(\r\n|[\r\n]|[ \t]+)/u).filter(Boolean)) {
|
|
@@ -7599,7 +7914,7 @@ function wrapStyledRuns(runs, maxWidth, measure3, options = {}) {
|
|
|
7599
7914
|
return result2;
|
|
7600
7915
|
};
|
|
7601
7916
|
const width = (pieces) => pieces.reduce((sum, piece) => {
|
|
7602
|
-
const advance =
|
|
7917
|
+
const advance = measure4(piece.text, piece.run);
|
|
7603
7918
|
return sum + (Number.isFinite(advance) && advance >= 0 ? advance : 0);
|
|
7604
7919
|
}, 0);
|
|
7605
7920
|
const result = [];
|
|
@@ -20790,9 +21105,9 @@ function paragraphsAt(text4, sizePt) {
|
|
|
20790
21105
|
const afterParent = (text4.spaceAfterParent ?? DEFAULT_SPACE_AFTER_PARENT) / 100;
|
|
20791
21106
|
const afterChild = (text4.spaceAfterChild ?? DEFAULT_SPACE_AFTER_CHILD) / 100;
|
|
20792
21107
|
const { secondary } = paragraphSizesPt(text4, sizePt);
|
|
20793
|
-
const paragraph2 = (value,
|
|
20794
|
-
const bullet = bulletLevel > 0 &&
|
|
20795
|
-
const size = bullet ||
|
|
21108
|
+
const paragraph2 = (value, level3) => {
|
|
21109
|
+
const bullet = bulletLevel > 0 && level3 >= bulletLevel;
|
|
21110
|
+
const size = bullet || level3 >= 2 ? secondary : sizePt;
|
|
20796
21111
|
return {
|
|
20797
21112
|
text: value,
|
|
20798
21113
|
size,
|
|
@@ -22226,7 +22541,7 @@ function arrangeHierRoot(node) {
|
|
|
22226
22541
|
}
|
|
22227
22542
|
|
|
22228
22543
|
// diagram/engine/alg-linear.ts
|
|
22229
|
-
function
|
|
22544
|
+
function measure2(node, box, horizontal, scale, uniform = false) {
|
|
22230
22545
|
const refW = horizontal || uniform ? box.w * scale : box.w;
|
|
22231
22546
|
const refH = !horizontal || uniform ? box.h * scale : box.h;
|
|
22232
22547
|
evaluateWithReference(node, refW, refH);
|
|
@@ -22293,7 +22608,7 @@ function fitLinear(node, box, horizontal) {
|
|
|
22293
22608
|
const along = horizontal ? box.w : box.h;
|
|
22294
22609
|
const across = horizontal ? box.h : box.w;
|
|
22295
22610
|
let scale = 1;
|
|
22296
|
-
let current =
|
|
22611
|
+
let current = measure2(node, box, horizontal, scale);
|
|
22297
22612
|
const full = current;
|
|
22298
22613
|
let crossLimited = true;
|
|
22299
22614
|
for (let iteration = 0; iteration < 12; iteration++) {
|
|
@@ -22303,10 +22618,10 @@ function fitLinear(node, box, horizontal) {
|
|
|
22303
22618
|
if (factor >= 0.99999) {
|
|
22304
22619
|
break;
|
|
22305
22620
|
}
|
|
22306
|
-
const next =
|
|
22621
|
+
const next = measure2(node, box, horizontal, scale * factor);
|
|
22307
22622
|
if (factor === fitAcross && next.cross >= current.cross - 1e-6) {
|
|
22308
22623
|
crossLimited = false;
|
|
22309
|
-
current =
|
|
22624
|
+
current = measure2(node, box, horizontal, scale);
|
|
22310
22625
|
continue;
|
|
22311
22626
|
}
|
|
22312
22627
|
scale *= factor;
|
|
@@ -22323,9 +22638,9 @@ function fitLinear(node, box, horizontal) {
|
|
|
22323
22638
|
function fitUniform(node, box, horizontal, stuck) {
|
|
22324
22639
|
const along = horizontal ? box.w : box.h;
|
|
22325
22640
|
let scale = 1;
|
|
22326
|
-
let current =
|
|
22641
|
+
let current = measure2(node, box, horizontal, 1, true);
|
|
22327
22642
|
for (let iteration = 0; iteration < 12 && current.total > along + 1e-3; iteration++) {
|
|
22328
|
-
const next =
|
|
22643
|
+
const next = measure2(node, box, horizontal, scale * (along / current.total), true);
|
|
22329
22644
|
if (next.total >= current.total - 1e-6) {
|
|
22330
22645
|
break;
|
|
22331
22646
|
}
|
|
@@ -22347,7 +22662,7 @@ function refineAlong(node, box, horizontal, scale, current, full, crossLimited)
|
|
|
22347
22662
|
let t1 = current.total;
|
|
22348
22663
|
for (let i2 = 0; i2 < 6 && s1 < 1 && Math.abs(t1 - along) > 1e-3 && Math.abs(t0 - t1) > 1e-9; i2++) {
|
|
22349
22664
|
const next = Math.min(1, Math.max(1e-6, s1 + (along - t1) * (s0 - s1) / (t0 - t1)));
|
|
22350
|
-
const measured =
|
|
22665
|
+
const measured = measure2(node, box, horizontal, next);
|
|
22351
22666
|
if (measured.total > along + 1e-3 || crossLimited && measured.cross > across + 1e-6) {
|
|
22352
22667
|
break;
|
|
22353
22668
|
}
|
|
@@ -22360,7 +22675,7 @@ function refineAlong(node, box, horizontal, scale, current, full, crossLimited)
|
|
|
22360
22675
|
if (best !== current) {
|
|
22361
22676
|
return best;
|
|
22362
22677
|
}
|
|
22363
|
-
return
|
|
22678
|
+
return measure2(node, box, horizontal, scale);
|
|
22364
22679
|
}
|
|
22365
22680
|
function alignOffset(free, align, start, end) {
|
|
22366
22681
|
if (align === start) {
|
|
@@ -22545,7 +22860,7 @@ function contentHeight(cell, w, h2) {
|
|
|
22545
22860
|
cell.values = saved;
|
|
22546
22861
|
return bottom;
|
|
22547
22862
|
}
|
|
22548
|
-
function
|
|
22863
|
+
function measure3(node, box, cells, spacer, row2) {
|
|
22549
22864
|
const cellW = Math.max(...cells.map((c2) => c2.values.get("w") ?? box.w));
|
|
22550
22865
|
const assignedH = Math.max(...cells.map((c2) => c2.values.get("h") ?? box.h));
|
|
22551
22866
|
const cellH = Math.max(...cells.map((c2) => contentHeight(c2, cellW, assignedH)));
|
|
@@ -22580,7 +22895,7 @@ function fitSnakeByRule(node, box, cells, spacers, row2) {
|
|
|
22580
22895
|
const floor = rule.val * POINTS_PER_MM2;
|
|
22581
22896
|
const at2 = (value) => {
|
|
22582
22897
|
evaluateAt(node, box, rule, targets, value);
|
|
22583
|
-
return
|
|
22898
|
+
return measure3(node, box, cells, spacers[0], row2);
|
|
22584
22899
|
};
|
|
22585
22900
|
let best = at2(start);
|
|
22586
22901
|
if (fits2(best, cells.length, box, row2) || !(start > floor)) {
|
|
@@ -22885,7 +23200,7 @@ function depthOf(point) {
|
|
|
22885
23200
|
}
|
|
22886
23201
|
return depth;
|
|
22887
23202
|
}
|
|
22888
|
-
function
|
|
23203
|
+
function level2(depth) {
|
|
22889
23204
|
return Math.max(0, Math.min(MAX_LEVEL, depth));
|
|
22890
23205
|
}
|
|
22891
23206
|
function connectorDim(node) {
|
|
@@ -22899,11 +23214,11 @@ function derivedStyleLabel(node) {
|
|
|
22899
23214
|
switch (point.type) {
|
|
22900
23215
|
case "node":
|
|
22901
23216
|
case "asst":
|
|
22902
|
-
return `node${
|
|
23217
|
+
return `node${level2(depthOf(point))}`;
|
|
22903
23218
|
case "sibTrans":
|
|
22904
23219
|
return `sibTrans${connectorDim(node)}1`;
|
|
22905
23220
|
case "parTrans":
|
|
22906
|
-
return `parChTrans${connectorDim(node)}${
|
|
23221
|
+
return `parChTrans${connectorDim(node)}${level2(depthOf(point))}`;
|
|
22907
23222
|
default:
|
|
22908
23223
|
return void 0;
|
|
22909
23224
|
}
|
|
@@ -29657,18 +29972,18 @@ function fanContinues(t, perRow, orgChart, siblingCount, normalCount) {
|
|
|
29657
29972
|
const spanW = effectiveWidth(t, orgChart);
|
|
29658
29973
|
return chPrefFanEligible || isSoloChainLink && normalCount > 1 && spanW === normalCount;
|
|
29659
29974
|
}
|
|
29660
|
-
function walk2(t,
|
|
29975
|
+
function walk2(t, level3, perRow, orgChart, siblingCount) {
|
|
29661
29976
|
const { normal } = partitionChildren(t, orgChart);
|
|
29662
29977
|
if (normal.length === 0) {
|
|
29663
|
-
return { deepestFanLevel:
|
|
29978
|
+
return { deepestFanLevel: level3, maxHangDepth: 0, maxHangRows: 0, hangingColumns: 0 };
|
|
29664
29979
|
}
|
|
29665
|
-
if (
|
|
29666
|
-
let deepestFan =
|
|
29980
|
+
if (level3 === 0) {
|
|
29981
|
+
let deepestFan = level3;
|
|
29667
29982
|
let maxHang = 0;
|
|
29668
29983
|
let maxRows = 0;
|
|
29669
29984
|
let hangingColumns = 0;
|
|
29670
29985
|
for (const child3 of normal) {
|
|
29671
|
-
const r = walk2(child3,
|
|
29986
|
+
const r = walk2(child3, level3 + 1, perRow, orgChart, normal.length);
|
|
29672
29987
|
deepestFan = Math.max(deepestFan, r.deepestFanLevel);
|
|
29673
29988
|
maxHang = Math.max(maxHang, r.maxHangDepth);
|
|
29674
29989
|
maxRows = Math.max(maxRows, r.maxHangRows);
|
|
@@ -29682,12 +29997,12 @@ function walk2(t, level2, perRow, orgChart, siblingCount) {
|
|
|
29682
29997
|
};
|
|
29683
29998
|
}
|
|
29684
29999
|
if (fanContinues(t, perRow, orgChart, siblingCount, normal.length)) {
|
|
29685
|
-
let deepestFan =
|
|
30000
|
+
let deepestFan = level3 + 1;
|
|
29686
30001
|
let maxHang = 0;
|
|
29687
30002
|
let maxRows = 0;
|
|
29688
30003
|
let hangingColumns = 0;
|
|
29689
30004
|
for (const child3 of normal) {
|
|
29690
|
-
const r = walk2(child3,
|
|
30005
|
+
const r = walk2(child3, level3 + 1, perRow, orgChart, void 0);
|
|
29691
30006
|
deepestFan = Math.max(deepestFan, r.deepestFanLevel);
|
|
29692
30007
|
maxHang = Math.max(maxHang, r.maxHangDepth);
|
|
29693
30008
|
maxRows = Math.max(maxRows, r.maxHangRows);
|
|
@@ -29701,7 +30016,7 @@ function walk2(t, level2, perRow, orgChart, siblingCount) {
|
|
|
29701
30016
|
};
|
|
29702
30017
|
}
|
|
29703
30018
|
return {
|
|
29704
|
-
deepestFanLevel:
|
|
30019
|
+
deepestFanLevel: level3,
|
|
29705
30020
|
maxHangDepth: treeDepth(t) - 1,
|
|
29706
30021
|
maxHangRows: countDescendants(t, orgChart),
|
|
29707
30022
|
hangingColumns: 1
|
|
@@ -29740,20 +30055,20 @@ function computeHangShape(roots2, orgChart, perRow) {
|
|
|
29740
30055
|
}
|
|
29741
30056
|
|
|
29742
30057
|
// diagram/hierarchy/smartart-hierarchy-fan-aware-width.ts
|
|
29743
|
-
function widthWalk(t,
|
|
30058
|
+
function widthWalk(t, level3, perRow, orgChart, siblingCount, map) {
|
|
29744
30059
|
const { normal } = partitionChildren(t, orgChart);
|
|
29745
30060
|
let width;
|
|
29746
30061
|
if (normal.length === 0) {
|
|
29747
30062
|
width = 1;
|
|
29748
|
-
} else if (
|
|
30063
|
+
} else if (level3 === 0) {
|
|
29749
30064
|
width = 0;
|
|
29750
30065
|
for (const child3 of normal) {
|
|
29751
|
-
width += widthWalk(child3,
|
|
30066
|
+
width += widthWalk(child3, level3 + 1, perRow, orgChart, normal.length, map);
|
|
29752
30067
|
}
|
|
29753
30068
|
} else if (fanContinues(t, perRow, orgChart, siblingCount, normal.length)) {
|
|
29754
30069
|
width = 0;
|
|
29755
30070
|
for (const child3 of normal) {
|
|
29756
|
-
width += widthWalk(child3,
|
|
30071
|
+
width += widthWalk(child3, level3 + 1, perRow, orgChart, void 0, map);
|
|
29757
30072
|
}
|
|
29758
30073
|
} else {
|
|
29759
30074
|
width = 1;
|
|
@@ -29947,7 +30262,7 @@ function placeAssistants(hc, x, parentBottom, assistants, options, cursor) {
|
|
|
29947
30262
|
stubConnector(hc, assistant.node.id, x + hc.boxH / 2, parentBottom, x + width / 2, y);
|
|
29948
30263
|
}
|
|
29949
30264
|
}
|
|
29950
|
-
function placeHangingTree(hc, t, x, options, cursor, size,
|
|
30265
|
+
function placeHangingTree(hc, t, x, options, cursor, size, level3 = 0) {
|
|
29951
30266
|
const y = cursor.y;
|
|
29952
30267
|
const boxW = size?.w ?? hc.boxW;
|
|
29953
30268
|
const boxH = size?.h ?? hc.boxH;
|
|
@@ -29960,7 +30275,7 @@ function placeHangingTree(hc, t, x, options, cursor, size, level2 = 0) {
|
|
|
29960
30275
|
if (normal.length === 0) {
|
|
29961
30276
|
return;
|
|
29962
30277
|
}
|
|
29963
|
-
if (options.foldDeeperGenerations &&
|
|
30278
|
+
if (options.foldDeeperGenerations && level3 >= 1) {
|
|
29964
30279
|
return;
|
|
29965
30280
|
}
|
|
29966
30281
|
const childX = align ? placeX : options.direction === "left" ? x - options.indent : x + options.indent;
|
|
@@ -29975,7 +30290,7 @@ function placeHangingTree(hc, t, x, options, cursor, size, level2 = 0) {
|
|
|
29975
30290
|
childY,
|
|
29976
30291
|
child3.node.id
|
|
29977
30292
|
);
|
|
29978
|
-
placeHangingTree(hc, child3, childX, options, cursor, void 0,
|
|
30293
|
+
placeHangingTree(hc, child3, childX, options, cursor, void 0, level3 + 1);
|
|
29979
30294
|
}
|
|
29980
30295
|
}
|
|
29981
30296
|
function placeHangingForest(hc, roots2, startX, startY, options, rootSize) {
|
|
@@ -30048,17 +30363,17 @@ function fitHangingBox(view, algorithmNode, index, w, h2, rows, nodeCount, presL
|
|
|
30048
30363
|
}
|
|
30049
30364
|
|
|
30050
30365
|
// diagram/hierarchy/smartart-hierarchy-hanging-fold.ts
|
|
30051
|
-
function countRows(t,
|
|
30366
|
+
function countRows(t, level3, orgChart, fold) {
|
|
30052
30367
|
const { assistants, normal } = partitionChildren(t, orgChart);
|
|
30053
30368
|
let count = 1 + assistants.length;
|
|
30054
30369
|
if (normal.length === 0) {
|
|
30055
30370
|
return count;
|
|
30056
30371
|
}
|
|
30057
|
-
if (fold &&
|
|
30372
|
+
if (fold && level3 >= 1) {
|
|
30058
30373
|
return count;
|
|
30059
30374
|
}
|
|
30060
30375
|
for (const child3 of normal) {
|
|
30061
|
-
count += countRows(child3,
|
|
30376
|
+
count += countRows(child3, level3 + 1, orgChart, fold);
|
|
30062
30377
|
}
|
|
30063
30378
|
return count;
|
|
30064
30379
|
}
|
|
@@ -30615,8 +30930,8 @@ function planFan(childCount, perRow, siblingCxs) {
|
|
|
30615
30930
|
}
|
|
30616
30931
|
return { columns: siblingCxs, overflow: childCount - siblingCxs.length };
|
|
30617
30932
|
}
|
|
30618
|
-
function placeFannedRow(hc, t, normal, plan, cx2, cy,
|
|
30619
|
-
const fanCy = (
|
|
30933
|
+
function placeFannedRow(hc, t, normal, plan, cx2, cy, level3, cellW, cellH, options, placeAtFn) {
|
|
30934
|
+
const fanCy = (level3 + 1) * cellH + cellH / 2;
|
|
30620
30935
|
const fanned = normal.slice(0, plan.columns.length);
|
|
30621
30936
|
for (let i2 = 0; i2 < fanned.length; i2++) {
|
|
30622
30937
|
const child3 = fanned[i2];
|
|
@@ -30630,7 +30945,7 @@ function placeFannedRow(hc, t, normal, plan, cx2, cy, level2, cellW, cellH, opti
|
|
|
30630
30945
|
fanCy - hc.boxH / 2,
|
|
30631
30946
|
child3.node.id
|
|
30632
30947
|
);
|
|
30633
|
-
placeAtFn(hc, child3, childCx, fanCy, 0, 1,
|
|
30948
|
+
placeAtFn(hc, child3, childCx, fanCy, 0, 1, level3 + 1, cellW, cellH, options);
|
|
30634
30949
|
}
|
|
30635
30950
|
if (plan.overflow <= 0 || !options.hangingPlacer) {
|
|
30636
30951
|
return;
|
|
@@ -30638,7 +30953,7 @@ function placeFannedRow(hc, t, normal, plan, cx2, cy, level2, cellW, cellH, opti
|
|
|
30638
30953
|
const remainder = normal.slice(plan.columns.length);
|
|
30639
30954
|
const columnOffset = hc.boxW * HIER_TAIL_OFFSET_RATIO;
|
|
30640
30955
|
const anchorX = plan.columns[0] - hc.boxW / 2 + columnOffset;
|
|
30641
|
-
const anchorY = (
|
|
30956
|
+
const anchorY = (level3 + 2) * cellH;
|
|
30642
30957
|
for (const child3 of remainder) {
|
|
30643
30958
|
elbowConnector(
|
|
30644
30959
|
hc,
|
|
@@ -30675,7 +30990,7 @@ function placeAssistantRow(hc, parentId, cx2, cy, assistants) {
|
|
|
30675
30990
|
x += assistW + ASSISTANT_GAP;
|
|
30676
30991
|
}
|
|
30677
30992
|
}
|
|
30678
|
-
function placeFlatChildren(hc, parentId, normal, cx2, cy, xOffset,
|
|
30993
|
+
function placeFlatChildren(hc, parentId, normal, cx2, cy, xOffset, level3, cellW, cellH, options, placeChild) {
|
|
30679
30994
|
const siblingCxs = [];
|
|
30680
30995
|
{
|
|
30681
30996
|
let offset = xOffset;
|
|
@@ -30685,12 +31000,12 @@ function placeFlatChildren(hc, parentId, normal, cx2, cy, xOffset, level2, cellW
|
|
|
30685
31000
|
offset += childW;
|
|
30686
31001
|
}
|
|
30687
31002
|
}
|
|
30688
|
-
const cascadeShift = options.cascadeOffsetX &&
|
|
31003
|
+
const cascadeShift = options.cascadeOffsetX && level3 + 1 >= options.cascadeOffsetX.fromLevel ? options.cascadeOffsetX.offsetPx : 0;
|
|
30689
31004
|
let childOffset = xOffset;
|
|
30690
31005
|
for (const child3 of normal) {
|
|
30691
31006
|
const childW = spanOf(child3, options);
|
|
30692
31007
|
const childCx = (childOffset + childW / 2) * cellW + cascadeShift;
|
|
30693
|
-
const childCy = (
|
|
31008
|
+
const childCy = (level3 + 1) * cellH + cellH / 2;
|
|
30694
31009
|
elbowConnector(
|
|
30695
31010
|
hc,
|
|
30696
31011
|
parentId,
|
|
@@ -30707,7 +31022,7 @@ function placeFlatChildren(hc, parentId, normal, cx2, cy, xOffset, level2, cellW
|
|
|
30707
31022
|
childCy,
|
|
30708
31023
|
childOffset,
|
|
30709
31024
|
childW,
|
|
30710
|
-
|
|
31025
|
+
level3 + 1,
|
|
30711
31026
|
cellW,
|
|
30712
31027
|
cellH,
|
|
30713
31028
|
options,
|
|
@@ -30733,13 +31048,13 @@ function wrappedGroupSlotCount(group2, orgChart) {
|
|
|
30733
31048
|
}
|
|
30734
31049
|
return group2.members.reduce((sum, m) => sum + effectiveWidth(m, orgChart), 0);
|
|
30735
31050
|
}
|
|
30736
|
-
function placeWrappedChildren(hc, parentId, normal, cx2, cy, xOffset, spanW,
|
|
31051
|
+
function placeWrappedChildren(hc, parentId, normal, cx2, cy, xOffset, spanW, level3, cellW, cellH, options, placeAtFn) {
|
|
30737
31052
|
const groups = planWrappedGroups(normal, options.perRow, options.orgChart);
|
|
30738
31053
|
const totalSlots = groups.reduce((sum, g2) => sum + wrappedGroupSlotCount(g2, options.orgChart), 0);
|
|
30739
31054
|
const totalW = spanW * cellW;
|
|
30740
31055
|
const leftX = xOffset * cellW;
|
|
30741
31056
|
const unitW = totalW / Math.max(1, totalSlots);
|
|
30742
|
-
const rowCy = (
|
|
31057
|
+
const rowCy = (level3 + 1) * cellH + cellH / 2;
|
|
30743
31058
|
let slot2 = 0;
|
|
30744
31059
|
for (const group2 of groups) {
|
|
30745
31060
|
slot2 = group2.fansAsRow ? placeRowFanGroup(
|
|
@@ -30752,7 +31067,7 @@ function placeWrappedChildren(hc, parentId, normal, cx2, cy, xOffset, spanW, lev
|
|
|
30752
31067
|
unitW,
|
|
30753
31068
|
slot2,
|
|
30754
31069
|
rowCy,
|
|
30755
|
-
|
|
31070
|
+
level3,
|
|
30756
31071
|
cellW,
|
|
30757
31072
|
cellH,
|
|
30758
31073
|
options,
|
|
@@ -30769,25 +31084,25 @@ function placeWrappedChildren(hc, parentId, normal, cx2, cy, xOffset, spanW, lev
|
|
|
30769
31084
|
rowCy,
|
|
30770
31085
|
cellW,
|
|
30771
31086
|
cellH,
|
|
30772
|
-
|
|
31087
|
+
level3,
|
|
30773
31088
|
options,
|
|
30774
31089
|
placeAtFn
|
|
30775
31090
|
);
|
|
30776
31091
|
}
|
|
30777
31092
|
}
|
|
30778
|
-
function placeRowFanGroup(hc, parentId, group2, cx2, cy, leftX, unitW, slot2, rowCy,
|
|
31093
|
+
function placeRowFanGroup(hc, parentId, group2, cx2, cy, leftX, unitW, slot2, rowCy, level3, cellW, cellH, options, placeAtFn) {
|
|
30779
31094
|
let cursor = slot2;
|
|
30780
31095
|
for (const child3 of group2.members) {
|
|
30781
31096
|
const childW = effectiveWidth(child3, options.orgChart);
|
|
30782
31097
|
const childCx = leftX + unitW * (cursor + childW / 2);
|
|
30783
31098
|
elbowConnector(hc, parentId, cx2, cy + hc.boxH / 2, childCx, rowCy - hc.boxH / 2, child3.node.id);
|
|
30784
31099
|
const virtualOffset = childCx / cellW - childW / 2;
|
|
30785
|
-
placeAtFn(hc, child3, childCx, rowCy, virtualOffset, childW,
|
|
31100
|
+
placeAtFn(hc, child3, childCx, rowCy, virtualOffset, childW, level3 + 1, cellW, cellH, options);
|
|
30786
31101
|
cursor += childW;
|
|
30787
31102
|
}
|
|
30788
31103
|
return cursor;
|
|
30789
31104
|
}
|
|
30790
|
-
function placeColumnGroup(hc, parentId, group2, cx2, cy, leftX, unitW, slot2, rowCy, cellW, cellH,
|
|
31105
|
+
function placeColumnGroup(hc, parentId, group2, cx2, cy, leftX, unitW, slot2, rowCy, cellW, cellH, level3, options, placeAtFn) {
|
|
30791
31106
|
const groupCx = leftX + unitW * (slot2 + 0.5);
|
|
30792
31107
|
const subRowH = cellH / group2.members.length;
|
|
30793
31108
|
let fromId = parentId;
|
|
@@ -30799,7 +31114,7 @@ function placeColumnGroup(hc, parentId, group2, cx2, cy, leftX, unitW, slot2, ro
|
|
|
30799
31114
|
elbowConnector(hc, fromId, fromX, fromY, groupCx, childCy - hc.boxH / 2, child3.node.id);
|
|
30800
31115
|
const childW = effectiveWidth(child3, options.orgChart);
|
|
30801
31116
|
const virtualOffset = groupCx / cellW - childW / 2;
|
|
30802
|
-
placeAtFn(hc, child3, groupCx, childCy, virtualOffset, childW,
|
|
31117
|
+
placeAtFn(hc, child3, groupCx, childCy, virtualOffset, childW, level3 + 1, cellW, cellH, options);
|
|
30803
31118
|
fromId = child3.node.id;
|
|
30804
31119
|
fromX = groupCx;
|
|
30805
31120
|
fromY = childCy + hc.boxH / 2;
|
|
@@ -30808,7 +31123,7 @@ function placeColumnGroup(hc, parentId, group2, cx2, cy, leftX, unitW, slot2, ro
|
|
|
30808
31123
|
}
|
|
30809
31124
|
|
|
30810
31125
|
// diagram/hierarchy/smartart-hierarchy-standard.ts
|
|
30811
|
-
function placeFlatChildren2(hc, parentId, normal, cx2, cy, xOffset,
|
|
31126
|
+
function placeFlatChildren2(hc, parentId, normal, cx2, cy, xOffset, level3, cellW, cellH, options) {
|
|
30812
31127
|
placeFlatChildren(
|
|
30813
31128
|
hc,
|
|
30814
31129
|
parentId,
|
|
@@ -30816,14 +31131,14 @@ function placeFlatChildren2(hc, parentId, normal, cx2, cy, xOffset, level2, cell
|
|
|
30816
31131
|
cx2,
|
|
30817
31132
|
cy,
|
|
30818
31133
|
xOffset,
|
|
30819
|
-
|
|
31134
|
+
level3,
|
|
30820
31135
|
cellW,
|
|
30821
31136
|
cellH,
|
|
30822
31137
|
options,
|
|
30823
31138
|
placeAt
|
|
30824
31139
|
);
|
|
30825
31140
|
}
|
|
30826
|
-
function placeWrappedChildren2(hc, parentId, normal, cx2, cy, xOffset, spanW,
|
|
31141
|
+
function placeWrappedChildren2(hc, parentId, normal, cx2, cy, xOffset, spanW, level3, cellW, cellH, options) {
|
|
30827
31142
|
placeWrappedChildren(
|
|
30828
31143
|
hc,
|
|
30829
31144
|
parentId,
|
|
@@ -30832,32 +31147,32 @@ function placeWrappedChildren2(hc, parentId, normal, cx2, cy, xOffset, spanW, le
|
|
|
30832
31147
|
cy,
|
|
30833
31148
|
xOffset,
|
|
30834
31149
|
spanW,
|
|
30835
|
-
|
|
31150
|
+
level3,
|
|
30836
31151
|
cellW,
|
|
30837
31152
|
cellH,
|
|
30838
31153
|
options,
|
|
30839
31154
|
placeAt
|
|
30840
31155
|
);
|
|
30841
31156
|
}
|
|
30842
|
-
function placeAt(hc, t, cx2, cy, xOffset, spanW,
|
|
31157
|
+
function placeAt(hc, t, cx2, cy, xOffset, spanW, level3, cellW, cellH, options, siblingCxs) {
|
|
30843
31158
|
pushNode(hc, t.node, cx2 - hc.boxW / 2, cy - hc.boxH / 2);
|
|
30844
31159
|
const { assistants, normal } = partitionChildren(t, options.orgChart);
|
|
30845
31160
|
placeAssistantRow(hc, t.node.id, cx2, cy, assistants);
|
|
30846
31161
|
if (normal.length === 0) {
|
|
30847
31162
|
return;
|
|
30848
31163
|
}
|
|
30849
|
-
if (options.foldDeeperGenerations &&
|
|
31164
|
+
if (options.foldDeeperGenerations && level3 >= 1) {
|
|
30850
31165
|
return;
|
|
30851
31166
|
}
|
|
30852
|
-
if (options.hangingPlacer &&
|
|
31167
|
+
if (options.hangingPlacer && level3 >= 1) {
|
|
30853
31168
|
const plan = planFan(normal.length, options.perRow, siblingCxs);
|
|
30854
31169
|
if (plan) {
|
|
30855
|
-
placeFannedRow(hc, t, normal, plan, cx2, cy,
|
|
31170
|
+
placeFannedRow(hc, t, normal, plan, cx2, cy, level3, cellW, cellH, options, placeAt);
|
|
30856
31171
|
return;
|
|
30857
31172
|
}
|
|
30858
31173
|
const isSoloChainLink = !siblingCxs || siblingCxs.length === 1;
|
|
30859
31174
|
if (isSoloChainLink && normal.length > 1 && spanW === normal.length) {
|
|
30860
|
-
placeFlatChildren2(hc, t.node.id, normal, cx2, cy, xOffset,
|
|
31175
|
+
placeFlatChildren2(hc, t.node.id, normal, cx2, cy, xOffset, level3, cellW, cellH, options);
|
|
30861
31176
|
return;
|
|
30862
31177
|
}
|
|
30863
31178
|
const anchorY = cy + hc.boxH / 2 + (options.hangHeightRatio ?? HANG_HEIGHT_RATIO) * hc.boxH;
|
|
@@ -30885,21 +31200,21 @@ function placeAt(hc, t, cx2, cy, xOffset, spanW, level2, cellW, cellH, options,
|
|
|
30885
31200
|
cy,
|
|
30886
31201
|
xOffset,
|
|
30887
31202
|
spanW,
|
|
30888
|
-
|
|
31203
|
+
level3,
|
|
30889
31204
|
cellW,
|
|
30890
31205
|
cellH,
|
|
30891
31206
|
options
|
|
30892
31207
|
);
|
|
30893
31208
|
} else {
|
|
30894
|
-
placeFlatChildren2(hc, t.node.id, normal, cx2, cy, xOffset,
|
|
31209
|
+
placeFlatChildren2(hc, t.node.id, normal, cx2, cy, xOffset, level3, cellW, cellH, options);
|
|
30895
31210
|
}
|
|
30896
31211
|
}
|
|
30897
|
-
function placeStandardTree(hc, t, xOffset,
|
|
31212
|
+
function placeStandardTree(hc, t, xOffset, level3, cellW, cellH, options) {
|
|
30898
31213
|
const spanW = spanOf(t, options);
|
|
30899
|
-
const cascadeShift = options.cascadeOffsetX &&
|
|
31214
|
+
const cascadeShift = options.cascadeOffsetX && level3 >= options.cascadeOffsetX.fromLevel ? options.cascadeOffsetX.offsetPx : 0;
|
|
30900
31215
|
const cx2 = (xOffset + spanW / 2) * cellW + cascadeShift;
|
|
30901
|
-
const cy =
|
|
30902
|
-
placeAt(hc, t, cx2, cy, xOffset, spanW,
|
|
31216
|
+
const cy = level3 * cellH + cellH / 2;
|
|
31217
|
+
placeAt(hc, t, cx2, cy, xOffset, spanW, level3, cellW, cellH, options);
|
|
30903
31218
|
}
|
|
30904
31219
|
|
|
30905
31220
|
// diagram/hierarchy/smartart-hierarchy-tailed-placer.ts
|
|
@@ -42702,8 +43017,8 @@ function layers(ids, forward, shortest) {
|
|
|
42702
43017
|
}
|
|
42703
43018
|
const result = [];
|
|
42704
43019
|
for (const id of ids) {
|
|
42705
|
-
const
|
|
42706
|
-
(result[
|
|
43020
|
+
const level3 = rank.get(id) ?? 0;
|
|
43021
|
+
(result[level3] ??= []).push(id);
|
|
42707
43022
|
}
|
|
42708
43023
|
return result.filter((layer) => layer.length);
|
|
42709
43024
|
}
|