ooxml-core 1.44.0 → 1.46.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-FZ43IJFP.mjs +5 -0
- package/dist/{PptxHandler-3VAVJDFB.mjs → PptxHandler-HWEOIHEA.mjs} +2 -2
- package/dist/PptxHandler-XAUKKK36.cjs +14 -0
- package/dist/{PresentationBuilder-KHL6GONR.cjs → PresentationBuilder-2BCCMZW7.cjs} +6 -6
- package/dist/{PresentationBuilder-7LJMTRJ6.mjs → PresentationBuilder-66RV4F45.mjs} +2 -2
- package/dist/{PresentationBuilder-PY2GB4IG.mjs → PresentationBuilder-AFD72LIG.mjs} +3 -3
- package/dist/automation/index.cjs +22 -8
- package/dist/automation/index.mjs +22 -8
- package/dist/chart/edit/fill.d.ts +6 -2
- package/dist/chart/edit/fill.d.ts.map +1 -1
- package/dist/chart/edit/group-options.d.ts +4 -0
- package/dist/chart/edit/group-options.d.ts.map +1 -1
- package/dist/chart/edit/new-chart-minimal.d.ts +13 -0
- package/dist/chart/edit/new-chart-minimal.d.ts.map +1 -0
- package/dist/chart/edit/new-chart.d.ts +34 -1
- package/dist/chart/edit/new-chart.d.ts.map +1 -1
- package/dist/chart/edit/secondary-axis.d.ts +8 -1
- package/dist/chart/edit/secondary-axis.d.ts.map +1 -1
- package/dist/chart/edit/type.d.ts +2 -0
- package/dist/chart/edit/type.d.ts.map +1 -1
- package/dist/chart/index.cjs +426 -266
- package/dist/chart/index.mjs +424 -267
- package/dist/{chunk-3J6VIKLP.cjs → chunk-5TOVSCVT.cjs} +3 -3
- package/dist/{chunk-4LEVL6ZW.mjs → chunk-E2TTMUKU.mjs} +681 -142
- package/dist/{chunk-7T3SJQA6.cjs → chunk-E5TGYYKO.cjs} +1 -0
- package/dist/{chunk-VKFKEVHK.mjs → chunk-EI6555OK.mjs} +1 -1
- package/dist/{chunk-R7NS42KQ.mjs → chunk-FKU2Z6ZB.mjs} +1 -1
- package/dist/{chunk-243ZYX2B.mjs → chunk-G6LEU3Y5.mjs} +1 -1
- package/dist/{chunk-JHYU7HGG.mjs → chunk-H43QQVJU.mjs} +1 -1
- package/dist/{chunk-HLYOHD2Z.mjs → chunk-HH3AYM63.mjs} +664 -146
- package/dist/{chunk-RNZQ2OU4.cjs → chunk-IBRV3AK3.cjs} +1930 -1412
- package/dist/{chunk-WEAWSXUX.mjs → chunk-L6MJGE3Q.mjs} +4 -4
- package/dist/{chunk-IPV3J3I5.mjs → chunk-LXVE2VKR.mjs} +4 -1
- package/dist/{chunk-QZPOPUI5.cjs → chunk-QUAFASFC.cjs} +4 -0
- package/dist/{chunk-XTUX5RMG.cjs → chunk-T4BVZTII.cjs} +9 -9
- package/dist/{chunk-KCDLTVUI.mjs → chunk-X2DC7XRL.mjs} +17 -16
- package/dist/{chunk-OORQCSVA.mjs → chunk-ZLUHU2SU.mjs} +1 -0
- package/dist/docx/index.cjs +300 -144
- package/dist/docx/index.mjs +300 -144
- package/dist/index.cjs +496 -336
- package/dist/index.mjs +496 -336
- package/dist/pptx/automation/index.cjs +879 -310
- package/dist/pptx/automation/index.d.ts +6 -6
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{elements-PBugbKtv.d.ts → elements-B4Z6N-Gz.d.ts} +4 -477
- package/dist/pptx/chunks/elements-B4Z6N-Gz.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-CCJiD-Bm.d.ts → index-BPGaFlm5.d.ts} +6 -6
- package/dist/pptx/chunks/{index-CCJiD-Bm.d.ts.map → index-BPGaFlm5.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-Bj-hur0D.d.ts → index-D4-WJQ1r.d.ts} +4 -4
- package/dist/pptx/chunks/{index-Bj-hur0D.d.ts.map → index-D4-WJQ1r.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-CGNb1TV9.d.ts → index-DtFoPmk7.d.ts} +108 -10
- package/dist/pptx/chunks/index-DtFoPmk7.d.ts.map +1 -0
- package/dist/pptx/chunks/{table-C7ITXL3Y.d.ts → table-BfgZfw5R.d.ts} +488 -4
- package/dist/pptx/chunks/table-BfgZfw5R.d.ts.map +1 -0
- package/dist/pptx/chunks/{text-operations-BNJr7aGa.d.ts → text-operations-CVHXOSit.d.ts} +19 -4
- package/dist/pptx/chunks/{text-operations-BNJr7aGa.d.ts.map → text-operations-CVHXOSit.d.ts.map} +1 -1
- package/dist/pptx/cli/index.cjs +832 -263
- package/dist/pptx/cli/index.d.ts +1 -1
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.cjs +1 -0
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/collaboration-live-patch-target.cjs +4 -4
- package/dist/pptx/editor/render/collaboration-live-patch-target.mjs +2 -2
- package/dist/pptx/editor/render/collaboration-reconcile.cjs +8 -8
- package/dist/pptx/editor/render/collaboration-reconcile.mjs +2 -2
- package/dist/pptx/editor/render/collaboration-sync.cjs +14 -14
- package/dist/pptx/editor/render/collaboration-sync.d.ts.map +1 -1
- package/dist/pptx/editor/render/collaboration-sync.mjs +1 -1
- package/dist/pptx/editor/render/custom-show-operations.cjs +2 -2
- package/dist/pptx/editor/render/custom-show-operations.mjs +1 -1
- package/dist/pptx/editor/render/find-replace.cjs +15 -15
- package/dist/pptx/editor/render/find-replace.d.ts +2 -2
- package/dist/pptx/editor/render/find-replace.mjs +2 -2
- package/dist/pptx/editor/render/slide-operations.cjs +9 -9
- package/dist/pptx/editor/render/slide-operations.mjs +3 -3
- package/dist/pptx/editor/render/table-layout.d.ts +1 -1
- package/dist/pptx/editor/render/text-runs-style-patch.d.ts +1 -1
- package/dist/pptx/editor/render/text-style-scope.d.ts +1 -1
- package/dist/pptx/index.cjs +909 -315
- package/dist/pptx/index.d.ts +7 -7
- package/dist/pptx/index.mjs +5 -5
- package/dist/pptx/node/index.d.ts +1 -1
- package/dist/xlsx/index.cjs +22 -8
- package/dist/xlsx/index.mjs +22 -8
- package/dist/xlsx/ui/index.cjs +22 -8
- package/dist/xlsx/ui/index.mjs +22 -8
- package/package.json +1 -1
- package/dist/PptxHandler-V23RDNEX.cjs +0 -14
- package/dist/PptxHandler-WB3KL2WH.mjs +0 -5
- package/dist/pptx/chunks/elements-PBugbKtv.d.ts.map +0 -1
- package/dist/pptx/chunks/index-CGNb1TV9.d.ts.map +0 -1
- package/dist/pptx/chunks/table-C7ITXL3Y.d.ts.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -771,6 +771,7 @@ __export(chart_exports, {
|
|
|
771
771
|
applyLabelManualLayout: () => applyLabelManualLayout,
|
|
772
772
|
applyStandardChartLayout: () => applyStandardChartLayout,
|
|
773
773
|
assertBarClusterOptions: () => assertBarClusterOptions,
|
|
774
|
+
assertChartGroupOption: () => assertChartGroupOption,
|
|
774
775
|
assertChartPercent: () => assertChartPercent,
|
|
775
776
|
assignOrDelete: () => assignOrDelete,
|
|
776
777
|
autoSeriesColor: () => autoSeriesColor,
|
|
@@ -826,6 +827,7 @@ __export(chart_exports, {
|
|
|
826
827
|
chartFormatTargetKey: () => chartFormatTargetKey,
|
|
827
828
|
chartGradientMarkup: () => chartGradientMarkup,
|
|
828
829
|
chartGradientStopTransparency: () => chartGradientStopTransparency,
|
|
830
|
+
chartGroupElement: () => chartGroupElement,
|
|
829
831
|
chartGroupHasAxes: () => groupHasAxes,
|
|
830
832
|
chartGroupPaintsLine: () => chartGroupPaintsLine,
|
|
831
833
|
chartIssuesLostOnWrite: () => chartIssuesLostOnWrite,
|
|
@@ -948,6 +950,7 @@ __export(chart_exports, {
|
|
|
948
950
|
hydrateChartExSpace: () => hydrateChartExSpace,
|
|
949
951
|
impliesAutoTitle: () => impliesAutoTitle,
|
|
950
952
|
isChartExRoot: () => isChartExRoot,
|
|
953
|
+
isChartGroupOption: () => isChartGroupOption,
|
|
951
954
|
isChartexOnlyType: () => isChartexOnlyType,
|
|
952
955
|
isEmbeddedXlsxPart: () => isEmbeddedXlsxPart,
|
|
953
956
|
isXYChartKind: () => isXYChartKind,
|
|
@@ -4964,9 +4967,9 @@ function writeChartAxisFormatting(root, formatting) {
|
|
|
4964
4967
|
const previous = readChartFormatting(root);
|
|
4965
4968
|
let changed = false;
|
|
4966
4969
|
for (const part of ["categoryAxis", "valueAxis"]) {
|
|
4967
|
-
const
|
|
4970
|
+
const axis2 = nodes[part];
|
|
4968
4971
|
const entry3 = formatting.entries[part];
|
|
4969
|
-
if (!
|
|
4972
|
+
if (!axis2 || !entry3) continue;
|
|
4970
4973
|
for (const [name2, flag, value, successors] of [
|
|
4971
4974
|
[
|
|
4972
4975
|
"delete",
|
|
@@ -5014,17 +5017,17 @@ function writeChartAxisFormatting(root, formatting) {
|
|
|
5014
5017
|
const key = name2 === "delete" ? "axisVisible" : "labelsVisible";
|
|
5015
5018
|
const revealingAxis = name2 === "tickLblPos" && entry3.axisVisible === true && previous?.entries[part]?.axisVisible === false;
|
|
5016
5019
|
if (flag === previous?.entries[part]?.[key] && !revealingAxis) continue;
|
|
5017
|
-
let node = first(
|
|
5020
|
+
let node = first(axis2, name2, NS.c);
|
|
5018
5021
|
const old = node?.getAttribute("val");
|
|
5019
5022
|
if (name2 === "delete" && old !== void 0 && old !== null && (flag && (old === "0" || old === "false") || !flag && (old === "1" || old === "true")))
|
|
5020
5023
|
continue;
|
|
5021
5024
|
if (name2 === "tickLblPos" && node && (flag ? old !== "none" : old === "none")) continue;
|
|
5022
5025
|
if (!node) {
|
|
5023
5026
|
node = root.ownerDocument.createElementNS(NS.c, "c:" + name2);
|
|
5024
|
-
const before = elements(
|
|
5027
|
+
const before = elements(axis2).find(
|
|
5025
5028
|
(child6) => child6.namespaceURI === NS.c && successors.includes(child6.localName)
|
|
5026
5029
|
);
|
|
5027
|
-
|
|
5030
|
+
axis2.insertBefore(node, before ?? null);
|
|
5028
5031
|
}
|
|
5029
5032
|
node.setAttribute("val", value);
|
|
5030
5033
|
changed = true;
|
|
@@ -6443,8 +6446,8 @@ function parseGroup(context, element4) {
|
|
|
6443
6446
|
element: element4.localName,
|
|
6444
6447
|
is3D,
|
|
6445
6448
|
series: children(element4, "ser", NS.c).map((ser) => parseSeries(context, ser)),
|
|
6446
|
-
axisIds: children(element4, "axId", NS.c).flatMap((
|
|
6447
|
-
const raw2 = attribute(
|
|
6449
|
+
axisIds: children(element4, "axId", NS.c).flatMap((axis2) => {
|
|
6450
|
+
const raw2 = attribute(axis2, "val")?.trim();
|
|
6448
6451
|
const id = raw2 ? Number(raw2) : Number.NaN;
|
|
6449
6452
|
return Number.isFinite(id) ? [id] : [];
|
|
6450
6453
|
})
|
|
@@ -6593,9 +6596,9 @@ function parsePlotArea(context, element4) {
|
|
|
6593
6596
|
plotArea.groups.push(parseGroup(context, child6));
|
|
6594
6597
|
handled.add(child6.localName);
|
|
6595
6598
|
}
|
|
6596
|
-
const
|
|
6597
|
-
if (
|
|
6598
|
-
plotArea.axes.push(parseAxis(context, child6,
|
|
6599
|
+
const axis2 = AXIS_ELEMENTS[child6.localName];
|
|
6600
|
+
if (axis2) {
|
|
6601
|
+
plotArea.axes.push(parseAxis(context, child6, axis2));
|
|
6599
6602
|
handled.add(child6.localName);
|
|
6600
6603
|
}
|
|
6601
6604
|
}
|
|
@@ -7149,14 +7152,14 @@ var AXIS_ELEMENTS2 = {
|
|
|
7149
7152
|
ser: "serAx"
|
|
7150
7153
|
};
|
|
7151
7154
|
var gridlinesXml = (context, local, present2, shape) => present2 ? elementXml(local, shapePropertiesXml(context, shape)) : "";
|
|
7152
|
-
function axisXml(context,
|
|
7153
|
-
const { scaling } =
|
|
7155
|
+
function axisXml(context, axis2) {
|
|
7156
|
+
const { scaling } = axis2;
|
|
7154
7157
|
return elementXml(
|
|
7155
|
-
AXIS_ELEMENTS2[
|
|
7156
|
-
valXml("axId",
|
|
7158
|
+
AXIS_ELEMENTS2[axis2.kind],
|
|
7159
|
+
valXml("axId", axis2.id) + elementXml(
|
|
7157
7160
|
"scaling",
|
|
7158
7161
|
valXml("logBase", scaling.logBase) + valXml("orientation", scaling.orientation) + valXml("max", scaling.max) + valXml("min", scaling.min)
|
|
7159
|
-
) + valXml("delete",
|
|
7162
|
+
) + valXml("delete", axis2.deleted) + valXml("axPos", axis2.position) + gridlinesXml(context, "majorGridlines", axis2.majorGridlines, axis2.majorGridlinesSpPr) + gridlinesXml(context, "minorGridlines", axis2.minorGridlines, axis2.minorGridlinesSpPr) + titleXml(context, axis2.title) + numberFormatXml(axis2.numberFormat) + valXml("majorTickMark", axis2.majorTickMark) + valXml("minorTickMark", axis2.minorTickMark) + valXml("tickLblPos", axis2.tickLabelPosition) + shapePropertiesXml(context, axis2.spPr) + textBodyXml(context, axis2.txPr) + valXml("crossAx", axis2.crossAxisId) + valXml("crosses", axis2.crosses) + valXml("crossesAt", axis2.crossesAt) + valXml("crossBetween", axis2.crossBetween) + valXml("auto", axis2.auto) + valXml("lblAlgn", axis2.labelAlign) + valXml("lblOffset", axis2.labelOffset) + valXml("baseTimeUnit", axis2.baseTimeUnit) + valXml("majorUnit", axis2.majorUnit) + valXml("majorTimeUnit", axis2.majorTimeUnit) + valXml("minorUnit", axis2.minorUnit) + valXml("minorTimeUnit", axis2.minorTimeUnit) + displayUnitsXml(context, axis2.displayUnits) + valXml("tickLblSkip", axis2.tickLabelSkip) + valXml("tickMarkSkip", axis2.tickMarkSkip) + valXml("noMultiLvlLbl", axis2.noMultiLevelLabels) + raw(context, axis2.extLst)
|
|
7160
7163
|
);
|
|
7161
7164
|
}
|
|
7162
7165
|
|
|
@@ -7230,7 +7233,7 @@ function groupXml(context, group2) {
|
|
|
7230
7233
|
function plotAreaXml(context, plotArea) {
|
|
7231
7234
|
return elementXml(
|
|
7232
7235
|
"plotArea",
|
|
7233
|
-
layoutXml(context, plotArea.layout) + plotArea.groups.map((group2) => groupXml(context, group2)).join("") + plotArea.axes.map((
|
|
7236
|
+
layoutXml(context, plotArea.layout) + plotArea.groups.map((group2) => groupXml(context, group2)).join("") + plotArea.axes.map((axis2) => axisXml(context, axis2)).join("") + dataTableXml(context, plotArea.dataTable) + shapePropertiesXml(context, plotArea.spPr) + raw(context, plotArea.extLst)
|
|
7234
7237
|
);
|
|
7235
7238
|
}
|
|
7236
7239
|
|
|
@@ -7639,14 +7642,14 @@ function parseLegend2(context, element4) {
|
|
|
7639
7642
|
}
|
|
7640
7643
|
|
|
7641
7644
|
// chart/ex/parse-axis.ts
|
|
7642
|
-
function parseScaling(context,
|
|
7643
|
-
const category = cxChild(
|
|
7645
|
+
function parseScaling(context, axis2) {
|
|
7646
|
+
const category = cxChild(axis2, "catScaling");
|
|
7644
7647
|
if (category)
|
|
7645
7648
|
return assignDefined(
|
|
7646
7649
|
{ kind: "cat" },
|
|
7647
7650
|
{ gapWidth: autoNumberAttribute(context, category, "gapWidth") }
|
|
7648
7651
|
);
|
|
7649
|
-
const value = cxChild(
|
|
7652
|
+
const value = cxChild(axis2, "valScaling");
|
|
7650
7653
|
if (!value) return void 0;
|
|
7651
7654
|
return assignDefined(
|
|
7652
7655
|
{ kind: "val" },
|
|
@@ -7857,9 +7860,9 @@ function parseSeries2(context, element4) {
|
|
|
7857
7860
|
const labels2 = cxChild(element4, "dataLabels");
|
|
7858
7861
|
const inline = cxChild(element4, "data");
|
|
7859
7862
|
const layout = cxChild(element4, "layoutPr");
|
|
7860
|
-
const
|
|
7863
|
+
const axisIds2 = cxChildren(element4, "axisId").map((axis2) => indexAttribute(context, axis2, "val")).filter((id) => id !== void 0);
|
|
7861
7864
|
return assignDefined(
|
|
7862
|
-
{ layoutId: attribute(element4, "layoutId") ?? "", dataPoints, axisIds },
|
|
7865
|
+
{ layoutId: attribute(element4, "layoutId") ?? "", dataPoints, axisIds: axisIds2 },
|
|
7863
7866
|
{
|
|
7864
7867
|
hidden: boolAttribute(context, element4, "hidden"),
|
|
7865
7868
|
ownerIndex: numberAttribute(context, element4, "ownerIdx"),
|
|
@@ -7901,7 +7904,7 @@ function parsePlotArea2(context, element4) {
|
|
|
7901
7904
|
const regionExtLst = extensionList2(region);
|
|
7902
7905
|
if (regionExtLst) out.regionExtLst = regionExtLst;
|
|
7903
7906
|
}
|
|
7904
|
-
out.axes = cxChildren(element4, "axis").map((
|
|
7907
|
+
out.axes = cxChildren(element4, "axis").map((axis2) => parseAxis2(context, axis2));
|
|
7905
7908
|
return assignDefined(out, { spPr: shapeProperties2(element4), extLst: extensionList2(element4) });
|
|
7906
7909
|
}
|
|
7907
7910
|
function namespaceDeclarations2(root) {
|
|
@@ -8152,19 +8155,19 @@ function scalingXml(scaling) {
|
|
|
8152
8155
|
);
|
|
8153
8156
|
}
|
|
8154
8157
|
var tickMarksXml = (local, marks) => marks ? cxElement(local, "", attributes([["type", marks.type]])) : "";
|
|
8155
|
-
function axisXml2(context,
|
|
8156
|
-
const units2 =
|
|
8158
|
+
function axisXml2(context, axis2) {
|
|
8159
|
+
const units2 = axis2.units;
|
|
8157
8160
|
const gridlines = (local, value) => value ? cxElement(local, shapeXml(context, value.spPr)) : "";
|
|
8158
8161
|
return cxElement(
|
|
8159
8162
|
"axis",
|
|
8160
|
-
scalingXml(
|
|
8163
|
+
scalingXml(axis2.scaling) + titleXml2(context, axis2.title) + (units2 ? cxElement(
|
|
8161
8164
|
"units",
|
|
8162
8165
|
titleXml2(context, units2.label, "unitsLabel") + raw(context, units2.extLst),
|
|
8163
8166
|
attributes([["unit", units2.unit]])
|
|
8164
|
-
) : "") + gridlines("majorGridlines",
|
|
8167
|
+
) : "") + gridlines("majorGridlines", axis2.majorGridlines) + gridlines("minorGridlines", axis2.minorGridlines) + tickMarksXml("majorTickMarks", axis2.majorTickMarks) + tickMarksXml("minorTickMarks", axis2.minorTickMarks) + (axis2.tickLabels ? cxElement("tickLabels", raw(context, axis2.tickLabels.extLst)) : "") + numberFormatXml2(axis2.numberFormat) + shapeXml(context, axis2.spPr) + textBodyXml2(context, axis2.txPr) + raw(context, axis2.extLst),
|
|
8165
8168
|
attributes([
|
|
8166
|
-
["id",
|
|
8167
|
-
["hidden",
|
|
8169
|
+
["id", axis2.id],
|
|
8170
|
+
["hidden", axis2.hidden]
|
|
8168
8171
|
])
|
|
8169
8172
|
);
|
|
8170
8173
|
}
|
|
@@ -8199,7 +8202,7 @@ function writeChartExSpace(space3, options2 = {}) {
|
|
|
8199
8202
|
);
|
|
8200
8203
|
const plotArea = cxElement(
|
|
8201
8204
|
"plotArea",
|
|
8202
|
-
region + plot.axes.map((
|
|
8205
|
+
region + plot.axes.map((axis2) => axisXml2(context, axis2)).join("") + shapeXml(context, plot.spPr) + raw(context, plot.extLst)
|
|
8203
8206
|
);
|
|
8204
8207
|
const legend = space3.legend;
|
|
8205
8208
|
const legendXml2 = legend ? cxElement(
|
|
@@ -8539,9 +8542,9 @@ function chartExSeriesAt(space3, index) {
|
|
|
8539
8542
|
return series2;
|
|
8540
8543
|
}
|
|
8541
8544
|
function chartExAxisAt(space3, index) {
|
|
8542
|
-
const
|
|
8543
|
-
if (!
|
|
8544
|
-
return
|
|
8545
|
+
const axis2 = typeof index === "number" && Number.isSafeInteger(index) ? space3.plotArea.axes.find((_, position) => position === index) : void 0;
|
|
8546
|
+
if (!axis2) throw new RangeError(`No chart axis at index ${String(index)}`);
|
|
8547
|
+
return axis2;
|
|
8545
8548
|
}
|
|
8546
8549
|
function setChartExTitle(space3, text3) {
|
|
8547
8550
|
return editChartExSpace(space3, (draft) => {
|
|
@@ -8819,7 +8822,7 @@ function setChartExLayout(space3, layout) {
|
|
|
8819
8822
|
];
|
|
8820
8823
|
for (const series2 of draft.plotArea.series)
|
|
8821
8824
|
series2.axisIds = draft.plotArea.axes.flatMap(
|
|
8822
|
-
(
|
|
8825
|
+
(axis2) => axis2.id === void 0 ? [] : [axis2.id]
|
|
8823
8826
|
);
|
|
8824
8827
|
} else {
|
|
8825
8828
|
draft.plotArea.axes = [];
|
|
@@ -10482,8 +10485,8 @@ function chartSummarySeries(source2, chartType, groupLabels, groupSmooth) {
|
|
|
10482
10485
|
Object.assign(out, summaryAnalysis(source2));
|
|
10483
10486
|
return out;
|
|
10484
10487
|
}
|
|
10485
|
-
function valueAxisId(chartSpace,
|
|
10486
|
-
return
|
|
10488
|
+
function valueAxisId(chartSpace, axisIds2) {
|
|
10489
|
+
return axisIds2.find(
|
|
10487
10490
|
(id) => chartSpace.plotArea.axes.some((a2) => a2.id === id && a2.kind === "val")
|
|
10488
10491
|
);
|
|
10489
10492
|
}
|
|
@@ -11190,35 +11193,35 @@ function chartExSummaryFromModel(space3) {
|
|
|
11190
11193
|
showLegend: legend !== void 0
|
|
11191
11194
|
};
|
|
11192
11195
|
if (chartType === "boxWhisker") {
|
|
11193
|
-
summary.axes = space3.plotArea.axes.flatMap((
|
|
11194
|
-
const scaling =
|
|
11196
|
+
summary.axes = space3.plotArea.axes.flatMap((axis2) => {
|
|
11197
|
+
const scaling = axis2.scaling;
|
|
11195
11198
|
if (!scaling) return [];
|
|
11196
11199
|
const value = scaling.kind === "val";
|
|
11197
11200
|
return [
|
|
11198
11201
|
{
|
|
11199
11202
|
kind: value ? "val" : "cat",
|
|
11200
|
-
...
|
|
11203
|
+
...axis2.id === void 0 ? {} : { id: axis2.id },
|
|
11201
11204
|
position: value ? "l" : "b",
|
|
11202
|
-
deleted:
|
|
11205
|
+
deleted: axis2.hidden ?? false,
|
|
11203
11206
|
scaling: {
|
|
11204
11207
|
...value && typeof scaling.min === "number" ? { min: scaling.min } : {},
|
|
11205
11208
|
...value && typeof scaling.max === "number" ? { max: scaling.max } : {}
|
|
11206
11209
|
},
|
|
11207
|
-
majorGridlines: !!
|
|
11208
|
-
minorGridlines: !!
|
|
11209
|
-
...
|
|
11210
|
-
...
|
|
11210
|
+
majorGridlines: !!axis2.majorGridlines,
|
|
11211
|
+
minorGridlines: !!axis2.minorGridlines,
|
|
11212
|
+
...axis2.majorGridlines?.spPr ? { majorGridlinesSpPr: axis2.majorGridlines.spPr } : {},
|
|
11213
|
+
...axis2.minorGridlines?.spPr ? { minorGridlinesSpPr: axis2.minorGridlines.spPr } : {},
|
|
11211
11214
|
...value && typeof scaling.majorUnit === "number" ? { majorUnit: scaling.majorUnit } : {},
|
|
11212
11215
|
...value && typeof scaling.minorUnit === "number" ? { minorUnit: scaling.minorUnit } : {},
|
|
11213
|
-
...
|
|
11214
|
-
...
|
|
11215
|
-
...
|
|
11216
|
+
...axis2.spPr ? { spPr: axis2.spPr } : {},
|
|
11217
|
+
...axis2.numberFormat ? { numberFormat: axis2.numberFormat } : {},
|
|
11218
|
+
...axis2.tickLabels ? {} : { tickLabelPosition: "none" }
|
|
11216
11219
|
}
|
|
11217
11220
|
];
|
|
11218
11221
|
});
|
|
11219
11222
|
}
|
|
11220
11223
|
if (chartType === "funnel") {
|
|
11221
|
-
const cat = space3.plotArea.axes.find((
|
|
11224
|
+
const cat = space3.plotArea.axes.find((axis2) => axis2.scaling?.kind === "cat")?.scaling;
|
|
11222
11225
|
if (cat?.kind === "cat" && typeof cat.gapWidth === "number")
|
|
11223
11226
|
summary.funnelGapWidth = cat.gapWidth;
|
|
11224
11227
|
}
|
|
@@ -12448,44 +12451,44 @@ function formatDate(date, unit, format) {
|
|
|
12448
12451
|
|
|
12449
12452
|
// chart/render/chart-svg-date-axis.ts
|
|
12450
12453
|
function chartDateAxis(model, plot, out) {
|
|
12451
|
-
const
|
|
12454
|
+
const axis2 = model.axes?.category?.source;
|
|
12452
12455
|
const values = model.dateCategories;
|
|
12453
|
-
if (
|
|
12456
|
+
if (axis2?.kind !== "date" || !values?.length) return void 0;
|
|
12454
12457
|
const points2 = values.flatMap(
|
|
12455
12458
|
(value, index) => value === null || !Number.isFinite(value) ? [] : [{ value, index }]
|
|
12456
12459
|
).sort((a2, b) => a2.value - b.value);
|
|
12457
12460
|
if (!points2.length) return void 0;
|
|
12458
|
-
const min =
|
|
12459
|
-
const max =
|
|
12461
|
+
const min = axis2.scaling.min ?? points2[0].value;
|
|
12462
|
+
const max = axis2.scaling.max ?? points2.at(-1).value;
|
|
12460
12463
|
if (!Number.isFinite(min) || !Number.isFinite(max) || max < min) return void 0;
|
|
12461
12464
|
const position = (value) => {
|
|
12462
12465
|
const ratio = max === min ? 0.5 : (value - min) / (max - min);
|
|
12463
|
-
const t =
|
|
12466
|
+
const t = axis2.scaling.orientation === "maxMin" ? 1 - ratio : ratio;
|
|
12464
12467
|
return model.horizontal ? plot.y + plot.h * (1 - t) : plot.x + plot.w * t;
|
|
12465
12468
|
};
|
|
12466
12469
|
const visible = points2.filter((p2) => p2.value >= min && p2.value <= max);
|
|
12467
12470
|
const unitOf = (unit2) => unit2 === "months" || unit2 === "years" ? unit2 : "days";
|
|
12468
|
-
const unit = unitOf(
|
|
12471
|
+
const unit = unitOf(axis2.majorTimeUnit ?? axis2.baseTimeUnit);
|
|
12469
12472
|
const ticks = calendarTicks(
|
|
12470
12473
|
min,
|
|
12471
12474
|
max,
|
|
12472
12475
|
model.date1904 ?? false,
|
|
12473
12476
|
unit,
|
|
12474
|
-
Math.max(1,
|
|
12477
|
+
Math.max(1, axis2.majorUnit ?? 1)
|
|
12475
12478
|
);
|
|
12476
12479
|
const attrs2 = chartTextAttributes(model, "categoryAxis");
|
|
12477
12480
|
const size = attrs2.size ?? 10;
|
|
12478
|
-
const y =
|
|
12481
|
+
const y = axis2.position === "t" ? plot.y : plot.y + plot.h;
|
|
12479
12482
|
const paint2 = model.axes?.category?.line;
|
|
12480
12483
|
const stroke = { color: paint2?.color ?? "#BFBFBF", width: paint2?.width ?? 1 };
|
|
12481
12484
|
const mark = (serial, placement, length) => {
|
|
12482
|
-
if (!placement || placement === "none" ||
|
|
12483
|
-
const inward =
|
|
12485
|
+
if (!placement || placement === "none" || axis2.deleted) return;
|
|
12486
|
+
const inward = axis2.position === "t" ? length : -length;
|
|
12484
12487
|
const start = placement === "cross" ? -length : 0;
|
|
12485
12488
|
const end = placement === "cross" ? length : placement === "in" ? inward : -inward;
|
|
12486
12489
|
if (model.horizontal) {
|
|
12487
|
-
const x =
|
|
12488
|
-
const direction =
|
|
12490
|
+
const x = axis2.position === "r" ? plot.x + plot.w : plot.x;
|
|
12491
|
+
const direction = axis2.position === "r" ? -1 : 1;
|
|
12489
12492
|
const a2 = placement === "cross" ? -length : 0;
|
|
12490
12493
|
const b = placement === "cross" ? length : placement === "in" ? direction * length : -direction * length;
|
|
12491
12494
|
out.push(
|
|
@@ -12497,19 +12500,19 @@ function chartDateAxis(model, plot, out) {
|
|
|
12497
12500
|
);
|
|
12498
12501
|
};
|
|
12499
12502
|
ticks.forEach((serial, index) => {
|
|
12500
|
-
if (index % Math.max(1,
|
|
12501
|
-
if (
|
|
12503
|
+
if (index % Math.max(1, axis2.tickMarkSkip ?? 1) === 0) mark(serial, axis2.majorTickMark, 4);
|
|
12504
|
+
if (axis2.deleted || model.dataTable || axis2.tickLabelPosition === "none" || index % Math.max(1, axis2.tickLabelSkip ?? 1))
|
|
12502
12505
|
return;
|
|
12503
12506
|
const label = formatDate(
|
|
12504
12507
|
excelSerialToDate(serial, model.date1904),
|
|
12505
12508
|
unit,
|
|
12506
|
-
|
|
12509
|
+
axis2.numberFormat?.formatCode
|
|
12507
12510
|
);
|
|
12508
12511
|
if (model.horizontal)
|
|
12509
12512
|
out.push(text(plot.x - 4, position(serial) + size * 0.3, label, { ...attrs2, anchor: "end" }));
|
|
12510
12513
|
else {
|
|
12511
|
-
const above2 =
|
|
12512
|
-
const baseline =
|
|
12514
|
+
const above2 = axis2.tickLabelPosition === "high" || axis2.tickLabelPosition !== "low" && axis2.position === "t";
|
|
12515
|
+
const baseline = axis2.tickLabelPosition === "high" ? plot.y : axis2.tickLabelPosition === "low" ? plot.y + plot.h : y;
|
|
12513
12516
|
out.push(
|
|
12514
12517
|
text(position(serial), baseline + (above2 ? -4 : size + 3), label, {
|
|
12515
12518
|
...attrs2,
|
|
@@ -12518,15 +12521,15 @@ function chartDateAxis(model, plot, out) {
|
|
|
12518
12521
|
);
|
|
12519
12522
|
}
|
|
12520
12523
|
});
|
|
12521
|
-
if (
|
|
12524
|
+
if (axis2.minorTickMark && axis2.minorTickMark !== "none")
|
|
12522
12525
|
for (const serial of calendarTicks(
|
|
12523
12526
|
min,
|
|
12524
12527
|
max,
|
|
12525
12528
|
model.date1904 ?? false,
|
|
12526
|
-
unitOf(
|
|
12527
|
-
Math.max(1,
|
|
12529
|
+
unitOf(axis2.minorTimeUnit ?? axis2.baseTimeUnit ?? unit),
|
|
12530
|
+
Math.max(1, axis2.minorUnit ?? 1)
|
|
12528
12531
|
))
|
|
12529
|
-
mark(serial,
|
|
12532
|
+
mark(serial, axis2.minorTickMark, 2.5);
|
|
12530
12533
|
return {
|
|
12531
12534
|
order: visible.map((p2) => p2.index),
|
|
12532
12535
|
band: (index) => position(values[index] ?? min),
|
|
@@ -12671,12 +12674,12 @@ function chartLineDashArray(style, width) {
|
|
|
12671
12674
|
}
|
|
12672
12675
|
|
|
12673
12676
|
// chart/render/chart-svg-axes.ts
|
|
12674
|
-
function axisTickText(value,
|
|
12675
|
-
return formatChartNumber(value,
|
|
12677
|
+
function axisTickText(value, axis2, percent = false) {
|
|
12678
|
+
return formatChartNumber(value, axis2?.source.numberFormat?.formatCode) ?? formatAxisValue(value, percent);
|
|
12676
12679
|
}
|
|
12677
|
-
function axisLine(model,
|
|
12678
|
-
if (
|
|
12679
|
-
return styledAxisLine(x1, y1, x2, y2,
|
|
12680
|
+
function axisLine(model, axis2, part, x1, y1, x2, y2) {
|
|
12681
|
+
if (axis2?.source.deleted) return "";
|
|
12682
|
+
return styledAxisLine(x1, y1, x2, y2, axis2?.line, chartStroke(model, part));
|
|
12680
12683
|
}
|
|
12681
12684
|
function styledAxisLine(x1, y1, x2, y2, paint2, fallback) {
|
|
12682
12685
|
const color2 = paint2?.color ?? fallback.color;
|
|
@@ -12688,7 +12691,7 @@ function styledAxisLine(x1, y1, x2, y2, paint2, fallback) {
|
|
|
12688
12691
|
dash ? ` stroke-dasharray="${dash}"/>` : "/>"
|
|
12689
12692
|
);
|
|
12690
12693
|
}
|
|
12691
|
-
function axisGridlines(model,
|
|
12694
|
+
function axisGridlines(model, axis2, ticks, position, plot, vertical) {
|
|
12692
12695
|
const draw2 = (values, paint2, minor2) => {
|
|
12693
12696
|
const fallback = chartStroke(model, minor2 ? "gridlineMinor" : "gridlineMajor");
|
|
12694
12697
|
return values.map((value) => {
|
|
@@ -12696,8 +12699,8 @@ function axisGridlines(model, axis, ticks, position, plot, vertical) {
|
|
|
12696
12699
|
return vertical ? styledAxisLine(p2, plot.y, p2, plot.y + plot.h, paint2, fallback) : styledAxisLine(plot.x, p2, plot.x + plot.w, p2, paint2, fallback);
|
|
12697
12700
|
}).join("");
|
|
12698
12701
|
};
|
|
12699
|
-
const major = !
|
|
12700
|
-
const minor =
|
|
12702
|
+
const major = !axis2 || axis2.source.majorGridlines ? draw2(ticks, axis2?.majorGrid, false) : "";
|
|
12703
|
+
const minor = axis2?.source.minorGridlines ? draw2(axis2.minorTicks, axis2.minorGrid, true) : "";
|
|
12701
12704
|
return major + minor;
|
|
12702
12705
|
}
|
|
12703
12706
|
|
|
@@ -12766,20 +12769,20 @@ function computeLogValueRange(series2, logBase) {
|
|
|
12766
12769
|
logBase
|
|
12767
12770
|
};
|
|
12768
12771
|
}
|
|
12769
|
-
function computeValueRangeForAxis(series2,
|
|
12770
|
-
const requestedLogBase =
|
|
12771
|
-
const logBase =
|
|
12772
|
+
function computeValueRangeForAxis(series2, axis2, plotHeightPx) {
|
|
12773
|
+
const requestedLogBase = axis2?.logBase ?? 10;
|
|
12774
|
+
const logBase = axis2?.logScale && Number.isFinite(requestedLogBase) && requestedLogBase > 1 ? requestedLogBase : axis2?.logScale ? 10 : void 0;
|
|
12772
12775
|
const automatic = logBase ? computeLogValueRange(series2, logBase) : computeAxisValueRange(series2, plotHeightPx);
|
|
12773
|
-
return withAxisBounds(automatic,
|
|
12776
|
+
return withAxisBounds(automatic, axis2, logBase);
|
|
12774
12777
|
}
|
|
12775
|
-
function computeStackedValueRangeForAxis(series2, catCount,
|
|
12778
|
+
function computeStackedValueRangeForAxis(series2, catCount, axis2, isPercent, plotSizePx) {
|
|
12776
12779
|
if (isPercent) {
|
|
12777
12780
|
return {
|
|
12778
12781
|
...percentStackedRange(series2, catCount, plotSizePx),
|
|
12779
|
-
...
|
|
12782
|
+
...axis2?.orientation === "maxMin" ? { reverseOrder: true } : {}
|
|
12780
12783
|
};
|
|
12781
12784
|
}
|
|
12782
|
-
return withAxisBounds(computeAxisStackedValueRange(series2, catCount, plotSizePx),
|
|
12785
|
+
return withAxisBounds(computeAxisStackedValueRange(series2, catCount, plotSizePx), axis2);
|
|
12783
12786
|
}
|
|
12784
12787
|
function percentStackedRange(series2, catCount, plotSizePx) {
|
|
12785
12788
|
const shares = series2.map((entry3) => ({
|
|
@@ -12802,9 +12805,9 @@ function percentStackedRange(series2, catCount, plotSizePx) {
|
|
|
12802
12805
|
...unit !== void 0 && 100 % unit === 0 && min % unit === 0 ? { majorUnit: unit } : {}
|
|
12803
12806
|
};
|
|
12804
12807
|
}
|
|
12805
|
-
function withAxisBounds(automatic,
|
|
12806
|
-
const validMin = typeof
|
|
12807
|
-
const validMax = typeof
|
|
12808
|
+
function withAxisBounds(automatic, axis2, logBase) {
|
|
12809
|
+
const validMin = typeof axis2?.min === "number" && Number.isFinite(axis2.min) && (!logBase || axis2.min > 0) ? axis2.min : void 0;
|
|
12810
|
+
const validMax = typeof axis2?.max === "number" && Number.isFinite(axis2.max) && (!logBase || axis2.max > 0) ? axis2.max : void 0;
|
|
12808
12811
|
const min = validMin ?? automatic.min;
|
|
12809
12812
|
let max = validMax ?? automatic.max;
|
|
12810
12813
|
const majorUnit = validMin === void 0 && validMax === void 0 ? automatic.majorUnit : void 0;
|
|
@@ -12818,7 +12821,7 @@ function withAxisBounds(automatic, axis, logBase) {
|
|
|
12818
12821
|
span: Math.max(span, Number.EPSILON),
|
|
12819
12822
|
...majorUnit !== void 0 ? { majorUnit } : {},
|
|
12820
12823
|
...logBase ? { logScale: true, logBase } : {},
|
|
12821
|
-
...
|
|
12824
|
+
...axis2?.orientation === "maxMin" ? { reverseOrder: true } : {}
|
|
12822
12825
|
};
|
|
12823
12826
|
}
|
|
12824
12827
|
function valueToYLog(val2, range2, topY, bottomY) {
|
|
@@ -12829,10 +12832,10 @@ function valueToYLog(val2, range2, topY, bottomY) {
|
|
|
12829
12832
|
return range2.reverseOrder ? topY + ratio * (bottomY - topY) : bottomY - ratio * (bottomY - topY);
|
|
12830
12833
|
}
|
|
12831
12834
|
function findLogAxis(axes) {
|
|
12832
|
-
return axes?.find((
|
|
12835
|
+
return axes?.find((axis2) => axis2.axisType === "valAx" && axis2.logScale);
|
|
12833
12836
|
}
|
|
12834
12837
|
function computeValueRangeForChart(series2, axes, plotHeightPx) {
|
|
12835
|
-
const primaryAxis = axes?.find((
|
|
12838
|
+
const primaryAxis = axes?.find((axis2) => axis2.axisType === "valAx" && axis2.axPos === "l") ?? axes?.find((axis2) => axis2.axisType === "valAx" && axis2.axPos !== "r");
|
|
12836
12839
|
return computeValueRangeForAxis(series2, primaryAxis, plotHeightPx);
|
|
12837
12840
|
}
|
|
12838
12841
|
|
|
@@ -12865,11 +12868,11 @@ function generateIntervalTicks(range2, unit) {
|
|
|
12865
12868
|
const count = Math.min(Math.max(last - first2 + 1, 0), 2e3);
|
|
12866
12869
|
return Array.from({ length: count }, (_, index) => (first2 + index) * unit);
|
|
12867
12870
|
}
|
|
12868
|
-
function generateAxisTicks(range2,
|
|
12871
|
+
function generateAxisTicks(range2, axis2, defaultIntervals) {
|
|
12869
12872
|
if (range2.logScale && range2.logBase) {
|
|
12870
12873
|
return generateLogTicks(range2);
|
|
12871
12874
|
}
|
|
12872
|
-
const explicit = generateIntervalTicks(range2,
|
|
12875
|
+
const explicit = generateIntervalTicks(range2, axis2?.majorUnit ?? 0);
|
|
12873
12876
|
if (explicit.length > 0) {
|
|
12874
12877
|
return explicit;
|
|
12875
12878
|
}
|
|
@@ -12882,12 +12885,12 @@ function generateAxisTicks(range2, axis, defaultIntervals) {
|
|
|
12882
12885
|
(_, index) => range2.min + range2.span / defaultIntervals * index
|
|
12883
12886
|
);
|
|
12884
12887
|
}
|
|
12885
|
-
function generateMinorAxisTicks(range2,
|
|
12886
|
-
const minor = generateIntervalTicks(range2,
|
|
12888
|
+
function generateMinorAxisTicks(range2, axis2) {
|
|
12889
|
+
const minor = generateIntervalTicks(range2, axis2?.minorUnit ?? 0);
|
|
12887
12890
|
if (minor.length === 0) {
|
|
12888
12891
|
return [];
|
|
12889
12892
|
}
|
|
12890
|
-
const majorUnit =
|
|
12893
|
+
const majorUnit = axis2?.majorUnit;
|
|
12891
12894
|
if (!majorUnit || !Number.isFinite(majorUnit) || majorUnit <= 0) {
|
|
12892
12895
|
return minor;
|
|
12893
12896
|
}
|
|
@@ -12898,33 +12901,33 @@ function generateMinorAxisTicks(range2, axis) {
|
|
|
12898
12901
|
}
|
|
12899
12902
|
|
|
12900
12903
|
// chart/render/chart-view-axes.ts
|
|
12901
|
-
function chartAxisRatio(value, scale,
|
|
12902
|
-
const range2 =
|
|
12904
|
+
function chartAxisRatio(value, scale, axis2) {
|
|
12905
|
+
const range2 = axis2?.range;
|
|
12903
12906
|
const ratio = range2?.logScale ? Math.log(Math.max(value, range2.min) / range2.min) / Math.log(range2.max / range2.min) : (value - scale.min) / (scale.max - scale.min || 1);
|
|
12904
12907
|
return range2?.reverseOrder ? 1 - ratio : ratio;
|
|
12905
12908
|
}
|
|
12906
|
-
function chartAxisLabels(
|
|
12907
|
-
return
|
|
12909
|
+
function chartAxisLabels(axis2) {
|
|
12910
|
+
return axis2?.source.deleted !== true && axis2?.source.tickLabelPosition !== "none";
|
|
12908
12911
|
}
|
|
12909
|
-
function options(
|
|
12912
|
+
function options(axis2) {
|
|
12910
12913
|
return {
|
|
12911
|
-
...
|
|
12912
|
-
...
|
|
12913
|
-
...
|
|
12914
|
-
...
|
|
12914
|
+
...axis2.scaling,
|
|
12915
|
+
...axis2.scaling.logBase === void 0 ? {} : { logScale: true },
|
|
12916
|
+
...axis2.majorUnit === void 0 ? {} : { majorUnit: axis2.majorUnit },
|
|
12917
|
+
...axis2.minorUnit === void 0 ? {} : { minorUnit: axis2.minorUnit }
|
|
12915
12918
|
};
|
|
12916
12919
|
}
|
|
12917
12920
|
function applyChartAxes(model, chart, color2) {
|
|
12918
12921
|
if (!chart.axes?.length) return;
|
|
12919
12922
|
const axes = chart.axes;
|
|
12920
|
-
const linked = axes.filter((
|
|
12923
|
+
const linked = axes.filter((axis2) => axis2.id !== void 0 && chart.axisIds?.includes(axis2.id));
|
|
12921
12924
|
const candidates = linked.length ? linked : axes;
|
|
12922
12925
|
const xy = model.type === "scatter" || model.type === "bubble";
|
|
12923
|
-
const value = candidates.find((
|
|
12926
|
+
const value = candidates.find((axis2) => axis2.kind === "val" && !["b", "t"].includes(axis2.position ?? "")) ?? candidates.find((axis2) => axis2.kind === "val");
|
|
12924
12927
|
const category = candidates.find(
|
|
12925
|
-
(
|
|
12928
|
+
(axis2) => xy ? axis2.kind === "val" && axis2 !== value : axis2.kind === "cat" || axis2.kind === "date"
|
|
12926
12929
|
);
|
|
12927
|
-
const secondary = axes.find((
|
|
12930
|
+
const secondary = axes.find((axis2) => axis2.kind === "val" && axis2 !== value && axis2 !== category);
|
|
12928
12931
|
const paint2 = (shape) => {
|
|
12929
12932
|
const ln = shape?.line;
|
|
12930
12933
|
const fill = ln?.fill;
|
|
@@ -12935,8 +12938,8 @@ function applyChartAxes(model, chart, color2) {
|
|
|
12935
12938
|
...ln?.dash === void 0 ? {} : { dash: ln.dash }
|
|
12936
12939
|
};
|
|
12937
12940
|
};
|
|
12938
|
-
const bind = (
|
|
12939
|
-
const opts = options(
|
|
12941
|
+
const bind = (axis2, scale, values) => {
|
|
12942
|
+
const opts = options(axis2);
|
|
12940
12943
|
const automatic = opts.logScale ? computeLogValueRange(
|
|
12941
12944
|
[{ values: values ?? [] }],
|
|
12942
12945
|
opts.logBase && Number.isFinite(opts.logBase) && opts.logBase > 1 ? opts.logBase : 10
|
|
@@ -12954,12 +12957,12 @@ function applyChartAxes(model, chart, color2) {
|
|
|
12954
12957
|
scale.ticks = generateAxisTicks(range2, opts, 5);
|
|
12955
12958
|
}
|
|
12956
12959
|
return {
|
|
12957
|
-
source:
|
|
12960
|
+
source: axis2,
|
|
12958
12961
|
range: range2,
|
|
12959
12962
|
minorTicks: generateMinorAxisTicks(range2, opts),
|
|
12960
|
-
line: paint2(
|
|
12961
|
-
majorGrid: paint2(
|
|
12962
|
-
minorGrid: paint2(
|
|
12963
|
+
line: paint2(axis2.spPr),
|
|
12964
|
+
majorGrid: paint2(axis2.majorGridlinesSpPr),
|
|
12965
|
+
minorGrid: paint2(axis2.minorGridlinesSpPr)
|
|
12963
12966
|
};
|
|
12964
12967
|
};
|
|
12965
12968
|
const out = {};
|
|
@@ -14465,12 +14468,12 @@ function readScene3DValues(node, read) {
|
|
|
14465
14468
|
["lightRig", light]
|
|
14466
14469
|
]) {
|
|
14467
14470
|
const rot = read.child(source2, "rot");
|
|
14468
|
-
for (const [
|
|
14471
|
+
for (const [axis2, key] of [
|
|
14469
14472
|
["lat", "RotX"],
|
|
14470
14473
|
["lon", "RotY"],
|
|
14471
14474
|
["rev", "RotZ"]
|
|
14472
14475
|
]) {
|
|
14473
|
-
const value = integer(read.attribute(rot,
|
|
14476
|
+
const value = integer(read.attribute(rot, axis2));
|
|
14474
14477
|
if (value !== void 0 && value >= 0 && value < 216e5) out[`${prefix}${key}`] = value;
|
|
14475
14478
|
}
|
|
14476
14479
|
}
|
|
@@ -14483,12 +14486,12 @@ function readScene3DValues(node, read) {
|
|
|
14483
14486
|
["up", "backdropUp", "d"]
|
|
14484
14487
|
]) {
|
|
14485
14488
|
const point = read.child(backdrop, name2);
|
|
14486
|
-
for (const [
|
|
14489
|
+
for (const [axis2, suffix] of [
|
|
14487
14490
|
["x", "X"],
|
|
14488
14491
|
["y", "Y"],
|
|
14489
14492
|
["z", "Z"]
|
|
14490
14493
|
]) {
|
|
14491
|
-
const value = integer(read.attribute(point, `${attr4}${
|
|
14494
|
+
const value = integer(read.attribute(point, `${attr4}${axis2}`));
|
|
14492
14495
|
if (value !== void 0) out[`${prefix}${suffix}`] = value;
|
|
14493
14496
|
}
|
|
14494
14497
|
}
|
|
@@ -15145,12 +15148,12 @@ function writeDrawingTextScene3D(doc, value) {
|
|
|
15145
15148
|
throw new Error("A backdrop point needs three finite coordinates");
|
|
15146
15149
|
const point = child2(backdrop, name2);
|
|
15147
15150
|
const vector = attr4 === "d" ? scaleVectorToIntegers(values[0], values[1], values[2]) : { x: values[0], y: values[1], z: values[2] };
|
|
15148
|
-
for (const [
|
|
15151
|
+
for (const [axis2, suffix] of [
|
|
15149
15152
|
["x", "X"],
|
|
15150
15153
|
["y", "Y"],
|
|
15151
15154
|
["z", "Z"]
|
|
15152
15155
|
])
|
|
15153
|
-
number(point, `${attr4}${
|
|
15156
|
+
number(point, `${attr4}${axis2}`, vector[axis2], before[`${prefix}${suffix}`]);
|
|
15154
15157
|
}
|
|
15155
15158
|
}
|
|
15156
15159
|
return node;
|
|
@@ -17980,13 +17983,13 @@ function scatter(model, area, out, size) {
|
|
|
17980
17983
|
s2.values.forEach((_, i2) => {
|
|
17981
17984
|
reach = Math.max(reach, radiusOf(s2.sizes?.[i2] ?? void 0) ?? 0);
|
|
17982
17985
|
});
|
|
17983
|
-
const widen = (s2, length,
|
|
17984
|
-
if (
|
|
17986
|
+
const widen = (s2, length, axis2) => {
|
|
17987
|
+
if (axis2?.range.logScale) return s2;
|
|
17985
17988
|
const pad5 = reach * (s2.max - s2.min || 1) / Math.max(1, length - 2 * reach);
|
|
17986
17989
|
return {
|
|
17987
17990
|
...s2,
|
|
17988
|
-
min:
|
|
17989
|
-
max:
|
|
17991
|
+
min: axis2?.source.scaling.min === void 0 ? s2.min - pad5 : s2.min,
|
|
17992
|
+
max: axis2?.source.scaling.max === void 0 ? s2.max + pad5 : s2.max
|
|
17990
17993
|
};
|
|
17991
17994
|
};
|
|
17992
17995
|
const xView = widen(xs, plot.w, model.axes?.category);
|
|
@@ -19123,124 +19126,124 @@ function editChartGradientFill(old, edit, defaultColor, toColor = identity) {
|
|
|
19123
19126
|
|
|
19124
19127
|
// chart/edit/axes.ts
|
|
19125
19128
|
function chartAxisAt(space3, target) {
|
|
19126
|
-
const
|
|
19129
|
+
const axis2 = space3.plotArea.axes.find(
|
|
19127
19130
|
(item2, position) => typeof target === "string" ? item2.kind === target : "index" in target ? position === target.index : item2.id === target.id
|
|
19128
19131
|
);
|
|
19129
|
-
if (!
|
|
19130
|
-
return
|
|
19132
|
+
if (!axis2) throw new RangeError(`No chart axis ${JSON.stringify(target)}`);
|
|
19133
|
+
return axis2;
|
|
19131
19134
|
}
|
|
19132
|
-
function setNumber(
|
|
19135
|
+
function setNumber(axis2, key, value) {
|
|
19133
19136
|
if (value === void 0) return;
|
|
19134
19137
|
if (value !== null && !(Number.isFinite(value) && value > 0))
|
|
19135
19138
|
throw new RangeError(`Chart axis ${key} must be a positive number`);
|
|
19136
|
-
assignOrDelete(
|
|
19139
|
+
assignOrDelete(axis2, key, value ?? void 0);
|
|
19137
19140
|
}
|
|
19138
|
-
function applyAxis(
|
|
19139
|
-
if (edit.position !== void 0) assignOrDelete(
|
|
19141
|
+
function applyAxis(axis2, edit) {
|
|
19142
|
+
if (edit.position !== void 0) assignOrDelete(axis2, "position", edit.position ?? void 0);
|
|
19140
19143
|
if (edit.crossBetween !== void 0)
|
|
19141
|
-
assignOrDelete(
|
|
19142
|
-
if (edit.crossAxisId !== void 0)
|
|
19143
|
-
if (edit.visible !== void 0)
|
|
19144
|
+
assignOrDelete(axis2, "crossBetween", edit.crossBetween ?? void 0);
|
|
19145
|
+
if (edit.crossAxisId !== void 0) axis2.crossAxisId = edit.crossAxisId;
|
|
19146
|
+
if (edit.visible !== void 0) axis2.deleted = !edit.visible;
|
|
19144
19147
|
if (edit.title !== void 0)
|
|
19145
19148
|
assignOrDelete(
|
|
19146
|
-
|
|
19149
|
+
axis2,
|
|
19147
19150
|
"title",
|
|
19148
|
-
edit.title ? chartTitleWithText(
|
|
19151
|
+
edit.title ? chartTitleWithText(axis2.title, edit.title) : void 0
|
|
19149
19152
|
);
|
|
19150
19153
|
for (const key of ["min", "max"]) {
|
|
19151
19154
|
const value = edit[key];
|
|
19152
19155
|
if (value === void 0) continue;
|
|
19153
19156
|
if (value !== null && !Number.isFinite(value))
|
|
19154
19157
|
throw new RangeError(`Chart axis ${key} must be a finite number`);
|
|
19155
|
-
assignOrDelete(
|
|
19158
|
+
assignOrDelete(axis2.scaling, key, value ?? void 0);
|
|
19156
19159
|
}
|
|
19157
|
-
const { min, max } =
|
|
19160
|
+
const { min, max } = axis2.scaling;
|
|
19158
19161
|
if (min !== void 0 && max !== void 0 && min >= max)
|
|
19159
19162
|
throw new RangeError("Chart axis minimum must be less than its maximum");
|
|
19160
|
-
setNumber(
|
|
19161
|
-
setNumber(
|
|
19163
|
+
setNumber(axis2, "majorUnit", edit.majorUnit);
|
|
19164
|
+
setNumber(axis2, "minorUnit", edit.minorUnit);
|
|
19162
19165
|
if (edit.majorTimeUnit !== void 0)
|
|
19163
|
-
assignOrDelete(
|
|
19166
|
+
assignOrDelete(axis2, "majorTimeUnit", edit.majorTimeUnit ?? void 0);
|
|
19164
19167
|
if (edit.minorTimeUnit !== void 0)
|
|
19165
|
-
assignOrDelete(
|
|
19168
|
+
assignOrDelete(axis2, "minorTimeUnit", edit.minorTimeUnit ?? void 0);
|
|
19166
19169
|
if (edit.baseTimeUnit !== void 0)
|
|
19167
|
-
assignOrDelete(
|
|
19170
|
+
assignOrDelete(axis2, "baseTimeUnit", edit.baseTimeUnit ?? void 0);
|
|
19168
19171
|
if (edit.logBase !== void 0) {
|
|
19169
19172
|
if (edit.logBase !== null && !(edit.logBase >= 2 && edit.logBase <= 1e3))
|
|
19170
19173
|
throw new RangeError("Chart axis log base must be from 2 to 1000");
|
|
19171
|
-
assignOrDelete(
|
|
19174
|
+
assignOrDelete(axis2.scaling, "logBase", edit.logBase ?? void 0);
|
|
19172
19175
|
}
|
|
19173
|
-
if (edit.reverse !== void 0)
|
|
19176
|
+
if (edit.reverse !== void 0) axis2.scaling.orientation = edit.reverse ? "maxMin" : "minMax";
|
|
19174
19177
|
if (edit.numberFormat !== void 0)
|
|
19175
19178
|
assignOrDelete(
|
|
19176
|
-
|
|
19179
|
+
axis2,
|
|
19177
19180
|
"numberFormat",
|
|
19178
19181
|
edit.numberFormat ? { formatCode: edit.numberFormat, sourceLinked: edit.numberFormatSourceLinked ?? false } : void 0
|
|
19179
19182
|
);
|
|
19180
|
-
else if (edit.numberFormatSourceLinked !== void 0 &&
|
|
19181
|
-
|
|
19183
|
+
else if (edit.numberFormatSourceLinked !== void 0 && axis2.numberFormat)
|
|
19184
|
+
axis2.numberFormat.sourceLinked = edit.numberFormatSourceLinked;
|
|
19182
19185
|
for (const key of ["auto", "noMultiLevelLabels"])
|
|
19183
|
-
if (edit[key] !== void 0)
|
|
19186
|
+
if (edit[key] !== void 0) axis2[key] = edit[key];
|
|
19184
19187
|
if (edit.labelAlign !== void 0)
|
|
19185
|
-
assignOrDelete(
|
|
19188
|
+
assignOrDelete(axis2, "labelAlign", edit.labelAlign ?? void 0);
|
|
19186
19189
|
for (const key of ["labelOffset", "tickLabelSkip", "tickMarkSkip"]) {
|
|
19187
19190
|
const value = edit[key];
|
|
19188
19191
|
if (value === void 0) continue;
|
|
19189
19192
|
if (value !== null && (!Number.isInteger(value) || value < (key === "labelOffset" ? 0 : 1) || value > (key === "labelOffset" ? 1e3 : 2147483647)))
|
|
19190
19193
|
throw new RangeError(`Invalid chart axis ${key}`);
|
|
19191
|
-
assignOrDelete(
|
|
19194
|
+
assignOrDelete(axis2, key, value ?? void 0);
|
|
19192
19195
|
}
|
|
19193
|
-
if (edit.majorTickMark !== void 0)
|
|
19194
|
-
if (edit.minorTickMark !== void 0)
|
|
19195
|
-
if (edit.tickLabelPosition !== void 0)
|
|
19196
|
+
if (edit.majorTickMark !== void 0) axis2.majorTickMark = edit.majorTickMark;
|
|
19197
|
+
if (edit.minorTickMark !== void 0) axis2.minorTickMark = edit.minorTickMark;
|
|
19198
|
+
if (edit.tickLabelPosition !== void 0) axis2.tickLabelPosition = edit.tickLabelPosition;
|
|
19196
19199
|
if (edit.crosses !== void 0) {
|
|
19197
19200
|
if (typeof edit.crosses === "number") {
|
|
19198
|
-
delete
|
|
19199
|
-
|
|
19201
|
+
delete axis2.crosses;
|
|
19202
|
+
axis2.crossesAt = edit.crosses;
|
|
19200
19203
|
} else {
|
|
19201
|
-
delete
|
|
19202
|
-
|
|
19204
|
+
delete axis2.crossesAt;
|
|
19205
|
+
axis2.crosses = edit.crosses;
|
|
19203
19206
|
}
|
|
19204
19207
|
}
|
|
19205
19208
|
if (edit.majorGridlines !== void 0) {
|
|
19206
|
-
|
|
19207
|
-
if (!edit.majorGridlines) delete
|
|
19209
|
+
axis2.majorGridlines = edit.majorGridlines;
|
|
19210
|
+
if (!edit.majorGridlines) delete axis2.majorGridlinesSpPr;
|
|
19208
19211
|
}
|
|
19209
19212
|
if (edit.minorGridlines !== void 0) {
|
|
19210
|
-
|
|
19211
|
-
if (!edit.minorGridlines) delete
|
|
19213
|
+
axis2.minorGridlines = edit.minorGridlines;
|
|
19214
|
+
if (!edit.minorGridlines) delete axis2.minorGridlinesSpPr;
|
|
19212
19215
|
}
|
|
19213
19216
|
if (edit.displayUnits !== void 0) {
|
|
19214
|
-
if (
|
|
19217
|
+
if (axis2.kind !== "val") throw new RangeError("Only a value axis has display units");
|
|
19215
19218
|
const units2 = edit.displayUnits;
|
|
19216
19219
|
if (typeof units2 === "number" && (!Number.isFinite(units2) || units2 <= 0))
|
|
19217
19220
|
throw new RangeError("Custom chart display units must be a positive finite number");
|
|
19218
|
-
const { builtInUnit: _builtIn, customUnit: _custom, ...kept } =
|
|
19221
|
+
const { builtInUnit: _builtIn, customUnit: _custom, ...kept } = axis2.displayUnits ?? {};
|
|
19219
19222
|
assignOrDelete(
|
|
19220
|
-
|
|
19223
|
+
axis2,
|
|
19221
19224
|
"displayUnits",
|
|
19222
19225
|
units2 === null ? void 0 : typeof units2 === "number" ? { ...kept, customUnit: units2 } : { ...kept, builtInUnit: units2 }
|
|
19223
19226
|
);
|
|
19224
19227
|
}
|
|
19225
19228
|
}
|
|
19226
19229
|
function setChartAxis(space3, target, edit) {
|
|
19227
|
-
if (edit.crossAxisId !== void 0 && !space3.plotArea.axes.some((
|
|
19230
|
+
if (edit.crossAxisId !== void 0 && !space3.plotArea.axes.some((axis2) => axis2.id === edit.crossAxisId))
|
|
19228
19231
|
throw new RangeError("The crossing axis does not exist");
|
|
19229
19232
|
return editChartSpace(space3, (draft) => applyAxis(chartAxisAt(draft, target), edit));
|
|
19230
19233
|
}
|
|
19231
19234
|
function setChartGridlineShape(space3, target, which, shape) {
|
|
19232
19235
|
return editChartSpace(space3, (draft) => {
|
|
19233
|
-
const
|
|
19236
|
+
const axis2 = chartAxisAt(draft, target);
|
|
19234
19237
|
const key = which === "major" ? "majorGridlinesSpPr" : "minorGridlinesSpPr";
|
|
19235
19238
|
if (shape === null) {
|
|
19236
|
-
delete
|
|
19239
|
+
delete axis2[key];
|
|
19237
19240
|
return;
|
|
19238
19241
|
}
|
|
19239
|
-
const next = { ...
|
|
19242
|
+
const next = { ...axis2[key] };
|
|
19240
19243
|
if (shape.line !== void 0) next.line = structuredClone(shape.line);
|
|
19241
19244
|
if (shape.fill !== void 0) next.fill = structuredClone(shape.fill);
|
|
19242
|
-
|
|
19243
|
-
|
|
19245
|
+
axis2[key] = next;
|
|
19246
|
+
axis2[which === "major" ? "majorGridlines" : "minorGridlines"] = true;
|
|
19244
19247
|
});
|
|
19245
19248
|
}
|
|
19246
19249
|
|
|
@@ -19326,7 +19329,16 @@ function repaintSeriesForFamily(series2, toLine) {
|
|
|
19326
19329
|
shape.fill = structuredClone(shape.line.fill);
|
|
19327
19330
|
}
|
|
19328
19331
|
function clearPointPaint(series2, key) {
|
|
19329
|
-
|
|
19332
|
+
const emptied = (part) => Object.keys(part).every((name2) => name2 === "sourceXml");
|
|
19333
|
+
for (const point of series2.dataPoints) {
|
|
19334
|
+
if (!point.spPr) continue;
|
|
19335
|
+
delete point.spPr[key];
|
|
19336
|
+
if (point.spPr.line && emptied(point.spPr.line)) delete point.spPr.line;
|
|
19337
|
+
if (emptied(point.spPr)) delete point.spPr;
|
|
19338
|
+
}
|
|
19339
|
+
series2.dataPoints = series2.dataPoints.filter(
|
|
19340
|
+
(point) => Object.keys(point).some((name2) => name2 !== "index")
|
|
19341
|
+
);
|
|
19330
19342
|
}
|
|
19331
19343
|
function setChartSeriesFill(space3, index, fill) {
|
|
19332
19344
|
return editChartSpace(space3, (draft) => {
|
|
@@ -19345,7 +19357,7 @@ function setChartSeriesLine(space3, index, line4) {
|
|
|
19345
19357
|
);
|
|
19346
19358
|
});
|
|
19347
19359
|
}
|
|
19348
|
-
function setChartSeriesColor(space3, index, color2) {
|
|
19360
|
+
function setChartSeriesColor(space3, index, color2, options2 = {}) {
|
|
19349
19361
|
return editChartSpace(space3, (draft) => {
|
|
19350
19362
|
const { series: series2 } = chartSeriesEntryAt(draft, index);
|
|
19351
19363
|
const shape = series2.spPr ??= {};
|
|
@@ -19355,7 +19367,7 @@ function setChartSeriesColor(space3, index, color2) {
|
|
|
19355
19367
|
const fill = color2 ? { kind: "solid", color: withAlphaOf(color2, previous) } : void 0;
|
|
19356
19368
|
if (line4) assignOrDelete(shape.line ??= {}, "fill", fill);
|
|
19357
19369
|
else assignOrDelete(shape, "fill", fill);
|
|
19358
|
-
clearPointPaint(series2, line4 ? "line" : "fill");
|
|
19370
|
+
if (!options2.keepPointColors) clearPointPaint(series2, line4 ? "line" : "fill");
|
|
19359
19371
|
});
|
|
19360
19372
|
}
|
|
19361
19373
|
function setChartSeriesTransparency(space3, index, percent) {
|
|
@@ -19439,10 +19451,10 @@ function chartTargetDraftShapes(draft, target) {
|
|
|
19439
19451
|
return [chartAxisAt(draft, { index: target.axisIndex }).spPr ??= {}];
|
|
19440
19452
|
case "majorGridlines":
|
|
19441
19453
|
case "minorGridlines": {
|
|
19442
|
-
const
|
|
19454
|
+
const axis2 = chartAxisAt(draft, { index: target.axisIndex });
|
|
19443
19455
|
const major = target.kind === "majorGridlines";
|
|
19444
|
-
|
|
19445
|
-
return [
|
|
19456
|
+
axis2[major ? "majorGridlines" : "minorGridlines"] = true;
|
|
19457
|
+
return [axis2[major ? "majorGridlinesSpPr" : "minorGridlinesSpPr"] ??= {}];
|
|
19446
19458
|
}
|
|
19447
19459
|
case "dataLabels": {
|
|
19448
19460
|
if (target.seriesIndex === void 0) {
|
|
@@ -20772,9 +20784,9 @@ var CATEGORY_ONLY = [
|
|
|
20772
20784
|
"minorTimeUnit"
|
|
20773
20785
|
];
|
|
20774
20786
|
var VALUE_ONLY = ["crossBetween", "displayUnits"];
|
|
20775
|
-
function convertChartAxis(
|
|
20776
|
-
if (
|
|
20777
|
-
const next = structuredClone(
|
|
20787
|
+
function convertChartAxis(axis2, kind) {
|
|
20788
|
+
if (axis2.kind === kind) return axis2;
|
|
20789
|
+
const next = structuredClone(axis2);
|
|
20778
20790
|
next.kind = kind;
|
|
20779
20791
|
if (kind === "val") {
|
|
20780
20792
|
for (const key of CATEGORY_ONLY) delete next[key];
|
|
@@ -20807,7 +20819,7 @@ var SWITCHABLE = {
|
|
|
20807
20819
|
stock: false,
|
|
20808
20820
|
surface: true
|
|
20809
20821
|
};
|
|
20810
|
-
function
|
|
20822
|
+
function chartGroupElement(kind, is3D) {
|
|
20811
20823
|
const match = Object.entries(CHART_GROUP_ELEMENTS).find(
|
|
20812
20824
|
([, value]) => value.kind === kind && value.is3D === is3D
|
|
20813
20825
|
);
|
|
@@ -20823,7 +20835,7 @@ function groupingFor(element4, grouping) {
|
|
|
20823
20835
|
var horizontalBars = (group2) => group2.kind === "bar" && group2.barDirection === "bar";
|
|
20824
20836
|
function newGroup(base, target, series2) {
|
|
20825
20837
|
const is3D = target.is3D ?? (base.is3D && SWITCHABLE[target.kind] === true);
|
|
20826
|
-
const element4 =
|
|
20838
|
+
const element4 = chartGroupElement(target.kind, is3D);
|
|
20827
20839
|
const group2 = { kind: target.kind, element: element4, is3D, series: series2, axisIds: [] };
|
|
20828
20840
|
const allowed = GROUP_FIELDS[element4] ?? [];
|
|
20829
20841
|
for (const key of allowed)
|
|
@@ -20849,11 +20861,11 @@ function newGroup(base, target, series2) {
|
|
|
20849
20861
|
return group2;
|
|
20850
20862
|
}
|
|
20851
20863
|
function withSeriesAxis(space3, group2, axes) {
|
|
20852
|
-
if ((group2.element === "line3DChart" || group2.kind === "surface") && !axes.some((
|
|
20864
|
+
if ((group2.element === "line3DChart" || group2.kind === "surface") && !axes.some((axis2) => axis2.kind === "ser")) {
|
|
20853
20865
|
const id = Math.max(
|
|
20854
20866
|
0,
|
|
20855
20867
|
...[...space3.plotArea.axes, ...axes].flatMap(
|
|
20856
|
-
(
|
|
20868
|
+
(axis2) => axis2.id === void 0 ? [] : [axis2.id]
|
|
20857
20869
|
)
|
|
20858
20870
|
) + 1;
|
|
20859
20871
|
axes.push({
|
|
@@ -20873,11 +20885,11 @@ function withSeriesAxis(space3, group2, axes) {
|
|
|
20873
20885
|
function groupAxes(space3, base, group2) {
|
|
20874
20886
|
if (!groupHasAxes(group2.element)) return [];
|
|
20875
20887
|
const xy = isXYChartKind(group2.kind);
|
|
20876
|
-
const byId = (id) => space3.plotArea.axes.find((
|
|
20877
|
-
const old = base.axisIds.map(byId).filter((
|
|
20888
|
+
const byId = (id) => space3.plotArea.axes.find((axis2) => axis2.id === id);
|
|
20889
|
+
const old = base.axisIds.map(byId).filter((axis2) => axis2 !== void 0);
|
|
20878
20890
|
if (old.length < 2) {
|
|
20879
20891
|
const taken = new Set(
|
|
20880
|
-
space3.plotArea.axes.flatMap((
|
|
20892
|
+
space3.plotArea.axes.flatMap((axis2) => axis2.id === void 0 ? [] : [axis2.id])
|
|
20881
20893
|
);
|
|
20882
20894
|
const free = DEFAULT_CHART_AXIS_IDS.every((id) => !taken.has(id));
|
|
20883
20895
|
const top = Math.max(0, ...taken);
|
|
@@ -20885,9 +20897,9 @@ function groupAxes(space3, base, group2) {
|
|
|
20885
20897
|
return withSeriesAxis(space3, group2, defaultChartAxes(horizontalBars(group2), xy, ids));
|
|
20886
20898
|
}
|
|
20887
20899
|
const rotate = horizontalBars(base) !== horizontalBars(group2);
|
|
20888
|
-
const axes = old.slice(0, group2.element === "line3DChart" || group2.is3D ? 3 : 2).map((
|
|
20889
|
-
const kind = i2 === 0 ? xy ? "val" :
|
|
20890
|
-
const next = convertChartAxis(
|
|
20900
|
+
const axes = old.slice(0, group2.element === "line3DChart" || group2.is3D ? 3 : 2).map((axis2, i2) => {
|
|
20901
|
+
const kind = i2 === 0 ? xy ? "val" : axis2.kind === "val" ? "cat" : axis2.kind : axis2.kind;
|
|
20902
|
+
const next = convertChartAxis(axis2, kind);
|
|
20891
20903
|
if (rotate) assignOrDelete(next, "position", rotatedAxisPosition(next.position));
|
|
20892
20904
|
if (i2 === 1 && next.kind === "val" && xy !== isXYChartKind(base.kind))
|
|
20893
20905
|
next.crossBetween = xy ? "midCat" : "between";
|
|
@@ -20912,7 +20924,7 @@ function setChartType(space3, target) {
|
|
|
20912
20924
|
if (group2.is3D && target.kind === "bar" && group2.grouping === "standard" && base.axisIds.length < 3)
|
|
20913
20925
|
group2.grouping = "clustered";
|
|
20914
20926
|
const axes = groupAxes(draft, base, group2);
|
|
20915
|
-
group2.axisIds = axes.flatMap((
|
|
20927
|
+
group2.axisIds = axes.flatMap((axis2) => axis2.id === void 0 ? [] : [axis2.id]);
|
|
20916
20928
|
draft.plotArea.groups = [group2];
|
|
20917
20929
|
draft.plotArea.axes = axes;
|
|
20918
20930
|
if (!group2.is3D) {
|
|
@@ -21048,15 +21060,15 @@ function chartSupportsQuickLayout(space3) {
|
|
|
21048
21060
|
return !!group2 && CHART_QUICK_LAYOUT_KINDS.has(group2.kind);
|
|
21049
21061
|
}
|
|
21050
21062
|
function applyAxes(draft, layout) {
|
|
21051
|
-
for (const
|
|
21052
|
-
const value =
|
|
21053
|
-
if (!value &&
|
|
21063
|
+
for (const axis2 of draft.plotArea.axes) {
|
|
21064
|
+
const value = axis2.kind === "val";
|
|
21065
|
+
if (!value && axis2.kind !== "cat" && axis2.kind !== "date") continue;
|
|
21054
21066
|
const titled = value ? layout.valAxisTitle : layout.catAxisTitle;
|
|
21055
|
-
if (!titled) delete
|
|
21056
|
-
else
|
|
21057
|
-
|
|
21058
|
-
|
|
21059
|
-
|
|
21067
|
+
if (!titled) delete axis2.title;
|
|
21068
|
+
else axis2.title ??= newChartTitle(CHART_QUICK_LAYOUT_AXIS_TITLE);
|
|
21069
|
+
axis2.majorGridlines = value && layout.majorGridlines;
|
|
21070
|
+
axis2.minorGridlines = value && layout.minorGridlines;
|
|
21071
|
+
axis2.deleted = value ? !layout.valueAxis : false;
|
|
21060
21072
|
}
|
|
21061
21073
|
}
|
|
21062
21074
|
function applyDataTable(draft, layout) {
|
|
@@ -21107,8 +21119,8 @@ function applyChartQuickLayout(space3, n3, only = ALL_PARTS) {
|
|
|
21107
21119
|
}
|
|
21108
21120
|
function matches(space3, layout) {
|
|
21109
21121
|
const axes = space3.plotArea.axes;
|
|
21110
|
-
const val2 = axes.find((
|
|
21111
|
-
const cat = axes.find((
|
|
21122
|
+
const val2 = axes.find((axis2) => axis2.kind === "val");
|
|
21123
|
+
const cat = axes.find((axis2) => axis2.kind === "cat" || axis2.kind === "date");
|
|
21112
21124
|
const bar = space3.plotArea.groups.find((group2) => group2.kind === "bar");
|
|
21113
21125
|
const labels2 = space3.plotArea.groups.some(
|
|
21114
21126
|
(group2) => group2.dataLabels && group2.dataLabels.deleted !== true && group2.dataLabels.showValue
|
|
@@ -21166,6 +21178,12 @@ var RANGES = {
|
|
|
21166
21178
|
firstSliceAngle: [0, 360],
|
|
21167
21179
|
holeSize: [1, 90]
|
|
21168
21180
|
};
|
|
21181
|
+
var isChartGroupOption = (key) => Object.hasOwn(RANGES, key);
|
|
21182
|
+
function assertChartGroupOption(key, value) {
|
|
21183
|
+
const [min, max] = RANGES[key];
|
|
21184
|
+
if (!Number.isInteger(value) || value < min || value > max)
|
|
21185
|
+
throw new RangeError(`Chart ${key} must be a whole number from ${min} to ${max}`);
|
|
21186
|
+
}
|
|
21169
21187
|
function setChartGroupOptions(space3, seriesIndex, edit) {
|
|
21170
21188
|
return editChartSpace(space3, (draft) => {
|
|
21171
21189
|
const { group: group2 } = chartSeriesEntryAt(draft, seriesIndex);
|
|
@@ -21178,9 +21196,7 @@ function setChartGroupOptions(space3, seriesIndex, edit) {
|
|
|
21178
21196
|
delete group2[key];
|
|
21179
21197
|
continue;
|
|
21180
21198
|
}
|
|
21181
|
-
|
|
21182
|
-
if (!Number.isInteger(value) || value < min || value > max)
|
|
21183
|
-
throw new RangeError(`Chart ${key} must be a whole number from ${min} to ${max}`);
|
|
21199
|
+
assertChartGroupOption(key, value);
|
|
21184
21200
|
group2[key] = value;
|
|
21185
21201
|
}
|
|
21186
21202
|
});
|
|
@@ -21513,9 +21529,9 @@ function setChartView3D(space3, edit) {
|
|
|
21513
21529
|
|
|
21514
21530
|
// chart/edit/secondary-axis.ts
|
|
21515
21531
|
function axisPair(space3, group2) {
|
|
21516
|
-
if (group2.axisIds.length !== 2 || new Set(space3.plotArea.axes.map((
|
|
21532
|
+
if (group2.axisIds.length !== 2 || new Set(space3.plotArea.axes.map((axis2) => axis2.id)).size !== space3.plotArea.axes.length)
|
|
21517
21533
|
return void 0;
|
|
21518
|
-
const [x, y] = group2.axisIds.map((id) => space3.plotArea.axes.find((
|
|
21534
|
+
const [x, y] = group2.axisIds.map((id) => space3.plotArea.axes.find((axis2) => axis2.id === id));
|
|
21519
21535
|
return x && y && ["cat", "date"].includes(x.kind) && y.kind === "val" && x.crossAxisId === y.id && y.crossAxisId === x.id ? [x, y] : void 0;
|
|
21520
21536
|
}
|
|
21521
21537
|
function chartSeriesSecondaryAxisSupported(space3, seriesIndex) {
|
|
@@ -21544,7 +21560,7 @@ function isolateSeries(space3, index) {
|
|
|
21544
21560
|
space3.plotArea.groups.splice(groupIndex, 1, ...segments);
|
|
21545
21561
|
return chartSeriesEntryAt(space3, index).group;
|
|
21546
21562
|
}
|
|
21547
|
-
function setChartSeriesSecondaryAxis(space3, seriesIndex, secondary) {
|
|
21563
|
+
function setChartSeriesSecondaryAxis(space3, seriesIndex, secondary, options2 = {}) {
|
|
21548
21564
|
if (!chartSeriesSecondaryAxisSupported(space3, seriesIndex))
|
|
21549
21565
|
throw new RangeError(
|
|
21550
21566
|
"Secondary-axis editing needs a later series in a supported vertical 2D chart"
|
|
@@ -21558,12 +21574,12 @@ function setChartSeriesSecondaryAxis(space3, seriesIndex, secondary) {
|
|
|
21558
21574
|
return;
|
|
21559
21575
|
}
|
|
21560
21576
|
if (group2.axisIds[1] !== primary.axisIds[1]) return;
|
|
21561
|
-
const existing = draft.plotArea.axes.filter((
|
|
21577
|
+
const existing = draft.plotArea.axes.filter((axis2) => axis2.kind === "cat" || axis2.kind === "date").map((axis2) => axisPair(draft, { ...primary, axisIds: [axis2.id, axis2.crossAxisId] })).find((pair) => pair && pair[1].id !== primary.axisIds[1]);
|
|
21562
21578
|
if (existing) {
|
|
21563
|
-
group2.axisIds = existing.map((
|
|
21579
|
+
group2.axisIds = existing.map((axis2) => axis2.id);
|
|
21564
21580
|
return;
|
|
21565
21581
|
}
|
|
21566
|
-
const used = new Set(draft.plotArea.axes.map((
|
|
21582
|
+
const used = new Set(draft.plotArea.axes.map((axis2) => axis2.id));
|
|
21567
21583
|
const allocate = () => {
|
|
21568
21584
|
let id = 500000003;
|
|
21569
21585
|
while (used.has(id)) id++;
|
|
@@ -21571,7 +21587,9 @@ function setChartSeriesSecondaryAxis(space3, seriesIndex, secondary) {
|
|
|
21571
21587
|
used.add(id);
|
|
21572
21588
|
return id;
|
|
21573
21589
|
};
|
|
21574
|
-
const ids = [allocate(), allocate()];
|
|
21590
|
+
const ids = options2.axisIds ? [...options2.axisIds] : [allocate(), allocate()];
|
|
21591
|
+
if (options2.axisIds && (ids[0] === ids[1] || ids.some((id) => used.has(id) || !Number.isSafeInteger(id) || id < 0 || id > 4294967295)))
|
|
21592
|
+
throw new RangeError("Secondary axis ids must be two unused whole numbers");
|
|
21575
21593
|
const horizontal = primary.barDirection === "bar";
|
|
21576
21594
|
const axes = defaultChartAxes(horizontal, false, ids);
|
|
21577
21595
|
axes[0] = { ...structuredClone(axisPair(draft, primary)[0]), id: ids[0], crossAxisId: ids[1] };
|
|
@@ -21717,6 +21735,58 @@ function applyChartSpaceDataSheetEdits(space3, edits) {
|
|
|
21717
21735
|
return editChartSpace(next, (draft) => applyStandardChartLayout(draft, layoutSheet, count));
|
|
21718
21736
|
}
|
|
21719
21737
|
|
|
21738
|
+
// chart/edit/new-chart-minimal.ts
|
|
21739
|
+
var VARIED = /* @__PURE__ */ new Set(["pie", "doughnut", "ofPie"]);
|
|
21740
|
+
function schemaGrouping(element4, grouping) {
|
|
21741
|
+
const bar = element4 === "barChart" || element4 === "bar3DChart";
|
|
21742
|
+
if (bar) return grouping ?? "clustered";
|
|
21743
|
+
return grouping === void 0 || grouping === "clustered" ? "standard" : grouping;
|
|
21744
|
+
}
|
|
21745
|
+
function minimalChartGroup(target, series2) {
|
|
21746
|
+
const is3D = target.is3D ?? false;
|
|
21747
|
+
const element4 = chartGroupElement(target.kind, is3D);
|
|
21748
|
+
const allowed = GROUP_FIELDS[element4] ?? [];
|
|
21749
|
+
const own = isXYChartKind(target.kind) ? series2.map((item2) => stripSeriesForKind(item2, "bar", target.kind)) : series2;
|
|
21750
|
+
const group2 = { kind: target.kind, element: element4, is3D, series: own, axisIds: [] };
|
|
21751
|
+
if (target.kind === "bar") group2.barDirection = target.barDirection ?? "col";
|
|
21752
|
+
if (allowed.includes("grouping")) group2.grouping = schemaGrouping(element4, target.grouping);
|
|
21753
|
+
if (allowed.includes("varyColors")) group2.varyColors = VARIED.has(target.kind);
|
|
21754
|
+
if (target.kind === "ofPie") group2.ofPieType = "pie";
|
|
21755
|
+
if (target.kind === "scatter") group2.scatterStyle = "lineMarker";
|
|
21756
|
+
if (target.kind === "radar") group2.radarStyle = "marker";
|
|
21757
|
+
return group2;
|
|
21758
|
+
}
|
|
21759
|
+
function axis(kind, id, crossAxisId, position) {
|
|
21760
|
+
return {
|
|
21761
|
+
kind,
|
|
21762
|
+
id,
|
|
21763
|
+
crossAxisId,
|
|
21764
|
+
position,
|
|
21765
|
+
scaling: { orientation: "minMax" },
|
|
21766
|
+
deleted: false,
|
|
21767
|
+
majorGridlines: false,
|
|
21768
|
+
minorGridlines: false
|
|
21769
|
+
};
|
|
21770
|
+
}
|
|
21771
|
+
function minimalChartAxes(group2, ids) {
|
|
21772
|
+
if (!groupHasAxes(group2.element)) return [];
|
|
21773
|
+
const [first2, second, third] = ids;
|
|
21774
|
+
const horizontal = group2.kind === "bar" && group2.barDirection === "bar";
|
|
21775
|
+
const axes = [
|
|
21776
|
+
axis(isXYChartKind(group2.kind) ? "val" : "cat", first2, second, horizontal ? "l" : "b"),
|
|
21777
|
+
axis("val", second, first2, horizontal ? "b" : "l")
|
|
21778
|
+
];
|
|
21779
|
+
if (group2.element === "line3DChart" || group2.kind === "surface")
|
|
21780
|
+
axes.push(axis("ser", third, second, "b"));
|
|
21781
|
+
return axes;
|
|
21782
|
+
}
|
|
21783
|
+
function minimalChartTitle(text3) {
|
|
21784
|
+
const rich = chartTextBodyFromXml(
|
|
21785
|
+
`<a:bodyPr/><a:lstStyle/><a:p><a:r><a:t>${escapeText(text3)}</a:t></a:r></a:p>`
|
|
21786
|
+
);
|
|
21787
|
+
return { tx: { rich, text: rich.text }, text: rich.text, overlay: false };
|
|
21788
|
+
}
|
|
21789
|
+
|
|
21720
21790
|
// chart/edit/new-chart.ts
|
|
21721
21791
|
var DEFAULT_CHART_DATA_SHEET = {
|
|
21722
21792
|
categories: ["Category 1", "Category 2", "Category 3", "Category 4"],
|
|
@@ -21726,21 +21796,84 @@ var DEFAULT_CHART_DATA_SHEET = {
|
|
|
21726
21796
|
{ name: "Series 3", values: [2, 2, 3, 5] }
|
|
21727
21797
|
]
|
|
21728
21798
|
};
|
|
21729
|
-
|
|
21799
|
+
var CATEGORY_ONLY2 = [
|
|
21800
|
+
"labelAlign",
|
|
21801
|
+
"noMultiLevelLabels",
|
|
21802
|
+
"tickLabelSkip",
|
|
21803
|
+
"tickMarkSkip"
|
|
21804
|
+
];
|
|
21805
|
+
function withDateAxis(space3) {
|
|
21806
|
+
return editChartSpace(space3, (draft) => {
|
|
21807
|
+
const axis2 = draft.plotArea.axes[0];
|
|
21808
|
+
if (axis2?.kind !== "cat") return;
|
|
21809
|
+
axis2.kind = "date";
|
|
21810
|
+
for (const key of CATEGORY_ONLY2) delete axis2[key];
|
|
21811
|
+
});
|
|
21812
|
+
}
|
|
21813
|
+
function series(sheet, index, options2, sheetName) {
|
|
21730
21814
|
const entry3 = sheet.series[index];
|
|
21815
|
+
if (options2.data === "literal")
|
|
21816
|
+
return {
|
|
21817
|
+
index,
|
|
21818
|
+
order: index,
|
|
21819
|
+
tx: { value: entry3.name, text: entry3.name },
|
|
21820
|
+
...options2.profile === "minimal" ? {} : { invertIfNegative: false },
|
|
21821
|
+
dataPoints: [],
|
|
21822
|
+
categories: categorySource(sheet.categories, void 0),
|
|
21823
|
+
values: numberSource(entry3.values, void 0)
|
|
21824
|
+
};
|
|
21731
21825
|
const formulas = standardChartFormulas(sheetName, index, sheet.categories.length);
|
|
21732
21826
|
return {
|
|
21733
21827
|
index,
|
|
21734
21828
|
order: index,
|
|
21735
21829
|
tx: { reference: categorySource([entry3.name], void 0, formulas.name), text: entry3.name },
|
|
21736
|
-
invertIfNegative: false,
|
|
21830
|
+
...options2.profile === "minimal" ? {} : { invertIfNegative: false },
|
|
21737
21831
|
dataPoints: [],
|
|
21738
21832
|
categories: categorySource(sheet.categories, void 0, formulas.categories),
|
|
21739
21833
|
values: numberSource(entry3.values, void 0, formulas.values)
|
|
21740
21834
|
};
|
|
21741
21835
|
}
|
|
21742
|
-
function
|
|
21743
|
-
const
|
|
21836
|
+
function axisIds(options2) {
|
|
21837
|
+
const ids = options2.axisIds ?? [];
|
|
21838
|
+
const [first2, second, third] = [
|
|
21839
|
+
ids[0] ?? DEFAULT_CHART_AXIS_IDS[0],
|
|
21840
|
+
ids[1] ?? DEFAULT_CHART_AXIS_IDS[1],
|
|
21841
|
+
ids[2] ?? DEFAULT_CHART_AXIS_IDS[1] + 1
|
|
21842
|
+
];
|
|
21843
|
+
for (const id of [first2, second, third])
|
|
21844
|
+
if (!Number.isSafeInteger(id) || id < 0)
|
|
21845
|
+
throw new RangeError("Chart axis ids must be non-negative whole numbers");
|
|
21846
|
+
if ((/* @__PURE__ */ new Set([first2, second, third])).size !== 3)
|
|
21847
|
+
throw new RangeError("Chart axis ids must differ");
|
|
21848
|
+
return [first2, second, third];
|
|
21849
|
+
}
|
|
21850
|
+
function withAxisIds(space3, ids) {
|
|
21851
|
+
return editChartSpace(space3, (draft) => {
|
|
21852
|
+
const map = /* @__PURE__ */ new Map();
|
|
21853
|
+
draft.plotArea.axes.forEach((axis2, position) => {
|
|
21854
|
+
if (axis2.id !== void 0 && ids[position] !== void 0) map.set(axis2.id, ids[position]);
|
|
21855
|
+
});
|
|
21856
|
+
const renumber = (id) => map.get(id) ?? id;
|
|
21857
|
+
for (const axis2 of draft.plotArea.axes) {
|
|
21858
|
+
if (axis2.id !== void 0) axis2.id = renumber(axis2.id);
|
|
21859
|
+
if (axis2.crossAxisId !== void 0) axis2.crossAxisId = renumber(axis2.crossAxisId);
|
|
21860
|
+
}
|
|
21861
|
+
for (const group2 of draft.plotArea.groups) group2.axisIds = group2.axisIds.map(renumber);
|
|
21862
|
+
});
|
|
21863
|
+
}
|
|
21864
|
+
function withGroupSettings(space3, settings) {
|
|
21865
|
+
return editChartSpace(space3, (draft) => {
|
|
21866
|
+
const group2 = draft.plotArea.groups[0];
|
|
21867
|
+
const allowed = GROUP_FIELDS[group2.element] ?? [];
|
|
21868
|
+
for (const [key, value] of Object.entries(settings)) {
|
|
21869
|
+
if (value === void 0) continue;
|
|
21870
|
+
if (!allowed.includes(key)) throw new RangeError(`A ${group2.element} has no ${key} setting`);
|
|
21871
|
+
if (isChartGroupOption(key)) assertChartGroupOption(key, value);
|
|
21872
|
+
Object.assign(group2, { [key]: structuredClone(value) });
|
|
21873
|
+
}
|
|
21874
|
+
});
|
|
21875
|
+
}
|
|
21876
|
+
function officeChartSpace(sheet, target, options2, sheetName) {
|
|
21744
21877
|
const group2 = {
|
|
21745
21878
|
kind: "bar",
|
|
21746
21879
|
element: "barChart",
|
|
@@ -21750,10 +21883,10 @@ function newChartSpace(sheet = DEFAULT_CHART_DATA_SHEET, target, options2 = {})
|
|
|
21750
21883
|
varyColors: false,
|
|
21751
21884
|
gapWidth: 219,
|
|
21752
21885
|
overlap: -27,
|
|
21753
|
-
series: sheet.series.map((_, index) => series(sheet, index, sheetName)),
|
|
21886
|
+
series: sheet.series.map((_, index) => series(sheet, index, options2, sheetName)),
|
|
21754
21887
|
axisIds: [...DEFAULT_CHART_AXIS_IDS]
|
|
21755
21888
|
};
|
|
21756
|
-
|
|
21889
|
+
const space3 = {
|
|
21757
21890
|
roundedCorners: false,
|
|
21758
21891
|
autoTitleDeleted: options2.title === void 0,
|
|
21759
21892
|
plotArea: { layout: {}, groups: [group2], axes: defaultChartAxes(false, false) },
|
|
@@ -21762,9 +21895,36 @@ function newChartSpace(sheet = DEFAULT_CHART_DATA_SHEET, target, options2 = {})
|
|
|
21762
21895
|
};
|
|
21763
21896
|
const column = !target || target.kind === "bar" && (target.barDirection ?? "col") === "col";
|
|
21764
21897
|
if (target && !(column && !target.is3D && (target.grouping ?? "clustered") === "clustered"))
|
|
21765
|
-
|
|
21766
|
-
|
|
21767
|
-
|
|
21898
|
+
return setChartType(space3, target);
|
|
21899
|
+
return space3;
|
|
21900
|
+
}
|
|
21901
|
+
function minimalChartSpace(sheet, target, options2, sheetName) {
|
|
21902
|
+
const group2 = minimalChartGroup(
|
|
21903
|
+
target ?? { kind: "bar" },
|
|
21904
|
+
sheet.series.map((_, index) => series(sheet, index, options2, sheetName))
|
|
21905
|
+
);
|
|
21906
|
+
if (group2.kind === "stock" && ![3, 4].includes(group2.series.length))
|
|
21907
|
+
throw new RangeError("A stock chart requires three or four price series");
|
|
21908
|
+
const axes = minimalChartAxes(group2, axisIds(options2));
|
|
21909
|
+
group2.axisIds = axes.flatMap((axis2) => axis2.id === void 0 ? [] : [axis2.id]);
|
|
21910
|
+
return {
|
|
21911
|
+
autoTitleDeleted: options2.title === void 0,
|
|
21912
|
+
plotArea: { layout: {}, groups: [group2], axes },
|
|
21913
|
+
plotVisibleOnly: true,
|
|
21914
|
+
displayBlanksAs: "gap"
|
|
21915
|
+
};
|
|
21916
|
+
}
|
|
21917
|
+
function newChartSpace(sheet = DEFAULT_CHART_DATA_SHEET, target, options2 = {}) {
|
|
21918
|
+
const sheetName = options2.sheetName ?? DEFAULT_CHART_SHEET_NAME;
|
|
21919
|
+
let space3 = options2.profile === "minimal" ? minimalChartSpace(sheet, target, options2, sheetName) : officeChartSpace(sheet, target, options2, sheetName);
|
|
21920
|
+
if (options2.profile !== "minimal" && options2.axisIds !== void 0)
|
|
21921
|
+
space3 = withAxisIds(space3, axisIds(options2));
|
|
21922
|
+
if (options2.dateAxis) space3 = withDateAxis(space3);
|
|
21923
|
+
if (options2.group) space3 = withGroupSettings(space3, options2.group);
|
|
21924
|
+
if (options2.title !== void 0)
|
|
21925
|
+
space3 = options2.profile === "minimal" ? { ...space3, title: minimalChartTitle(options2.title), autoTitleDeleted: false } : setChartTitle(space3, options2.title);
|
|
21926
|
+
const legend = options2.legendPosition === void 0 ? "b" : options2.legendPosition;
|
|
21927
|
+
return legend === null ? space3 : setChartLegend(space3, { position: legend });
|
|
21768
21928
|
}
|
|
21769
21929
|
|
|
21770
21930
|
// chart/edit/apply-appearance.ts
|
|
@@ -21892,21 +22052,21 @@ function chartExStyleSpace(space3) {
|
|
|
21892
22052
|
} : {},
|
|
21893
22053
|
plotArea: {
|
|
21894
22054
|
...styles(space3.plotArea),
|
|
21895
|
-
axes: space3.plotArea.axes.map((
|
|
21896
|
-
kind:
|
|
22055
|
+
axes: space3.plotArea.axes.map((axis2) => ({
|
|
22056
|
+
kind: axis2.scaling?.kind ?? "val",
|
|
21897
22057
|
scaling: {},
|
|
21898
|
-
...styles(
|
|
21899
|
-
...
|
|
22058
|
+
...styles(axis2),
|
|
22059
|
+
...axis2.title ? {
|
|
21900
22060
|
title: {
|
|
21901
|
-
...styles(
|
|
21902
|
-
...
|
|
22061
|
+
...styles(axis2.title),
|
|
22062
|
+
...axis2.title.tx?.rich ? { tx: { rich: axis2.title.tx.rich, text: axis2.title.tx.rich.text } } : {}
|
|
21903
22063
|
}
|
|
21904
22064
|
} : {},
|
|
21905
|
-
...
|
|
21906
|
-
majorGridlines: !!
|
|
21907
|
-
minorGridlines: !!
|
|
21908
|
-
...
|
|
21909
|
-
...
|
|
22065
|
+
...axis2.id === void 0 ? {} : { id: axis2.id },
|
|
22066
|
+
majorGridlines: !!axis2.majorGridlines,
|
|
22067
|
+
minorGridlines: !!axis2.minorGridlines,
|
|
22068
|
+
...axis2.majorGridlines?.spPr ? { majorGridlinesSpPr: axis2.majorGridlines.spPr } : {},
|
|
22069
|
+
...axis2.minorGridlines?.spPr ? { minorGridlinesSpPr: axis2.minorGridlines.spPr } : {}
|
|
21910
22070
|
})),
|
|
21911
22071
|
groups: space3.plotArea.series.map((series2) => ({
|
|
21912
22072
|
kind: "bar",
|
|
@@ -21942,19 +22102,19 @@ function editChartExStyle(space3, operation) {
|
|
|
21942
22102
|
if (after.title.tx?.rich) draft.title.tx = { ...draft.title.tx, rich: after.title.tx.rich };
|
|
21943
22103
|
}
|
|
21944
22104
|
if (draft.legend && after.legend) copyStyle(draft.legend, after.legend);
|
|
21945
|
-
draft.plotArea.axes.forEach((
|
|
22105
|
+
draft.plotArea.axes.forEach((axis2, index) => {
|
|
21946
22106
|
const edited = after.plotArea.axes[index];
|
|
21947
22107
|
if (!edited) return;
|
|
21948
|
-
copyStyle(
|
|
21949
|
-
if (
|
|
21950
|
-
copyStyle(
|
|
21951
|
-
if (edited.title.tx?.rich)
|
|
22108
|
+
copyStyle(axis2, edited);
|
|
22109
|
+
if (axis2.title && edited.title) {
|
|
22110
|
+
copyStyle(axis2.title, edited.title);
|
|
22111
|
+
if (edited.title.tx?.rich) axis2.title.tx = { ...axis2.title.tx, rich: edited.title.tx.rich };
|
|
21952
22112
|
}
|
|
21953
22113
|
for (const key of ["majorGridlines", "minorGridlines"]) {
|
|
21954
22114
|
const shape = edited[key === "majorGridlines" ? "majorGridlinesSpPr" : "minorGridlinesSpPr"];
|
|
21955
22115
|
if (shape) {
|
|
21956
|
-
|
|
21957
|
-
|
|
22116
|
+
axis2[key] ??= {};
|
|
22117
|
+
axis2[key].spPr = structuredClone(shape);
|
|
21958
22118
|
}
|
|
21959
22119
|
}
|
|
21960
22120
|
});
|
|
@@ -21999,10 +22159,10 @@ function shapes(space3, target) {
|
|
|
21999
22159
|
case "axis":
|
|
22000
22160
|
case "majorGridlines":
|
|
22001
22161
|
case "minorGridlines": {
|
|
22002
|
-
const
|
|
22003
|
-
if (!
|
|
22004
|
-
if (target.kind === "axis") return [
|
|
22005
|
-
return [(
|
|
22162
|
+
const axis2 = space3.plotArea.axes[target.axisIndex];
|
|
22163
|
+
if (!axis2) throw new RangeError("No chart axis at index.");
|
|
22164
|
+
if (target.kind === "axis") return [axis2.spPr ??= {}];
|
|
22165
|
+
return [(axis2[target.kind] ??= {}).spPr ??= {}];
|
|
22006
22166
|
}
|
|
22007
22167
|
case "dataLabels": {
|
|
22008
22168
|
const series2 = target.seriesIndex === void 0 ? space3.plotArea.series : [chartExSeriesAt(space3, target.seriesIndex)];
|
|
@@ -22092,25 +22252,25 @@ function editChartExAxis(space3, index, edit) {
|
|
|
22092
22252
|
throw new RangeError("Invalid ChartEx axis scaling.");
|
|
22093
22253
|
}
|
|
22094
22254
|
return editChartExSpace(space3, (draft) => {
|
|
22095
|
-
const
|
|
22255
|
+
const axis2 = chartExAxisAt(draft, index);
|
|
22096
22256
|
for (const key of ["min", "max", "majorUnit", "minorUnit"])
|
|
22097
22257
|
if (edit[key] !== void 0) {
|
|
22098
|
-
if (
|
|
22258
|
+
if (axis2.scaling?.kind !== "val")
|
|
22099
22259
|
throw new RangeError("Only a value axis supports numeric scaling.");
|
|
22100
|
-
if (edit[key] === null) delete
|
|
22101
|
-
else
|
|
22260
|
+
if (edit[key] === null) delete axis2.scaling[key];
|
|
22261
|
+
else axis2.scaling[key] = edit[key];
|
|
22102
22262
|
}
|
|
22103
|
-
if (
|
|
22263
|
+
if (axis2.scaling?.kind === "val" && typeof axis2.scaling.min === "number" && typeof axis2.scaling.max === "number" && axis2.scaling.min >= axis2.scaling.max)
|
|
22104
22264
|
throw new RangeError("Axis maximum must exceed its minimum.");
|
|
22105
|
-
if (edit.visible !== void 0)
|
|
22265
|
+
if (edit.visible !== void 0) axis2.hidden = !edit.visible;
|
|
22106
22266
|
if (edit.tickLabels !== void 0) {
|
|
22107
|
-
if (edit.tickLabels)
|
|
22108
|
-
else delete
|
|
22267
|
+
if (edit.tickLabels) axis2.tickLabels ??= {};
|
|
22268
|
+
else delete axis2.tickLabels;
|
|
22109
22269
|
}
|
|
22110
22270
|
for (const key of ["majorGridlines", "minorGridlines"])
|
|
22111
22271
|
if (edit[key] !== void 0) {
|
|
22112
|
-
if (edit[key])
|
|
22113
|
-
else delete
|
|
22272
|
+
if (edit[key]) axis2[key] ??= {};
|
|
22273
|
+
else delete axis2[key];
|
|
22114
22274
|
}
|
|
22115
22275
|
for (const [key, target] of [
|
|
22116
22276
|
["majorTickMark", "majorTickMarks"],
|
|
@@ -22118,28 +22278,28 @@ function editChartExAxis(space3, index, edit) {
|
|
|
22118
22278
|
])
|
|
22119
22279
|
if (edit[key] !== void 0) {
|
|
22120
22280
|
const value = edit[key];
|
|
22121
|
-
if (value === null) delete
|
|
22281
|
+
if (value === null) delete axis2[target];
|
|
22122
22282
|
else {
|
|
22123
22283
|
if (!["in", "out", "cross", "none"].includes(value))
|
|
22124
22284
|
throw new RangeError("Invalid tick mark.");
|
|
22125
|
-
|
|
22285
|
+
axis2[target] = { type: value };
|
|
22126
22286
|
}
|
|
22127
22287
|
}
|
|
22128
22288
|
if (edit.title !== void 0) {
|
|
22129
22289
|
const { title: _chartTitle, ...base } = draft;
|
|
22130
22290
|
const title = setChartExTitle(
|
|
22131
|
-
{ ...base, ...
|
|
22291
|
+
{ ...base, ...axis2.title ? { title: axis2.title } : {} },
|
|
22132
22292
|
edit.title ?? void 0
|
|
22133
22293
|
).title;
|
|
22134
|
-
if (title)
|
|
22135
|
-
else delete
|
|
22294
|
+
if (title) axis2.title = title;
|
|
22295
|
+
else delete axis2.title;
|
|
22136
22296
|
}
|
|
22137
22297
|
if (edit.numberFormat !== void 0) {
|
|
22138
|
-
if (edit.numberFormat === null) delete
|
|
22139
|
-
else
|
|
22298
|
+
if (edit.numberFormat === null) delete axis2.numberFormat;
|
|
22299
|
+
else axis2.numberFormat = structuredClone(edit.numberFormat);
|
|
22140
22300
|
}
|
|
22141
22301
|
if (edit.units !== void 0) {
|
|
22142
|
-
if (edit.units === null) delete
|
|
22302
|
+
if (edit.units === null) delete axis2.units;
|
|
22143
22303
|
else {
|
|
22144
22304
|
if (![
|
|
22145
22305
|
"hundreds",
|
|
@@ -22154,7 +22314,7 @@ function editChartExAxis(space3, index, edit) {
|
|
|
22154
22314
|
"percentage"
|
|
22155
22315
|
].includes(edit.units))
|
|
22156
22316
|
throw new RangeError("Unsupported ChartEx display units.");
|
|
22157
|
-
|
|
22317
|
+
axis2.units = { ...axis2.units, unit: edit.units };
|
|
22158
22318
|
}
|
|
22159
22319
|
}
|
|
22160
22320
|
});
|
|
@@ -22250,9 +22410,9 @@ function applyChartExEditAction(space3, action) {
|
|
|
22250
22410
|
return setChartExAxis(space3, action.axisIndex, action.edit);
|
|
22251
22411
|
case "tickLabels":
|
|
22252
22412
|
return editChartExSpace(space3, (draft) => {
|
|
22253
|
-
const
|
|
22254
|
-
if (action.visible)
|
|
22255
|
-
else delete
|
|
22413
|
+
const axis2 = chartExAxisAt(draft, action.axisIndex);
|
|
22414
|
+
if (action.visible) axis2.tickLabels ??= {};
|
|
22415
|
+
else delete axis2.tickLabels;
|
|
22256
22416
|
});
|
|
22257
22417
|
case "pointLabel":
|
|
22258
22418
|
return setChartExPointLabel(space3, action.seriesIndex, action.pointIndex, action.label);
|
|
@@ -22549,15 +22709,15 @@ function setChartSeriesAxis(space3, seriesIndex, valueAxisId2) {
|
|
|
22549
22709
|
const { group: group2 } = chartSeriesEntryAt(space3, seriesIndex);
|
|
22550
22710
|
if (group2.is3D || !["bar", "line", "area", "scatter", "bubble"].includes(group2.kind))
|
|
22551
22711
|
throw new RangeError("This chart family has no editable axis pair");
|
|
22552
|
-
if (new Set(space3.plotArea.axes.map((
|
|
22712
|
+
if (new Set(space3.plotArea.axes.map((axis2) => axis2.id)).size !== space3.plotArea.axes.length)
|
|
22553
22713
|
throw new RangeError("Ambiguous chart axis ids");
|
|
22554
22714
|
const horizontal = group2.kind === "bar" && group2.barDirection === "bar";
|
|
22555
22715
|
const candidates = space3.plotArea.axes.filter(
|
|
22556
|
-
(
|
|
22716
|
+
(axis2) => axis2.kind === "val" && (valueAxisId2 === null ? axis2.position === (horizontal ? "b" : "l") : axis2.id === valueAxisId2)
|
|
22557
22717
|
);
|
|
22558
22718
|
if (candidates.length !== 1) throw new RangeError("No unique existing value axis");
|
|
22559
22719
|
const value = candidates[0];
|
|
22560
|
-
const category = space3.plotArea.axes.find((
|
|
22720
|
+
const category = space3.plotArea.axes.find((axis2) => axis2.id === value.crossAxisId);
|
|
22561
22721
|
const xy = group2.kind === "scatter" || group2.kind === "bubble";
|
|
22562
22722
|
if (value.id === void 0 || category?.id === void 0 || category.crossAxisId !== value.id || (xy ? category.kind !== "val" : !["cat", "date"].includes(category.kind)))
|
|
22563
22723
|
throw new RangeError("Axis references do not form a coherent pair");
|
|
@@ -22590,7 +22750,7 @@ function setChartSeriesType(space3, index, target) {
|
|
|
22590
22750
|
return structuredClone(space3);
|
|
22591
22751
|
if (group2.is3D || target.is3D || !["bar", "line", "area"].includes(group2.kind) || !["bar", "line", "area"].includes(target.kind) || group2.barDirection === "bar" || target.barDirection === "bar")
|
|
22592
22752
|
throw new RangeError("Series combo types need vertical 2D column, line or area families");
|
|
22593
|
-
const pair = group2.axisIds.map((id) => space3.plotArea.axes.find((
|
|
22753
|
+
const pair = group2.axisIds.map((id) => space3.plotArea.axes.find((axis2) => axis2.id === id));
|
|
22594
22754
|
if (pair.length !== 2 || !pair[0] || !pair[1] || !["cat", "date"].includes(pair[0].kind) || pair[1].kind !== "val" || pair[0].crossAxisId !== pair[1].id || pair[1].crossAxisId !== pair[0].id)
|
|
22595
22755
|
throw new RangeError("Combo types need a coherent category/value axis pair");
|
|
22596
22756
|
if (group2.series.length > 1 && group2.extLst)
|
|
@@ -22661,14 +22821,14 @@ function setChartGroupDecorations(space3, edit) {
|
|
|
22661
22821
|
// chart/edit/axis-label.ts
|
|
22662
22822
|
function setChartDisplayUnitsLabel(space3, target, edit) {
|
|
22663
22823
|
return editChartSpace(space3, (draft) => {
|
|
22664
|
-
const
|
|
22665
|
-
if (
|
|
22824
|
+
const axis2 = chartAxisAt(draft, target);
|
|
22825
|
+
if (axis2.kind !== "val") throw new RangeError("Only a value axis has a display-units label");
|
|
22666
22826
|
if (edit === null) {
|
|
22667
|
-
if (
|
|
22827
|
+
if (axis2.displayUnits) delete axis2.displayUnits.label;
|
|
22668
22828
|
return;
|
|
22669
22829
|
}
|
|
22670
|
-
|
|
22671
|
-
const label =
|
|
22830
|
+
axis2.displayUnits ??= {};
|
|
22831
|
+
const label = axis2.displayUnits.label ??= {};
|
|
22672
22832
|
if (edit.text === null) delete label.tx;
|
|
22673
22833
|
else if (edit.text !== void 0)
|
|
22674
22834
|
assignOrDelete(
|
|
@@ -28170,8 +28330,8 @@ function documentOrder(point) {
|
|
|
28170
28330
|
descendants3(all[0], all);
|
|
28171
28331
|
return all;
|
|
28172
28332
|
}
|
|
28173
|
-
function axisPoints(point,
|
|
28174
|
-
switch (
|
|
28333
|
+
function axisPoints(point, axis2) {
|
|
28334
|
+
switch (axis2) {
|
|
28175
28335
|
case "self":
|
|
28176
28336
|
return [point];
|
|
28177
28337
|
case "ch":
|
|
@@ -28190,7 +28350,7 @@ function axisPoints(point, axis) {
|
|
|
28190
28350
|
return point.parent ? [point.parent] : [];
|
|
28191
28351
|
case "ancst":
|
|
28192
28352
|
case "ancstOrSelf": {
|
|
28193
|
-
const out =
|
|
28353
|
+
const out = axis2 === "ancstOrSelf" ? [point] : [];
|
|
28194
28354
|
let current = point.parent;
|
|
28195
28355
|
while (current) {
|
|
28196
28356
|
out.push(current);
|
|
@@ -28205,13 +28365,13 @@ function axisPoints(point, axis) {
|
|
|
28205
28365
|
if (index < 0) {
|
|
28206
28366
|
return [];
|
|
28207
28367
|
}
|
|
28208
|
-
return
|
|
28368
|
+
return axis2 === "followSib" ? siblings.slice(index + 1) : siblings.slice(0, index);
|
|
28209
28369
|
}
|
|
28210
28370
|
case "follow":
|
|
28211
28371
|
case "preced": {
|
|
28212
28372
|
const all = documentOrder(point);
|
|
28213
28373
|
const index = all.indexOf(point);
|
|
28214
|
-
return
|
|
28374
|
+
return axis2 === "follow" ? all.slice(index + 1) : all.slice(0, index);
|
|
28215
28375
|
}
|
|
28216
28376
|
case "root":
|
|
28217
28377
|
return [rootOf2(point)];
|
|
@@ -28283,10 +28443,10 @@ function windowPoints(points2, st = 1, cnt = 0, step = 1) {
|
|
|
28283
28443
|
return out;
|
|
28284
28444
|
}
|
|
28285
28445
|
function iterateStep(point, iterator, step) {
|
|
28286
|
-
const
|
|
28446
|
+
const axis2 = iterator.axis[step] ?? "none";
|
|
28287
28447
|
const ptType = iterator.ptType[step] ?? iterator.ptType[iterator.ptType.length - 1] ?? "all";
|
|
28288
|
-
const hideLast = (iterator.hideLastTrans[step] ?? true) && SIBLING_AXES.has(
|
|
28289
|
-
let points2 = axisPoints(point,
|
|
28448
|
+
const hideLast = (iterator.hideLastTrans[step] ?? true) && SIBLING_AXES.has(axis2);
|
|
28449
|
+
let points2 = axisPoints(point, axis2).filter((candidate) => matchesPointType(candidate, ptType));
|
|
28290
28450
|
if (hideLast) {
|
|
28291
28451
|
points2 = points2.filter((candidate) => !isLastSiblingTransition(candidate));
|
|
28292
28452
|
}
|
|
@@ -28551,8 +28711,8 @@ function valueOf(node, type) {
|
|
|
28551
28711
|
if (direct !== void 0) {
|
|
28552
28712
|
return boundedValue(node, type, direct);
|
|
28553
28713
|
}
|
|
28554
|
-
const
|
|
28555
|
-
return
|
|
28714
|
+
const axis2 = AXIS_LOOKUP[type];
|
|
28715
|
+
return axis2 ? axisValue(node, axis2[0], axis2[1]) : void 0;
|
|
28556
28716
|
}
|
|
28557
28717
|
function boundedValue(node, type, value) {
|
|
28558
28718
|
let out = value;
|
|
@@ -28695,17 +28855,17 @@ function exactDef(name2, avLst, gdLines, rect3, paths) {
|
|
|
28695
28855
|
var Glyph = class {
|
|
28696
28856
|
lines = [];
|
|
28697
28857
|
names = /* @__PURE__ */ new Map();
|
|
28698
|
-
coord(
|
|
28699
|
-
const key = `${
|
|
28858
|
+
coord(axis2, value) {
|
|
28859
|
+
const key = `${axis2}${value}`;
|
|
28700
28860
|
const known = this.names.get(key);
|
|
28701
28861
|
if (known) {
|
|
28702
28862
|
return known;
|
|
28703
28863
|
}
|
|
28704
28864
|
const id = this.names.size;
|
|
28705
|
-
const name2 = `${
|
|
28865
|
+
const name2 = `${axis2}g${id}`;
|
|
28706
28866
|
this.lines.push(
|
|
28707
28867
|
`k${id} */ ss ${Math.round(value * 1e3)} 90000`,
|
|
28708
|
-
`${name2} +- ${
|
|
28868
|
+
`${name2} +- ${axis2 === "x" ? "hc" : "vc"} k${id} 0`
|
|
28709
28869
|
);
|
|
28710
28870
|
this.names.set(key, name2);
|
|
28711
28871
|
return name2;
|
|
@@ -43858,7 +44018,7 @@ function siblingGroupOf(node, parentOf, childrenOf, roots2) {
|
|
|
43858
44018
|
const parent = parentOf.get(node.id);
|
|
43859
44019
|
return parent ? childrenOf.get(parent.id) ?? [] : roots2;
|
|
43860
44020
|
}
|
|
43861
|
-
function navigateAxisHop(current,
|
|
44021
|
+
function navigateAxisHop(current, axis2, nodes, childrenOf, parentOf, roots2) {
|
|
43862
44022
|
const out = [];
|
|
43863
44023
|
const seen = /* @__PURE__ */ new Set();
|
|
43864
44024
|
const add3 = (node) => {
|
|
@@ -43873,7 +44033,7 @@ function navigateAxisHop(current, axis, nodes, childrenOf, parentOf, roots2) {
|
|
|
43873
44033
|
}
|
|
43874
44034
|
};
|
|
43875
44035
|
for (const node of current) {
|
|
43876
|
-
switch (
|
|
44036
|
+
switch (axis2) {
|
|
43877
44037
|
case "self":
|
|
43878
44038
|
add3(node);
|
|
43879
44039
|
break;
|
|
@@ -43905,7 +44065,7 @@ function navigateAxisHop(current, axis, nodes, childrenOf, parentOf, roots2) {
|
|
|
43905
44065
|
case "precedSib": {
|
|
43906
44066
|
const siblings = siblingGroupOf(node, parentOf, childrenOf, roots2);
|
|
43907
44067
|
const index = siblings.findIndex((sibling) => sibling.id === node.id);
|
|
43908
|
-
addAll(
|
|
44068
|
+
addAll(axis2 === "followSib" ? siblings.slice(index + 1) : siblings.slice(0, index));
|
|
43909
44069
|
break;
|
|
43910
44070
|
}
|
|
43911
44071
|
case "follow":
|
|
@@ -43915,11 +44075,11 @@ function navigateAxisHop(current, axis, nodes, childrenOf, parentOf, roots2) {
|
|
|
43915
44075
|
break;
|
|
43916
44076
|
}
|
|
43917
44077
|
const excluded = new Set(
|
|
43918
|
-
(
|
|
44078
|
+
(axis2 === "follow" ? descendantsOf(node, childrenOf) : ancestorsOf(node, parentOf)).map(
|
|
43919
44079
|
(n3) => n3.id
|
|
43920
44080
|
)
|
|
43921
44081
|
);
|
|
43922
|
-
const range2 =
|
|
44082
|
+
const range2 = axis2 === "follow" ? nodes.slice(docIndex + 1) : nodes.slice(0, docIndex);
|
|
43923
44083
|
addAll(range2.filter((n3) => !excluded.has(n3.id)));
|
|
43924
44084
|
break;
|
|
43925
44085
|
}
|
|
@@ -43955,15 +44115,15 @@ function applyPointTypeAndRange(nodes, pointType2, start, count) {
|
|
|
43955
44115
|
const filtered = pointType2 ? nodes.filter((n3) => pointTypeMatches(n3, pointType2)) : nodes;
|
|
43956
44116
|
return selectRange(filtered, start, count);
|
|
43957
44117
|
}
|
|
43958
|
-
function resolveAxisNodes(nodes,
|
|
43959
|
-
if (
|
|
44118
|
+
function resolveAxisNodes(nodes, axis2, pointTypes, start, count, context) {
|
|
44119
|
+
if (axis2.length === 0) {
|
|
43960
44120
|
return void 0;
|
|
43961
44121
|
}
|
|
43962
44122
|
const rootRelative = context === void 0;
|
|
43963
|
-
if (rootRelative &&
|
|
44123
|
+
if (rootRelative && axis2[0] !== "ch" && axis2[0] !== "self" && axis2[0] !== "root") {
|
|
43964
44124
|
return void 0;
|
|
43965
44125
|
}
|
|
43966
|
-
if (
|
|
44126
|
+
if (axis2[0] === "root" && axis2.length > 1 && axis2[1] !== "ch") {
|
|
43967
44127
|
return void 0;
|
|
43968
44128
|
}
|
|
43969
44129
|
const byId = new Map(nodes.map((n3) => [n3.id, n3]));
|
|
@@ -43984,15 +44144,15 @@ function resolveAxisNodes(nodes, axis, pointTypes, start, count, context) {
|
|
|
43984
44144
|
const roots2 = nodes.filter((n3) => !n3.parentId || !byId.has(n3.parentId));
|
|
43985
44145
|
let current;
|
|
43986
44146
|
let nextHop;
|
|
43987
|
-
if (
|
|
44147
|
+
if (axis2[0] === "root" && axis2.length > 1) {
|
|
43988
44148
|
current = applyPointTypeAndRange(roots2, pointTypes?.[1], start?.[1], count?.[1]);
|
|
43989
44149
|
nextHop = 2;
|
|
43990
|
-
} else if (
|
|
44150
|
+
} else if (axis2[0] === "root") {
|
|
43991
44151
|
current = applyPointTypeAndRange(roots2, pointTypes?.[0], start?.[0], count?.[0]);
|
|
43992
44152
|
nextHop = 1;
|
|
43993
44153
|
} else if (context !== void 0) {
|
|
43994
44154
|
current = applyPointTypeAndRange(
|
|
43995
|
-
navigateAxisHop(context,
|
|
44155
|
+
navigateAxisHop(context, axis2[0], nodes, childrenOf, parentOf, roots2),
|
|
43996
44156
|
pointTypes?.[0],
|
|
43997
44157
|
start?.[0],
|
|
43998
44158
|
count?.[0]
|
|
@@ -44002,9 +44162,9 @@ function resolveAxisNodes(nodes, axis, pointTypes, start, count, context) {
|
|
|
44002
44162
|
current = applyPointTypeAndRange(roots2, pointTypes?.[0], start?.[0], count?.[0]);
|
|
44003
44163
|
nextHop = 1;
|
|
44004
44164
|
}
|
|
44005
|
-
for (let hop = nextHop; hop <
|
|
44165
|
+
for (let hop = nextHop; hop < axis2.length; hop += 1) {
|
|
44006
44166
|
current = applyPointTypeAndRange(
|
|
44007
|
-
navigateAxisHop(current,
|
|
44167
|
+
navigateAxisHop(current, axis2[hop], nodes, childrenOf, parentOf, roots2),
|
|
44008
44168
|
pointTypes?.[hop],
|
|
44009
44169
|
start?.[hop],
|
|
44010
44170
|
count?.[hop]
|
|
@@ -44012,8 +44172,8 @@ function resolveAxisNodes(nodes, axis, pointTypes, start, count, context) {
|
|
|
44012
44172
|
}
|
|
44013
44173
|
return current;
|
|
44014
44174
|
}
|
|
44015
|
-
function resolveAxisCount(nodes,
|
|
44016
|
-
return resolveAxisNodes(nodes,
|
|
44175
|
+
function resolveAxisCount(nodes, axis2, pointTypes, start, count, context) {
|
|
44176
|
+
return resolveAxisNodes(nodes, axis2, pointTypes, start, count, context)?.length;
|
|
44017
44177
|
}
|
|
44018
44178
|
|
|
44019
44179
|
// diagram/layout/smartart-layout-interpreter-axis-depth.ts
|
|
@@ -44034,14 +44194,14 @@ function depthFromAnchor(node, anchorId, byId) {
|
|
|
44034
44194
|
}
|
|
44035
44195
|
return void 0;
|
|
44036
44196
|
}
|
|
44037
|
-
function resolveAxisMaxDepth(nodes,
|
|
44197
|
+
function resolveAxisMaxDepth(nodes, axis2, pointTypes, start, count, anchor) {
|
|
44038
44198
|
if (anchor.length === 0) {
|
|
44039
44199
|
return void 0;
|
|
44040
44200
|
}
|
|
44041
44201
|
const byId = new Map(nodes.map((n3) => [n3.id, n3]));
|
|
44042
44202
|
let max = 0;
|
|
44043
44203
|
for (const anchorPoint of anchor) {
|
|
44044
|
-
const resolved = resolveAxisNodes(nodes,
|
|
44204
|
+
const resolved = resolveAxisNodes(nodes, axis2, pointTypes, start, count, [anchorPoint]);
|
|
44045
44205
|
if (resolved === void 0) {
|
|
44046
44206
|
return void 0;
|
|
44047
44207
|
}
|
|
@@ -44141,11 +44301,11 @@ function evaluateWhen(when, nodeCount, context) {
|
|
|
44141
44301
|
if (threshold === void 0) {
|
|
44142
44302
|
return void 0;
|
|
44143
44303
|
}
|
|
44144
|
-
const
|
|
44145
|
-
if (
|
|
44304
|
+
const axis2 = when.axis;
|
|
44305
|
+
if (axis2 !== void 0 && context.nodes) {
|
|
44146
44306
|
const resolved = resolveAxisCount(
|
|
44147
44307
|
context.nodes,
|
|
44148
|
-
|
|
44308
|
+
axis2,
|
|
44149
44309
|
when.pointTypes,
|
|
44150
44310
|
when.start,
|
|
44151
44311
|
when.count,
|
|
@@ -45152,7 +45312,7 @@ function qualifyingIterators(node) {
|
|
|
45152
45312
|
return nodeIters;
|
|
45153
45313
|
}
|
|
45154
45314
|
const axisIter = list2.find(
|
|
45155
|
-
(each) => each.axis?.some((
|
|
45315
|
+
(each) => each.axis?.some((axis2) => axis2 === "ch" || axis2 === "des" || axis2 === "self")
|
|
45156
45316
|
);
|
|
45157
45317
|
return [axisIter ?? list2[0]];
|
|
45158
45318
|
}
|
|
@@ -47200,8 +47360,8 @@ function positionRange(start, count, step, total) {
|
|
|
47200
47360
|
|
|
47201
47361
|
// diagram/layout/smartart-layout-interpreter-item-role-compound.ts
|
|
47202
47362
|
function compoundChildIds(role, node, childrenOf) {
|
|
47203
|
-
const
|
|
47204
|
-
const chIndex =
|
|
47363
|
+
const axis2 = role.presentationOf?.axis ?? [];
|
|
47364
|
+
const chIndex = axis2.indexOf("ch");
|
|
47205
47365
|
if (chIndex < 0) {
|
|
47206
47366
|
return [];
|
|
47207
47367
|
}
|
|
@@ -47239,8 +47399,8 @@ function isTextRole(node) {
|
|
|
47239
47399
|
function hasAmbiguousTopLevelRoles(topLevelChildren) {
|
|
47240
47400
|
const textRoles = topLevelChildren.filter(isTextRole);
|
|
47241
47401
|
const descendantAxisRoles = textRoles.filter((child6) => {
|
|
47242
|
-
const
|
|
47243
|
-
return
|
|
47402
|
+
const axis2 = child6.presentationOf?.axis?.[0];
|
|
47403
|
+
return axis2 === "ch" || axis2 === "des" || axis2 === "desOrSelf";
|
|
47244
47404
|
});
|
|
47245
47405
|
if (descendantAxisRoles.length >= 2) {
|
|
47246
47406
|
return true;
|
|
@@ -47269,17 +47429,17 @@ function contentIds(role, node, childrenOf) {
|
|
|
47269
47429
|
if (fullAxis && fullAxis.length > 1) {
|
|
47270
47430
|
return fullAxis[0] === "ch" ? compoundChildIds(role, node, childrenOf) : [];
|
|
47271
47431
|
}
|
|
47272
|
-
const
|
|
47273
|
-
if (
|
|
47432
|
+
const axis2 = fullAxis?.[0];
|
|
47433
|
+
if (axis2 === "self") {
|
|
47274
47434
|
return [node.id];
|
|
47275
47435
|
}
|
|
47276
|
-
if (
|
|
47436
|
+
if (axis2 === "ch") {
|
|
47277
47437
|
return (childrenOf.get(node.id) ?? []).filter((child6) => child6.text.trim().length > 0).map((child6) => child6.id);
|
|
47278
47438
|
}
|
|
47279
|
-
if (
|
|
47439
|
+
if (axis2 === "des") {
|
|
47280
47440
|
return descendantIds(node, childrenOf);
|
|
47281
47441
|
}
|
|
47282
|
-
if (
|
|
47442
|
+
if (axis2 === "desOrSelf") {
|
|
47283
47443
|
const ids = descendantIds(node, childrenOf);
|
|
47284
47444
|
return node.text.trim().length > 0 ? [node.id, ...ids] : ids;
|
|
47285
47445
|
}
|
|
@@ -48455,9 +48615,9 @@ function arrangeByChooseAwareSlots(root, flat, box, index, ctx, fontCtx) {
|
|
|
48455
48615
|
// diagram/layout/smartart-layout-interpreter-composite-foreach.ts
|
|
48456
48616
|
function forEachBoundSlots(slotted) {
|
|
48457
48617
|
return slotted.filter((slot2) => {
|
|
48458
|
-
const
|
|
48618
|
+
const axis2 = slot2.node.presentationOf?.axis;
|
|
48459
48619
|
const origin = slot2.node.forEachOrigin?.axis;
|
|
48460
|
-
return
|
|
48620
|
+
return axis2?.length === 1 && (origin?.length ?? 0) > 1 && origin?.[0] === "ch";
|
|
48461
48621
|
});
|
|
48462
48622
|
}
|
|
48463
48623
|
function resolveForEachBoundContent(node, flat, childrenOf) {
|
|
@@ -48621,12 +48781,12 @@ function resolveUserSizeItemBoxPx(wrapper, index, box, sizeBox, declaringRoleCha
|
|
|
48621
48781
|
return void 0;
|
|
48622
48782
|
}
|
|
48623
48783
|
function childAxisSpec(template, childCount) {
|
|
48624
|
-
const
|
|
48625
|
-
if (!
|
|
48784
|
+
const axis2 = template.presentationOf?.axis;
|
|
48785
|
+
if (!axis2 || axis2.length === 0) {
|
|
48626
48786
|
return void 0;
|
|
48627
48787
|
}
|
|
48628
|
-
const fold =
|
|
48629
|
-
const ownIndex =
|
|
48788
|
+
const fold = axis2.includes("des") || axis2.includes("desOrSelf");
|
|
48789
|
+
const ownIndex = axis2.indexOf("ch");
|
|
48630
48790
|
if (ownIndex >= 0) {
|
|
48631
48791
|
const start = template.presentationOf?.start?.[ownIndex] ?? 1;
|
|
48632
48792
|
const count = template.presentationOf?.count?.[ownIndex];
|
|
@@ -48936,8 +49096,8 @@ function renderAnchoredPair(node, index, total, selfSlot, selfLayoutNode, desSlo
|
|
|
48936
49096
|
}
|
|
48937
49097
|
|
|
48938
49098
|
// diagram/layout/smartart-layout-interpreter-composite.ts
|
|
48939
|
-
function slotsWithAxis(slotted,
|
|
48940
|
-
return slotted.filter((slot2) => slot2.node.presentationOf?.axis?.[0] ===
|
|
49099
|
+
function slotsWithAxis(slotted, axis2) {
|
|
49100
|
+
return slotted.filter((slot2) => slot2.node.presentationOf?.axis?.[0] === axis2);
|
|
48941
49101
|
}
|
|
48942
49102
|
function arrangeByPresentationOf(view, slotted, allChildren, nodes, flat, box, absX, absY, childrenOf, ctx, fontCtx, index, presLayoutVars, declaringRoleChain, sizeBox) {
|
|
48943
49103
|
const selfSlots = slotsWithAxis(slotted, "self");
|
|
@@ -49755,12 +49915,12 @@ function resolveSpanWidth(map, t, orgChart) {
|
|
|
49755
49915
|
}
|
|
49756
49916
|
|
|
49757
49917
|
// diagram/hierarchy/smartart-hierarchy-fold-depth.ts
|
|
49758
|
-
function endsInUnboundedDescendantHop(
|
|
49759
|
-
if (!
|
|
49918
|
+
function endsInUnboundedDescendantHop(axis2, count) {
|
|
49919
|
+
if (!axis2 || axis2.length === 0) {
|
|
49760
49920
|
return false;
|
|
49761
49921
|
}
|
|
49762
|
-
const lastIndex =
|
|
49763
|
-
const lastAxis =
|
|
49922
|
+
const lastIndex = axis2.length - 1;
|
|
49923
|
+
const lastAxis = axis2[lastIndex];
|
|
49764
49924
|
if (lastAxis !== "des" && lastAxis !== "desOrSelf") {
|
|
49765
49925
|
return false;
|
|
49766
49926
|
}
|
|
@@ -66143,9 +66303,9 @@ function alignElements(elements3, edge, options2) {
|
|
|
66143
66303
|
}
|
|
66144
66304
|
return result;
|
|
66145
66305
|
}
|
|
66146
|
-
function distributeElements(elements3,
|
|
66306
|
+
function distributeElements(elements3, axis2, options2) {
|
|
66147
66307
|
const result = /* @__PURE__ */ new Map();
|
|
66148
|
-
const horizontal =
|
|
66308
|
+
const horizontal = axis2 === "horizontal";
|
|
66149
66309
|
const start = (e) => horizontal ? e.x : e.y;
|
|
66150
66310
|
const size = (e) => horizontal ? e.width : e.height;
|
|
66151
66311
|
const sorted = [...elements3].sort((a2, b) => start(a2) - start(b));
|
|
@@ -68866,21 +69026,21 @@ function fraction(node, style, ctx) {
|
|
|
68866
69026
|
return row([num2, slash, den]);
|
|
68867
69027
|
}
|
|
68868
69028
|
const gap = style.size * 0.15;
|
|
68869
|
-
const
|
|
69029
|
+
const axis2 = style.size * AXIS3;
|
|
68870
69030
|
const width = Math.max(num2.width, den.width) + style.size * 0.2;
|
|
68871
69031
|
const bar = type === "noBar" ? [] : [
|
|
68872
69032
|
{
|
|
68873
69033
|
kind: "line",
|
|
68874
69034
|
x1: 0,
|
|
68875
69035
|
x2: width,
|
|
68876
|
-
y1: -
|
|
68877
|
-
y2: -
|
|
69036
|
+
y1: -axis2,
|
|
69037
|
+
y2: -axis2,
|
|
68878
69038
|
width: Math.max(0.8, style.size * 0.05)
|
|
68879
69039
|
}
|
|
68880
69040
|
];
|
|
68881
69041
|
const box = overlay([
|
|
68882
|
-
{ box: num2, x: (width - num2.width) / 2, y: -(
|
|
68883
|
-
{ box: den, x: (width - den.width) / 2, y: -
|
|
69042
|
+
{ box: num2, x: (width - num2.width) / 2, y: -(axis2 + gap + num2.descent) },
|
|
69043
|
+
{ box: den, x: (width - den.width) / 2, y: -axis2 + gap + den.ascent }
|
|
68884
69044
|
]);
|
|
68885
69045
|
box.width = width;
|
|
68886
69046
|
box.prims.push(...bar);
|