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.mjs
CHANGED
|
@@ -746,6 +746,7 @@ __export(chart_exports, {
|
|
|
746
746
|
applyLabelManualLayout: () => applyLabelManualLayout,
|
|
747
747
|
applyStandardChartLayout: () => applyStandardChartLayout,
|
|
748
748
|
assertBarClusterOptions: () => assertBarClusterOptions,
|
|
749
|
+
assertChartGroupOption: () => assertChartGroupOption,
|
|
749
750
|
assertChartPercent: () => assertChartPercent,
|
|
750
751
|
assignOrDelete: () => assignOrDelete,
|
|
751
752
|
autoSeriesColor: () => autoSeriesColor,
|
|
@@ -801,6 +802,7 @@ __export(chart_exports, {
|
|
|
801
802
|
chartFormatTargetKey: () => chartFormatTargetKey,
|
|
802
803
|
chartGradientMarkup: () => chartGradientMarkup,
|
|
803
804
|
chartGradientStopTransparency: () => chartGradientStopTransparency,
|
|
805
|
+
chartGroupElement: () => chartGroupElement,
|
|
804
806
|
chartGroupHasAxes: () => groupHasAxes,
|
|
805
807
|
chartGroupPaintsLine: () => chartGroupPaintsLine,
|
|
806
808
|
chartIssuesLostOnWrite: () => chartIssuesLostOnWrite,
|
|
@@ -923,6 +925,7 @@ __export(chart_exports, {
|
|
|
923
925
|
hydrateChartExSpace: () => hydrateChartExSpace,
|
|
924
926
|
impliesAutoTitle: () => impliesAutoTitle,
|
|
925
927
|
isChartExRoot: () => isChartExRoot,
|
|
928
|
+
isChartGroupOption: () => isChartGroupOption,
|
|
926
929
|
isChartexOnlyType: () => isChartexOnlyType,
|
|
927
930
|
isEmbeddedXlsxPart: () => isEmbeddedXlsxPart,
|
|
928
931
|
isXYChartKind: () => isXYChartKind,
|
|
@@ -4939,9 +4942,9 @@ function writeChartAxisFormatting(root, formatting) {
|
|
|
4939
4942
|
const previous = readChartFormatting(root);
|
|
4940
4943
|
let changed = false;
|
|
4941
4944
|
for (const part of ["categoryAxis", "valueAxis"]) {
|
|
4942
|
-
const
|
|
4945
|
+
const axis2 = nodes[part];
|
|
4943
4946
|
const entry3 = formatting.entries[part];
|
|
4944
|
-
if (!
|
|
4947
|
+
if (!axis2 || !entry3) continue;
|
|
4945
4948
|
for (const [name2, flag, value, successors] of [
|
|
4946
4949
|
[
|
|
4947
4950
|
"delete",
|
|
@@ -4989,17 +4992,17 @@ function writeChartAxisFormatting(root, formatting) {
|
|
|
4989
4992
|
const key = name2 === "delete" ? "axisVisible" : "labelsVisible";
|
|
4990
4993
|
const revealingAxis = name2 === "tickLblPos" && entry3.axisVisible === true && previous?.entries[part]?.axisVisible === false;
|
|
4991
4994
|
if (flag === previous?.entries[part]?.[key] && !revealingAxis) continue;
|
|
4992
|
-
let node = first(
|
|
4995
|
+
let node = first(axis2, name2, NS.c);
|
|
4993
4996
|
const old = node?.getAttribute("val");
|
|
4994
4997
|
if (name2 === "delete" && old !== void 0 && old !== null && (flag && (old === "0" || old === "false") || !flag && (old === "1" || old === "true")))
|
|
4995
4998
|
continue;
|
|
4996
4999
|
if (name2 === "tickLblPos" && node && (flag ? old !== "none" : old === "none")) continue;
|
|
4997
5000
|
if (!node) {
|
|
4998
5001
|
node = root.ownerDocument.createElementNS(NS.c, "c:" + name2);
|
|
4999
|
-
const before = elements(
|
|
5002
|
+
const before = elements(axis2).find(
|
|
5000
5003
|
(child6) => child6.namespaceURI === NS.c && successors.includes(child6.localName)
|
|
5001
5004
|
);
|
|
5002
|
-
|
|
5005
|
+
axis2.insertBefore(node, before ?? null);
|
|
5003
5006
|
}
|
|
5004
5007
|
node.setAttribute("val", value);
|
|
5005
5008
|
changed = true;
|
|
@@ -6418,8 +6421,8 @@ function parseGroup(context, element4) {
|
|
|
6418
6421
|
element: element4.localName,
|
|
6419
6422
|
is3D,
|
|
6420
6423
|
series: children(element4, "ser", NS.c).map((ser) => parseSeries(context, ser)),
|
|
6421
|
-
axisIds: children(element4, "axId", NS.c).flatMap((
|
|
6422
|
-
const raw2 = attribute(
|
|
6424
|
+
axisIds: children(element4, "axId", NS.c).flatMap((axis2) => {
|
|
6425
|
+
const raw2 = attribute(axis2, "val")?.trim();
|
|
6423
6426
|
const id = raw2 ? Number(raw2) : Number.NaN;
|
|
6424
6427
|
return Number.isFinite(id) ? [id] : [];
|
|
6425
6428
|
})
|
|
@@ -6568,9 +6571,9 @@ function parsePlotArea(context, element4) {
|
|
|
6568
6571
|
plotArea.groups.push(parseGroup(context, child6));
|
|
6569
6572
|
handled.add(child6.localName);
|
|
6570
6573
|
}
|
|
6571
|
-
const
|
|
6572
|
-
if (
|
|
6573
|
-
plotArea.axes.push(parseAxis(context, child6,
|
|
6574
|
+
const axis2 = AXIS_ELEMENTS[child6.localName];
|
|
6575
|
+
if (axis2) {
|
|
6576
|
+
plotArea.axes.push(parseAxis(context, child6, axis2));
|
|
6574
6577
|
handled.add(child6.localName);
|
|
6575
6578
|
}
|
|
6576
6579
|
}
|
|
@@ -7124,14 +7127,14 @@ var AXIS_ELEMENTS2 = {
|
|
|
7124
7127
|
ser: "serAx"
|
|
7125
7128
|
};
|
|
7126
7129
|
var gridlinesXml = (context, local, present2, shape) => present2 ? elementXml(local, shapePropertiesXml(context, shape)) : "";
|
|
7127
|
-
function axisXml(context,
|
|
7128
|
-
const { scaling } =
|
|
7130
|
+
function axisXml(context, axis2) {
|
|
7131
|
+
const { scaling } = axis2;
|
|
7129
7132
|
return elementXml(
|
|
7130
|
-
AXIS_ELEMENTS2[
|
|
7131
|
-
valXml("axId",
|
|
7133
|
+
AXIS_ELEMENTS2[axis2.kind],
|
|
7134
|
+
valXml("axId", axis2.id) + elementXml(
|
|
7132
7135
|
"scaling",
|
|
7133
7136
|
valXml("logBase", scaling.logBase) + valXml("orientation", scaling.orientation) + valXml("max", scaling.max) + valXml("min", scaling.min)
|
|
7134
|
-
) + valXml("delete",
|
|
7137
|
+
) + 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)
|
|
7135
7138
|
);
|
|
7136
7139
|
}
|
|
7137
7140
|
|
|
@@ -7205,7 +7208,7 @@ function groupXml(context, group2) {
|
|
|
7205
7208
|
function plotAreaXml(context, plotArea) {
|
|
7206
7209
|
return elementXml(
|
|
7207
7210
|
"plotArea",
|
|
7208
|
-
layoutXml(context, plotArea.layout) + plotArea.groups.map((group2) => groupXml(context, group2)).join("") + plotArea.axes.map((
|
|
7211
|
+
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)
|
|
7209
7212
|
);
|
|
7210
7213
|
}
|
|
7211
7214
|
|
|
@@ -7614,14 +7617,14 @@ function parseLegend2(context, element4) {
|
|
|
7614
7617
|
}
|
|
7615
7618
|
|
|
7616
7619
|
// chart/ex/parse-axis.ts
|
|
7617
|
-
function parseScaling(context,
|
|
7618
|
-
const category = cxChild(
|
|
7620
|
+
function parseScaling(context, axis2) {
|
|
7621
|
+
const category = cxChild(axis2, "catScaling");
|
|
7619
7622
|
if (category)
|
|
7620
7623
|
return assignDefined(
|
|
7621
7624
|
{ kind: "cat" },
|
|
7622
7625
|
{ gapWidth: autoNumberAttribute(context, category, "gapWidth") }
|
|
7623
7626
|
);
|
|
7624
|
-
const value = cxChild(
|
|
7627
|
+
const value = cxChild(axis2, "valScaling");
|
|
7625
7628
|
if (!value) return void 0;
|
|
7626
7629
|
return assignDefined(
|
|
7627
7630
|
{ kind: "val" },
|
|
@@ -7832,9 +7835,9 @@ function parseSeries2(context, element4) {
|
|
|
7832
7835
|
const labels2 = cxChild(element4, "dataLabels");
|
|
7833
7836
|
const inline = cxChild(element4, "data");
|
|
7834
7837
|
const layout = cxChild(element4, "layoutPr");
|
|
7835
|
-
const
|
|
7838
|
+
const axisIds2 = cxChildren(element4, "axisId").map((axis2) => indexAttribute(context, axis2, "val")).filter((id) => id !== void 0);
|
|
7836
7839
|
return assignDefined(
|
|
7837
|
-
{ layoutId: attribute(element4, "layoutId") ?? "", dataPoints, axisIds },
|
|
7840
|
+
{ layoutId: attribute(element4, "layoutId") ?? "", dataPoints, axisIds: axisIds2 },
|
|
7838
7841
|
{
|
|
7839
7842
|
hidden: boolAttribute(context, element4, "hidden"),
|
|
7840
7843
|
ownerIndex: numberAttribute(context, element4, "ownerIdx"),
|
|
@@ -7876,7 +7879,7 @@ function parsePlotArea2(context, element4) {
|
|
|
7876
7879
|
const regionExtLst = extensionList2(region);
|
|
7877
7880
|
if (regionExtLst) out.regionExtLst = regionExtLst;
|
|
7878
7881
|
}
|
|
7879
|
-
out.axes = cxChildren(element4, "axis").map((
|
|
7882
|
+
out.axes = cxChildren(element4, "axis").map((axis2) => parseAxis2(context, axis2));
|
|
7880
7883
|
return assignDefined(out, { spPr: shapeProperties2(element4), extLst: extensionList2(element4) });
|
|
7881
7884
|
}
|
|
7882
7885
|
function namespaceDeclarations2(root) {
|
|
@@ -8127,19 +8130,19 @@ function scalingXml(scaling) {
|
|
|
8127
8130
|
);
|
|
8128
8131
|
}
|
|
8129
8132
|
var tickMarksXml = (local, marks) => marks ? cxElement(local, "", attributes([["type", marks.type]])) : "";
|
|
8130
|
-
function axisXml2(context,
|
|
8131
|
-
const units2 =
|
|
8133
|
+
function axisXml2(context, axis2) {
|
|
8134
|
+
const units2 = axis2.units;
|
|
8132
8135
|
const gridlines = (local, value) => value ? cxElement(local, shapeXml(context, value.spPr)) : "";
|
|
8133
8136
|
return cxElement(
|
|
8134
8137
|
"axis",
|
|
8135
|
-
scalingXml(
|
|
8138
|
+
scalingXml(axis2.scaling) + titleXml2(context, axis2.title) + (units2 ? cxElement(
|
|
8136
8139
|
"units",
|
|
8137
8140
|
titleXml2(context, units2.label, "unitsLabel") + raw(context, units2.extLst),
|
|
8138
8141
|
attributes([["unit", units2.unit]])
|
|
8139
|
-
) : "") + gridlines("majorGridlines",
|
|
8142
|
+
) : "") + 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),
|
|
8140
8143
|
attributes([
|
|
8141
|
-
["id",
|
|
8142
|
-
["hidden",
|
|
8144
|
+
["id", axis2.id],
|
|
8145
|
+
["hidden", axis2.hidden]
|
|
8143
8146
|
])
|
|
8144
8147
|
);
|
|
8145
8148
|
}
|
|
@@ -8174,7 +8177,7 @@ function writeChartExSpace(space3, options2 = {}) {
|
|
|
8174
8177
|
);
|
|
8175
8178
|
const plotArea = cxElement(
|
|
8176
8179
|
"plotArea",
|
|
8177
|
-
region + plot.axes.map((
|
|
8180
|
+
region + plot.axes.map((axis2) => axisXml2(context, axis2)).join("") + shapeXml(context, plot.spPr) + raw(context, plot.extLst)
|
|
8178
8181
|
);
|
|
8179
8182
|
const legend = space3.legend;
|
|
8180
8183
|
const legendXml2 = legend ? cxElement(
|
|
@@ -8514,9 +8517,9 @@ function chartExSeriesAt(space3, index) {
|
|
|
8514
8517
|
return series2;
|
|
8515
8518
|
}
|
|
8516
8519
|
function chartExAxisAt(space3, index) {
|
|
8517
|
-
const
|
|
8518
|
-
if (!
|
|
8519
|
-
return
|
|
8520
|
+
const axis2 = typeof index === "number" && Number.isSafeInteger(index) ? space3.plotArea.axes.find((_, position) => position === index) : void 0;
|
|
8521
|
+
if (!axis2) throw new RangeError(`No chart axis at index ${String(index)}`);
|
|
8522
|
+
return axis2;
|
|
8520
8523
|
}
|
|
8521
8524
|
function setChartExTitle(space3, text3) {
|
|
8522
8525
|
return editChartExSpace(space3, (draft) => {
|
|
@@ -8794,7 +8797,7 @@ function setChartExLayout(space3, layout) {
|
|
|
8794
8797
|
];
|
|
8795
8798
|
for (const series2 of draft.plotArea.series)
|
|
8796
8799
|
series2.axisIds = draft.plotArea.axes.flatMap(
|
|
8797
|
-
(
|
|
8800
|
+
(axis2) => axis2.id === void 0 ? [] : [axis2.id]
|
|
8798
8801
|
);
|
|
8799
8802
|
} else {
|
|
8800
8803
|
draft.plotArea.axes = [];
|
|
@@ -10457,8 +10460,8 @@ function chartSummarySeries(source2, chartType, groupLabels, groupSmooth) {
|
|
|
10457
10460
|
Object.assign(out, summaryAnalysis(source2));
|
|
10458
10461
|
return out;
|
|
10459
10462
|
}
|
|
10460
|
-
function valueAxisId(chartSpace,
|
|
10461
|
-
return
|
|
10463
|
+
function valueAxisId(chartSpace, axisIds2) {
|
|
10464
|
+
return axisIds2.find(
|
|
10462
10465
|
(id) => chartSpace.plotArea.axes.some((a2) => a2.id === id && a2.kind === "val")
|
|
10463
10466
|
);
|
|
10464
10467
|
}
|
|
@@ -11165,35 +11168,35 @@ function chartExSummaryFromModel(space3) {
|
|
|
11165
11168
|
showLegend: legend !== void 0
|
|
11166
11169
|
};
|
|
11167
11170
|
if (chartType === "boxWhisker") {
|
|
11168
|
-
summary.axes = space3.plotArea.axes.flatMap((
|
|
11169
|
-
const scaling =
|
|
11171
|
+
summary.axes = space3.plotArea.axes.flatMap((axis2) => {
|
|
11172
|
+
const scaling = axis2.scaling;
|
|
11170
11173
|
if (!scaling) return [];
|
|
11171
11174
|
const value = scaling.kind === "val";
|
|
11172
11175
|
return [
|
|
11173
11176
|
{
|
|
11174
11177
|
kind: value ? "val" : "cat",
|
|
11175
|
-
...
|
|
11178
|
+
...axis2.id === void 0 ? {} : { id: axis2.id },
|
|
11176
11179
|
position: value ? "l" : "b",
|
|
11177
|
-
deleted:
|
|
11180
|
+
deleted: axis2.hidden ?? false,
|
|
11178
11181
|
scaling: {
|
|
11179
11182
|
...value && typeof scaling.min === "number" ? { min: scaling.min } : {},
|
|
11180
11183
|
...value && typeof scaling.max === "number" ? { max: scaling.max } : {}
|
|
11181
11184
|
},
|
|
11182
|
-
majorGridlines: !!
|
|
11183
|
-
minorGridlines: !!
|
|
11184
|
-
...
|
|
11185
|
-
...
|
|
11185
|
+
majorGridlines: !!axis2.majorGridlines,
|
|
11186
|
+
minorGridlines: !!axis2.minorGridlines,
|
|
11187
|
+
...axis2.majorGridlines?.spPr ? { majorGridlinesSpPr: axis2.majorGridlines.spPr } : {},
|
|
11188
|
+
...axis2.minorGridlines?.spPr ? { minorGridlinesSpPr: axis2.minorGridlines.spPr } : {},
|
|
11186
11189
|
...value && typeof scaling.majorUnit === "number" ? { majorUnit: scaling.majorUnit } : {},
|
|
11187
11190
|
...value && typeof scaling.minorUnit === "number" ? { minorUnit: scaling.minorUnit } : {},
|
|
11188
|
-
...
|
|
11189
|
-
...
|
|
11190
|
-
...
|
|
11191
|
+
...axis2.spPr ? { spPr: axis2.spPr } : {},
|
|
11192
|
+
...axis2.numberFormat ? { numberFormat: axis2.numberFormat } : {},
|
|
11193
|
+
...axis2.tickLabels ? {} : { tickLabelPosition: "none" }
|
|
11191
11194
|
}
|
|
11192
11195
|
];
|
|
11193
11196
|
});
|
|
11194
11197
|
}
|
|
11195
11198
|
if (chartType === "funnel") {
|
|
11196
|
-
const cat = space3.plotArea.axes.find((
|
|
11199
|
+
const cat = space3.plotArea.axes.find((axis2) => axis2.scaling?.kind === "cat")?.scaling;
|
|
11197
11200
|
if (cat?.kind === "cat" && typeof cat.gapWidth === "number")
|
|
11198
11201
|
summary.funnelGapWidth = cat.gapWidth;
|
|
11199
11202
|
}
|
|
@@ -12423,44 +12426,44 @@ function formatDate(date, unit, format) {
|
|
|
12423
12426
|
|
|
12424
12427
|
// chart/render/chart-svg-date-axis.ts
|
|
12425
12428
|
function chartDateAxis(model, plot, out) {
|
|
12426
|
-
const
|
|
12429
|
+
const axis2 = model.axes?.category?.source;
|
|
12427
12430
|
const values = model.dateCategories;
|
|
12428
|
-
if (
|
|
12431
|
+
if (axis2?.kind !== "date" || !values?.length) return void 0;
|
|
12429
12432
|
const points2 = values.flatMap(
|
|
12430
12433
|
(value, index) => value === null || !Number.isFinite(value) ? [] : [{ value, index }]
|
|
12431
12434
|
).sort((a2, b) => a2.value - b.value);
|
|
12432
12435
|
if (!points2.length) return void 0;
|
|
12433
|
-
const min =
|
|
12434
|
-
const max =
|
|
12436
|
+
const min = axis2.scaling.min ?? points2[0].value;
|
|
12437
|
+
const max = axis2.scaling.max ?? points2.at(-1).value;
|
|
12435
12438
|
if (!Number.isFinite(min) || !Number.isFinite(max) || max < min) return void 0;
|
|
12436
12439
|
const position = (value) => {
|
|
12437
12440
|
const ratio = max === min ? 0.5 : (value - min) / (max - min);
|
|
12438
|
-
const t =
|
|
12441
|
+
const t = axis2.scaling.orientation === "maxMin" ? 1 - ratio : ratio;
|
|
12439
12442
|
return model.horizontal ? plot.y + plot.h * (1 - t) : plot.x + plot.w * t;
|
|
12440
12443
|
};
|
|
12441
12444
|
const visible = points2.filter((p2) => p2.value >= min && p2.value <= max);
|
|
12442
12445
|
const unitOf = (unit2) => unit2 === "months" || unit2 === "years" ? unit2 : "days";
|
|
12443
|
-
const unit = unitOf(
|
|
12446
|
+
const unit = unitOf(axis2.majorTimeUnit ?? axis2.baseTimeUnit);
|
|
12444
12447
|
const ticks = calendarTicks(
|
|
12445
12448
|
min,
|
|
12446
12449
|
max,
|
|
12447
12450
|
model.date1904 ?? false,
|
|
12448
12451
|
unit,
|
|
12449
|
-
Math.max(1,
|
|
12452
|
+
Math.max(1, axis2.majorUnit ?? 1)
|
|
12450
12453
|
);
|
|
12451
12454
|
const attrs2 = chartTextAttributes(model, "categoryAxis");
|
|
12452
12455
|
const size = attrs2.size ?? 10;
|
|
12453
|
-
const y =
|
|
12456
|
+
const y = axis2.position === "t" ? plot.y : plot.y + plot.h;
|
|
12454
12457
|
const paint2 = model.axes?.category?.line;
|
|
12455
12458
|
const stroke = { color: paint2?.color ?? "#BFBFBF", width: paint2?.width ?? 1 };
|
|
12456
12459
|
const mark = (serial, placement, length) => {
|
|
12457
|
-
if (!placement || placement === "none" ||
|
|
12458
|
-
const inward =
|
|
12460
|
+
if (!placement || placement === "none" || axis2.deleted) return;
|
|
12461
|
+
const inward = axis2.position === "t" ? length : -length;
|
|
12459
12462
|
const start = placement === "cross" ? -length : 0;
|
|
12460
12463
|
const end = placement === "cross" ? length : placement === "in" ? inward : -inward;
|
|
12461
12464
|
if (model.horizontal) {
|
|
12462
|
-
const x =
|
|
12463
|
-
const direction =
|
|
12465
|
+
const x = axis2.position === "r" ? plot.x + plot.w : plot.x;
|
|
12466
|
+
const direction = axis2.position === "r" ? -1 : 1;
|
|
12464
12467
|
const a2 = placement === "cross" ? -length : 0;
|
|
12465
12468
|
const b = placement === "cross" ? length : placement === "in" ? direction * length : -direction * length;
|
|
12466
12469
|
out.push(
|
|
@@ -12472,19 +12475,19 @@ function chartDateAxis(model, plot, out) {
|
|
|
12472
12475
|
);
|
|
12473
12476
|
};
|
|
12474
12477
|
ticks.forEach((serial, index) => {
|
|
12475
|
-
if (index % Math.max(1,
|
|
12476
|
-
if (
|
|
12478
|
+
if (index % Math.max(1, axis2.tickMarkSkip ?? 1) === 0) mark(serial, axis2.majorTickMark, 4);
|
|
12479
|
+
if (axis2.deleted || model.dataTable || axis2.tickLabelPosition === "none" || index % Math.max(1, axis2.tickLabelSkip ?? 1))
|
|
12477
12480
|
return;
|
|
12478
12481
|
const label = formatDate(
|
|
12479
12482
|
excelSerialToDate(serial, model.date1904),
|
|
12480
12483
|
unit,
|
|
12481
|
-
|
|
12484
|
+
axis2.numberFormat?.formatCode
|
|
12482
12485
|
);
|
|
12483
12486
|
if (model.horizontal)
|
|
12484
12487
|
out.push(text(plot.x - 4, position(serial) + size * 0.3, label, { ...attrs2, anchor: "end" }));
|
|
12485
12488
|
else {
|
|
12486
|
-
const above2 =
|
|
12487
|
-
const baseline =
|
|
12489
|
+
const above2 = axis2.tickLabelPosition === "high" || axis2.tickLabelPosition !== "low" && axis2.position === "t";
|
|
12490
|
+
const baseline = axis2.tickLabelPosition === "high" ? plot.y : axis2.tickLabelPosition === "low" ? plot.y + plot.h : y;
|
|
12488
12491
|
out.push(
|
|
12489
12492
|
text(position(serial), baseline + (above2 ? -4 : size + 3), label, {
|
|
12490
12493
|
...attrs2,
|
|
@@ -12493,15 +12496,15 @@ function chartDateAxis(model, plot, out) {
|
|
|
12493
12496
|
);
|
|
12494
12497
|
}
|
|
12495
12498
|
});
|
|
12496
|
-
if (
|
|
12499
|
+
if (axis2.minorTickMark && axis2.minorTickMark !== "none")
|
|
12497
12500
|
for (const serial of calendarTicks(
|
|
12498
12501
|
min,
|
|
12499
12502
|
max,
|
|
12500
12503
|
model.date1904 ?? false,
|
|
12501
|
-
unitOf(
|
|
12502
|
-
Math.max(1,
|
|
12504
|
+
unitOf(axis2.minorTimeUnit ?? axis2.baseTimeUnit ?? unit),
|
|
12505
|
+
Math.max(1, axis2.minorUnit ?? 1)
|
|
12503
12506
|
))
|
|
12504
|
-
mark(serial,
|
|
12507
|
+
mark(serial, axis2.minorTickMark, 2.5);
|
|
12505
12508
|
return {
|
|
12506
12509
|
order: visible.map((p2) => p2.index),
|
|
12507
12510
|
band: (index) => position(values[index] ?? min),
|
|
@@ -12646,12 +12649,12 @@ function chartLineDashArray(style, width) {
|
|
|
12646
12649
|
}
|
|
12647
12650
|
|
|
12648
12651
|
// chart/render/chart-svg-axes.ts
|
|
12649
|
-
function axisTickText(value,
|
|
12650
|
-
return formatChartNumber(value,
|
|
12652
|
+
function axisTickText(value, axis2, percent = false) {
|
|
12653
|
+
return formatChartNumber(value, axis2?.source.numberFormat?.formatCode) ?? formatAxisValue(value, percent);
|
|
12651
12654
|
}
|
|
12652
|
-
function axisLine(model,
|
|
12653
|
-
if (
|
|
12654
|
-
return styledAxisLine(x1, y1, x2, y2,
|
|
12655
|
+
function axisLine(model, axis2, part, x1, y1, x2, y2) {
|
|
12656
|
+
if (axis2?.source.deleted) return "";
|
|
12657
|
+
return styledAxisLine(x1, y1, x2, y2, axis2?.line, chartStroke(model, part));
|
|
12655
12658
|
}
|
|
12656
12659
|
function styledAxisLine(x1, y1, x2, y2, paint2, fallback) {
|
|
12657
12660
|
const color2 = paint2?.color ?? fallback.color;
|
|
@@ -12663,7 +12666,7 @@ function styledAxisLine(x1, y1, x2, y2, paint2, fallback) {
|
|
|
12663
12666
|
dash ? ` stroke-dasharray="${dash}"/>` : "/>"
|
|
12664
12667
|
);
|
|
12665
12668
|
}
|
|
12666
|
-
function axisGridlines(model,
|
|
12669
|
+
function axisGridlines(model, axis2, ticks, position, plot, vertical) {
|
|
12667
12670
|
const draw2 = (values, paint2, minor2) => {
|
|
12668
12671
|
const fallback = chartStroke(model, minor2 ? "gridlineMinor" : "gridlineMajor");
|
|
12669
12672
|
return values.map((value) => {
|
|
@@ -12671,8 +12674,8 @@ function axisGridlines(model, axis, ticks, position, plot, vertical) {
|
|
|
12671
12674
|
return vertical ? styledAxisLine(p2, plot.y, p2, plot.y + plot.h, paint2, fallback) : styledAxisLine(plot.x, p2, plot.x + plot.w, p2, paint2, fallback);
|
|
12672
12675
|
}).join("");
|
|
12673
12676
|
};
|
|
12674
|
-
const major = !
|
|
12675
|
-
const minor =
|
|
12677
|
+
const major = !axis2 || axis2.source.majorGridlines ? draw2(ticks, axis2?.majorGrid, false) : "";
|
|
12678
|
+
const minor = axis2?.source.minorGridlines ? draw2(axis2.minorTicks, axis2.minorGrid, true) : "";
|
|
12676
12679
|
return major + minor;
|
|
12677
12680
|
}
|
|
12678
12681
|
|
|
@@ -12741,20 +12744,20 @@ function computeLogValueRange(series2, logBase) {
|
|
|
12741
12744
|
logBase
|
|
12742
12745
|
};
|
|
12743
12746
|
}
|
|
12744
|
-
function computeValueRangeForAxis(series2,
|
|
12745
|
-
const requestedLogBase =
|
|
12746
|
-
const logBase =
|
|
12747
|
+
function computeValueRangeForAxis(series2, axis2, plotHeightPx) {
|
|
12748
|
+
const requestedLogBase = axis2?.logBase ?? 10;
|
|
12749
|
+
const logBase = axis2?.logScale && Number.isFinite(requestedLogBase) && requestedLogBase > 1 ? requestedLogBase : axis2?.logScale ? 10 : void 0;
|
|
12747
12750
|
const automatic = logBase ? computeLogValueRange(series2, logBase) : computeAxisValueRange(series2, plotHeightPx);
|
|
12748
|
-
return withAxisBounds(automatic,
|
|
12751
|
+
return withAxisBounds(automatic, axis2, logBase);
|
|
12749
12752
|
}
|
|
12750
|
-
function computeStackedValueRangeForAxis(series2, catCount,
|
|
12753
|
+
function computeStackedValueRangeForAxis(series2, catCount, axis2, isPercent, plotSizePx) {
|
|
12751
12754
|
if (isPercent) {
|
|
12752
12755
|
return {
|
|
12753
12756
|
...percentStackedRange(series2, catCount, plotSizePx),
|
|
12754
|
-
...
|
|
12757
|
+
...axis2?.orientation === "maxMin" ? { reverseOrder: true } : {}
|
|
12755
12758
|
};
|
|
12756
12759
|
}
|
|
12757
|
-
return withAxisBounds(computeAxisStackedValueRange(series2, catCount, plotSizePx),
|
|
12760
|
+
return withAxisBounds(computeAxisStackedValueRange(series2, catCount, plotSizePx), axis2);
|
|
12758
12761
|
}
|
|
12759
12762
|
function percentStackedRange(series2, catCount, plotSizePx) {
|
|
12760
12763
|
const shares = series2.map((entry3) => ({
|
|
@@ -12777,9 +12780,9 @@ function percentStackedRange(series2, catCount, plotSizePx) {
|
|
|
12777
12780
|
...unit !== void 0 && 100 % unit === 0 && min % unit === 0 ? { majorUnit: unit } : {}
|
|
12778
12781
|
};
|
|
12779
12782
|
}
|
|
12780
|
-
function withAxisBounds(automatic,
|
|
12781
|
-
const validMin = typeof
|
|
12782
|
-
const validMax = typeof
|
|
12783
|
+
function withAxisBounds(automatic, axis2, logBase) {
|
|
12784
|
+
const validMin = typeof axis2?.min === "number" && Number.isFinite(axis2.min) && (!logBase || axis2.min > 0) ? axis2.min : void 0;
|
|
12785
|
+
const validMax = typeof axis2?.max === "number" && Number.isFinite(axis2.max) && (!logBase || axis2.max > 0) ? axis2.max : void 0;
|
|
12783
12786
|
const min = validMin ?? automatic.min;
|
|
12784
12787
|
let max = validMax ?? automatic.max;
|
|
12785
12788
|
const majorUnit = validMin === void 0 && validMax === void 0 ? automatic.majorUnit : void 0;
|
|
@@ -12793,7 +12796,7 @@ function withAxisBounds(automatic, axis, logBase) {
|
|
|
12793
12796
|
span: Math.max(span, Number.EPSILON),
|
|
12794
12797
|
...majorUnit !== void 0 ? { majorUnit } : {},
|
|
12795
12798
|
...logBase ? { logScale: true, logBase } : {},
|
|
12796
|
-
...
|
|
12799
|
+
...axis2?.orientation === "maxMin" ? { reverseOrder: true } : {}
|
|
12797
12800
|
};
|
|
12798
12801
|
}
|
|
12799
12802
|
function valueToYLog(val2, range2, topY, bottomY) {
|
|
@@ -12804,10 +12807,10 @@ function valueToYLog(val2, range2, topY, bottomY) {
|
|
|
12804
12807
|
return range2.reverseOrder ? topY + ratio * (bottomY - topY) : bottomY - ratio * (bottomY - topY);
|
|
12805
12808
|
}
|
|
12806
12809
|
function findLogAxis(axes) {
|
|
12807
|
-
return axes?.find((
|
|
12810
|
+
return axes?.find((axis2) => axis2.axisType === "valAx" && axis2.logScale);
|
|
12808
12811
|
}
|
|
12809
12812
|
function computeValueRangeForChart(series2, axes, plotHeightPx) {
|
|
12810
|
-
const primaryAxis = axes?.find((
|
|
12813
|
+
const primaryAxis = axes?.find((axis2) => axis2.axisType === "valAx" && axis2.axPos === "l") ?? axes?.find((axis2) => axis2.axisType === "valAx" && axis2.axPos !== "r");
|
|
12811
12814
|
return computeValueRangeForAxis(series2, primaryAxis, plotHeightPx);
|
|
12812
12815
|
}
|
|
12813
12816
|
|
|
@@ -12840,11 +12843,11 @@ function generateIntervalTicks(range2, unit) {
|
|
|
12840
12843
|
const count = Math.min(Math.max(last - first2 + 1, 0), 2e3);
|
|
12841
12844
|
return Array.from({ length: count }, (_, index) => (first2 + index) * unit);
|
|
12842
12845
|
}
|
|
12843
|
-
function generateAxisTicks(range2,
|
|
12846
|
+
function generateAxisTicks(range2, axis2, defaultIntervals) {
|
|
12844
12847
|
if (range2.logScale && range2.logBase) {
|
|
12845
12848
|
return generateLogTicks(range2);
|
|
12846
12849
|
}
|
|
12847
|
-
const explicit = generateIntervalTicks(range2,
|
|
12850
|
+
const explicit = generateIntervalTicks(range2, axis2?.majorUnit ?? 0);
|
|
12848
12851
|
if (explicit.length > 0) {
|
|
12849
12852
|
return explicit;
|
|
12850
12853
|
}
|
|
@@ -12857,12 +12860,12 @@ function generateAxisTicks(range2, axis, defaultIntervals) {
|
|
|
12857
12860
|
(_, index) => range2.min + range2.span / defaultIntervals * index
|
|
12858
12861
|
);
|
|
12859
12862
|
}
|
|
12860
|
-
function generateMinorAxisTicks(range2,
|
|
12861
|
-
const minor = generateIntervalTicks(range2,
|
|
12863
|
+
function generateMinorAxisTicks(range2, axis2) {
|
|
12864
|
+
const minor = generateIntervalTicks(range2, axis2?.minorUnit ?? 0);
|
|
12862
12865
|
if (minor.length === 0) {
|
|
12863
12866
|
return [];
|
|
12864
12867
|
}
|
|
12865
|
-
const majorUnit =
|
|
12868
|
+
const majorUnit = axis2?.majorUnit;
|
|
12866
12869
|
if (!majorUnit || !Number.isFinite(majorUnit) || majorUnit <= 0) {
|
|
12867
12870
|
return minor;
|
|
12868
12871
|
}
|
|
@@ -12873,33 +12876,33 @@ function generateMinorAxisTicks(range2, axis) {
|
|
|
12873
12876
|
}
|
|
12874
12877
|
|
|
12875
12878
|
// chart/render/chart-view-axes.ts
|
|
12876
|
-
function chartAxisRatio(value, scale,
|
|
12877
|
-
const range2 =
|
|
12879
|
+
function chartAxisRatio(value, scale, axis2) {
|
|
12880
|
+
const range2 = axis2?.range;
|
|
12878
12881
|
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);
|
|
12879
12882
|
return range2?.reverseOrder ? 1 - ratio : ratio;
|
|
12880
12883
|
}
|
|
12881
|
-
function chartAxisLabels(
|
|
12882
|
-
return
|
|
12884
|
+
function chartAxisLabels(axis2) {
|
|
12885
|
+
return axis2?.source.deleted !== true && axis2?.source.tickLabelPosition !== "none";
|
|
12883
12886
|
}
|
|
12884
|
-
function options(
|
|
12887
|
+
function options(axis2) {
|
|
12885
12888
|
return {
|
|
12886
|
-
...
|
|
12887
|
-
...
|
|
12888
|
-
...
|
|
12889
|
-
...
|
|
12889
|
+
...axis2.scaling,
|
|
12890
|
+
...axis2.scaling.logBase === void 0 ? {} : { logScale: true },
|
|
12891
|
+
...axis2.majorUnit === void 0 ? {} : { majorUnit: axis2.majorUnit },
|
|
12892
|
+
...axis2.minorUnit === void 0 ? {} : { minorUnit: axis2.minorUnit }
|
|
12890
12893
|
};
|
|
12891
12894
|
}
|
|
12892
12895
|
function applyChartAxes(model, chart, color2) {
|
|
12893
12896
|
if (!chart.axes?.length) return;
|
|
12894
12897
|
const axes = chart.axes;
|
|
12895
|
-
const linked = axes.filter((
|
|
12898
|
+
const linked = axes.filter((axis2) => axis2.id !== void 0 && chart.axisIds?.includes(axis2.id));
|
|
12896
12899
|
const candidates = linked.length ? linked : axes;
|
|
12897
12900
|
const xy = model.type === "scatter" || model.type === "bubble";
|
|
12898
|
-
const value = candidates.find((
|
|
12901
|
+
const value = candidates.find((axis2) => axis2.kind === "val" && !["b", "t"].includes(axis2.position ?? "")) ?? candidates.find((axis2) => axis2.kind === "val");
|
|
12899
12902
|
const category = candidates.find(
|
|
12900
|
-
(
|
|
12903
|
+
(axis2) => xy ? axis2.kind === "val" && axis2 !== value : axis2.kind === "cat" || axis2.kind === "date"
|
|
12901
12904
|
);
|
|
12902
|
-
const secondary = axes.find((
|
|
12905
|
+
const secondary = axes.find((axis2) => axis2.kind === "val" && axis2 !== value && axis2 !== category);
|
|
12903
12906
|
const paint2 = (shape) => {
|
|
12904
12907
|
const ln = shape?.line;
|
|
12905
12908
|
const fill = ln?.fill;
|
|
@@ -12910,8 +12913,8 @@ function applyChartAxes(model, chart, color2) {
|
|
|
12910
12913
|
...ln?.dash === void 0 ? {} : { dash: ln.dash }
|
|
12911
12914
|
};
|
|
12912
12915
|
};
|
|
12913
|
-
const bind = (
|
|
12914
|
-
const opts = options(
|
|
12916
|
+
const bind = (axis2, scale, values) => {
|
|
12917
|
+
const opts = options(axis2);
|
|
12915
12918
|
const automatic = opts.logScale ? computeLogValueRange(
|
|
12916
12919
|
[{ values: values ?? [] }],
|
|
12917
12920
|
opts.logBase && Number.isFinite(opts.logBase) && opts.logBase > 1 ? opts.logBase : 10
|
|
@@ -12929,12 +12932,12 @@ function applyChartAxes(model, chart, color2) {
|
|
|
12929
12932
|
scale.ticks = generateAxisTicks(range2, opts, 5);
|
|
12930
12933
|
}
|
|
12931
12934
|
return {
|
|
12932
|
-
source:
|
|
12935
|
+
source: axis2,
|
|
12933
12936
|
range: range2,
|
|
12934
12937
|
minorTicks: generateMinorAxisTicks(range2, opts),
|
|
12935
|
-
line: paint2(
|
|
12936
|
-
majorGrid: paint2(
|
|
12937
|
-
minorGrid: paint2(
|
|
12938
|
+
line: paint2(axis2.spPr),
|
|
12939
|
+
majorGrid: paint2(axis2.majorGridlinesSpPr),
|
|
12940
|
+
minorGrid: paint2(axis2.minorGridlinesSpPr)
|
|
12938
12941
|
};
|
|
12939
12942
|
};
|
|
12940
12943
|
const out = {};
|
|
@@ -14440,12 +14443,12 @@ function readScene3DValues(node, read) {
|
|
|
14440
14443
|
["lightRig", light]
|
|
14441
14444
|
]) {
|
|
14442
14445
|
const rot = read.child(source2, "rot");
|
|
14443
|
-
for (const [
|
|
14446
|
+
for (const [axis2, key] of [
|
|
14444
14447
|
["lat", "RotX"],
|
|
14445
14448
|
["lon", "RotY"],
|
|
14446
14449
|
["rev", "RotZ"]
|
|
14447
14450
|
]) {
|
|
14448
|
-
const value = integer(read.attribute(rot,
|
|
14451
|
+
const value = integer(read.attribute(rot, axis2));
|
|
14449
14452
|
if (value !== void 0 && value >= 0 && value < 216e5) out[`${prefix}${key}`] = value;
|
|
14450
14453
|
}
|
|
14451
14454
|
}
|
|
@@ -14458,12 +14461,12 @@ function readScene3DValues(node, read) {
|
|
|
14458
14461
|
["up", "backdropUp", "d"]
|
|
14459
14462
|
]) {
|
|
14460
14463
|
const point = read.child(backdrop, name2);
|
|
14461
|
-
for (const [
|
|
14464
|
+
for (const [axis2, suffix] of [
|
|
14462
14465
|
["x", "X"],
|
|
14463
14466
|
["y", "Y"],
|
|
14464
14467
|
["z", "Z"]
|
|
14465
14468
|
]) {
|
|
14466
|
-
const value = integer(read.attribute(point, `${attr4}${
|
|
14469
|
+
const value = integer(read.attribute(point, `${attr4}${axis2}`));
|
|
14467
14470
|
if (value !== void 0) out[`${prefix}${suffix}`] = value;
|
|
14468
14471
|
}
|
|
14469
14472
|
}
|
|
@@ -15120,12 +15123,12 @@ function writeDrawingTextScene3D(doc, value) {
|
|
|
15120
15123
|
throw new Error("A backdrop point needs three finite coordinates");
|
|
15121
15124
|
const point = child2(backdrop, name2);
|
|
15122
15125
|
const vector = attr4 === "d" ? scaleVectorToIntegers(values[0], values[1], values[2]) : { x: values[0], y: values[1], z: values[2] };
|
|
15123
|
-
for (const [
|
|
15126
|
+
for (const [axis2, suffix] of [
|
|
15124
15127
|
["x", "X"],
|
|
15125
15128
|
["y", "Y"],
|
|
15126
15129
|
["z", "Z"]
|
|
15127
15130
|
])
|
|
15128
|
-
number(point, `${attr4}${
|
|
15131
|
+
number(point, `${attr4}${axis2}`, vector[axis2], before[`${prefix}${suffix}`]);
|
|
15129
15132
|
}
|
|
15130
15133
|
}
|
|
15131
15134
|
return node;
|
|
@@ -17955,13 +17958,13 @@ function scatter(model, area, out, size) {
|
|
|
17955
17958
|
s2.values.forEach((_, i2) => {
|
|
17956
17959
|
reach = Math.max(reach, radiusOf(s2.sizes?.[i2] ?? void 0) ?? 0);
|
|
17957
17960
|
});
|
|
17958
|
-
const widen = (s2, length,
|
|
17959
|
-
if (
|
|
17961
|
+
const widen = (s2, length, axis2) => {
|
|
17962
|
+
if (axis2?.range.logScale) return s2;
|
|
17960
17963
|
const pad5 = reach * (s2.max - s2.min || 1) / Math.max(1, length - 2 * reach);
|
|
17961
17964
|
return {
|
|
17962
17965
|
...s2,
|
|
17963
|
-
min:
|
|
17964
|
-
max:
|
|
17966
|
+
min: axis2?.source.scaling.min === void 0 ? s2.min - pad5 : s2.min,
|
|
17967
|
+
max: axis2?.source.scaling.max === void 0 ? s2.max + pad5 : s2.max
|
|
17965
17968
|
};
|
|
17966
17969
|
};
|
|
17967
17970
|
const xView = widen(xs, plot.w, model.axes?.category);
|
|
@@ -19098,124 +19101,124 @@ function editChartGradientFill(old, edit, defaultColor, toColor = identity) {
|
|
|
19098
19101
|
|
|
19099
19102
|
// chart/edit/axes.ts
|
|
19100
19103
|
function chartAxisAt(space3, target) {
|
|
19101
|
-
const
|
|
19104
|
+
const axis2 = space3.plotArea.axes.find(
|
|
19102
19105
|
(item2, position) => typeof target === "string" ? item2.kind === target : "index" in target ? position === target.index : item2.id === target.id
|
|
19103
19106
|
);
|
|
19104
|
-
if (!
|
|
19105
|
-
return
|
|
19107
|
+
if (!axis2) throw new RangeError(`No chart axis ${JSON.stringify(target)}`);
|
|
19108
|
+
return axis2;
|
|
19106
19109
|
}
|
|
19107
|
-
function setNumber(
|
|
19110
|
+
function setNumber(axis2, key, value) {
|
|
19108
19111
|
if (value === void 0) return;
|
|
19109
19112
|
if (value !== null && !(Number.isFinite(value) && value > 0))
|
|
19110
19113
|
throw new RangeError(`Chart axis ${key} must be a positive number`);
|
|
19111
|
-
assignOrDelete(
|
|
19114
|
+
assignOrDelete(axis2, key, value ?? void 0);
|
|
19112
19115
|
}
|
|
19113
|
-
function applyAxis(
|
|
19114
|
-
if (edit.position !== void 0) assignOrDelete(
|
|
19116
|
+
function applyAxis(axis2, edit) {
|
|
19117
|
+
if (edit.position !== void 0) assignOrDelete(axis2, "position", edit.position ?? void 0);
|
|
19115
19118
|
if (edit.crossBetween !== void 0)
|
|
19116
|
-
assignOrDelete(
|
|
19117
|
-
if (edit.crossAxisId !== void 0)
|
|
19118
|
-
if (edit.visible !== void 0)
|
|
19119
|
+
assignOrDelete(axis2, "crossBetween", edit.crossBetween ?? void 0);
|
|
19120
|
+
if (edit.crossAxisId !== void 0) axis2.crossAxisId = edit.crossAxisId;
|
|
19121
|
+
if (edit.visible !== void 0) axis2.deleted = !edit.visible;
|
|
19119
19122
|
if (edit.title !== void 0)
|
|
19120
19123
|
assignOrDelete(
|
|
19121
|
-
|
|
19124
|
+
axis2,
|
|
19122
19125
|
"title",
|
|
19123
|
-
edit.title ? chartTitleWithText(
|
|
19126
|
+
edit.title ? chartTitleWithText(axis2.title, edit.title) : void 0
|
|
19124
19127
|
);
|
|
19125
19128
|
for (const key of ["min", "max"]) {
|
|
19126
19129
|
const value = edit[key];
|
|
19127
19130
|
if (value === void 0) continue;
|
|
19128
19131
|
if (value !== null && !Number.isFinite(value))
|
|
19129
19132
|
throw new RangeError(`Chart axis ${key} must be a finite number`);
|
|
19130
|
-
assignOrDelete(
|
|
19133
|
+
assignOrDelete(axis2.scaling, key, value ?? void 0);
|
|
19131
19134
|
}
|
|
19132
|
-
const { min, max } =
|
|
19135
|
+
const { min, max } = axis2.scaling;
|
|
19133
19136
|
if (min !== void 0 && max !== void 0 && min >= max)
|
|
19134
19137
|
throw new RangeError("Chart axis minimum must be less than its maximum");
|
|
19135
|
-
setNumber(
|
|
19136
|
-
setNumber(
|
|
19138
|
+
setNumber(axis2, "majorUnit", edit.majorUnit);
|
|
19139
|
+
setNumber(axis2, "minorUnit", edit.minorUnit);
|
|
19137
19140
|
if (edit.majorTimeUnit !== void 0)
|
|
19138
|
-
assignOrDelete(
|
|
19141
|
+
assignOrDelete(axis2, "majorTimeUnit", edit.majorTimeUnit ?? void 0);
|
|
19139
19142
|
if (edit.minorTimeUnit !== void 0)
|
|
19140
|
-
assignOrDelete(
|
|
19143
|
+
assignOrDelete(axis2, "minorTimeUnit", edit.minorTimeUnit ?? void 0);
|
|
19141
19144
|
if (edit.baseTimeUnit !== void 0)
|
|
19142
|
-
assignOrDelete(
|
|
19145
|
+
assignOrDelete(axis2, "baseTimeUnit", edit.baseTimeUnit ?? void 0);
|
|
19143
19146
|
if (edit.logBase !== void 0) {
|
|
19144
19147
|
if (edit.logBase !== null && !(edit.logBase >= 2 && edit.logBase <= 1e3))
|
|
19145
19148
|
throw new RangeError("Chart axis log base must be from 2 to 1000");
|
|
19146
|
-
assignOrDelete(
|
|
19149
|
+
assignOrDelete(axis2.scaling, "logBase", edit.logBase ?? void 0);
|
|
19147
19150
|
}
|
|
19148
|
-
if (edit.reverse !== void 0)
|
|
19151
|
+
if (edit.reverse !== void 0) axis2.scaling.orientation = edit.reverse ? "maxMin" : "minMax";
|
|
19149
19152
|
if (edit.numberFormat !== void 0)
|
|
19150
19153
|
assignOrDelete(
|
|
19151
|
-
|
|
19154
|
+
axis2,
|
|
19152
19155
|
"numberFormat",
|
|
19153
19156
|
edit.numberFormat ? { formatCode: edit.numberFormat, sourceLinked: edit.numberFormatSourceLinked ?? false } : void 0
|
|
19154
19157
|
);
|
|
19155
|
-
else if (edit.numberFormatSourceLinked !== void 0 &&
|
|
19156
|
-
|
|
19158
|
+
else if (edit.numberFormatSourceLinked !== void 0 && axis2.numberFormat)
|
|
19159
|
+
axis2.numberFormat.sourceLinked = edit.numberFormatSourceLinked;
|
|
19157
19160
|
for (const key of ["auto", "noMultiLevelLabels"])
|
|
19158
|
-
if (edit[key] !== void 0)
|
|
19161
|
+
if (edit[key] !== void 0) axis2[key] = edit[key];
|
|
19159
19162
|
if (edit.labelAlign !== void 0)
|
|
19160
|
-
assignOrDelete(
|
|
19163
|
+
assignOrDelete(axis2, "labelAlign", edit.labelAlign ?? void 0);
|
|
19161
19164
|
for (const key of ["labelOffset", "tickLabelSkip", "tickMarkSkip"]) {
|
|
19162
19165
|
const value = edit[key];
|
|
19163
19166
|
if (value === void 0) continue;
|
|
19164
19167
|
if (value !== null && (!Number.isInteger(value) || value < (key === "labelOffset" ? 0 : 1) || value > (key === "labelOffset" ? 1e3 : 2147483647)))
|
|
19165
19168
|
throw new RangeError(`Invalid chart axis ${key}`);
|
|
19166
|
-
assignOrDelete(
|
|
19169
|
+
assignOrDelete(axis2, key, value ?? void 0);
|
|
19167
19170
|
}
|
|
19168
|
-
if (edit.majorTickMark !== void 0)
|
|
19169
|
-
if (edit.minorTickMark !== void 0)
|
|
19170
|
-
if (edit.tickLabelPosition !== void 0)
|
|
19171
|
+
if (edit.majorTickMark !== void 0) axis2.majorTickMark = edit.majorTickMark;
|
|
19172
|
+
if (edit.minorTickMark !== void 0) axis2.minorTickMark = edit.minorTickMark;
|
|
19173
|
+
if (edit.tickLabelPosition !== void 0) axis2.tickLabelPosition = edit.tickLabelPosition;
|
|
19171
19174
|
if (edit.crosses !== void 0) {
|
|
19172
19175
|
if (typeof edit.crosses === "number") {
|
|
19173
|
-
delete
|
|
19174
|
-
|
|
19176
|
+
delete axis2.crosses;
|
|
19177
|
+
axis2.crossesAt = edit.crosses;
|
|
19175
19178
|
} else {
|
|
19176
|
-
delete
|
|
19177
|
-
|
|
19179
|
+
delete axis2.crossesAt;
|
|
19180
|
+
axis2.crosses = edit.crosses;
|
|
19178
19181
|
}
|
|
19179
19182
|
}
|
|
19180
19183
|
if (edit.majorGridlines !== void 0) {
|
|
19181
|
-
|
|
19182
|
-
if (!edit.majorGridlines) delete
|
|
19184
|
+
axis2.majorGridlines = edit.majorGridlines;
|
|
19185
|
+
if (!edit.majorGridlines) delete axis2.majorGridlinesSpPr;
|
|
19183
19186
|
}
|
|
19184
19187
|
if (edit.minorGridlines !== void 0) {
|
|
19185
|
-
|
|
19186
|
-
if (!edit.minorGridlines) delete
|
|
19188
|
+
axis2.minorGridlines = edit.minorGridlines;
|
|
19189
|
+
if (!edit.minorGridlines) delete axis2.minorGridlinesSpPr;
|
|
19187
19190
|
}
|
|
19188
19191
|
if (edit.displayUnits !== void 0) {
|
|
19189
|
-
if (
|
|
19192
|
+
if (axis2.kind !== "val") throw new RangeError("Only a value axis has display units");
|
|
19190
19193
|
const units2 = edit.displayUnits;
|
|
19191
19194
|
if (typeof units2 === "number" && (!Number.isFinite(units2) || units2 <= 0))
|
|
19192
19195
|
throw new RangeError("Custom chart display units must be a positive finite number");
|
|
19193
|
-
const { builtInUnit: _builtIn, customUnit: _custom, ...kept } =
|
|
19196
|
+
const { builtInUnit: _builtIn, customUnit: _custom, ...kept } = axis2.displayUnits ?? {};
|
|
19194
19197
|
assignOrDelete(
|
|
19195
|
-
|
|
19198
|
+
axis2,
|
|
19196
19199
|
"displayUnits",
|
|
19197
19200
|
units2 === null ? void 0 : typeof units2 === "number" ? { ...kept, customUnit: units2 } : { ...kept, builtInUnit: units2 }
|
|
19198
19201
|
);
|
|
19199
19202
|
}
|
|
19200
19203
|
}
|
|
19201
19204
|
function setChartAxis(space3, target, edit) {
|
|
19202
|
-
if (edit.crossAxisId !== void 0 && !space3.plotArea.axes.some((
|
|
19205
|
+
if (edit.crossAxisId !== void 0 && !space3.plotArea.axes.some((axis2) => axis2.id === edit.crossAxisId))
|
|
19203
19206
|
throw new RangeError("The crossing axis does not exist");
|
|
19204
19207
|
return editChartSpace(space3, (draft) => applyAxis(chartAxisAt(draft, target), edit));
|
|
19205
19208
|
}
|
|
19206
19209
|
function setChartGridlineShape(space3, target, which, shape) {
|
|
19207
19210
|
return editChartSpace(space3, (draft) => {
|
|
19208
|
-
const
|
|
19211
|
+
const axis2 = chartAxisAt(draft, target);
|
|
19209
19212
|
const key = which === "major" ? "majorGridlinesSpPr" : "minorGridlinesSpPr";
|
|
19210
19213
|
if (shape === null) {
|
|
19211
|
-
delete
|
|
19214
|
+
delete axis2[key];
|
|
19212
19215
|
return;
|
|
19213
19216
|
}
|
|
19214
|
-
const next = { ...
|
|
19217
|
+
const next = { ...axis2[key] };
|
|
19215
19218
|
if (shape.line !== void 0) next.line = structuredClone(shape.line);
|
|
19216
19219
|
if (shape.fill !== void 0) next.fill = structuredClone(shape.fill);
|
|
19217
|
-
|
|
19218
|
-
|
|
19220
|
+
axis2[key] = next;
|
|
19221
|
+
axis2[which === "major" ? "majorGridlines" : "minorGridlines"] = true;
|
|
19219
19222
|
});
|
|
19220
19223
|
}
|
|
19221
19224
|
|
|
@@ -19301,7 +19304,16 @@ function repaintSeriesForFamily(series2, toLine) {
|
|
|
19301
19304
|
shape.fill = structuredClone(shape.line.fill);
|
|
19302
19305
|
}
|
|
19303
19306
|
function clearPointPaint(series2, key) {
|
|
19304
|
-
|
|
19307
|
+
const emptied = (part) => Object.keys(part).every((name2) => name2 === "sourceXml");
|
|
19308
|
+
for (const point of series2.dataPoints) {
|
|
19309
|
+
if (!point.spPr) continue;
|
|
19310
|
+
delete point.spPr[key];
|
|
19311
|
+
if (point.spPr.line && emptied(point.spPr.line)) delete point.spPr.line;
|
|
19312
|
+
if (emptied(point.spPr)) delete point.spPr;
|
|
19313
|
+
}
|
|
19314
|
+
series2.dataPoints = series2.dataPoints.filter(
|
|
19315
|
+
(point) => Object.keys(point).some((name2) => name2 !== "index")
|
|
19316
|
+
);
|
|
19305
19317
|
}
|
|
19306
19318
|
function setChartSeriesFill(space3, index, fill) {
|
|
19307
19319
|
return editChartSpace(space3, (draft) => {
|
|
@@ -19320,7 +19332,7 @@ function setChartSeriesLine(space3, index, line4) {
|
|
|
19320
19332
|
);
|
|
19321
19333
|
});
|
|
19322
19334
|
}
|
|
19323
|
-
function setChartSeriesColor(space3, index, color2) {
|
|
19335
|
+
function setChartSeriesColor(space3, index, color2, options2 = {}) {
|
|
19324
19336
|
return editChartSpace(space3, (draft) => {
|
|
19325
19337
|
const { series: series2 } = chartSeriesEntryAt(draft, index);
|
|
19326
19338
|
const shape = series2.spPr ??= {};
|
|
@@ -19330,7 +19342,7 @@ function setChartSeriesColor(space3, index, color2) {
|
|
|
19330
19342
|
const fill = color2 ? { kind: "solid", color: withAlphaOf(color2, previous) } : void 0;
|
|
19331
19343
|
if (line4) assignOrDelete(shape.line ??= {}, "fill", fill);
|
|
19332
19344
|
else assignOrDelete(shape, "fill", fill);
|
|
19333
|
-
clearPointPaint(series2, line4 ? "line" : "fill");
|
|
19345
|
+
if (!options2.keepPointColors) clearPointPaint(series2, line4 ? "line" : "fill");
|
|
19334
19346
|
});
|
|
19335
19347
|
}
|
|
19336
19348
|
function setChartSeriesTransparency(space3, index, percent) {
|
|
@@ -19414,10 +19426,10 @@ function chartTargetDraftShapes(draft, target) {
|
|
|
19414
19426
|
return [chartAxisAt(draft, { index: target.axisIndex }).spPr ??= {}];
|
|
19415
19427
|
case "majorGridlines":
|
|
19416
19428
|
case "minorGridlines": {
|
|
19417
|
-
const
|
|
19429
|
+
const axis2 = chartAxisAt(draft, { index: target.axisIndex });
|
|
19418
19430
|
const major = target.kind === "majorGridlines";
|
|
19419
|
-
|
|
19420
|
-
return [
|
|
19431
|
+
axis2[major ? "majorGridlines" : "minorGridlines"] = true;
|
|
19432
|
+
return [axis2[major ? "majorGridlinesSpPr" : "minorGridlinesSpPr"] ??= {}];
|
|
19421
19433
|
}
|
|
19422
19434
|
case "dataLabels": {
|
|
19423
19435
|
if (target.seriesIndex === void 0) {
|
|
@@ -20747,9 +20759,9 @@ var CATEGORY_ONLY = [
|
|
|
20747
20759
|
"minorTimeUnit"
|
|
20748
20760
|
];
|
|
20749
20761
|
var VALUE_ONLY = ["crossBetween", "displayUnits"];
|
|
20750
|
-
function convertChartAxis(
|
|
20751
|
-
if (
|
|
20752
|
-
const next = structuredClone(
|
|
20762
|
+
function convertChartAxis(axis2, kind) {
|
|
20763
|
+
if (axis2.kind === kind) return axis2;
|
|
20764
|
+
const next = structuredClone(axis2);
|
|
20753
20765
|
next.kind = kind;
|
|
20754
20766
|
if (kind === "val") {
|
|
20755
20767
|
for (const key of CATEGORY_ONLY) delete next[key];
|
|
@@ -20782,7 +20794,7 @@ var SWITCHABLE = {
|
|
|
20782
20794
|
stock: false,
|
|
20783
20795
|
surface: true
|
|
20784
20796
|
};
|
|
20785
|
-
function
|
|
20797
|
+
function chartGroupElement(kind, is3D) {
|
|
20786
20798
|
const match = Object.entries(CHART_GROUP_ELEMENTS).find(
|
|
20787
20799
|
([, value]) => value.kind === kind && value.is3D === is3D
|
|
20788
20800
|
);
|
|
@@ -20798,7 +20810,7 @@ function groupingFor(element4, grouping) {
|
|
|
20798
20810
|
var horizontalBars = (group2) => group2.kind === "bar" && group2.barDirection === "bar";
|
|
20799
20811
|
function newGroup(base, target, series2) {
|
|
20800
20812
|
const is3D = target.is3D ?? (base.is3D && SWITCHABLE[target.kind] === true);
|
|
20801
|
-
const element4 =
|
|
20813
|
+
const element4 = chartGroupElement(target.kind, is3D);
|
|
20802
20814
|
const group2 = { kind: target.kind, element: element4, is3D, series: series2, axisIds: [] };
|
|
20803
20815
|
const allowed = GROUP_FIELDS[element4] ?? [];
|
|
20804
20816
|
for (const key of allowed)
|
|
@@ -20824,11 +20836,11 @@ function newGroup(base, target, series2) {
|
|
|
20824
20836
|
return group2;
|
|
20825
20837
|
}
|
|
20826
20838
|
function withSeriesAxis(space3, group2, axes) {
|
|
20827
|
-
if ((group2.element === "line3DChart" || group2.kind === "surface") && !axes.some((
|
|
20839
|
+
if ((group2.element === "line3DChart" || group2.kind === "surface") && !axes.some((axis2) => axis2.kind === "ser")) {
|
|
20828
20840
|
const id = Math.max(
|
|
20829
20841
|
0,
|
|
20830
20842
|
...[...space3.plotArea.axes, ...axes].flatMap(
|
|
20831
|
-
(
|
|
20843
|
+
(axis2) => axis2.id === void 0 ? [] : [axis2.id]
|
|
20832
20844
|
)
|
|
20833
20845
|
) + 1;
|
|
20834
20846
|
axes.push({
|
|
@@ -20848,11 +20860,11 @@ function withSeriesAxis(space3, group2, axes) {
|
|
|
20848
20860
|
function groupAxes(space3, base, group2) {
|
|
20849
20861
|
if (!groupHasAxes(group2.element)) return [];
|
|
20850
20862
|
const xy = isXYChartKind(group2.kind);
|
|
20851
|
-
const byId = (id) => space3.plotArea.axes.find((
|
|
20852
|
-
const old = base.axisIds.map(byId).filter((
|
|
20863
|
+
const byId = (id) => space3.plotArea.axes.find((axis2) => axis2.id === id);
|
|
20864
|
+
const old = base.axisIds.map(byId).filter((axis2) => axis2 !== void 0);
|
|
20853
20865
|
if (old.length < 2) {
|
|
20854
20866
|
const taken = new Set(
|
|
20855
|
-
space3.plotArea.axes.flatMap((
|
|
20867
|
+
space3.plotArea.axes.flatMap((axis2) => axis2.id === void 0 ? [] : [axis2.id])
|
|
20856
20868
|
);
|
|
20857
20869
|
const free = DEFAULT_CHART_AXIS_IDS.every((id) => !taken.has(id));
|
|
20858
20870
|
const top = Math.max(0, ...taken);
|
|
@@ -20860,9 +20872,9 @@ function groupAxes(space3, base, group2) {
|
|
|
20860
20872
|
return withSeriesAxis(space3, group2, defaultChartAxes(horizontalBars(group2), xy, ids));
|
|
20861
20873
|
}
|
|
20862
20874
|
const rotate = horizontalBars(base) !== horizontalBars(group2);
|
|
20863
|
-
const axes = old.slice(0, group2.element === "line3DChart" || group2.is3D ? 3 : 2).map((
|
|
20864
|
-
const kind = i2 === 0 ? xy ? "val" :
|
|
20865
|
-
const next = convertChartAxis(
|
|
20875
|
+
const axes = old.slice(0, group2.element === "line3DChart" || group2.is3D ? 3 : 2).map((axis2, i2) => {
|
|
20876
|
+
const kind = i2 === 0 ? xy ? "val" : axis2.kind === "val" ? "cat" : axis2.kind : axis2.kind;
|
|
20877
|
+
const next = convertChartAxis(axis2, kind);
|
|
20866
20878
|
if (rotate) assignOrDelete(next, "position", rotatedAxisPosition(next.position));
|
|
20867
20879
|
if (i2 === 1 && next.kind === "val" && xy !== isXYChartKind(base.kind))
|
|
20868
20880
|
next.crossBetween = xy ? "midCat" : "between";
|
|
@@ -20887,7 +20899,7 @@ function setChartType(space3, target) {
|
|
|
20887
20899
|
if (group2.is3D && target.kind === "bar" && group2.grouping === "standard" && base.axisIds.length < 3)
|
|
20888
20900
|
group2.grouping = "clustered";
|
|
20889
20901
|
const axes = groupAxes(draft, base, group2);
|
|
20890
|
-
group2.axisIds = axes.flatMap((
|
|
20902
|
+
group2.axisIds = axes.flatMap((axis2) => axis2.id === void 0 ? [] : [axis2.id]);
|
|
20891
20903
|
draft.plotArea.groups = [group2];
|
|
20892
20904
|
draft.plotArea.axes = axes;
|
|
20893
20905
|
if (!group2.is3D) {
|
|
@@ -21023,15 +21035,15 @@ function chartSupportsQuickLayout(space3) {
|
|
|
21023
21035
|
return !!group2 && CHART_QUICK_LAYOUT_KINDS.has(group2.kind);
|
|
21024
21036
|
}
|
|
21025
21037
|
function applyAxes(draft, layout) {
|
|
21026
|
-
for (const
|
|
21027
|
-
const value =
|
|
21028
|
-
if (!value &&
|
|
21038
|
+
for (const axis2 of draft.plotArea.axes) {
|
|
21039
|
+
const value = axis2.kind === "val";
|
|
21040
|
+
if (!value && axis2.kind !== "cat" && axis2.kind !== "date") continue;
|
|
21029
21041
|
const titled = value ? layout.valAxisTitle : layout.catAxisTitle;
|
|
21030
|
-
if (!titled) delete
|
|
21031
|
-
else
|
|
21032
|
-
|
|
21033
|
-
|
|
21034
|
-
|
|
21042
|
+
if (!titled) delete axis2.title;
|
|
21043
|
+
else axis2.title ??= newChartTitle(CHART_QUICK_LAYOUT_AXIS_TITLE);
|
|
21044
|
+
axis2.majorGridlines = value && layout.majorGridlines;
|
|
21045
|
+
axis2.minorGridlines = value && layout.minorGridlines;
|
|
21046
|
+
axis2.deleted = value ? !layout.valueAxis : false;
|
|
21035
21047
|
}
|
|
21036
21048
|
}
|
|
21037
21049
|
function applyDataTable(draft, layout) {
|
|
@@ -21082,8 +21094,8 @@ function applyChartQuickLayout(space3, n3, only = ALL_PARTS) {
|
|
|
21082
21094
|
}
|
|
21083
21095
|
function matches(space3, layout) {
|
|
21084
21096
|
const axes = space3.plotArea.axes;
|
|
21085
|
-
const val2 = axes.find((
|
|
21086
|
-
const cat = axes.find((
|
|
21097
|
+
const val2 = axes.find((axis2) => axis2.kind === "val");
|
|
21098
|
+
const cat = axes.find((axis2) => axis2.kind === "cat" || axis2.kind === "date");
|
|
21087
21099
|
const bar = space3.plotArea.groups.find((group2) => group2.kind === "bar");
|
|
21088
21100
|
const labels2 = space3.plotArea.groups.some(
|
|
21089
21101
|
(group2) => group2.dataLabels && group2.dataLabels.deleted !== true && group2.dataLabels.showValue
|
|
@@ -21141,6 +21153,12 @@ var RANGES = {
|
|
|
21141
21153
|
firstSliceAngle: [0, 360],
|
|
21142
21154
|
holeSize: [1, 90]
|
|
21143
21155
|
};
|
|
21156
|
+
var isChartGroupOption = (key) => Object.hasOwn(RANGES, key);
|
|
21157
|
+
function assertChartGroupOption(key, value) {
|
|
21158
|
+
const [min, max] = RANGES[key];
|
|
21159
|
+
if (!Number.isInteger(value) || value < min || value > max)
|
|
21160
|
+
throw new RangeError(`Chart ${key} must be a whole number from ${min} to ${max}`);
|
|
21161
|
+
}
|
|
21144
21162
|
function setChartGroupOptions(space3, seriesIndex, edit) {
|
|
21145
21163
|
return editChartSpace(space3, (draft) => {
|
|
21146
21164
|
const { group: group2 } = chartSeriesEntryAt(draft, seriesIndex);
|
|
@@ -21153,9 +21171,7 @@ function setChartGroupOptions(space3, seriesIndex, edit) {
|
|
|
21153
21171
|
delete group2[key];
|
|
21154
21172
|
continue;
|
|
21155
21173
|
}
|
|
21156
|
-
|
|
21157
|
-
if (!Number.isInteger(value) || value < min || value > max)
|
|
21158
|
-
throw new RangeError(`Chart ${key} must be a whole number from ${min} to ${max}`);
|
|
21174
|
+
assertChartGroupOption(key, value);
|
|
21159
21175
|
group2[key] = value;
|
|
21160
21176
|
}
|
|
21161
21177
|
});
|
|
@@ -21488,9 +21504,9 @@ function setChartView3D(space3, edit) {
|
|
|
21488
21504
|
|
|
21489
21505
|
// chart/edit/secondary-axis.ts
|
|
21490
21506
|
function axisPair(space3, group2) {
|
|
21491
|
-
if (group2.axisIds.length !== 2 || new Set(space3.plotArea.axes.map((
|
|
21507
|
+
if (group2.axisIds.length !== 2 || new Set(space3.plotArea.axes.map((axis2) => axis2.id)).size !== space3.plotArea.axes.length)
|
|
21492
21508
|
return void 0;
|
|
21493
|
-
const [x, y] = group2.axisIds.map((id) => space3.plotArea.axes.find((
|
|
21509
|
+
const [x, y] = group2.axisIds.map((id) => space3.plotArea.axes.find((axis2) => axis2.id === id));
|
|
21494
21510
|
return x && y && ["cat", "date"].includes(x.kind) && y.kind === "val" && x.crossAxisId === y.id && y.crossAxisId === x.id ? [x, y] : void 0;
|
|
21495
21511
|
}
|
|
21496
21512
|
function chartSeriesSecondaryAxisSupported(space3, seriesIndex) {
|
|
@@ -21519,7 +21535,7 @@ function isolateSeries(space3, index) {
|
|
|
21519
21535
|
space3.plotArea.groups.splice(groupIndex, 1, ...segments);
|
|
21520
21536
|
return chartSeriesEntryAt(space3, index).group;
|
|
21521
21537
|
}
|
|
21522
|
-
function setChartSeriesSecondaryAxis(space3, seriesIndex, secondary) {
|
|
21538
|
+
function setChartSeriesSecondaryAxis(space3, seriesIndex, secondary, options2 = {}) {
|
|
21523
21539
|
if (!chartSeriesSecondaryAxisSupported(space3, seriesIndex))
|
|
21524
21540
|
throw new RangeError(
|
|
21525
21541
|
"Secondary-axis editing needs a later series in a supported vertical 2D chart"
|
|
@@ -21533,12 +21549,12 @@ function setChartSeriesSecondaryAxis(space3, seriesIndex, secondary) {
|
|
|
21533
21549
|
return;
|
|
21534
21550
|
}
|
|
21535
21551
|
if (group2.axisIds[1] !== primary.axisIds[1]) return;
|
|
21536
|
-
const existing = draft.plotArea.axes.filter((
|
|
21552
|
+
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]);
|
|
21537
21553
|
if (existing) {
|
|
21538
|
-
group2.axisIds = existing.map((
|
|
21554
|
+
group2.axisIds = existing.map((axis2) => axis2.id);
|
|
21539
21555
|
return;
|
|
21540
21556
|
}
|
|
21541
|
-
const used = new Set(draft.plotArea.axes.map((
|
|
21557
|
+
const used = new Set(draft.plotArea.axes.map((axis2) => axis2.id));
|
|
21542
21558
|
const allocate = () => {
|
|
21543
21559
|
let id = 500000003;
|
|
21544
21560
|
while (used.has(id)) id++;
|
|
@@ -21546,7 +21562,9 @@ function setChartSeriesSecondaryAxis(space3, seriesIndex, secondary) {
|
|
|
21546
21562
|
used.add(id);
|
|
21547
21563
|
return id;
|
|
21548
21564
|
};
|
|
21549
|
-
const ids = [allocate(), allocate()];
|
|
21565
|
+
const ids = options2.axisIds ? [...options2.axisIds] : [allocate(), allocate()];
|
|
21566
|
+
if (options2.axisIds && (ids[0] === ids[1] || ids.some((id) => used.has(id) || !Number.isSafeInteger(id) || id < 0 || id > 4294967295)))
|
|
21567
|
+
throw new RangeError("Secondary axis ids must be two unused whole numbers");
|
|
21550
21568
|
const horizontal = primary.barDirection === "bar";
|
|
21551
21569
|
const axes = defaultChartAxes(horizontal, false, ids);
|
|
21552
21570
|
axes[0] = { ...structuredClone(axisPair(draft, primary)[0]), id: ids[0], crossAxisId: ids[1] };
|
|
@@ -21692,6 +21710,58 @@ function applyChartSpaceDataSheetEdits(space3, edits) {
|
|
|
21692
21710
|
return editChartSpace(next, (draft) => applyStandardChartLayout(draft, layoutSheet, count));
|
|
21693
21711
|
}
|
|
21694
21712
|
|
|
21713
|
+
// chart/edit/new-chart-minimal.ts
|
|
21714
|
+
var VARIED = /* @__PURE__ */ new Set(["pie", "doughnut", "ofPie"]);
|
|
21715
|
+
function schemaGrouping(element4, grouping) {
|
|
21716
|
+
const bar = element4 === "barChart" || element4 === "bar3DChart";
|
|
21717
|
+
if (bar) return grouping ?? "clustered";
|
|
21718
|
+
return grouping === void 0 || grouping === "clustered" ? "standard" : grouping;
|
|
21719
|
+
}
|
|
21720
|
+
function minimalChartGroup(target, series2) {
|
|
21721
|
+
const is3D = target.is3D ?? false;
|
|
21722
|
+
const element4 = chartGroupElement(target.kind, is3D);
|
|
21723
|
+
const allowed = GROUP_FIELDS[element4] ?? [];
|
|
21724
|
+
const own = isXYChartKind(target.kind) ? series2.map((item2) => stripSeriesForKind(item2, "bar", target.kind)) : series2;
|
|
21725
|
+
const group2 = { kind: target.kind, element: element4, is3D, series: own, axisIds: [] };
|
|
21726
|
+
if (target.kind === "bar") group2.barDirection = target.barDirection ?? "col";
|
|
21727
|
+
if (allowed.includes("grouping")) group2.grouping = schemaGrouping(element4, target.grouping);
|
|
21728
|
+
if (allowed.includes("varyColors")) group2.varyColors = VARIED.has(target.kind);
|
|
21729
|
+
if (target.kind === "ofPie") group2.ofPieType = "pie";
|
|
21730
|
+
if (target.kind === "scatter") group2.scatterStyle = "lineMarker";
|
|
21731
|
+
if (target.kind === "radar") group2.radarStyle = "marker";
|
|
21732
|
+
return group2;
|
|
21733
|
+
}
|
|
21734
|
+
function axis(kind, id, crossAxisId, position) {
|
|
21735
|
+
return {
|
|
21736
|
+
kind,
|
|
21737
|
+
id,
|
|
21738
|
+
crossAxisId,
|
|
21739
|
+
position,
|
|
21740
|
+
scaling: { orientation: "minMax" },
|
|
21741
|
+
deleted: false,
|
|
21742
|
+
majorGridlines: false,
|
|
21743
|
+
minorGridlines: false
|
|
21744
|
+
};
|
|
21745
|
+
}
|
|
21746
|
+
function minimalChartAxes(group2, ids) {
|
|
21747
|
+
if (!groupHasAxes(group2.element)) return [];
|
|
21748
|
+
const [first2, second, third] = ids;
|
|
21749
|
+
const horizontal = group2.kind === "bar" && group2.barDirection === "bar";
|
|
21750
|
+
const axes = [
|
|
21751
|
+
axis(isXYChartKind(group2.kind) ? "val" : "cat", first2, second, horizontal ? "l" : "b"),
|
|
21752
|
+
axis("val", second, first2, horizontal ? "b" : "l")
|
|
21753
|
+
];
|
|
21754
|
+
if (group2.element === "line3DChart" || group2.kind === "surface")
|
|
21755
|
+
axes.push(axis("ser", third, second, "b"));
|
|
21756
|
+
return axes;
|
|
21757
|
+
}
|
|
21758
|
+
function minimalChartTitle(text3) {
|
|
21759
|
+
const rich = chartTextBodyFromXml(
|
|
21760
|
+
`<a:bodyPr/><a:lstStyle/><a:p><a:r><a:t>${escapeText(text3)}</a:t></a:r></a:p>`
|
|
21761
|
+
);
|
|
21762
|
+
return { tx: { rich, text: rich.text }, text: rich.text, overlay: false };
|
|
21763
|
+
}
|
|
21764
|
+
|
|
21695
21765
|
// chart/edit/new-chart.ts
|
|
21696
21766
|
var DEFAULT_CHART_DATA_SHEET = {
|
|
21697
21767
|
categories: ["Category 1", "Category 2", "Category 3", "Category 4"],
|
|
@@ -21701,21 +21771,84 @@ var DEFAULT_CHART_DATA_SHEET = {
|
|
|
21701
21771
|
{ name: "Series 3", values: [2, 2, 3, 5] }
|
|
21702
21772
|
]
|
|
21703
21773
|
};
|
|
21704
|
-
|
|
21774
|
+
var CATEGORY_ONLY2 = [
|
|
21775
|
+
"labelAlign",
|
|
21776
|
+
"noMultiLevelLabels",
|
|
21777
|
+
"tickLabelSkip",
|
|
21778
|
+
"tickMarkSkip"
|
|
21779
|
+
];
|
|
21780
|
+
function withDateAxis(space3) {
|
|
21781
|
+
return editChartSpace(space3, (draft) => {
|
|
21782
|
+
const axis2 = draft.plotArea.axes[0];
|
|
21783
|
+
if (axis2?.kind !== "cat") return;
|
|
21784
|
+
axis2.kind = "date";
|
|
21785
|
+
for (const key of CATEGORY_ONLY2) delete axis2[key];
|
|
21786
|
+
});
|
|
21787
|
+
}
|
|
21788
|
+
function series(sheet, index, options2, sheetName) {
|
|
21705
21789
|
const entry3 = sheet.series[index];
|
|
21790
|
+
if (options2.data === "literal")
|
|
21791
|
+
return {
|
|
21792
|
+
index,
|
|
21793
|
+
order: index,
|
|
21794
|
+
tx: { value: entry3.name, text: entry3.name },
|
|
21795
|
+
...options2.profile === "minimal" ? {} : { invertIfNegative: false },
|
|
21796
|
+
dataPoints: [],
|
|
21797
|
+
categories: categorySource(sheet.categories, void 0),
|
|
21798
|
+
values: numberSource(entry3.values, void 0)
|
|
21799
|
+
};
|
|
21706
21800
|
const formulas = standardChartFormulas(sheetName, index, sheet.categories.length);
|
|
21707
21801
|
return {
|
|
21708
21802
|
index,
|
|
21709
21803
|
order: index,
|
|
21710
21804
|
tx: { reference: categorySource([entry3.name], void 0, formulas.name), text: entry3.name },
|
|
21711
|
-
invertIfNegative: false,
|
|
21805
|
+
...options2.profile === "minimal" ? {} : { invertIfNegative: false },
|
|
21712
21806
|
dataPoints: [],
|
|
21713
21807
|
categories: categorySource(sheet.categories, void 0, formulas.categories),
|
|
21714
21808
|
values: numberSource(entry3.values, void 0, formulas.values)
|
|
21715
21809
|
};
|
|
21716
21810
|
}
|
|
21717
|
-
function
|
|
21718
|
-
const
|
|
21811
|
+
function axisIds(options2) {
|
|
21812
|
+
const ids = options2.axisIds ?? [];
|
|
21813
|
+
const [first2, second, third] = [
|
|
21814
|
+
ids[0] ?? DEFAULT_CHART_AXIS_IDS[0],
|
|
21815
|
+
ids[1] ?? DEFAULT_CHART_AXIS_IDS[1],
|
|
21816
|
+
ids[2] ?? DEFAULT_CHART_AXIS_IDS[1] + 1
|
|
21817
|
+
];
|
|
21818
|
+
for (const id of [first2, second, third])
|
|
21819
|
+
if (!Number.isSafeInteger(id) || id < 0)
|
|
21820
|
+
throw new RangeError("Chart axis ids must be non-negative whole numbers");
|
|
21821
|
+
if ((/* @__PURE__ */ new Set([first2, second, third])).size !== 3)
|
|
21822
|
+
throw new RangeError("Chart axis ids must differ");
|
|
21823
|
+
return [first2, second, third];
|
|
21824
|
+
}
|
|
21825
|
+
function withAxisIds(space3, ids) {
|
|
21826
|
+
return editChartSpace(space3, (draft) => {
|
|
21827
|
+
const map = /* @__PURE__ */ new Map();
|
|
21828
|
+
draft.plotArea.axes.forEach((axis2, position) => {
|
|
21829
|
+
if (axis2.id !== void 0 && ids[position] !== void 0) map.set(axis2.id, ids[position]);
|
|
21830
|
+
});
|
|
21831
|
+
const renumber = (id) => map.get(id) ?? id;
|
|
21832
|
+
for (const axis2 of draft.plotArea.axes) {
|
|
21833
|
+
if (axis2.id !== void 0) axis2.id = renumber(axis2.id);
|
|
21834
|
+
if (axis2.crossAxisId !== void 0) axis2.crossAxisId = renumber(axis2.crossAxisId);
|
|
21835
|
+
}
|
|
21836
|
+
for (const group2 of draft.plotArea.groups) group2.axisIds = group2.axisIds.map(renumber);
|
|
21837
|
+
});
|
|
21838
|
+
}
|
|
21839
|
+
function withGroupSettings(space3, settings) {
|
|
21840
|
+
return editChartSpace(space3, (draft) => {
|
|
21841
|
+
const group2 = draft.plotArea.groups[0];
|
|
21842
|
+
const allowed = GROUP_FIELDS[group2.element] ?? [];
|
|
21843
|
+
for (const [key, value] of Object.entries(settings)) {
|
|
21844
|
+
if (value === void 0) continue;
|
|
21845
|
+
if (!allowed.includes(key)) throw new RangeError(`A ${group2.element} has no ${key} setting`);
|
|
21846
|
+
if (isChartGroupOption(key)) assertChartGroupOption(key, value);
|
|
21847
|
+
Object.assign(group2, { [key]: structuredClone(value) });
|
|
21848
|
+
}
|
|
21849
|
+
});
|
|
21850
|
+
}
|
|
21851
|
+
function officeChartSpace(sheet, target, options2, sheetName) {
|
|
21719
21852
|
const group2 = {
|
|
21720
21853
|
kind: "bar",
|
|
21721
21854
|
element: "barChart",
|
|
@@ -21725,10 +21858,10 @@ function newChartSpace(sheet = DEFAULT_CHART_DATA_SHEET, target, options2 = {})
|
|
|
21725
21858
|
varyColors: false,
|
|
21726
21859
|
gapWidth: 219,
|
|
21727
21860
|
overlap: -27,
|
|
21728
|
-
series: sheet.series.map((_, index) => series(sheet, index, sheetName)),
|
|
21861
|
+
series: sheet.series.map((_, index) => series(sheet, index, options2, sheetName)),
|
|
21729
21862
|
axisIds: [...DEFAULT_CHART_AXIS_IDS]
|
|
21730
21863
|
};
|
|
21731
|
-
|
|
21864
|
+
const space3 = {
|
|
21732
21865
|
roundedCorners: false,
|
|
21733
21866
|
autoTitleDeleted: options2.title === void 0,
|
|
21734
21867
|
plotArea: { layout: {}, groups: [group2], axes: defaultChartAxes(false, false) },
|
|
@@ -21737,9 +21870,36 @@ function newChartSpace(sheet = DEFAULT_CHART_DATA_SHEET, target, options2 = {})
|
|
|
21737
21870
|
};
|
|
21738
21871
|
const column = !target || target.kind === "bar" && (target.barDirection ?? "col") === "col";
|
|
21739
21872
|
if (target && !(column && !target.is3D && (target.grouping ?? "clustered") === "clustered"))
|
|
21740
|
-
|
|
21741
|
-
|
|
21742
|
-
|
|
21873
|
+
return setChartType(space3, target);
|
|
21874
|
+
return space3;
|
|
21875
|
+
}
|
|
21876
|
+
function minimalChartSpace(sheet, target, options2, sheetName) {
|
|
21877
|
+
const group2 = minimalChartGroup(
|
|
21878
|
+
target ?? { kind: "bar" },
|
|
21879
|
+
sheet.series.map((_, index) => series(sheet, index, options2, sheetName))
|
|
21880
|
+
);
|
|
21881
|
+
if (group2.kind === "stock" && ![3, 4].includes(group2.series.length))
|
|
21882
|
+
throw new RangeError("A stock chart requires three or four price series");
|
|
21883
|
+
const axes = minimalChartAxes(group2, axisIds(options2));
|
|
21884
|
+
group2.axisIds = axes.flatMap((axis2) => axis2.id === void 0 ? [] : [axis2.id]);
|
|
21885
|
+
return {
|
|
21886
|
+
autoTitleDeleted: options2.title === void 0,
|
|
21887
|
+
plotArea: { layout: {}, groups: [group2], axes },
|
|
21888
|
+
plotVisibleOnly: true,
|
|
21889
|
+
displayBlanksAs: "gap"
|
|
21890
|
+
};
|
|
21891
|
+
}
|
|
21892
|
+
function newChartSpace(sheet = DEFAULT_CHART_DATA_SHEET, target, options2 = {}) {
|
|
21893
|
+
const sheetName = options2.sheetName ?? DEFAULT_CHART_SHEET_NAME;
|
|
21894
|
+
let space3 = options2.profile === "minimal" ? minimalChartSpace(sheet, target, options2, sheetName) : officeChartSpace(sheet, target, options2, sheetName);
|
|
21895
|
+
if (options2.profile !== "minimal" && options2.axisIds !== void 0)
|
|
21896
|
+
space3 = withAxisIds(space3, axisIds(options2));
|
|
21897
|
+
if (options2.dateAxis) space3 = withDateAxis(space3);
|
|
21898
|
+
if (options2.group) space3 = withGroupSettings(space3, options2.group);
|
|
21899
|
+
if (options2.title !== void 0)
|
|
21900
|
+
space3 = options2.profile === "minimal" ? { ...space3, title: minimalChartTitle(options2.title), autoTitleDeleted: false } : setChartTitle(space3, options2.title);
|
|
21901
|
+
const legend = options2.legendPosition === void 0 ? "b" : options2.legendPosition;
|
|
21902
|
+
return legend === null ? space3 : setChartLegend(space3, { position: legend });
|
|
21743
21903
|
}
|
|
21744
21904
|
|
|
21745
21905
|
// chart/edit/apply-appearance.ts
|
|
@@ -21867,21 +22027,21 @@ function chartExStyleSpace(space3) {
|
|
|
21867
22027
|
} : {},
|
|
21868
22028
|
plotArea: {
|
|
21869
22029
|
...styles(space3.plotArea),
|
|
21870
|
-
axes: space3.plotArea.axes.map((
|
|
21871
|
-
kind:
|
|
22030
|
+
axes: space3.plotArea.axes.map((axis2) => ({
|
|
22031
|
+
kind: axis2.scaling?.kind ?? "val",
|
|
21872
22032
|
scaling: {},
|
|
21873
|
-
...styles(
|
|
21874
|
-
...
|
|
22033
|
+
...styles(axis2),
|
|
22034
|
+
...axis2.title ? {
|
|
21875
22035
|
title: {
|
|
21876
|
-
...styles(
|
|
21877
|
-
...
|
|
22036
|
+
...styles(axis2.title),
|
|
22037
|
+
...axis2.title.tx?.rich ? { tx: { rich: axis2.title.tx.rich, text: axis2.title.tx.rich.text } } : {}
|
|
21878
22038
|
}
|
|
21879
22039
|
} : {},
|
|
21880
|
-
...
|
|
21881
|
-
majorGridlines: !!
|
|
21882
|
-
minorGridlines: !!
|
|
21883
|
-
...
|
|
21884
|
-
...
|
|
22040
|
+
...axis2.id === void 0 ? {} : { id: axis2.id },
|
|
22041
|
+
majorGridlines: !!axis2.majorGridlines,
|
|
22042
|
+
minorGridlines: !!axis2.minorGridlines,
|
|
22043
|
+
...axis2.majorGridlines?.spPr ? { majorGridlinesSpPr: axis2.majorGridlines.spPr } : {},
|
|
22044
|
+
...axis2.minorGridlines?.spPr ? { minorGridlinesSpPr: axis2.minorGridlines.spPr } : {}
|
|
21885
22045
|
})),
|
|
21886
22046
|
groups: space3.plotArea.series.map((series2) => ({
|
|
21887
22047
|
kind: "bar",
|
|
@@ -21917,19 +22077,19 @@ function editChartExStyle(space3, operation) {
|
|
|
21917
22077
|
if (after.title.tx?.rich) draft.title.tx = { ...draft.title.tx, rich: after.title.tx.rich };
|
|
21918
22078
|
}
|
|
21919
22079
|
if (draft.legend && after.legend) copyStyle(draft.legend, after.legend);
|
|
21920
|
-
draft.plotArea.axes.forEach((
|
|
22080
|
+
draft.plotArea.axes.forEach((axis2, index) => {
|
|
21921
22081
|
const edited = after.plotArea.axes[index];
|
|
21922
22082
|
if (!edited) return;
|
|
21923
|
-
copyStyle(
|
|
21924
|
-
if (
|
|
21925
|
-
copyStyle(
|
|
21926
|
-
if (edited.title.tx?.rich)
|
|
22083
|
+
copyStyle(axis2, edited);
|
|
22084
|
+
if (axis2.title && edited.title) {
|
|
22085
|
+
copyStyle(axis2.title, edited.title);
|
|
22086
|
+
if (edited.title.tx?.rich) axis2.title.tx = { ...axis2.title.tx, rich: edited.title.tx.rich };
|
|
21927
22087
|
}
|
|
21928
22088
|
for (const key of ["majorGridlines", "minorGridlines"]) {
|
|
21929
22089
|
const shape = edited[key === "majorGridlines" ? "majorGridlinesSpPr" : "minorGridlinesSpPr"];
|
|
21930
22090
|
if (shape) {
|
|
21931
|
-
|
|
21932
|
-
|
|
22091
|
+
axis2[key] ??= {};
|
|
22092
|
+
axis2[key].spPr = structuredClone(shape);
|
|
21933
22093
|
}
|
|
21934
22094
|
}
|
|
21935
22095
|
});
|
|
@@ -21974,10 +22134,10 @@ function shapes(space3, target) {
|
|
|
21974
22134
|
case "axis":
|
|
21975
22135
|
case "majorGridlines":
|
|
21976
22136
|
case "minorGridlines": {
|
|
21977
|
-
const
|
|
21978
|
-
if (!
|
|
21979
|
-
if (target.kind === "axis") return [
|
|
21980
|
-
return [(
|
|
22137
|
+
const axis2 = space3.plotArea.axes[target.axisIndex];
|
|
22138
|
+
if (!axis2) throw new RangeError("No chart axis at index.");
|
|
22139
|
+
if (target.kind === "axis") return [axis2.spPr ??= {}];
|
|
22140
|
+
return [(axis2[target.kind] ??= {}).spPr ??= {}];
|
|
21981
22141
|
}
|
|
21982
22142
|
case "dataLabels": {
|
|
21983
22143
|
const series2 = target.seriesIndex === void 0 ? space3.plotArea.series : [chartExSeriesAt(space3, target.seriesIndex)];
|
|
@@ -22067,25 +22227,25 @@ function editChartExAxis(space3, index, edit) {
|
|
|
22067
22227
|
throw new RangeError("Invalid ChartEx axis scaling.");
|
|
22068
22228
|
}
|
|
22069
22229
|
return editChartExSpace(space3, (draft) => {
|
|
22070
|
-
const
|
|
22230
|
+
const axis2 = chartExAxisAt(draft, index);
|
|
22071
22231
|
for (const key of ["min", "max", "majorUnit", "minorUnit"])
|
|
22072
22232
|
if (edit[key] !== void 0) {
|
|
22073
|
-
if (
|
|
22233
|
+
if (axis2.scaling?.kind !== "val")
|
|
22074
22234
|
throw new RangeError("Only a value axis supports numeric scaling.");
|
|
22075
|
-
if (edit[key] === null) delete
|
|
22076
|
-
else
|
|
22235
|
+
if (edit[key] === null) delete axis2.scaling[key];
|
|
22236
|
+
else axis2.scaling[key] = edit[key];
|
|
22077
22237
|
}
|
|
22078
|
-
if (
|
|
22238
|
+
if (axis2.scaling?.kind === "val" && typeof axis2.scaling.min === "number" && typeof axis2.scaling.max === "number" && axis2.scaling.min >= axis2.scaling.max)
|
|
22079
22239
|
throw new RangeError("Axis maximum must exceed its minimum.");
|
|
22080
|
-
if (edit.visible !== void 0)
|
|
22240
|
+
if (edit.visible !== void 0) axis2.hidden = !edit.visible;
|
|
22081
22241
|
if (edit.tickLabels !== void 0) {
|
|
22082
|
-
if (edit.tickLabels)
|
|
22083
|
-
else delete
|
|
22242
|
+
if (edit.tickLabels) axis2.tickLabels ??= {};
|
|
22243
|
+
else delete axis2.tickLabels;
|
|
22084
22244
|
}
|
|
22085
22245
|
for (const key of ["majorGridlines", "minorGridlines"])
|
|
22086
22246
|
if (edit[key] !== void 0) {
|
|
22087
|
-
if (edit[key])
|
|
22088
|
-
else delete
|
|
22247
|
+
if (edit[key]) axis2[key] ??= {};
|
|
22248
|
+
else delete axis2[key];
|
|
22089
22249
|
}
|
|
22090
22250
|
for (const [key, target] of [
|
|
22091
22251
|
["majorTickMark", "majorTickMarks"],
|
|
@@ -22093,28 +22253,28 @@ function editChartExAxis(space3, index, edit) {
|
|
|
22093
22253
|
])
|
|
22094
22254
|
if (edit[key] !== void 0) {
|
|
22095
22255
|
const value = edit[key];
|
|
22096
|
-
if (value === null) delete
|
|
22256
|
+
if (value === null) delete axis2[target];
|
|
22097
22257
|
else {
|
|
22098
22258
|
if (!["in", "out", "cross", "none"].includes(value))
|
|
22099
22259
|
throw new RangeError("Invalid tick mark.");
|
|
22100
|
-
|
|
22260
|
+
axis2[target] = { type: value };
|
|
22101
22261
|
}
|
|
22102
22262
|
}
|
|
22103
22263
|
if (edit.title !== void 0) {
|
|
22104
22264
|
const { title: _chartTitle, ...base } = draft;
|
|
22105
22265
|
const title = setChartExTitle(
|
|
22106
|
-
{ ...base, ...
|
|
22266
|
+
{ ...base, ...axis2.title ? { title: axis2.title } : {} },
|
|
22107
22267
|
edit.title ?? void 0
|
|
22108
22268
|
).title;
|
|
22109
|
-
if (title)
|
|
22110
|
-
else delete
|
|
22269
|
+
if (title) axis2.title = title;
|
|
22270
|
+
else delete axis2.title;
|
|
22111
22271
|
}
|
|
22112
22272
|
if (edit.numberFormat !== void 0) {
|
|
22113
|
-
if (edit.numberFormat === null) delete
|
|
22114
|
-
else
|
|
22273
|
+
if (edit.numberFormat === null) delete axis2.numberFormat;
|
|
22274
|
+
else axis2.numberFormat = structuredClone(edit.numberFormat);
|
|
22115
22275
|
}
|
|
22116
22276
|
if (edit.units !== void 0) {
|
|
22117
|
-
if (edit.units === null) delete
|
|
22277
|
+
if (edit.units === null) delete axis2.units;
|
|
22118
22278
|
else {
|
|
22119
22279
|
if (![
|
|
22120
22280
|
"hundreds",
|
|
@@ -22129,7 +22289,7 @@ function editChartExAxis(space3, index, edit) {
|
|
|
22129
22289
|
"percentage"
|
|
22130
22290
|
].includes(edit.units))
|
|
22131
22291
|
throw new RangeError("Unsupported ChartEx display units.");
|
|
22132
|
-
|
|
22292
|
+
axis2.units = { ...axis2.units, unit: edit.units };
|
|
22133
22293
|
}
|
|
22134
22294
|
}
|
|
22135
22295
|
});
|
|
@@ -22225,9 +22385,9 @@ function applyChartExEditAction(space3, action) {
|
|
|
22225
22385
|
return setChartExAxis(space3, action.axisIndex, action.edit);
|
|
22226
22386
|
case "tickLabels":
|
|
22227
22387
|
return editChartExSpace(space3, (draft) => {
|
|
22228
|
-
const
|
|
22229
|
-
if (action.visible)
|
|
22230
|
-
else delete
|
|
22388
|
+
const axis2 = chartExAxisAt(draft, action.axisIndex);
|
|
22389
|
+
if (action.visible) axis2.tickLabels ??= {};
|
|
22390
|
+
else delete axis2.tickLabels;
|
|
22231
22391
|
});
|
|
22232
22392
|
case "pointLabel":
|
|
22233
22393
|
return setChartExPointLabel(space3, action.seriesIndex, action.pointIndex, action.label);
|
|
@@ -22524,15 +22684,15 @@ function setChartSeriesAxis(space3, seriesIndex, valueAxisId2) {
|
|
|
22524
22684
|
const { group: group2 } = chartSeriesEntryAt(space3, seriesIndex);
|
|
22525
22685
|
if (group2.is3D || !["bar", "line", "area", "scatter", "bubble"].includes(group2.kind))
|
|
22526
22686
|
throw new RangeError("This chart family has no editable axis pair");
|
|
22527
|
-
if (new Set(space3.plotArea.axes.map((
|
|
22687
|
+
if (new Set(space3.plotArea.axes.map((axis2) => axis2.id)).size !== space3.plotArea.axes.length)
|
|
22528
22688
|
throw new RangeError("Ambiguous chart axis ids");
|
|
22529
22689
|
const horizontal = group2.kind === "bar" && group2.barDirection === "bar";
|
|
22530
22690
|
const candidates = space3.plotArea.axes.filter(
|
|
22531
|
-
(
|
|
22691
|
+
(axis2) => axis2.kind === "val" && (valueAxisId2 === null ? axis2.position === (horizontal ? "b" : "l") : axis2.id === valueAxisId2)
|
|
22532
22692
|
);
|
|
22533
22693
|
if (candidates.length !== 1) throw new RangeError("No unique existing value axis");
|
|
22534
22694
|
const value = candidates[0];
|
|
22535
|
-
const category = space3.plotArea.axes.find((
|
|
22695
|
+
const category = space3.plotArea.axes.find((axis2) => axis2.id === value.crossAxisId);
|
|
22536
22696
|
const xy = group2.kind === "scatter" || group2.kind === "bubble";
|
|
22537
22697
|
if (value.id === void 0 || category?.id === void 0 || category.crossAxisId !== value.id || (xy ? category.kind !== "val" : !["cat", "date"].includes(category.kind)))
|
|
22538
22698
|
throw new RangeError("Axis references do not form a coherent pair");
|
|
@@ -22565,7 +22725,7 @@ function setChartSeriesType(space3, index, target) {
|
|
|
22565
22725
|
return structuredClone(space3);
|
|
22566
22726
|
if (group2.is3D || target.is3D || !["bar", "line", "area"].includes(group2.kind) || !["bar", "line", "area"].includes(target.kind) || group2.barDirection === "bar" || target.barDirection === "bar")
|
|
22567
22727
|
throw new RangeError("Series combo types need vertical 2D column, line or area families");
|
|
22568
|
-
const pair = group2.axisIds.map((id) => space3.plotArea.axes.find((
|
|
22728
|
+
const pair = group2.axisIds.map((id) => space3.plotArea.axes.find((axis2) => axis2.id === id));
|
|
22569
22729
|
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)
|
|
22570
22730
|
throw new RangeError("Combo types need a coherent category/value axis pair");
|
|
22571
22731
|
if (group2.series.length > 1 && group2.extLst)
|
|
@@ -22636,14 +22796,14 @@ function setChartGroupDecorations(space3, edit) {
|
|
|
22636
22796
|
// chart/edit/axis-label.ts
|
|
22637
22797
|
function setChartDisplayUnitsLabel(space3, target, edit) {
|
|
22638
22798
|
return editChartSpace(space3, (draft) => {
|
|
22639
|
-
const
|
|
22640
|
-
if (
|
|
22799
|
+
const axis2 = chartAxisAt(draft, target);
|
|
22800
|
+
if (axis2.kind !== "val") throw new RangeError("Only a value axis has a display-units label");
|
|
22641
22801
|
if (edit === null) {
|
|
22642
|
-
if (
|
|
22802
|
+
if (axis2.displayUnits) delete axis2.displayUnits.label;
|
|
22643
22803
|
return;
|
|
22644
22804
|
}
|
|
22645
|
-
|
|
22646
|
-
const label =
|
|
22805
|
+
axis2.displayUnits ??= {};
|
|
22806
|
+
const label = axis2.displayUnits.label ??= {};
|
|
22647
22807
|
if (edit.text === null) delete label.tx;
|
|
22648
22808
|
else if (edit.text !== void 0)
|
|
22649
22809
|
assignOrDelete(
|
|
@@ -28145,8 +28305,8 @@ function documentOrder(point) {
|
|
|
28145
28305
|
descendants3(all[0], all);
|
|
28146
28306
|
return all;
|
|
28147
28307
|
}
|
|
28148
|
-
function axisPoints(point,
|
|
28149
|
-
switch (
|
|
28308
|
+
function axisPoints(point, axis2) {
|
|
28309
|
+
switch (axis2) {
|
|
28150
28310
|
case "self":
|
|
28151
28311
|
return [point];
|
|
28152
28312
|
case "ch":
|
|
@@ -28165,7 +28325,7 @@ function axisPoints(point, axis) {
|
|
|
28165
28325
|
return point.parent ? [point.parent] : [];
|
|
28166
28326
|
case "ancst":
|
|
28167
28327
|
case "ancstOrSelf": {
|
|
28168
|
-
const out =
|
|
28328
|
+
const out = axis2 === "ancstOrSelf" ? [point] : [];
|
|
28169
28329
|
let current = point.parent;
|
|
28170
28330
|
while (current) {
|
|
28171
28331
|
out.push(current);
|
|
@@ -28180,13 +28340,13 @@ function axisPoints(point, axis) {
|
|
|
28180
28340
|
if (index < 0) {
|
|
28181
28341
|
return [];
|
|
28182
28342
|
}
|
|
28183
|
-
return
|
|
28343
|
+
return axis2 === "followSib" ? siblings.slice(index + 1) : siblings.slice(0, index);
|
|
28184
28344
|
}
|
|
28185
28345
|
case "follow":
|
|
28186
28346
|
case "preced": {
|
|
28187
28347
|
const all = documentOrder(point);
|
|
28188
28348
|
const index = all.indexOf(point);
|
|
28189
|
-
return
|
|
28349
|
+
return axis2 === "follow" ? all.slice(index + 1) : all.slice(0, index);
|
|
28190
28350
|
}
|
|
28191
28351
|
case "root":
|
|
28192
28352
|
return [rootOf2(point)];
|
|
@@ -28258,10 +28418,10 @@ function windowPoints(points2, st = 1, cnt = 0, step = 1) {
|
|
|
28258
28418
|
return out;
|
|
28259
28419
|
}
|
|
28260
28420
|
function iterateStep(point, iterator, step) {
|
|
28261
|
-
const
|
|
28421
|
+
const axis2 = iterator.axis[step] ?? "none";
|
|
28262
28422
|
const ptType = iterator.ptType[step] ?? iterator.ptType[iterator.ptType.length - 1] ?? "all";
|
|
28263
|
-
const hideLast = (iterator.hideLastTrans[step] ?? true) && SIBLING_AXES.has(
|
|
28264
|
-
let points2 = axisPoints(point,
|
|
28423
|
+
const hideLast = (iterator.hideLastTrans[step] ?? true) && SIBLING_AXES.has(axis2);
|
|
28424
|
+
let points2 = axisPoints(point, axis2).filter((candidate) => matchesPointType(candidate, ptType));
|
|
28265
28425
|
if (hideLast) {
|
|
28266
28426
|
points2 = points2.filter((candidate) => !isLastSiblingTransition(candidate));
|
|
28267
28427
|
}
|
|
@@ -28526,8 +28686,8 @@ function valueOf(node, type) {
|
|
|
28526
28686
|
if (direct !== void 0) {
|
|
28527
28687
|
return boundedValue(node, type, direct);
|
|
28528
28688
|
}
|
|
28529
|
-
const
|
|
28530
|
-
return
|
|
28689
|
+
const axis2 = AXIS_LOOKUP[type];
|
|
28690
|
+
return axis2 ? axisValue(node, axis2[0], axis2[1]) : void 0;
|
|
28531
28691
|
}
|
|
28532
28692
|
function boundedValue(node, type, value) {
|
|
28533
28693
|
let out = value;
|
|
@@ -28670,17 +28830,17 @@ function exactDef(name2, avLst, gdLines, rect3, paths) {
|
|
|
28670
28830
|
var Glyph = class {
|
|
28671
28831
|
lines = [];
|
|
28672
28832
|
names = /* @__PURE__ */ new Map();
|
|
28673
|
-
coord(
|
|
28674
|
-
const key = `${
|
|
28833
|
+
coord(axis2, value) {
|
|
28834
|
+
const key = `${axis2}${value}`;
|
|
28675
28835
|
const known = this.names.get(key);
|
|
28676
28836
|
if (known) {
|
|
28677
28837
|
return known;
|
|
28678
28838
|
}
|
|
28679
28839
|
const id = this.names.size;
|
|
28680
|
-
const name2 = `${
|
|
28840
|
+
const name2 = `${axis2}g${id}`;
|
|
28681
28841
|
this.lines.push(
|
|
28682
28842
|
`k${id} */ ss ${Math.round(value * 1e3)} 90000`,
|
|
28683
|
-
`${name2} +- ${
|
|
28843
|
+
`${name2} +- ${axis2 === "x" ? "hc" : "vc"} k${id} 0`
|
|
28684
28844
|
);
|
|
28685
28845
|
this.names.set(key, name2);
|
|
28686
28846
|
return name2;
|
|
@@ -43833,7 +43993,7 @@ function siblingGroupOf(node, parentOf, childrenOf, roots2) {
|
|
|
43833
43993
|
const parent = parentOf.get(node.id);
|
|
43834
43994
|
return parent ? childrenOf.get(parent.id) ?? [] : roots2;
|
|
43835
43995
|
}
|
|
43836
|
-
function navigateAxisHop(current,
|
|
43996
|
+
function navigateAxisHop(current, axis2, nodes, childrenOf, parentOf, roots2) {
|
|
43837
43997
|
const out = [];
|
|
43838
43998
|
const seen = /* @__PURE__ */ new Set();
|
|
43839
43999
|
const add3 = (node) => {
|
|
@@ -43848,7 +44008,7 @@ function navigateAxisHop(current, axis, nodes, childrenOf, parentOf, roots2) {
|
|
|
43848
44008
|
}
|
|
43849
44009
|
};
|
|
43850
44010
|
for (const node of current) {
|
|
43851
|
-
switch (
|
|
44011
|
+
switch (axis2) {
|
|
43852
44012
|
case "self":
|
|
43853
44013
|
add3(node);
|
|
43854
44014
|
break;
|
|
@@ -43880,7 +44040,7 @@ function navigateAxisHop(current, axis, nodes, childrenOf, parentOf, roots2) {
|
|
|
43880
44040
|
case "precedSib": {
|
|
43881
44041
|
const siblings = siblingGroupOf(node, parentOf, childrenOf, roots2);
|
|
43882
44042
|
const index = siblings.findIndex((sibling) => sibling.id === node.id);
|
|
43883
|
-
addAll(
|
|
44043
|
+
addAll(axis2 === "followSib" ? siblings.slice(index + 1) : siblings.slice(0, index));
|
|
43884
44044
|
break;
|
|
43885
44045
|
}
|
|
43886
44046
|
case "follow":
|
|
@@ -43890,11 +44050,11 @@ function navigateAxisHop(current, axis, nodes, childrenOf, parentOf, roots2) {
|
|
|
43890
44050
|
break;
|
|
43891
44051
|
}
|
|
43892
44052
|
const excluded = new Set(
|
|
43893
|
-
(
|
|
44053
|
+
(axis2 === "follow" ? descendantsOf(node, childrenOf) : ancestorsOf(node, parentOf)).map(
|
|
43894
44054
|
(n3) => n3.id
|
|
43895
44055
|
)
|
|
43896
44056
|
);
|
|
43897
|
-
const range2 =
|
|
44057
|
+
const range2 = axis2 === "follow" ? nodes.slice(docIndex + 1) : nodes.slice(0, docIndex);
|
|
43898
44058
|
addAll(range2.filter((n3) => !excluded.has(n3.id)));
|
|
43899
44059
|
break;
|
|
43900
44060
|
}
|
|
@@ -43930,15 +44090,15 @@ function applyPointTypeAndRange(nodes, pointType2, start, count) {
|
|
|
43930
44090
|
const filtered = pointType2 ? nodes.filter((n3) => pointTypeMatches(n3, pointType2)) : nodes;
|
|
43931
44091
|
return selectRange(filtered, start, count);
|
|
43932
44092
|
}
|
|
43933
|
-
function resolveAxisNodes(nodes,
|
|
43934
|
-
if (
|
|
44093
|
+
function resolveAxisNodes(nodes, axis2, pointTypes, start, count, context) {
|
|
44094
|
+
if (axis2.length === 0) {
|
|
43935
44095
|
return void 0;
|
|
43936
44096
|
}
|
|
43937
44097
|
const rootRelative = context === void 0;
|
|
43938
|
-
if (rootRelative &&
|
|
44098
|
+
if (rootRelative && axis2[0] !== "ch" && axis2[0] !== "self" && axis2[0] !== "root") {
|
|
43939
44099
|
return void 0;
|
|
43940
44100
|
}
|
|
43941
|
-
if (
|
|
44101
|
+
if (axis2[0] === "root" && axis2.length > 1 && axis2[1] !== "ch") {
|
|
43942
44102
|
return void 0;
|
|
43943
44103
|
}
|
|
43944
44104
|
const byId = new Map(nodes.map((n3) => [n3.id, n3]));
|
|
@@ -43959,15 +44119,15 @@ function resolveAxisNodes(nodes, axis, pointTypes, start, count, context) {
|
|
|
43959
44119
|
const roots2 = nodes.filter((n3) => !n3.parentId || !byId.has(n3.parentId));
|
|
43960
44120
|
let current;
|
|
43961
44121
|
let nextHop;
|
|
43962
|
-
if (
|
|
44122
|
+
if (axis2[0] === "root" && axis2.length > 1) {
|
|
43963
44123
|
current = applyPointTypeAndRange(roots2, pointTypes?.[1], start?.[1], count?.[1]);
|
|
43964
44124
|
nextHop = 2;
|
|
43965
|
-
} else if (
|
|
44125
|
+
} else if (axis2[0] === "root") {
|
|
43966
44126
|
current = applyPointTypeAndRange(roots2, pointTypes?.[0], start?.[0], count?.[0]);
|
|
43967
44127
|
nextHop = 1;
|
|
43968
44128
|
} else if (context !== void 0) {
|
|
43969
44129
|
current = applyPointTypeAndRange(
|
|
43970
|
-
navigateAxisHop(context,
|
|
44130
|
+
navigateAxisHop(context, axis2[0], nodes, childrenOf, parentOf, roots2),
|
|
43971
44131
|
pointTypes?.[0],
|
|
43972
44132
|
start?.[0],
|
|
43973
44133
|
count?.[0]
|
|
@@ -43977,9 +44137,9 @@ function resolveAxisNodes(nodes, axis, pointTypes, start, count, context) {
|
|
|
43977
44137
|
current = applyPointTypeAndRange(roots2, pointTypes?.[0], start?.[0], count?.[0]);
|
|
43978
44138
|
nextHop = 1;
|
|
43979
44139
|
}
|
|
43980
|
-
for (let hop = nextHop; hop <
|
|
44140
|
+
for (let hop = nextHop; hop < axis2.length; hop += 1) {
|
|
43981
44141
|
current = applyPointTypeAndRange(
|
|
43982
|
-
navigateAxisHop(current,
|
|
44142
|
+
navigateAxisHop(current, axis2[hop], nodes, childrenOf, parentOf, roots2),
|
|
43983
44143
|
pointTypes?.[hop],
|
|
43984
44144
|
start?.[hop],
|
|
43985
44145
|
count?.[hop]
|
|
@@ -43987,8 +44147,8 @@ function resolveAxisNodes(nodes, axis, pointTypes, start, count, context) {
|
|
|
43987
44147
|
}
|
|
43988
44148
|
return current;
|
|
43989
44149
|
}
|
|
43990
|
-
function resolveAxisCount(nodes,
|
|
43991
|
-
return resolveAxisNodes(nodes,
|
|
44150
|
+
function resolveAxisCount(nodes, axis2, pointTypes, start, count, context) {
|
|
44151
|
+
return resolveAxisNodes(nodes, axis2, pointTypes, start, count, context)?.length;
|
|
43992
44152
|
}
|
|
43993
44153
|
|
|
43994
44154
|
// diagram/layout/smartart-layout-interpreter-axis-depth.ts
|
|
@@ -44009,14 +44169,14 @@ function depthFromAnchor(node, anchorId, byId) {
|
|
|
44009
44169
|
}
|
|
44010
44170
|
return void 0;
|
|
44011
44171
|
}
|
|
44012
|
-
function resolveAxisMaxDepth(nodes,
|
|
44172
|
+
function resolveAxisMaxDepth(nodes, axis2, pointTypes, start, count, anchor) {
|
|
44013
44173
|
if (anchor.length === 0) {
|
|
44014
44174
|
return void 0;
|
|
44015
44175
|
}
|
|
44016
44176
|
const byId = new Map(nodes.map((n3) => [n3.id, n3]));
|
|
44017
44177
|
let max = 0;
|
|
44018
44178
|
for (const anchorPoint of anchor) {
|
|
44019
|
-
const resolved = resolveAxisNodes(nodes,
|
|
44179
|
+
const resolved = resolveAxisNodes(nodes, axis2, pointTypes, start, count, [anchorPoint]);
|
|
44020
44180
|
if (resolved === void 0) {
|
|
44021
44181
|
return void 0;
|
|
44022
44182
|
}
|
|
@@ -44116,11 +44276,11 @@ function evaluateWhen(when, nodeCount, context) {
|
|
|
44116
44276
|
if (threshold === void 0) {
|
|
44117
44277
|
return void 0;
|
|
44118
44278
|
}
|
|
44119
|
-
const
|
|
44120
|
-
if (
|
|
44279
|
+
const axis2 = when.axis;
|
|
44280
|
+
if (axis2 !== void 0 && context.nodes) {
|
|
44121
44281
|
const resolved = resolveAxisCount(
|
|
44122
44282
|
context.nodes,
|
|
44123
|
-
|
|
44283
|
+
axis2,
|
|
44124
44284
|
when.pointTypes,
|
|
44125
44285
|
when.start,
|
|
44126
44286
|
when.count,
|
|
@@ -45127,7 +45287,7 @@ function qualifyingIterators(node) {
|
|
|
45127
45287
|
return nodeIters;
|
|
45128
45288
|
}
|
|
45129
45289
|
const axisIter = list2.find(
|
|
45130
|
-
(each) => each.axis?.some((
|
|
45290
|
+
(each) => each.axis?.some((axis2) => axis2 === "ch" || axis2 === "des" || axis2 === "self")
|
|
45131
45291
|
);
|
|
45132
45292
|
return [axisIter ?? list2[0]];
|
|
45133
45293
|
}
|
|
@@ -47175,8 +47335,8 @@ function positionRange(start, count, step, total) {
|
|
|
47175
47335
|
|
|
47176
47336
|
// diagram/layout/smartart-layout-interpreter-item-role-compound.ts
|
|
47177
47337
|
function compoundChildIds(role, node, childrenOf) {
|
|
47178
|
-
const
|
|
47179
|
-
const chIndex =
|
|
47338
|
+
const axis2 = role.presentationOf?.axis ?? [];
|
|
47339
|
+
const chIndex = axis2.indexOf("ch");
|
|
47180
47340
|
if (chIndex < 0) {
|
|
47181
47341
|
return [];
|
|
47182
47342
|
}
|
|
@@ -47214,8 +47374,8 @@ function isTextRole(node) {
|
|
|
47214
47374
|
function hasAmbiguousTopLevelRoles(topLevelChildren) {
|
|
47215
47375
|
const textRoles = topLevelChildren.filter(isTextRole);
|
|
47216
47376
|
const descendantAxisRoles = textRoles.filter((child6) => {
|
|
47217
|
-
const
|
|
47218
|
-
return
|
|
47377
|
+
const axis2 = child6.presentationOf?.axis?.[0];
|
|
47378
|
+
return axis2 === "ch" || axis2 === "des" || axis2 === "desOrSelf";
|
|
47219
47379
|
});
|
|
47220
47380
|
if (descendantAxisRoles.length >= 2) {
|
|
47221
47381
|
return true;
|
|
@@ -47244,17 +47404,17 @@ function contentIds(role, node, childrenOf) {
|
|
|
47244
47404
|
if (fullAxis && fullAxis.length > 1) {
|
|
47245
47405
|
return fullAxis[0] === "ch" ? compoundChildIds(role, node, childrenOf) : [];
|
|
47246
47406
|
}
|
|
47247
|
-
const
|
|
47248
|
-
if (
|
|
47407
|
+
const axis2 = fullAxis?.[0];
|
|
47408
|
+
if (axis2 === "self") {
|
|
47249
47409
|
return [node.id];
|
|
47250
47410
|
}
|
|
47251
|
-
if (
|
|
47411
|
+
if (axis2 === "ch") {
|
|
47252
47412
|
return (childrenOf.get(node.id) ?? []).filter((child6) => child6.text.trim().length > 0).map((child6) => child6.id);
|
|
47253
47413
|
}
|
|
47254
|
-
if (
|
|
47414
|
+
if (axis2 === "des") {
|
|
47255
47415
|
return descendantIds(node, childrenOf);
|
|
47256
47416
|
}
|
|
47257
|
-
if (
|
|
47417
|
+
if (axis2 === "desOrSelf") {
|
|
47258
47418
|
const ids = descendantIds(node, childrenOf);
|
|
47259
47419
|
return node.text.trim().length > 0 ? [node.id, ...ids] : ids;
|
|
47260
47420
|
}
|
|
@@ -48430,9 +48590,9 @@ function arrangeByChooseAwareSlots(root, flat, box, index, ctx, fontCtx) {
|
|
|
48430
48590
|
// diagram/layout/smartart-layout-interpreter-composite-foreach.ts
|
|
48431
48591
|
function forEachBoundSlots(slotted) {
|
|
48432
48592
|
return slotted.filter((slot2) => {
|
|
48433
|
-
const
|
|
48593
|
+
const axis2 = slot2.node.presentationOf?.axis;
|
|
48434
48594
|
const origin = slot2.node.forEachOrigin?.axis;
|
|
48435
|
-
return
|
|
48595
|
+
return axis2?.length === 1 && (origin?.length ?? 0) > 1 && origin?.[0] === "ch";
|
|
48436
48596
|
});
|
|
48437
48597
|
}
|
|
48438
48598
|
function resolveForEachBoundContent(node, flat, childrenOf) {
|
|
@@ -48596,12 +48756,12 @@ function resolveUserSizeItemBoxPx(wrapper, index, box, sizeBox, declaringRoleCha
|
|
|
48596
48756
|
return void 0;
|
|
48597
48757
|
}
|
|
48598
48758
|
function childAxisSpec(template, childCount) {
|
|
48599
|
-
const
|
|
48600
|
-
if (!
|
|
48759
|
+
const axis2 = template.presentationOf?.axis;
|
|
48760
|
+
if (!axis2 || axis2.length === 0) {
|
|
48601
48761
|
return void 0;
|
|
48602
48762
|
}
|
|
48603
|
-
const fold =
|
|
48604
|
-
const ownIndex =
|
|
48763
|
+
const fold = axis2.includes("des") || axis2.includes("desOrSelf");
|
|
48764
|
+
const ownIndex = axis2.indexOf("ch");
|
|
48605
48765
|
if (ownIndex >= 0) {
|
|
48606
48766
|
const start = template.presentationOf?.start?.[ownIndex] ?? 1;
|
|
48607
48767
|
const count = template.presentationOf?.count?.[ownIndex];
|
|
@@ -48911,8 +49071,8 @@ function renderAnchoredPair(node, index, total, selfSlot, selfLayoutNode, desSlo
|
|
|
48911
49071
|
}
|
|
48912
49072
|
|
|
48913
49073
|
// diagram/layout/smartart-layout-interpreter-composite.ts
|
|
48914
|
-
function slotsWithAxis(slotted,
|
|
48915
|
-
return slotted.filter((slot2) => slot2.node.presentationOf?.axis?.[0] ===
|
|
49074
|
+
function slotsWithAxis(slotted, axis2) {
|
|
49075
|
+
return slotted.filter((slot2) => slot2.node.presentationOf?.axis?.[0] === axis2);
|
|
48916
49076
|
}
|
|
48917
49077
|
function arrangeByPresentationOf(view, slotted, allChildren, nodes, flat, box, absX, absY, childrenOf, ctx, fontCtx, index, presLayoutVars, declaringRoleChain, sizeBox) {
|
|
48918
49078
|
const selfSlots = slotsWithAxis(slotted, "self");
|
|
@@ -49730,12 +49890,12 @@ function resolveSpanWidth(map, t, orgChart) {
|
|
|
49730
49890
|
}
|
|
49731
49891
|
|
|
49732
49892
|
// diagram/hierarchy/smartart-hierarchy-fold-depth.ts
|
|
49733
|
-
function endsInUnboundedDescendantHop(
|
|
49734
|
-
if (!
|
|
49893
|
+
function endsInUnboundedDescendantHop(axis2, count) {
|
|
49894
|
+
if (!axis2 || axis2.length === 0) {
|
|
49735
49895
|
return false;
|
|
49736
49896
|
}
|
|
49737
|
-
const lastIndex =
|
|
49738
|
-
const lastAxis =
|
|
49897
|
+
const lastIndex = axis2.length - 1;
|
|
49898
|
+
const lastAxis = axis2[lastIndex];
|
|
49739
49899
|
if (lastAxis !== "des" && lastAxis !== "desOrSelf") {
|
|
49740
49900
|
return false;
|
|
49741
49901
|
}
|
|
@@ -66118,9 +66278,9 @@ function alignElements(elements3, edge, options2) {
|
|
|
66118
66278
|
}
|
|
66119
66279
|
return result;
|
|
66120
66280
|
}
|
|
66121
|
-
function distributeElements(elements3,
|
|
66281
|
+
function distributeElements(elements3, axis2, options2) {
|
|
66122
66282
|
const result = /* @__PURE__ */ new Map();
|
|
66123
|
-
const horizontal =
|
|
66283
|
+
const horizontal = axis2 === "horizontal";
|
|
66124
66284
|
const start = (e) => horizontal ? e.x : e.y;
|
|
66125
66285
|
const size = (e) => horizontal ? e.width : e.height;
|
|
66126
66286
|
const sorted = [...elements3].sort((a2, b) => start(a2) - start(b));
|
|
@@ -68841,21 +69001,21 @@ function fraction(node, style, ctx) {
|
|
|
68841
69001
|
return row([num2, slash, den]);
|
|
68842
69002
|
}
|
|
68843
69003
|
const gap = style.size * 0.15;
|
|
68844
|
-
const
|
|
69004
|
+
const axis2 = style.size * AXIS3;
|
|
68845
69005
|
const width = Math.max(num2.width, den.width) + style.size * 0.2;
|
|
68846
69006
|
const bar = type === "noBar" ? [] : [
|
|
68847
69007
|
{
|
|
68848
69008
|
kind: "line",
|
|
68849
69009
|
x1: 0,
|
|
68850
69010
|
x2: width,
|
|
68851
|
-
y1: -
|
|
68852
|
-
y2: -
|
|
69011
|
+
y1: -axis2,
|
|
69012
|
+
y2: -axis2,
|
|
68853
69013
|
width: Math.max(0.8, style.size * 0.05)
|
|
68854
69014
|
}
|
|
68855
69015
|
];
|
|
68856
69016
|
const box = overlay([
|
|
68857
|
-
{ box: num2, x: (width - num2.width) / 2, y: -(
|
|
68858
|
-
{ box: den, x: (width - den.width) / 2, y: -
|
|
69017
|
+
{ box: num2, x: (width - num2.width) / 2, y: -(axis2 + gap + num2.descent) },
|
|
69018
|
+
{ box: den, x: (width - den.width) / 2, y: -axis2 + gap + den.ascent }
|
|
68859
69019
|
]);
|
|
68860
69020
|
box.width = width;
|
|
68861
69021
|
box.prims.push(...bar);
|