ooxml-core 1.45.0 → 1.47.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-JX62VKU4.cjs +14 -0
- package/dist/{PptxHandler-FXLXIOLT.mjs → PptxHandler-NXHZ6ITL.mjs} +2 -2
- package/dist/PptxHandler-SUGLNSZI.mjs +5 -0
- package/dist/{PresentationBuilder-CSKLG64K.cjs → PresentationBuilder-IK6NIK6T.cjs} +6 -6
- package/dist/{PresentationBuilder-DDYHRV26.mjs → PresentationBuilder-LHQ333UL.mjs} +3 -3
- package/dist/{PresentationBuilder-3FKFRSSV.mjs → PresentationBuilder-URSPID7L.mjs} +2 -2
- package/dist/automation/index.cjs +12 -7
- package/dist/automation/index.mjs +12 -7
- 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 +414 -263
- package/dist/chart/index.mjs +412 -264
- package/dist/{chunk-YBSNMVSN.cjs → chunk-4GPLQEEC.cjs} +1604 -1324
- package/dist/{chunk-U5BXJQZG.mjs → chunk-553WFEHD.mjs} +332 -53
- package/dist/{chunk-RVYGAYCP.mjs → chunk-5HNRZOBX.mjs} +1 -1
- package/dist/{chunk-VKFKEVHK.mjs → chunk-6MU4WKHS.mjs} +1 -1
- package/dist/{chunk-GXYK3H4O.mjs → chunk-7L6ZAA5Y.mjs} +82 -17
- package/dist/{chunk-3J6VIKLP.cjs → chunk-APCA7N6Q.cjs} +3 -3
- package/dist/{chunk-IPV3J3I5.mjs → chunk-DEDK2J57.mjs} +68 -1
- package/dist/{chunk-7T3SJQA6.cjs → chunk-E5TGYYKO.cjs} +1 -0
- package/dist/{chunk-R7NS42KQ.mjs → chunk-FKU2Z6ZB.mjs} +1 -1
- package/dist/{chunk-GGJUWJXB.mjs → chunk-QHR726W3.mjs} +1 -1
- package/dist/{chunk-XTUX5RMG.cjs → chunk-T4BVZTII.cjs} +9 -9
- package/dist/{chunk-QZPOPUI5.cjs → chunk-WFN6ZU7N.cjs} +69 -0
- package/dist/{chunk-LCXBTJXE.mjs → chunk-XVEJS7HN.mjs} +5 -5
- package/dist/{chunk-CVJX6NNO.mjs → chunk-Z734BYYR.mjs} +334 -54
- 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 +484 -333
- package/dist/index.mjs +484 -333
- package/dist/pptx/automation/index.cjs +2207 -1825
- package/dist/pptx/automation/index.d.ts +4 -4
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{index-6Ot1b-4U.d.ts → index--HBUyILF.d.ts} +5 -5
- package/dist/pptx/chunks/{index-6Ot1b-4U.d.ts.map → index--HBUyILF.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-DGKI80Hj.d.ts → index-BDVzSboe.d.ts} +71 -7
- package/dist/pptx/chunks/{index-DGKI80Hj.d.ts.map → index-BDVzSboe.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-jdZUtLGB.d.ts → index-Dr3iIPt9.d.ts} +3 -3
- package/dist/pptx/chunks/{index-jdZUtLGB.d.ts.map → index-Dr3iIPt9.d.ts.map} +1 -1
- package/dist/pptx/chunks/{text-operations-Mek86RBL.d.ts → text-operations-CVHXOSit.d.ts} +18 -3
- package/dist/pptx/chunks/{text-operations-Mek86RBL.d.ts.map → text-operations-CVHXOSit.d.ts.map} +1 -1
- package/dist/pptx/cli/index.cjs +608 -226
- 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/index.cjs +2605 -2226
- package/dist/pptx/index.d.ts +5 -5
- package/dist/pptx/index.mjs +5 -5
- package/dist/pptx/node/index.d.ts +1 -1
- package/dist/xlsx/index.cjs +12 -7
- package/dist/xlsx/index.mjs +12 -7
- package/dist/xlsx/ui/index.cjs +12 -7
- package/dist/xlsx/ui/index.mjs +12 -7
- package/package.json +1 -1
- package/dist/PptxHandler-3RDVJFQV.cjs +0 -14
- package/dist/PptxHandler-EI6DMHPM.mjs +0 -5
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
|
|
|
@@ -19423,10 +19426,10 @@ function chartTargetDraftShapes(draft, target) {
|
|
|
19423
19426
|
return [chartAxisAt(draft, { index: target.axisIndex }).spPr ??= {}];
|
|
19424
19427
|
case "majorGridlines":
|
|
19425
19428
|
case "minorGridlines": {
|
|
19426
|
-
const
|
|
19429
|
+
const axis2 = chartAxisAt(draft, { index: target.axisIndex });
|
|
19427
19430
|
const major = target.kind === "majorGridlines";
|
|
19428
|
-
|
|
19429
|
-
return [
|
|
19431
|
+
axis2[major ? "majorGridlines" : "minorGridlines"] = true;
|
|
19432
|
+
return [axis2[major ? "majorGridlinesSpPr" : "minorGridlinesSpPr"] ??= {}];
|
|
19430
19433
|
}
|
|
19431
19434
|
case "dataLabels": {
|
|
19432
19435
|
if (target.seriesIndex === void 0) {
|
|
@@ -20756,9 +20759,9 @@ var CATEGORY_ONLY = [
|
|
|
20756
20759
|
"minorTimeUnit"
|
|
20757
20760
|
];
|
|
20758
20761
|
var VALUE_ONLY = ["crossBetween", "displayUnits"];
|
|
20759
|
-
function convertChartAxis(
|
|
20760
|
-
if (
|
|
20761
|
-
const next = structuredClone(
|
|
20762
|
+
function convertChartAxis(axis2, kind) {
|
|
20763
|
+
if (axis2.kind === kind) return axis2;
|
|
20764
|
+
const next = structuredClone(axis2);
|
|
20762
20765
|
next.kind = kind;
|
|
20763
20766
|
if (kind === "val") {
|
|
20764
20767
|
for (const key of CATEGORY_ONLY) delete next[key];
|
|
@@ -20791,7 +20794,7 @@ var SWITCHABLE = {
|
|
|
20791
20794
|
stock: false,
|
|
20792
20795
|
surface: true
|
|
20793
20796
|
};
|
|
20794
|
-
function
|
|
20797
|
+
function chartGroupElement(kind, is3D) {
|
|
20795
20798
|
const match = Object.entries(CHART_GROUP_ELEMENTS).find(
|
|
20796
20799
|
([, value]) => value.kind === kind && value.is3D === is3D
|
|
20797
20800
|
);
|
|
@@ -20807,7 +20810,7 @@ function groupingFor(element4, grouping) {
|
|
|
20807
20810
|
var horizontalBars = (group2) => group2.kind === "bar" && group2.barDirection === "bar";
|
|
20808
20811
|
function newGroup(base, target, series2) {
|
|
20809
20812
|
const is3D = target.is3D ?? (base.is3D && SWITCHABLE[target.kind] === true);
|
|
20810
|
-
const element4 =
|
|
20813
|
+
const element4 = chartGroupElement(target.kind, is3D);
|
|
20811
20814
|
const group2 = { kind: target.kind, element: element4, is3D, series: series2, axisIds: [] };
|
|
20812
20815
|
const allowed = GROUP_FIELDS[element4] ?? [];
|
|
20813
20816
|
for (const key of allowed)
|
|
@@ -20833,11 +20836,11 @@ function newGroup(base, target, series2) {
|
|
|
20833
20836
|
return group2;
|
|
20834
20837
|
}
|
|
20835
20838
|
function withSeriesAxis(space3, group2, axes) {
|
|
20836
|
-
if ((group2.element === "line3DChart" || group2.kind === "surface") && !axes.some((
|
|
20839
|
+
if ((group2.element === "line3DChart" || group2.kind === "surface") && !axes.some((axis2) => axis2.kind === "ser")) {
|
|
20837
20840
|
const id = Math.max(
|
|
20838
20841
|
0,
|
|
20839
20842
|
...[...space3.plotArea.axes, ...axes].flatMap(
|
|
20840
|
-
(
|
|
20843
|
+
(axis2) => axis2.id === void 0 ? [] : [axis2.id]
|
|
20841
20844
|
)
|
|
20842
20845
|
) + 1;
|
|
20843
20846
|
axes.push({
|
|
@@ -20857,11 +20860,11 @@ function withSeriesAxis(space3, group2, axes) {
|
|
|
20857
20860
|
function groupAxes(space3, base, group2) {
|
|
20858
20861
|
if (!groupHasAxes(group2.element)) return [];
|
|
20859
20862
|
const xy = isXYChartKind(group2.kind);
|
|
20860
|
-
const byId = (id) => space3.plotArea.axes.find((
|
|
20861
|
-
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);
|
|
20862
20865
|
if (old.length < 2) {
|
|
20863
20866
|
const taken = new Set(
|
|
20864
|
-
space3.plotArea.axes.flatMap((
|
|
20867
|
+
space3.plotArea.axes.flatMap((axis2) => axis2.id === void 0 ? [] : [axis2.id])
|
|
20865
20868
|
);
|
|
20866
20869
|
const free = DEFAULT_CHART_AXIS_IDS.every((id) => !taken.has(id));
|
|
20867
20870
|
const top = Math.max(0, ...taken);
|
|
@@ -20869,9 +20872,9 @@ function groupAxes(space3, base, group2) {
|
|
|
20869
20872
|
return withSeriesAxis(space3, group2, defaultChartAxes(horizontalBars(group2), xy, ids));
|
|
20870
20873
|
}
|
|
20871
20874
|
const rotate = horizontalBars(base) !== horizontalBars(group2);
|
|
20872
|
-
const axes = old.slice(0, group2.element === "line3DChart" || group2.is3D ? 3 : 2).map((
|
|
20873
|
-
const kind = i2 === 0 ? xy ? "val" :
|
|
20874
|
-
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);
|
|
20875
20878
|
if (rotate) assignOrDelete(next, "position", rotatedAxisPosition(next.position));
|
|
20876
20879
|
if (i2 === 1 && next.kind === "val" && xy !== isXYChartKind(base.kind))
|
|
20877
20880
|
next.crossBetween = xy ? "midCat" : "between";
|
|
@@ -20896,7 +20899,7 @@ function setChartType(space3, target) {
|
|
|
20896
20899
|
if (group2.is3D && target.kind === "bar" && group2.grouping === "standard" && base.axisIds.length < 3)
|
|
20897
20900
|
group2.grouping = "clustered";
|
|
20898
20901
|
const axes = groupAxes(draft, base, group2);
|
|
20899
|
-
group2.axisIds = axes.flatMap((
|
|
20902
|
+
group2.axisIds = axes.flatMap((axis2) => axis2.id === void 0 ? [] : [axis2.id]);
|
|
20900
20903
|
draft.plotArea.groups = [group2];
|
|
20901
20904
|
draft.plotArea.axes = axes;
|
|
20902
20905
|
if (!group2.is3D) {
|
|
@@ -21032,15 +21035,15 @@ function chartSupportsQuickLayout(space3) {
|
|
|
21032
21035
|
return !!group2 && CHART_QUICK_LAYOUT_KINDS.has(group2.kind);
|
|
21033
21036
|
}
|
|
21034
21037
|
function applyAxes(draft, layout) {
|
|
21035
|
-
for (const
|
|
21036
|
-
const value =
|
|
21037
|
-
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;
|
|
21038
21041
|
const titled = value ? layout.valAxisTitle : layout.catAxisTitle;
|
|
21039
|
-
if (!titled) delete
|
|
21040
|
-
else
|
|
21041
|
-
|
|
21042
|
-
|
|
21043
|
-
|
|
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;
|
|
21044
21047
|
}
|
|
21045
21048
|
}
|
|
21046
21049
|
function applyDataTable(draft, layout) {
|
|
@@ -21091,8 +21094,8 @@ function applyChartQuickLayout(space3, n3, only = ALL_PARTS) {
|
|
|
21091
21094
|
}
|
|
21092
21095
|
function matches(space3, layout) {
|
|
21093
21096
|
const axes = space3.plotArea.axes;
|
|
21094
|
-
const val2 = axes.find((
|
|
21095
|
-
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");
|
|
21096
21099
|
const bar = space3.plotArea.groups.find((group2) => group2.kind === "bar");
|
|
21097
21100
|
const labels2 = space3.plotArea.groups.some(
|
|
21098
21101
|
(group2) => group2.dataLabels && group2.dataLabels.deleted !== true && group2.dataLabels.showValue
|
|
@@ -21150,6 +21153,12 @@ var RANGES = {
|
|
|
21150
21153
|
firstSliceAngle: [0, 360],
|
|
21151
21154
|
holeSize: [1, 90]
|
|
21152
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
|
+
}
|
|
21153
21162
|
function setChartGroupOptions(space3, seriesIndex, edit) {
|
|
21154
21163
|
return editChartSpace(space3, (draft) => {
|
|
21155
21164
|
const { group: group2 } = chartSeriesEntryAt(draft, seriesIndex);
|
|
@@ -21162,9 +21171,7 @@ function setChartGroupOptions(space3, seriesIndex, edit) {
|
|
|
21162
21171
|
delete group2[key];
|
|
21163
21172
|
continue;
|
|
21164
21173
|
}
|
|
21165
|
-
|
|
21166
|
-
if (!Number.isInteger(value) || value < min || value > max)
|
|
21167
|
-
throw new RangeError(`Chart ${key} must be a whole number from ${min} to ${max}`);
|
|
21174
|
+
assertChartGroupOption(key, value);
|
|
21168
21175
|
group2[key] = value;
|
|
21169
21176
|
}
|
|
21170
21177
|
});
|
|
@@ -21497,9 +21504,9 @@ function setChartView3D(space3, edit) {
|
|
|
21497
21504
|
|
|
21498
21505
|
// chart/edit/secondary-axis.ts
|
|
21499
21506
|
function axisPair(space3, group2) {
|
|
21500
|
-
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)
|
|
21501
21508
|
return void 0;
|
|
21502
|
-
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));
|
|
21503
21510
|
return x && y && ["cat", "date"].includes(x.kind) && y.kind === "val" && x.crossAxisId === y.id && y.crossAxisId === x.id ? [x, y] : void 0;
|
|
21504
21511
|
}
|
|
21505
21512
|
function chartSeriesSecondaryAxisSupported(space3, seriesIndex) {
|
|
@@ -21528,7 +21535,7 @@ function isolateSeries(space3, index) {
|
|
|
21528
21535
|
space3.plotArea.groups.splice(groupIndex, 1, ...segments);
|
|
21529
21536
|
return chartSeriesEntryAt(space3, index).group;
|
|
21530
21537
|
}
|
|
21531
|
-
function setChartSeriesSecondaryAxis(space3, seriesIndex, secondary) {
|
|
21538
|
+
function setChartSeriesSecondaryAxis(space3, seriesIndex, secondary, options2 = {}) {
|
|
21532
21539
|
if (!chartSeriesSecondaryAxisSupported(space3, seriesIndex))
|
|
21533
21540
|
throw new RangeError(
|
|
21534
21541
|
"Secondary-axis editing needs a later series in a supported vertical 2D chart"
|
|
@@ -21542,12 +21549,12 @@ function setChartSeriesSecondaryAxis(space3, seriesIndex, secondary) {
|
|
|
21542
21549
|
return;
|
|
21543
21550
|
}
|
|
21544
21551
|
if (group2.axisIds[1] !== primary.axisIds[1]) return;
|
|
21545
|
-
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]);
|
|
21546
21553
|
if (existing) {
|
|
21547
|
-
group2.axisIds = existing.map((
|
|
21554
|
+
group2.axisIds = existing.map((axis2) => axis2.id);
|
|
21548
21555
|
return;
|
|
21549
21556
|
}
|
|
21550
|
-
const used = new Set(draft.plotArea.axes.map((
|
|
21557
|
+
const used = new Set(draft.plotArea.axes.map((axis2) => axis2.id));
|
|
21551
21558
|
const allocate = () => {
|
|
21552
21559
|
let id = 500000003;
|
|
21553
21560
|
while (used.has(id)) id++;
|
|
@@ -21555,7 +21562,9 @@ function setChartSeriesSecondaryAxis(space3, seriesIndex, secondary) {
|
|
|
21555
21562
|
used.add(id);
|
|
21556
21563
|
return id;
|
|
21557
21564
|
};
|
|
21558
|
-
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");
|
|
21559
21568
|
const horizontal = primary.barDirection === "bar";
|
|
21560
21569
|
const axes = defaultChartAxes(horizontal, false, ids);
|
|
21561
21570
|
axes[0] = { ...structuredClone(axisPair(draft, primary)[0]), id: ids[0], crossAxisId: ids[1] };
|
|
@@ -21701,6 +21710,58 @@ function applyChartSpaceDataSheetEdits(space3, edits) {
|
|
|
21701
21710
|
return editChartSpace(next, (draft) => applyStandardChartLayout(draft, layoutSheet, count));
|
|
21702
21711
|
}
|
|
21703
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
|
+
|
|
21704
21765
|
// chart/edit/new-chart.ts
|
|
21705
21766
|
var DEFAULT_CHART_DATA_SHEET = {
|
|
21706
21767
|
categories: ["Category 1", "Category 2", "Category 3", "Category 4"],
|
|
@@ -21710,21 +21771,84 @@ var DEFAULT_CHART_DATA_SHEET = {
|
|
|
21710
21771
|
{ name: "Series 3", values: [2, 2, 3, 5] }
|
|
21711
21772
|
]
|
|
21712
21773
|
};
|
|
21713
|
-
|
|
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) {
|
|
21714
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
|
+
};
|
|
21715
21800
|
const formulas = standardChartFormulas(sheetName, index, sheet.categories.length);
|
|
21716
21801
|
return {
|
|
21717
21802
|
index,
|
|
21718
21803
|
order: index,
|
|
21719
21804
|
tx: { reference: categorySource([entry3.name], void 0, formulas.name), text: entry3.name },
|
|
21720
|
-
invertIfNegative: false,
|
|
21805
|
+
...options2.profile === "minimal" ? {} : { invertIfNegative: false },
|
|
21721
21806
|
dataPoints: [],
|
|
21722
21807
|
categories: categorySource(sheet.categories, void 0, formulas.categories),
|
|
21723
21808
|
values: numberSource(entry3.values, void 0, formulas.values)
|
|
21724
21809
|
};
|
|
21725
21810
|
}
|
|
21726
|
-
function
|
|
21727
|
-
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) {
|
|
21728
21852
|
const group2 = {
|
|
21729
21853
|
kind: "bar",
|
|
21730
21854
|
element: "barChart",
|
|
@@ -21734,10 +21858,10 @@ function newChartSpace(sheet = DEFAULT_CHART_DATA_SHEET, target, options2 = {})
|
|
|
21734
21858
|
varyColors: false,
|
|
21735
21859
|
gapWidth: 219,
|
|
21736
21860
|
overlap: -27,
|
|
21737
|
-
series: sheet.series.map((_, index) => series(sheet, index, sheetName)),
|
|
21861
|
+
series: sheet.series.map((_, index) => series(sheet, index, options2, sheetName)),
|
|
21738
21862
|
axisIds: [...DEFAULT_CHART_AXIS_IDS]
|
|
21739
21863
|
};
|
|
21740
|
-
|
|
21864
|
+
const space3 = {
|
|
21741
21865
|
roundedCorners: false,
|
|
21742
21866
|
autoTitleDeleted: options2.title === void 0,
|
|
21743
21867
|
plotArea: { layout: {}, groups: [group2], axes: defaultChartAxes(false, false) },
|
|
@@ -21746,9 +21870,36 @@ function newChartSpace(sheet = DEFAULT_CHART_DATA_SHEET, target, options2 = {})
|
|
|
21746
21870
|
};
|
|
21747
21871
|
const column = !target || target.kind === "bar" && (target.barDirection ?? "col") === "col";
|
|
21748
21872
|
if (target && !(column && !target.is3D && (target.grouping ?? "clustered") === "clustered"))
|
|
21749
|
-
|
|
21750
|
-
|
|
21751
|
-
|
|
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 });
|
|
21752
21903
|
}
|
|
21753
21904
|
|
|
21754
21905
|
// chart/edit/apply-appearance.ts
|
|
@@ -21876,21 +22027,21 @@ function chartExStyleSpace(space3) {
|
|
|
21876
22027
|
} : {},
|
|
21877
22028
|
plotArea: {
|
|
21878
22029
|
...styles(space3.plotArea),
|
|
21879
|
-
axes: space3.plotArea.axes.map((
|
|
21880
|
-
kind:
|
|
22030
|
+
axes: space3.plotArea.axes.map((axis2) => ({
|
|
22031
|
+
kind: axis2.scaling?.kind ?? "val",
|
|
21881
22032
|
scaling: {},
|
|
21882
|
-
...styles(
|
|
21883
|
-
...
|
|
22033
|
+
...styles(axis2),
|
|
22034
|
+
...axis2.title ? {
|
|
21884
22035
|
title: {
|
|
21885
|
-
...styles(
|
|
21886
|
-
...
|
|
22036
|
+
...styles(axis2.title),
|
|
22037
|
+
...axis2.title.tx?.rich ? { tx: { rich: axis2.title.tx.rich, text: axis2.title.tx.rich.text } } : {}
|
|
21887
22038
|
}
|
|
21888
22039
|
} : {},
|
|
21889
|
-
...
|
|
21890
|
-
majorGridlines: !!
|
|
21891
|
-
minorGridlines: !!
|
|
21892
|
-
...
|
|
21893
|
-
...
|
|
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 } : {}
|
|
21894
22045
|
})),
|
|
21895
22046
|
groups: space3.plotArea.series.map((series2) => ({
|
|
21896
22047
|
kind: "bar",
|
|
@@ -21926,19 +22077,19 @@ function editChartExStyle(space3, operation) {
|
|
|
21926
22077
|
if (after.title.tx?.rich) draft.title.tx = { ...draft.title.tx, rich: after.title.tx.rich };
|
|
21927
22078
|
}
|
|
21928
22079
|
if (draft.legend && after.legend) copyStyle(draft.legend, after.legend);
|
|
21929
|
-
draft.plotArea.axes.forEach((
|
|
22080
|
+
draft.plotArea.axes.forEach((axis2, index) => {
|
|
21930
22081
|
const edited = after.plotArea.axes[index];
|
|
21931
22082
|
if (!edited) return;
|
|
21932
|
-
copyStyle(
|
|
21933
|
-
if (
|
|
21934
|
-
copyStyle(
|
|
21935
|
-
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 };
|
|
21936
22087
|
}
|
|
21937
22088
|
for (const key of ["majorGridlines", "minorGridlines"]) {
|
|
21938
22089
|
const shape = edited[key === "majorGridlines" ? "majorGridlinesSpPr" : "minorGridlinesSpPr"];
|
|
21939
22090
|
if (shape) {
|
|
21940
|
-
|
|
21941
|
-
|
|
22091
|
+
axis2[key] ??= {};
|
|
22092
|
+
axis2[key].spPr = structuredClone(shape);
|
|
21942
22093
|
}
|
|
21943
22094
|
}
|
|
21944
22095
|
});
|
|
@@ -21983,10 +22134,10 @@ function shapes(space3, target) {
|
|
|
21983
22134
|
case "axis":
|
|
21984
22135
|
case "majorGridlines":
|
|
21985
22136
|
case "minorGridlines": {
|
|
21986
|
-
const
|
|
21987
|
-
if (!
|
|
21988
|
-
if (target.kind === "axis") return [
|
|
21989
|
-
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 ??= {}];
|
|
21990
22141
|
}
|
|
21991
22142
|
case "dataLabels": {
|
|
21992
22143
|
const series2 = target.seriesIndex === void 0 ? space3.plotArea.series : [chartExSeriesAt(space3, target.seriesIndex)];
|
|
@@ -22076,25 +22227,25 @@ function editChartExAxis(space3, index, edit) {
|
|
|
22076
22227
|
throw new RangeError("Invalid ChartEx axis scaling.");
|
|
22077
22228
|
}
|
|
22078
22229
|
return editChartExSpace(space3, (draft) => {
|
|
22079
|
-
const
|
|
22230
|
+
const axis2 = chartExAxisAt(draft, index);
|
|
22080
22231
|
for (const key of ["min", "max", "majorUnit", "minorUnit"])
|
|
22081
22232
|
if (edit[key] !== void 0) {
|
|
22082
|
-
if (
|
|
22233
|
+
if (axis2.scaling?.kind !== "val")
|
|
22083
22234
|
throw new RangeError("Only a value axis supports numeric scaling.");
|
|
22084
|
-
if (edit[key] === null) delete
|
|
22085
|
-
else
|
|
22235
|
+
if (edit[key] === null) delete axis2.scaling[key];
|
|
22236
|
+
else axis2.scaling[key] = edit[key];
|
|
22086
22237
|
}
|
|
22087
|
-
if (
|
|
22238
|
+
if (axis2.scaling?.kind === "val" && typeof axis2.scaling.min === "number" && typeof axis2.scaling.max === "number" && axis2.scaling.min >= axis2.scaling.max)
|
|
22088
22239
|
throw new RangeError("Axis maximum must exceed its minimum.");
|
|
22089
|
-
if (edit.visible !== void 0)
|
|
22240
|
+
if (edit.visible !== void 0) axis2.hidden = !edit.visible;
|
|
22090
22241
|
if (edit.tickLabels !== void 0) {
|
|
22091
|
-
if (edit.tickLabels)
|
|
22092
|
-
else delete
|
|
22242
|
+
if (edit.tickLabels) axis2.tickLabels ??= {};
|
|
22243
|
+
else delete axis2.tickLabels;
|
|
22093
22244
|
}
|
|
22094
22245
|
for (const key of ["majorGridlines", "minorGridlines"])
|
|
22095
22246
|
if (edit[key] !== void 0) {
|
|
22096
|
-
if (edit[key])
|
|
22097
|
-
else delete
|
|
22247
|
+
if (edit[key]) axis2[key] ??= {};
|
|
22248
|
+
else delete axis2[key];
|
|
22098
22249
|
}
|
|
22099
22250
|
for (const [key, target] of [
|
|
22100
22251
|
["majorTickMark", "majorTickMarks"],
|
|
@@ -22102,28 +22253,28 @@ function editChartExAxis(space3, index, edit) {
|
|
|
22102
22253
|
])
|
|
22103
22254
|
if (edit[key] !== void 0) {
|
|
22104
22255
|
const value = edit[key];
|
|
22105
|
-
if (value === null) delete
|
|
22256
|
+
if (value === null) delete axis2[target];
|
|
22106
22257
|
else {
|
|
22107
22258
|
if (!["in", "out", "cross", "none"].includes(value))
|
|
22108
22259
|
throw new RangeError("Invalid tick mark.");
|
|
22109
|
-
|
|
22260
|
+
axis2[target] = { type: value };
|
|
22110
22261
|
}
|
|
22111
22262
|
}
|
|
22112
22263
|
if (edit.title !== void 0) {
|
|
22113
22264
|
const { title: _chartTitle, ...base } = draft;
|
|
22114
22265
|
const title = setChartExTitle(
|
|
22115
|
-
{ ...base, ...
|
|
22266
|
+
{ ...base, ...axis2.title ? { title: axis2.title } : {} },
|
|
22116
22267
|
edit.title ?? void 0
|
|
22117
22268
|
).title;
|
|
22118
|
-
if (title)
|
|
22119
|
-
else delete
|
|
22269
|
+
if (title) axis2.title = title;
|
|
22270
|
+
else delete axis2.title;
|
|
22120
22271
|
}
|
|
22121
22272
|
if (edit.numberFormat !== void 0) {
|
|
22122
|
-
if (edit.numberFormat === null) delete
|
|
22123
|
-
else
|
|
22273
|
+
if (edit.numberFormat === null) delete axis2.numberFormat;
|
|
22274
|
+
else axis2.numberFormat = structuredClone(edit.numberFormat);
|
|
22124
22275
|
}
|
|
22125
22276
|
if (edit.units !== void 0) {
|
|
22126
|
-
if (edit.units === null) delete
|
|
22277
|
+
if (edit.units === null) delete axis2.units;
|
|
22127
22278
|
else {
|
|
22128
22279
|
if (![
|
|
22129
22280
|
"hundreds",
|
|
@@ -22138,7 +22289,7 @@ function editChartExAxis(space3, index, edit) {
|
|
|
22138
22289
|
"percentage"
|
|
22139
22290
|
].includes(edit.units))
|
|
22140
22291
|
throw new RangeError("Unsupported ChartEx display units.");
|
|
22141
|
-
|
|
22292
|
+
axis2.units = { ...axis2.units, unit: edit.units };
|
|
22142
22293
|
}
|
|
22143
22294
|
}
|
|
22144
22295
|
});
|
|
@@ -22234,9 +22385,9 @@ function applyChartExEditAction(space3, action) {
|
|
|
22234
22385
|
return setChartExAxis(space3, action.axisIndex, action.edit);
|
|
22235
22386
|
case "tickLabels":
|
|
22236
22387
|
return editChartExSpace(space3, (draft) => {
|
|
22237
|
-
const
|
|
22238
|
-
if (action.visible)
|
|
22239
|
-
else delete
|
|
22388
|
+
const axis2 = chartExAxisAt(draft, action.axisIndex);
|
|
22389
|
+
if (action.visible) axis2.tickLabels ??= {};
|
|
22390
|
+
else delete axis2.tickLabels;
|
|
22240
22391
|
});
|
|
22241
22392
|
case "pointLabel":
|
|
22242
22393
|
return setChartExPointLabel(space3, action.seriesIndex, action.pointIndex, action.label);
|
|
@@ -22533,15 +22684,15 @@ function setChartSeriesAxis(space3, seriesIndex, valueAxisId2) {
|
|
|
22533
22684
|
const { group: group2 } = chartSeriesEntryAt(space3, seriesIndex);
|
|
22534
22685
|
if (group2.is3D || !["bar", "line", "area", "scatter", "bubble"].includes(group2.kind))
|
|
22535
22686
|
throw new RangeError("This chart family has no editable axis pair");
|
|
22536
|
-
if (new Set(space3.plotArea.axes.map((
|
|
22687
|
+
if (new Set(space3.plotArea.axes.map((axis2) => axis2.id)).size !== space3.plotArea.axes.length)
|
|
22537
22688
|
throw new RangeError("Ambiguous chart axis ids");
|
|
22538
22689
|
const horizontal = group2.kind === "bar" && group2.barDirection === "bar";
|
|
22539
22690
|
const candidates = space3.plotArea.axes.filter(
|
|
22540
|
-
(
|
|
22691
|
+
(axis2) => axis2.kind === "val" && (valueAxisId2 === null ? axis2.position === (horizontal ? "b" : "l") : axis2.id === valueAxisId2)
|
|
22541
22692
|
);
|
|
22542
22693
|
if (candidates.length !== 1) throw new RangeError("No unique existing value axis");
|
|
22543
22694
|
const value = candidates[0];
|
|
22544
|
-
const category = space3.plotArea.axes.find((
|
|
22695
|
+
const category = space3.plotArea.axes.find((axis2) => axis2.id === value.crossAxisId);
|
|
22545
22696
|
const xy = group2.kind === "scatter" || group2.kind === "bubble";
|
|
22546
22697
|
if (value.id === void 0 || category?.id === void 0 || category.crossAxisId !== value.id || (xy ? category.kind !== "val" : !["cat", "date"].includes(category.kind)))
|
|
22547
22698
|
throw new RangeError("Axis references do not form a coherent pair");
|
|
@@ -22574,7 +22725,7 @@ function setChartSeriesType(space3, index, target) {
|
|
|
22574
22725
|
return structuredClone(space3);
|
|
22575
22726
|
if (group2.is3D || target.is3D || !["bar", "line", "area"].includes(group2.kind) || !["bar", "line", "area"].includes(target.kind) || group2.barDirection === "bar" || target.barDirection === "bar")
|
|
22576
22727
|
throw new RangeError("Series combo types need vertical 2D column, line or area families");
|
|
22577
|
-
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));
|
|
22578
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)
|
|
22579
22730
|
throw new RangeError("Combo types need a coherent category/value axis pair");
|
|
22580
22731
|
if (group2.series.length > 1 && group2.extLst)
|
|
@@ -22645,14 +22796,14 @@ function setChartGroupDecorations(space3, edit) {
|
|
|
22645
22796
|
// chart/edit/axis-label.ts
|
|
22646
22797
|
function setChartDisplayUnitsLabel(space3, target, edit) {
|
|
22647
22798
|
return editChartSpace(space3, (draft) => {
|
|
22648
|
-
const
|
|
22649
|
-
if (
|
|
22799
|
+
const axis2 = chartAxisAt(draft, target);
|
|
22800
|
+
if (axis2.kind !== "val") throw new RangeError("Only a value axis has a display-units label");
|
|
22650
22801
|
if (edit === null) {
|
|
22651
|
-
if (
|
|
22802
|
+
if (axis2.displayUnits) delete axis2.displayUnits.label;
|
|
22652
22803
|
return;
|
|
22653
22804
|
}
|
|
22654
|
-
|
|
22655
|
-
const label =
|
|
22805
|
+
axis2.displayUnits ??= {};
|
|
22806
|
+
const label = axis2.displayUnits.label ??= {};
|
|
22656
22807
|
if (edit.text === null) delete label.tx;
|
|
22657
22808
|
else if (edit.text !== void 0)
|
|
22658
22809
|
assignOrDelete(
|
|
@@ -28154,8 +28305,8 @@ function documentOrder(point) {
|
|
|
28154
28305
|
descendants3(all[0], all);
|
|
28155
28306
|
return all;
|
|
28156
28307
|
}
|
|
28157
|
-
function axisPoints(point,
|
|
28158
|
-
switch (
|
|
28308
|
+
function axisPoints(point, axis2) {
|
|
28309
|
+
switch (axis2) {
|
|
28159
28310
|
case "self":
|
|
28160
28311
|
return [point];
|
|
28161
28312
|
case "ch":
|
|
@@ -28174,7 +28325,7 @@ function axisPoints(point, axis) {
|
|
|
28174
28325
|
return point.parent ? [point.parent] : [];
|
|
28175
28326
|
case "ancst":
|
|
28176
28327
|
case "ancstOrSelf": {
|
|
28177
|
-
const out =
|
|
28328
|
+
const out = axis2 === "ancstOrSelf" ? [point] : [];
|
|
28178
28329
|
let current = point.parent;
|
|
28179
28330
|
while (current) {
|
|
28180
28331
|
out.push(current);
|
|
@@ -28189,13 +28340,13 @@ function axisPoints(point, axis) {
|
|
|
28189
28340
|
if (index < 0) {
|
|
28190
28341
|
return [];
|
|
28191
28342
|
}
|
|
28192
|
-
return
|
|
28343
|
+
return axis2 === "followSib" ? siblings.slice(index + 1) : siblings.slice(0, index);
|
|
28193
28344
|
}
|
|
28194
28345
|
case "follow":
|
|
28195
28346
|
case "preced": {
|
|
28196
28347
|
const all = documentOrder(point);
|
|
28197
28348
|
const index = all.indexOf(point);
|
|
28198
|
-
return
|
|
28349
|
+
return axis2 === "follow" ? all.slice(index + 1) : all.slice(0, index);
|
|
28199
28350
|
}
|
|
28200
28351
|
case "root":
|
|
28201
28352
|
return [rootOf2(point)];
|
|
@@ -28267,10 +28418,10 @@ function windowPoints(points2, st = 1, cnt = 0, step = 1) {
|
|
|
28267
28418
|
return out;
|
|
28268
28419
|
}
|
|
28269
28420
|
function iterateStep(point, iterator, step) {
|
|
28270
|
-
const
|
|
28421
|
+
const axis2 = iterator.axis[step] ?? "none";
|
|
28271
28422
|
const ptType = iterator.ptType[step] ?? iterator.ptType[iterator.ptType.length - 1] ?? "all";
|
|
28272
|
-
const hideLast = (iterator.hideLastTrans[step] ?? true) && SIBLING_AXES.has(
|
|
28273
|
-
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));
|
|
28274
28425
|
if (hideLast) {
|
|
28275
28426
|
points2 = points2.filter((candidate) => !isLastSiblingTransition(candidate));
|
|
28276
28427
|
}
|
|
@@ -28535,8 +28686,8 @@ function valueOf(node, type) {
|
|
|
28535
28686
|
if (direct !== void 0) {
|
|
28536
28687
|
return boundedValue(node, type, direct);
|
|
28537
28688
|
}
|
|
28538
|
-
const
|
|
28539
|
-
return
|
|
28689
|
+
const axis2 = AXIS_LOOKUP[type];
|
|
28690
|
+
return axis2 ? axisValue(node, axis2[0], axis2[1]) : void 0;
|
|
28540
28691
|
}
|
|
28541
28692
|
function boundedValue(node, type, value) {
|
|
28542
28693
|
let out = value;
|
|
@@ -28679,17 +28830,17 @@ function exactDef(name2, avLst, gdLines, rect3, paths) {
|
|
|
28679
28830
|
var Glyph = class {
|
|
28680
28831
|
lines = [];
|
|
28681
28832
|
names = /* @__PURE__ */ new Map();
|
|
28682
|
-
coord(
|
|
28683
|
-
const key = `${
|
|
28833
|
+
coord(axis2, value) {
|
|
28834
|
+
const key = `${axis2}${value}`;
|
|
28684
28835
|
const known = this.names.get(key);
|
|
28685
28836
|
if (known) {
|
|
28686
28837
|
return known;
|
|
28687
28838
|
}
|
|
28688
28839
|
const id = this.names.size;
|
|
28689
|
-
const name2 = `${
|
|
28840
|
+
const name2 = `${axis2}g${id}`;
|
|
28690
28841
|
this.lines.push(
|
|
28691
28842
|
`k${id} */ ss ${Math.round(value * 1e3)} 90000`,
|
|
28692
|
-
`${name2} +- ${
|
|
28843
|
+
`${name2} +- ${axis2 === "x" ? "hc" : "vc"} k${id} 0`
|
|
28693
28844
|
);
|
|
28694
28845
|
this.names.set(key, name2);
|
|
28695
28846
|
return name2;
|
|
@@ -43842,7 +43993,7 @@ function siblingGroupOf(node, parentOf, childrenOf, roots2) {
|
|
|
43842
43993
|
const parent = parentOf.get(node.id);
|
|
43843
43994
|
return parent ? childrenOf.get(parent.id) ?? [] : roots2;
|
|
43844
43995
|
}
|
|
43845
|
-
function navigateAxisHop(current,
|
|
43996
|
+
function navigateAxisHop(current, axis2, nodes, childrenOf, parentOf, roots2) {
|
|
43846
43997
|
const out = [];
|
|
43847
43998
|
const seen = /* @__PURE__ */ new Set();
|
|
43848
43999
|
const add3 = (node) => {
|
|
@@ -43857,7 +44008,7 @@ function navigateAxisHop(current, axis, nodes, childrenOf, parentOf, roots2) {
|
|
|
43857
44008
|
}
|
|
43858
44009
|
};
|
|
43859
44010
|
for (const node of current) {
|
|
43860
|
-
switch (
|
|
44011
|
+
switch (axis2) {
|
|
43861
44012
|
case "self":
|
|
43862
44013
|
add3(node);
|
|
43863
44014
|
break;
|
|
@@ -43889,7 +44040,7 @@ function navigateAxisHop(current, axis, nodes, childrenOf, parentOf, roots2) {
|
|
|
43889
44040
|
case "precedSib": {
|
|
43890
44041
|
const siblings = siblingGroupOf(node, parentOf, childrenOf, roots2);
|
|
43891
44042
|
const index = siblings.findIndex((sibling) => sibling.id === node.id);
|
|
43892
|
-
addAll(
|
|
44043
|
+
addAll(axis2 === "followSib" ? siblings.slice(index + 1) : siblings.slice(0, index));
|
|
43893
44044
|
break;
|
|
43894
44045
|
}
|
|
43895
44046
|
case "follow":
|
|
@@ -43899,11 +44050,11 @@ function navigateAxisHop(current, axis, nodes, childrenOf, parentOf, roots2) {
|
|
|
43899
44050
|
break;
|
|
43900
44051
|
}
|
|
43901
44052
|
const excluded = new Set(
|
|
43902
|
-
(
|
|
44053
|
+
(axis2 === "follow" ? descendantsOf(node, childrenOf) : ancestorsOf(node, parentOf)).map(
|
|
43903
44054
|
(n3) => n3.id
|
|
43904
44055
|
)
|
|
43905
44056
|
);
|
|
43906
|
-
const range2 =
|
|
44057
|
+
const range2 = axis2 === "follow" ? nodes.slice(docIndex + 1) : nodes.slice(0, docIndex);
|
|
43907
44058
|
addAll(range2.filter((n3) => !excluded.has(n3.id)));
|
|
43908
44059
|
break;
|
|
43909
44060
|
}
|
|
@@ -43939,15 +44090,15 @@ function applyPointTypeAndRange(nodes, pointType2, start, count) {
|
|
|
43939
44090
|
const filtered = pointType2 ? nodes.filter((n3) => pointTypeMatches(n3, pointType2)) : nodes;
|
|
43940
44091
|
return selectRange(filtered, start, count);
|
|
43941
44092
|
}
|
|
43942
|
-
function resolveAxisNodes(nodes,
|
|
43943
|
-
if (
|
|
44093
|
+
function resolveAxisNodes(nodes, axis2, pointTypes, start, count, context) {
|
|
44094
|
+
if (axis2.length === 0) {
|
|
43944
44095
|
return void 0;
|
|
43945
44096
|
}
|
|
43946
44097
|
const rootRelative = context === void 0;
|
|
43947
|
-
if (rootRelative &&
|
|
44098
|
+
if (rootRelative && axis2[0] !== "ch" && axis2[0] !== "self" && axis2[0] !== "root") {
|
|
43948
44099
|
return void 0;
|
|
43949
44100
|
}
|
|
43950
|
-
if (
|
|
44101
|
+
if (axis2[0] === "root" && axis2.length > 1 && axis2[1] !== "ch") {
|
|
43951
44102
|
return void 0;
|
|
43952
44103
|
}
|
|
43953
44104
|
const byId = new Map(nodes.map((n3) => [n3.id, n3]));
|
|
@@ -43968,15 +44119,15 @@ function resolveAxisNodes(nodes, axis, pointTypes, start, count, context) {
|
|
|
43968
44119
|
const roots2 = nodes.filter((n3) => !n3.parentId || !byId.has(n3.parentId));
|
|
43969
44120
|
let current;
|
|
43970
44121
|
let nextHop;
|
|
43971
|
-
if (
|
|
44122
|
+
if (axis2[0] === "root" && axis2.length > 1) {
|
|
43972
44123
|
current = applyPointTypeAndRange(roots2, pointTypes?.[1], start?.[1], count?.[1]);
|
|
43973
44124
|
nextHop = 2;
|
|
43974
|
-
} else if (
|
|
44125
|
+
} else if (axis2[0] === "root") {
|
|
43975
44126
|
current = applyPointTypeAndRange(roots2, pointTypes?.[0], start?.[0], count?.[0]);
|
|
43976
44127
|
nextHop = 1;
|
|
43977
44128
|
} else if (context !== void 0) {
|
|
43978
44129
|
current = applyPointTypeAndRange(
|
|
43979
|
-
navigateAxisHop(context,
|
|
44130
|
+
navigateAxisHop(context, axis2[0], nodes, childrenOf, parentOf, roots2),
|
|
43980
44131
|
pointTypes?.[0],
|
|
43981
44132
|
start?.[0],
|
|
43982
44133
|
count?.[0]
|
|
@@ -43986,9 +44137,9 @@ function resolveAxisNodes(nodes, axis, pointTypes, start, count, context) {
|
|
|
43986
44137
|
current = applyPointTypeAndRange(roots2, pointTypes?.[0], start?.[0], count?.[0]);
|
|
43987
44138
|
nextHop = 1;
|
|
43988
44139
|
}
|
|
43989
|
-
for (let hop = nextHop; hop <
|
|
44140
|
+
for (let hop = nextHop; hop < axis2.length; hop += 1) {
|
|
43990
44141
|
current = applyPointTypeAndRange(
|
|
43991
|
-
navigateAxisHop(current,
|
|
44142
|
+
navigateAxisHop(current, axis2[hop], nodes, childrenOf, parentOf, roots2),
|
|
43992
44143
|
pointTypes?.[hop],
|
|
43993
44144
|
start?.[hop],
|
|
43994
44145
|
count?.[hop]
|
|
@@ -43996,8 +44147,8 @@ function resolveAxisNodes(nodes, axis, pointTypes, start, count, context) {
|
|
|
43996
44147
|
}
|
|
43997
44148
|
return current;
|
|
43998
44149
|
}
|
|
43999
|
-
function resolveAxisCount(nodes,
|
|
44000
|
-
return resolveAxisNodes(nodes,
|
|
44150
|
+
function resolveAxisCount(nodes, axis2, pointTypes, start, count, context) {
|
|
44151
|
+
return resolveAxisNodes(nodes, axis2, pointTypes, start, count, context)?.length;
|
|
44001
44152
|
}
|
|
44002
44153
|
|
|
44003
44154
|
// diagram/layout/smartart-layout-interpreter-axis-depth.ts
|
|
@@ -44018,14 +44169,14 @@ function depthFromAnchor(node, anchorId, byId) {
|
|
|
44018
44169
|
}
|
|
44019
44170
|
return void 0;
|
|
44020
44171
|
}
|
|
44021
|
-
function resolveAxisMaxDepth(nodes,
|
|
44172
|
+
function resolveAxisMaxDepth(nodes, axis2, pointTypes, start, count, anchor) {
|
|
44022
44173
|
if (anchor.length === 0) {
|
|
44023
44174
|
return void 0;
|
|
44024
44175
|
}
|
|
44025
44176
|
const byId = new Map(nodes.map((n3) => [n3.id, n3]));
|
|
44026
44177
|
let max = 0;
|
|
44027
44178
|
for (const anchorPoint of anchor) {
|
|
44028
|
-
const resolved = resolveAxisNodes(nodes,
|
|
44179
|
+
const resolved = resolveAxisNodes(nodes, axis2, pointTypes, start, count, [anchorPoint]);
|
|
44029
44180
|
if (resolved === void 0) {
|
|
44030
44181
|
return void 0;
|
|
44031
44182
|
}
|
|
@@ -44125,11 +44276,11 @@ function evaluateWhen(when, nodeCount, context) {
|
|
|
44125
44276
|
if (threshold === void 0) {
|
|
44126
44277
|
return void 0;
|
|
44127
44278
|
}
|
|
44128
|
-
const
|
|
44129
|
-
if (
|
|
44279
|
+
const axis2 = when.axis;
|
|
44280
|
+
if (axis2 !== void 0 && context.nodes) {
|
|
44130
44281
|
const resolved = resolveAxisCount(
|
|
44131
44282
|
context.nodes,
|
|
44132
|
-
|
|
44283
|
+
axis2,
|
|
44133
44284
|
when.pointTypes,
|
|
44134
44285
|
when.start,
|
|
44135
44286
|
when.count,
|
|
@@ -45136,7 +45287,7 @@ function qualifyingIterators(node) {
|
|
|
45136
45287
|
return nodeIters;
|
|
45137
45288
|
}
|
|
45138
45289
|
const axisIter = list2.find(
|
|
45139
|
-
(each) => each.axis?.some((
|
|
45290
|
+
(each) => each.axis?.some((axis2) => axis2 === "ch" || axis2 === "des" || axis2 === "self")
|
|
45140
45291
|
);
|
|
45141
45292
|
return [axisIter ?? list2[0]];
|
|
45142
45293
|
}
|
|
@@ -47184,8 +47335,8 @@ function positionRange(start, count, step, total) {
|
|
|
47184
47335
|
|
|
47185
47336
|
// diagram/layout/smartart-layout-interpreter-item-role-compound.ts
|
|
47186
47337
|
function compoundChildIds(role, node, childrenOf) {
|
|
47187
|
-
const
|
|
47188
|
-
const chIndex =
|
|
47338
|
+
const axis2 = role.presentationOf?.axis ?? [];
|
|
47339
|
+
const chIndex = axis2.indexOf("ch");
|
|
47189
47340
|
if (chIndex < 0) {
|
|
47190
47341
|
return [];
|
|
47191
47342
|
}
|
|
@@ -47223,8 +47374,8 @@ function isTextRole(node) {
|
|
|
47223
47374
|
function hasAmbiguousTopLevelRoles(topLevelChildren) {
|
|
47224
47375
|
const textRoles = topLevelChildren.filter(isTextRole);
|
|
47225
47376
|
const descendantAxisRoles = textRoles.filter((child6) => {
|
|
47226
|
-
const
|
|
47227
|
-
return
|
|
47377
|
+
const axis2 = child6.presentationOf?.axis?.[0];
|
|
47378
|
+
return axis2 === "ch" || axis2 === "des" || axis2 === "desOrSelf";
|
|
47228
47379
|
});
|
|
47229
47380
|
if (descendantAxisRoles.length >= 2) {
|
|
47230
47381
|
return true;
|
|
@@ -47253,17 +47404,17 @@ function contentIds(role, node, childrenOf) {
|
|
|
47253
47404
|
if (fullAxis && fullAxis.length > 1) {
|
|
47254
47405
|
return fullAxis[0] === "ch" ? compoundChildIds(role, node, childrenOf) : [];
|
|
47255
47406
|
}
|
|
47256
|
-
const
|
|
47257
|
-
if (
|
|
47407
|
+
const axis2 = fullAxis?.[0];
|
|
47408
|
+
if (axis2 === "self") {
|
|
47258
47409
|
return [node.id];
|
|
47259
47410
|
}
|
|
47260
|
-
if (
|
|
47411
|
+
if (axis2 === "ch") {
|
|
47261
47412
|
return (childrenOf.get(node.id) ?? []).filter((child6) => child6.text.trim().length > 0).map((child6) => child6.id);
|
|
47262
47413
|
}
|
|
47263
|
-
if (
|
|
47414
|
+
if (axis2 === "des") {
|
|
47264
47415
|
return descendantIds(node, childrenOf);
|
|
47265
47416
|
}
|
|
47266
|
-
if (
|
|
47417
|
+
if (axis2 === "desOrSelf") {
|
|
47267
47418
|
const ids = descendantIds(node, childrenOf);
|
|
47268
47419
|
return node.text.trim().length > 0 ? [node.id, ...ids] : ids;
|
|
47269
47420
|
}
|
|
@@ -48439,9 +48590,9 @@ function arrangeByChooseAwareSlots(root, flat, box, index, ctx, fontCtx) {
|
|
|
48439
48590
|
// diagram/layout/smartart-layout-interpreter-composite-foreach.ts
|
|
48440
48591
|
function forEachBoundSlots(slotted) {
|
|
48441
48592
|
return slotted.filter((slot2) => {
|
|
48442
|
-
const
|
|
48593
|
+
const axis2 = slot2.node.presentationOf?.axis;
|
|
48443
48594
|
const origin = slot2.node.forEachOrigin?.axis;
|
|
48444
|
-
return
|
|
48595
|
+
return axis2?.length === 1 && (origin?.length ?? 0) > 1 && origin?.[0] === "ch";
|
|
48445
48596
|
});
|
|
48446
48597
|
}
|
|
48447
48598
|
function resolveForEachBoundContent(node, flat, childrenOf) {
|
|
@@ -48605,12 +48756,12 @@ function resolveUserSizeItemBoxPx(wrapper, index, box, sizeBox, declaringRoleCha
|
|
|
48605
48756
|
return void 0;
|
|
48606
48757
|
}
|
|
48607
48758
|
function childAxisSpec(template, childCount) {
|
|
48608
|
-
const
|
|
48609
|
-
if (!
|
|
48759
|
+
const axis2 = template.presentationOf?.axis;
|
|
48760
|
+
if (!axis2 || axis2.length === 0) {
|
|
48610
48761
|
return void 0;
|
|
48611
48762
|
}
|
|
48612
|
-
const fold =
|
|
48613
|
-
const ownIndex =
|
|
48763
|
+
const fold = axis2.includes("des") || axis2.includes("desOrSelf");
|
|
48764
|
+
const ownIndex = axis2.indexOf("ch");
|
|
48614
48765
|
if (ownIndex >= 0) {
|
|
48615
48766
|
const start = template.presentationOf?.start?.[ownIndex] ?? 1;
|
|
48616
48767
|
const count = template.presentationOf?.count?.[ownIndex];
|
|
@@ -48920,8 +49071,8 @@ function renderAnchoredPair(node, index, total, selfSlot, selfLayoutNode, desSlo
|
|
|
48920
49071
|
}
|
|
48921
49072
|
|
|
48922
49073
|
// diagram/layout/smartart-layout-interpreter-composite.ts
|
|
48923
|
-
function slotsWithAxis(slotted,
|
|
48924
|
-
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);
|
|
48925
49076
|
}
|
|
48926
49077
|
function arrangeByPresentationOf(view, slotted, allChildren, nodes, flat, box, absX, absY, childrenOf, ctx, fontCtx, index, presLayoutVars, declaringRoleChain, sizeBox) {
|
|
48927
49078
|
const selfSlots = slotsWithAxis(slotted, "self");
|
|
@@ -49739,12 +49890,12 @@ function resolveSpanWidth(map, t, orgChart) {
|
|
|
49739
49890
|
}
|
|
49740
49891
|
|
|
49741
49892
|
// diagram/hierarchy/smartart-hierarchy-fold-depth.ts
|
|
49742
|
-
function endsInUnboundedDescendantHop(
|
|
49743
|
-
if (!
|
|
49893
|
+
function endsInUnboundedDescendantHop(axis2, count) {
|
|
49894
|
+
if (!axis2 || axis2.length === 0) {
|
|
49744
49895
|
return false;
|
|
49745
49896
|
}
|
|
49746
|
-
const lastIndex =
|
|
49747
|
-
const lastAxis =
|
|
49897
|
+
const lastIndex = axis2.length - 1;
|
|
49898
|
+
const lastAxis = axis2[lastIndex];
|
|
49748
49899
|
if (lastAxis !== "des" && lastAxis !== "desOrSelf") {
|
|
49749
49900
|
return false;
|
|
49750
49901
|
}
|
|
@@ -66127,9 +66278,9 @@ function alignElements(elements3, edge, options2) {
|
|
|
66127
66278
|
}
|
|
66128
66279
|
return result;
|
|
66129
66280
|
}
|
|
66130
|
-
function distributeElements(elements3,
|
|
66281
|
+
function distributeElements(elements3, axis2, options2) {
|
|
66131
66282
|
const result = /* @__PURE__ */ new Map();
|
|
66132
|
-
const horizontal =
|
|
66283
|
+
const horizontal = axis2 === "horizontal";
|
|
66133
66284
|
const start = (e) => horizontal ? e.x : e.y;
|
|
66134
66285
|
const size = (e) => horizontal ? e.width : e.height;
|
|
66135
66286
|
const sorted = [...elements3].sort((a2, b) => start(a2) - start(b));
|
|
@@ -68850,21 +69001,21 @@ function fraction(node, style, ctx) {
|
|
|
68850
69001
|
return row([num2, slash, den]);
|
|
68851
69002
|
}
|
|
68852
69003
|
const gap = style.size * 0.15;
|
|
68853
|
-
const
|
|
69004
|
+
const axis2 = style.size * AXIS3;
|
|
68854
69005
|
const width = Math.max(num2.width, den.width) + style.size * 0.2;
|
|
68855
69006
|
const bar = type === "noBar" ? [] : [
|
|
68856
69007
|
{
|
|
68857
69008
|
kind: "line",
|
|
68858
69009
|
x1: 0,
|
|
68859
69010
|
x2: width,
|
|
68860
|
-
y1: -
|
|
68861
|
-
y2: -
|
|
69011
|
+
y1: -axis2,
|
|
69012
|
+
y2: -axis2,
|
|
68862
69013
|
width: Math.max(0.8, style.size * 0.05)
|
|
68863
69014
|
}
|
|
68864
69015
|
];
|
|
68865
69016
|
const box = overlay([
|
|
68866
|
-
{ box: num2, x: (width - num2.width) / 2, y: -(
|
|
68867
|
-
{ 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 }
|
|
68868
69019
|
]);
|
|
68869
69020
|
box.width = width;
|
|
68870
69021
|
box.prims.push(...bar);
|