ooxml-core 1.45.0 → 1.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/PptxHandler-FZ43IJFP.mjs +5 -0
- package/dist/{PptxHandler-FXLXIOLT.mjs → PptxHandler-HWEOIHEA.mjs} +2 -2
- package/dist/PptxHandler-XAUKKK36.cjs +14 -0
- package/dist/{PresentationBuilder-CSKLG64K.cjs → PresentationBuilder-2BCCMZW7.cjs} +6 -6
- package/dist/{PresentationBuilder-3FKFRSSV.mjs → PresentationBuilder-66RV4F45.mjs} +2 -2
- package/dist/{PresentationBuilder-DDYHRV26.mjs → PresentationBuilder-AFD72LIG.mjs} +3 -3
- 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-3J6VIKLP.cjs → chunk-5TOVSCVT.cjs} +3 -3
- package/dist/{chunk-U5BXJQZG.mjs → chunk-E2TTMUKU.mjs} +225 -38
- package/dist/{chunk-7T3SJQA6.cjs → chunk-E5TGYYKO.cjs} +1 -0
- package/dist/{chunk-VKFKEVHK.mjs → chunk-EI6555OK.mjs} +1 -1
- package/dist/{chunk-R7NS42KQ.mjs → chunk-FKU2Z6ZB.mjs} +1 -1
- package/dist/{chunk-GGJUWJXB.mjs → chunk-G6LEU3Y5.mjs} +1 -1
- package/dist/{chunk-RVYGAYCP.mjs → chunk-H43QQVJU.mjs} +1 -1
- package/dist/{chunk-CVJX6NNO.mjs → chunk-HH3AYM63.mjs} +227 -39
- package/dist/{chunk-YBSNMVSN.cjs → chunk-IBRV3AK3.cjs} +1497 -1309
- package/dist/{chunk-LCXBTJXE.mjs → chunk-L6MJGE3Q.mjs} +4 -4
- package/dist/{chunk-IPV3J3I5.mjs → chunk-LXVE2VKR.mjs} +4 -1
- package/dist/{chunk-QZPOPUI5.cjs → chunk-QUAFASFC.cjs} +4 -0
- package/dist/{chunk-XTUX5RMG.cjs → chunk-T4BVZTII.cjs} +9 -9
- package/dist/{chunk-GXYK3H4O.mjs → chunk-X2DC7XRL.mjs} +17 -16
- package/dist/{chunk-OORQCSVA.mjs → chunk-ZLUHU2SU.mjs} +1 -0
- package/dist/docx/index.cjs +300 -144
- package/dist/docx/index.mjs +300 -144
- package/dist/index.cjs +484 -333
- package/dist/index.mjs +484 -333
- package/dist/pptx/automation/index.cjs +350 -143
- 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-BPGaFlm5.d.ts} +4 -4
- package/dist/pptx/chunks/{index-6Ot1b-4U.d.ts.map → index-BPGaFlm5.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-jdZUtLGB.d.ts → index-D4-WJQ1r.d.ts} +3 -3
- package/dist/pptx/chunks/{index-jdZUtLGB.d.ts.map → index-D4-WJQ1r.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-DGKI80Hj.d.ts → index-DtFoPmk7.d.ts} +49 -6
- package/dist/pptx/chunks/index-DtFoPmk7.d.ts.map +1 -0
- 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 +307 -100
- 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 +351 -147
- 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/pptx/chunks/index-DGKI80Hj.d.ts.map +0 -1
package/dist/chart/index.cjs
CHANGED
|
@@ -3488,9 +3488,9 @@ function writeChartAxisFormatting(root, formatting) {
|
|
|
3488
3488
|
const previous = readChartFormatting(root);
|
|
3489
3489
|
let changed = false;
|
|
3490
3490
|
for (const part of ["categoryAxis", "valueAxis"]) {
|
|
3491
|
-
const
|
|
3491
|
+
const axis2 = nodes[part];
|
|
3492
3492
|
const entry3 = formatting.entries[part];
|
|
3493
|
-
if (!
|
|
3493
|
+
if (!axis2 || !entry3) continue;
|
|
3494
3494
|
for (const [name, flag, value, successors] of [
|
|
3495
3495
|
[
|
|
3496
3496
|
"delete",
|
|
@@ -3538,17 +3538,17 @@ function writeChartAxisFormatting(root, formatting) {
|
|
|
3538
3538
|
const key = name === "delete" ? "axisVisible" : "labelsVisible";
|
|
3539
3539
|
const revealingAxis = name === "tickLblPos" && entry3.axisVisible === true && previous?.entries[part]?.axisVisible === false;
|
|
3540
3540
|
if (flag === previous?.entries[part]?.[key] && !revealingAxis) continue;
|
|
3541
|
-
let node = first(
|
|
3541
|
+
let node = first(axis2, name, NS.c);
|
|
3542
3542
|
const old = node?.getAttribute("val");
|
|
3543
3543
|
if (name === "delete" && old !== void 0 && old !== null && (flag && (old === "0" || old === "false") || !flag && (old === "1" || old === "true")))
|
|
3544
3544
|
continue;
|
|
3545
3545
|
if (name === "tickLblPos" && node && (flag ? old !== "none" : old === "none")) continue;
|
|
3546
3546
|
if (!node) {
|
|
3547
3547
|
node = root.ownerDocument.createElementNS(NS.c, "c:" + name);
|
|
3548
|
-
const before = elements(
|
|
3548
|
+
const before = elements(axis2).find(
|
|
3549
3549
|
(child3) => child3.namespaceURI === NS.c && successors.includes(child3.localName)
|
|
3550
3550
|
);
|
|
3551
|
-
|
|
3551
|
+
axis2.insertBefore(node, before ?? null);
|
|
3552
3552
|
}
|
|
3553
3553
|
node.setAttribute("val", value);
|
|
3554
3554
|
changed = true;
|
|
@@ -4843,8 +4843,8 @@ function parseGroup(context, element2) {
|
|
|
4843
4843
|
element: element2.localName,
|
|
4844
4844
|
is3D,
|
|
4845
4845
|
series: children(element2, "ser", NS.c).map((ser) => parseSeries(context, ser)),
|
|
4846
|
-
axisIds: children(element2, "axId", NS.c).flatMap((
|
|
4847
|
-
const raw2 = attribute(
|
|
4846
|
+
axisIds: children(element2, "axId", NS.c).flatMap((axis2) => {
|
|
4847
|
+
const raw2 = attribute(axis2, "val")?.trim();
|
|
4848
4848
|
const id = raw2 ? Number(raw2) : Number.NaN;
|
|
4849
4849
|
return Number.isFinite(id) ? [id] : [];
|
|
4850
4850
|
})
|
|
@@ -4993,9 +4993,9 @@ function parsePlotArea(context, element2) {
|
|
|
4993
4993
|
plotArea.groups.push(parseGroup(context, child3));
|
|
4994
4994
|
handled.add(child3.localName);
|
|
4995
4995
|
}
|
|
4996
|
-
const
|
|
4997
|
-
if (
|
|
4998
|
-
plotArea.axes.push(parseAxis(context, child3,
|
|
4996
|
+
const axis2 = AXIS_ELEMENTS[child3.localName];
|
|
4997
|
+
if (axis2) {
|
|
4998
|
+
plotArea.axes.push(parseAxis(context, child3, axis2));
|
|
4999
4999
|
handled.add(child3.localName);
|
|
5000
5000
|
}
|
|
5001
5001
|
}
|
|
@@ -5549,14 +5549,14 @@ var AXIS_ELEMENTS2 = {
|
|
|
5549
5549
|
ser: "serAx"
|
|
5550
5550
|
};
|
|
5551
5551
|
var gridlinesXml = (context, local, present2, shape) => present2 ? elementXml(local, shapePropertiesXml(context, shape)) : "";
|
|
5552
|
-
function axisXml(context,
|
|
5553
|
-
const { scaling } =
|
|
5552
|
+
function axisXml(context, axis2) {
|
|
5553
|
+
const { scaling } = axis2;
|
|
5554
5554
|
return elementXml(
|
|
5555
|
-
AXIS_ELEMENTS2[
|
|
5556
|
-
valXml("axId",
|
|
5555
|
+
AXIS_ELEMENTS2[axis2.kind],
|
|
5556
|
+
valXml("axId", axis2.id) + elementXml(
|
|
5557
5557
|
"scaling",
|
|
5558
5558
|
valXml("logBase", scaling.logBase) + valXml("orientation", scaling.orientation) + valXml("max", scaling.max) + valXml("min", scaling.min)
|
|
5559
|
-
) + valXml("delete",
|
|
5559
|
+
) + 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)
|
|
5560
5560
|
);
|
|
5561
5561
|
}
|
|
5562
5562
|
|
|
@@ -5630,7 +5630,7 @@ function groupXml(context, group2) {
|
|
|
5630
5630
|
function plotAreaXml(context, plotArea) {
|
|
5631
5631
|
return elementXml(
|
|
5632
5632
|
"plotArea",
|
|
5633
|
-
layoutXml(context, plotArea.layout) + plotArea.groups.map((group2) => groupXml(context, group2)).join("") + plotArea.axes.map((
|
|
5633
|
+
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)
|
|
5634
5634
|
);
|
|
5635
5635
|
}
|
|
5636
5636
|
|
|
@@ -6039,14 +6039,14 @@ function parseLegend2(context, element2) {
|
|
|
6039
6039
|
}
|
|
6040
6040
|
|
|
6041
6041
|
// chart/ex/parse-axis.ts
|
|
6042
|
-
function parseScaling(context,
|
|
6043
|
-
const category = cxChild(
|
|
6042
|
+
function parseScaling(context, axis2) {
|
|
6043
|
+
const category = cxChild(axis2, "catScaling");
|
|
6044
6044
|
if (category)
|
|
6045
6045
|
return assignDefined(
|
|
6046
6046
|
{ kind: "cat" },
|
|
6047
6047
|
{ gapWidth: autoNumberAttribute(context, category, "gapWidth") }
|
|
6048
6048
|
);
|
|
6049
|
-
const value = cxChild(
|
|
6049
|
+
const value = cxChild(axis2, "valScaling");
|
|
6050
6050
|
if (!value) return void 0;
|
|
6051
6051
|
return assignDefined(
|
|
6052
6052
|
{ kind: "val" },
|
|
@@ -6257,9 +6257,9 @@ function parseSeries2(context, element2) {
|
|
|
6257
6257
|
const labels2 = cxChild(element2, "dataLabels");
|
|
6258
6258
|
const inline = cxChild(element2, "data");
|
|
6259
6259
|
const layout = cxChild(element2, "layoutPr");
|
|
6260
|
-
const
|
|
6260
|
+
const axisIds2 = cxChildren(element2, "axisId").map((axis2) => indexAttribute(context, axis2, "val")).filter((id) => id !== void 0);
|
|
6261
6261
|
return assignDefined(
|
|
6262
|
-
{ layoutId: attribute(element2, "layoutId") ?? "", dataPoints, axisIds },
|
|
6262
|
+
{ layoutId: attribute(element2, "layoutId") ?? "", dataPoints, axisIds: axisIds2 },
|
|
6263
6263
|
{
|
|
6264
6264
|
hidden: boolAttribute(context, element2, "hidden"),
|
|
6265
6265
|
ownerIndex: numberAttribute(context, element2, "ownerIdx"),
|
|
@@ -6301,7 +6301,7 @@ function parsePlotArea2(context, element2) {
|
|
|
6301
6301
|
const regionExtLst = extensionList2(region);
|
|
6302
6302
|
if (regionExtLst) out.regionExtLst = regionExtLst;
|
|
6303
6303
|
}
|
|
6304
|
-
out.axes = cxChildren(element2, "axis").map((
|
|
6304
|
+
out.axes = cxChildren(element2, "axis").map((axis2) => parseAxis2(context, axis2));
|
|
6305
6305
|
return assignDefined(out, { spPr: shapeProperties2(element2), extLst: extensionList2(element2) });
|
|
6306
6306
|
}
|
|
6307
6307
|
function namespaceDeclarations2(root) {
|
|
@@ -6552,19 +6552,19 @@ function scalingXml(scaling) {
|
|
|
6552
6552
|
);
|
|
6553
6553
|
}
|
|
6554
6554
|
var tickMarksXml = (local, marks) => marks ? cxElement(local, "", attributes([["type", marks.type]])) : "";
|
|
6555
|
-
function axisXml2(context,
|
|
6556
|
-
const units2 =
|
|
6555
|
+
function axisXml2(context, axis2) {
|
|
6556
|
+
const units2 = axis2.units;
|
|
6557
6557
|
const gridlines = (local, value) => value ? cxElement(local, shapeXml(context, value.spPr)) : "";
|
|
6558
6558
|
return cxElement(
|
|
6559
6559
|
"axis",
|
|
6560
|
-
scalingXml(
|
|
6560
|
+
scalingXml(axis2.scaling) + titleXml2(context, axis2.title) + (units2 ? cxElement(
|
|
6561
6561
|
"units",
|
|
6562
6562
|
titleXml2(context, units2.label, "unitsLabel") + raw(context, units2.extLst),
|
|
6563
6563
|
attributes([["unit", units2.unit]])
|
|
6564
|
-
) : "") + gridlines("majorGridlines",
|
|
6564
|
+
) : "") + 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),
|
|
6565
6565
|
attributes([
|
|
6566
|
-
["id",
|
|
6567
|
-
["hidden",
|
|
6566
|
+
["id", axis2.id],
|
|
6567
|
+
["hidden", axis2.hidden]
|
|
6568
6568
|
])
|
|
6569
6569
|
);
|
|
6570
6570
|
}
|
|
@@ -6599,7 +6599,7 @@ function writeChartExSpace(space, options2 = {}) {
|
|
|
6599
6599
|
);
|
|
6600
6600
|
const plotArea = cxElement(
|
|
6601
6601
|
"plotArea",
|
|
6602
|
-
region + plot.axes.map((
|
|
6602
|
+
region + plot.axes.map((axis2) => axisXml2(context, axis2)).join("") + shapeXml(context, plot.spPr) + raw(context, plot.extLst)
|
|
6603
6603
|
);
|
|
6604
6604
|
const legend = space.legend;
|
|
6605
6605
|
const legendXml2 = legend ? cxElement(
|
|
@@ -6930,9 +6930,9 @@ function chartExSeriesAt(space, index) {
|
|
|
6930
6930
|
return series2;
|
|
6931
6931
|
}
|
|
6932
6932
|
function chartExAxisAt(space, index) {
|
|
6933
|
-
const
|
|
6934
|
-
if (!
|
|
6935
|
-
return
|
|
6933
|
+
const axis2 = typeof index === "number" && Number.isSafeInteger(index) ? space.plotArea.axes.find((_, position) => position === index) : void 0;
|
|
6934
|
+
if (!axis2) throw new RangeError(`No chart axis at index ${String(index)}`);
|
|
6935
|
+
return axis2;
|
|
6936
6936
|
}
|
|
6937
6937
|
function setChartExTitle(space, text2) {
|
|
6938
6938
|
return editChartExSpace(space, (draft) => {
|
|
@@ -7210,7 +7210,7 @@ function setChartExLayout(space, layout) {
|
|
|
7210
7210
|
];
|
|
7211
7211
|
for (const series2 of draft.plotArea.series)
|
|
7212
7212
|
series2.axisIds = draft.plotArea.axes.flatMap(
|
|
7213
|
-
(
|
|
7213
|
+
(axis2) => axis2.id === void 0 ? [] : [axis2.id]
|
|
7214
7214
|
);
|
|
7215
7215
|
} else {
|
|
7216
7216
|
draft.plotArea.axes = [];
|
|
@@ -8859,8 +8859,8 @@ function chartSummarySeries(source, chartType, groupLabels, groupSmooth) {
|
|
|
8859
8859
|
Object.assign(out, summaryAnalysis(source));
|
|
8860
8860
|
return out;
|
|
8861
8861
|
}
|
|
8862
|
-
function valueAxisId(chartSpace,
|
|
8863
|
-
return
|
|
8862
|
+
function valueAxisId(chartSpace, axisIds2) {
|
|
8863
|
+
return axisIds2.find(
|
|
8864
8864
|
(id) => chartSpace.plotArea.axes.some((a2) => a2.id === id && a2.kind === "val")
|
|
8865
8865
|
);
|
|
8866
8866
|
}
|
|
@@ -9563,35 +9563,35 @@ function chartExSummaryFromModel(space) {
|
|
|
9563
9563
|
showLegend: legend !== void 0
|
|
9564
9564
|
};
|
|
9565
9565
|
if (chartType === "boxWhisker") {
|
|
9566
|
-
summary.axes = space.plotArea.axes.flatMap((
|
|
9567
|
-
const scaling =
|
|
9566
|
+
summary.axes = space.plotArea.axes.flatMap((axis2) => {
|
|
9567
|
+
const scaling = axis2.scaling;
|
|
9568
9568
|
if (!scaling) return [];
|
|
9569
9569
|
const value = scaling.kind === "val";
|
|
9570
9570
|
return [
|
|
9571
9571
|
{
|
|
9572
9572
|
kind: value ? "val" : "cat",
|
|
9573
|
-
...
|
|
9573
|
+
...axis2.id === void 0 ? {} : { id: axis2.id },
|
|
9574
9574
|
position: value ? "l" : "b",
|
|
9575
|
-
deleted:
|
|
9575
|
+
deleted: axis2.hidden ?? false,
|
|
9576
9576
|
scaling: {
|
|
9577
9577
|
...value && typeof scaling.min === "number" ? { min: scaling.min } : {},
|
|
9578
9578
|
...value && typeof scaling.max === "number" ? { max: scaling.max } : {}
|
|
9579
9579
|
},
|
|
9580
|
-
majorGridlines: !!
|
|
9581
|
-
minorGridlines: !!
|
|
9582
|
-
...
|
|
9583
|
-
...
|
|
9580
|
+
majorGridlines: !!axis2.majorGridlines,
|
|
9581
|
+
minorGridlines: !!axis2.minorGridlines,
|
|
9582
|
+
...axis2.majorGridlines?.spPr ? { majorGridlinesSpPr: axis2.majorGridlines.spPr } : {},
|
|
9583
|
+
...axis2.minorGridlines?.spPr ? { minorGridlinesSpPr: axis2.minorGridlines.spPr } : {},
|
|
9584
9584
|
...value && typeof scaling.majorUnit === "number" ? { majorUnit: scaling.majorUnit } : {},
|
|
9585
9585
|
...value && typeof scaling.minorUnit === "number" ? { minorUnit: scaling.minorUnit } : {},
|
|
9586
|
-
...
|
|
9587
|
-
...
|
|
9588
|
-
...
|
|
9586
|
+
...axis2.spPr ? { spPr: axis2.spPr } : {},
|
|
9587
|
+
...axis2.numberFormat ? { numberFormat: axis2.numberFormat } : {},
|
|
9588
|
+
...axis2.tickLabels ? {} : { tickLabelPosition: "none" }
|
|
9589
9589
|
}
|
|
9590
9590
|
];
|
|
9591
9591
|
});
|
|
9592
9592
|
}
|
|
9593
9593
|
if (chartType === "funnel") {
|
|
9594
|
-
const cat = space.plotArea.axes.find((
|
|
9594
|
+
const cat = space.plotArea.axes.find((axis2) => axis2.scaling?.kind === "cat")?.scaling;
|
|
9595
9595
|
if (cat?.kind === "cat" && typeof cat.gapWidth === "number")
|
|
9596
9596
|
summary.funnelGapWidth = cat.gapWidth;
|
|
9597
9597
|
}
|
|
@@ -10536,44 +10536,44 @@ function formatDate(date, unit, format) {
|
|
|
10536
10536
|
|
|
10537
10537
|
// chart/render/chart-svg-date-axis.ts
|
|
10538
10538
|
function chartDateAxis(model, plot, out) {
|
|
10539
|
-
const
|
|
10539
|
+
const axis2 = model.axes?.category?.source;
|
|
10540
10540
|
const values = model.dateCategories;
|
|
10541
|
-
if (
|
|
10541
|
+
if (axis2?.kind !== "date" || !values?.length) return void 0;
|
|
10542
10542
|
const points2 = values.flatMap(
|
|
10543
10543
|
(value, index) => value === null || !Number.isFinite(value) ? [] : [{ value, index }]
|
|
10544
10544
|
).sort((a2, b) => a2.value - b.value);
|
|
10545
10545
|
if (!points2.length) return void 0;
|
|
10546
|
-
const min =
|
|
10547
|
-
const max =
|
|
10546
|
+
const min = axis2.scaling.min ?? points2[0].value;
|
|
10547
|
+
const max = axis2.scaling.max ?? points2.at(-1).value;
|
|
10548
10548
|
if (!Number.isFinite(min) || !Number.isFinite(max) || max < min) return void 0;
|
|
10549
10549
|
const position = (value) => {
|
|
10550
10550
|
const ratio = max === min ? 0.5 : (value - min) / (max - min);
|
|
10551
|
-
const t =
|
|
10551
|
+
const t = axis2.scaling.orientation === "maxMin" ? 1 - ratio : ratio;
|
|
10552
10552
|
return model.horizontal ? plot.y + plot.h * (1 - t) : plot.x + plot.w * t;
|
|
10553
10553
|
};
|
|
10554
10554
|
const visible = points2.filter((p) => p.value >= min && p.value <= max);
|
|
10555
10555
|
const unitOf = (unit2) => unit2 === "months" || unit2 === "years" ? unit2 : "days";
|
|
10556
|
-
const unit = unitOf(
|
|
10556
|
+
const unit = unitOf(axis2.majorTimeUnit ?? axis2.baseTimeUnit);
|
|
10557
10557
|
const ticks = calendarTicks(
|
|
10558
10558
|
min,
|
|
10559
10559
|
max,
|
|
10560
10560
|
model.date1904 ?? false,
|
|
10561
10561
|
unit,
|
|
10562
|
-
Math.max(1,
|
|
10562
|
+
Math.max(1, axis2.majorUnit ?? 1)
|
|
10563
10563
|
);
|
|
10564
10564
|
const attrs2 = chartTextAttributes(model, "categoryAxis");
|
|
10565
10565
|
const size = attrs2.size ?? 10;
|
|
10566
|
-
const y =
|
|
10566
|
+
const y = axis2.position === "t" ? plot.y : plot.y + plot.h;
|
|
10567
10567
|
const paint2 = model.axes?.category?.line;
|
|
10568
10568
|
const stroke = { color: paint2?.color ?? "#BFBFBF", width: paint2?.width ?? 1 };
|
|
10569
10569
|
const mark = (serial, placement, length) => {
|
|
10570
|
-
if (!placement || placement === "none" ||
|
|
10571
|
-
const inward =
|
|
10570
|
+
if (!placement || placement === "none" || axis2.deleted) return;
|
|
10571
|
+
const inward = axis2.position === "t" ? length : -length;
|
|
10572
10572
|
const start = placement === "cross" ? -length : 0;
|
|
10573
10573
|
const end = placement === "cross" ? length : placement === "in" ? inward : -inward;
|
|
10574
10574
|
if (model.horizontal) {
|
|
10575
|
-
const x =
|
|
10576
|
-
const direction =
|
|
10575
|
+
const x = axis2.position === "r" ? plot.x + plot.w : plot.x;
|
|
10576
|
+
const direction = axis2.position === "r" ? -1 : 1;
|
|
10577
10577
|
const a2 = placement === "cross" ? -length : 0;
|
|
10578
10578
|
const b = placement === "cross" ? length : placement === "in" ? direction * length : -direction * length;
|
|
10579
10579
|
out.push(
|
|
@@ -10585,19 +10585,19 @@ function chartDateAxis(model, plot, out) {
|
|
|
10585
10585
|
);
|
|
10586
10586
|
};
|
|
10587
10587
|
ticks.forEach((serial, index) => {
|
|
10588
|
-
if (index % Math.max(1,
|
|
10589
|
-
if (
|
|
10588
|
+
if (index % Math.max(1, axis2.tickMarkSkip ?? 1) === 0) mark(serial, axis2.majorTickMark, 4);
|
|
10589
|
+
if (axis2.deleted || model.dataTable || axis2.tickLabelPosition === "none" || index % Math.max(1, axis2.tickLabelSkip ?? 1))
|
|
10590
10590
|
return;
|
|
10591
10591
|
const label = formatDate(
|
|
10592
10592
|
excelSerialToDate(serial, model.date1904),
|
|
10593
10593
|
unit,
|
|
10594
|
-
|
|
10594
|
+
axis2.numberFormat?.formatCode
|
|
10595
10595
|
);
|
|
10596
10596
|
if (model.horizontal)
|
|
10597
10597
|
out.push(text(plot.x - 4, position(serial) + size * 0.3, label, { ...attrs2, anchor: "end" }));
|
|
10598
10598
|
else {
|
|
10599
|
-
const above =
|
|
10600
|
-
const baseline =
|
|
10599
|
+
const above = axis2.tickLabelPosition === "high" || axis2.tickLabelPosition !== "low" && axis2.position === "t";
|
|
10600
|
+
const baseline = axis2.tickLabelPosition === "high" ? plot.y : axis2.tickLabelPosition === "low" ? plot.y + plot.h : y;
|
|
10601
10601
|
out.push(
|
|
10602
10602
|
text(position(serial), baseline + (above ? -4 : size + 3), label, {
|
|
10603
10603
|
...attrs2,
|
|
@@ -10606,15 +10606,15 @@ function chartDateAxis(model, plot, out) {
|
|
|
10606
10606
|
);
|
|
10607
10607
|
}
|
|
10608
10608
|
});
|
|
10609
|
-
if (
|
|
10609
|
+
if (axis2.minorTickMark && axis2.minorTickMark !== "none")
|
|
10610
10610
|
for (const serial of calendarTicks(
|
|
10611
10611
|
min,
|
|
10612
10612
|
max,
|
|
10613
10613
|
model.date1904 ?? false,
|
|
10614
|
-
unitOf(
|
|
10615
|
-
Math.max(1,
|
|
10614
|
+
unitOf(axis2.minorTimeUnit ?? axis2.baseTimeUnit ?? unit),
|
|
10615
|
+
Math.max(1, axis2.minorUnit ?? 1)
|
|
10616
10616
|
))
|
|
10617
|
-
mark(serial,
|
|
10617
|
+
mark(serial, axis2.minorTickMark, 2.5);
|
|
10618
10618
|
return {
|
|
10619
10619
|
order: visible.map((p) => p.index),
|
|
10620
10620
|
band: (index) => position(values[index] ?? min),
|
|
@@ -10759,12 +10759,12 @@ function chartLineDashArray(style, width) {
|
|
|
10759
10759
|
}
|
|
10760
10760
|
|
|
10761
10761
|
// chart/render/chart-svg-axes.ts
|
|
10762
|
-
function axisTickText(value,
|
|
10763
|
-
return formatChartNumber(value,
|
|
10762
|
+
function axisTickText(value, axis2, percent = false) {
|
|
10763
|
+
return formatChartNumber(value, axis2?.source.numberFormat?.formatCode) ?? formatAxisValue(value, percent);
|
|
10764
10764
|
}
|
|
10765
|
-
function axisLine(model,
|
|
10766
|
-
if (
|
|
10767
|
-
return styledAxisLine(x1, y1, x2, y2,
|
|
10765
|
+
function axisLine(model, axis2, part, x1, y1, x2, y2) {
|
|
10766
|
+
if (axis2?.source.deleted) return "";
|
|
10767
|
+
return styledAxisLine(x1, y1, x2, y2, axis2?.line, chartStroke(model, part));
|
|
10768
10768
|
}
|
|
10769
10769
|
function styledAxisLine(x1, y1, x2, y2, paint2, fallback) {
|
|
10770
10770
|
const color2 = paint2?.color ?? fallback.color;
|
|
@@ -10776,7 +10776,7 @@ function styledAxisLine(x1, y1, x2, y2, paint2, fallback) {
|
|
|
10776
10776
|
dash ? ` stroke-dasharray="${dash}"/>` : "/>"
|
|
10777
10777
|
);
|
|
10778
10778
|
}
|
|
10779
|
-
function axisGridlines(model,
|
|
10779
|
+
function axisGridlines(model, axis2, ticks, position, plot, vertical) {
|
|
10780
10780
|
const draw2 = (values, paint2, minor2) => {
|
|
10781
10781
|
const fallback = chartStroke(model, minor2 ? "gridlineMinor" : "gridlineMajor");
|
|
10782
10782
|
return values.map((value) => {
|
|
@@ -10784,8 +10784,8 @@ function axisGridlines(model, axis, ticks, position, plot, vertical) {
|
|
|
10784
10784
|
return vertical ? styledAxisLine(p, plot.y, p, plot.y + plot.h, paint2, fallback) : styledAxisLine(plot.x, p, plot.x + plot.w, p, paint2, fallback);
|
|
10785
10785
|
}).join("");
|
|
10786
10786
|
};
|
|
10787
|
-
const major = !
|
|
10788
|
-
const minor =
|
|
10787
|
+
const major = !axis2 || axis2.source.majorGridlines ? draw2(ticks, axis2?.majorGrid, false) : "";
|
|
10788
|
+
const minor = axis2?.source.minorGridlines ? draw2(axis2.minorTicks, axis2.minorGrid, true) : "";
|
|
10789
10789
|
return major + minor;
|
|
10790
10790
|
}
|
|
10791
10791
|
|
|
@@ -10854,20 +10854,20 @@ function computeLogValueRange(series2, logBase) {
|
|
|
10854
10854
|
logBase
|
|
10855
10855
|
};
|
|
10856
10856
|
}
|
|
10857
|
-
function computeValueRangeForAxis(series2,
|
|
10858
|
-
const requestedLogBase =
|
|
10859
|
-
const logBase =
|
|
10857
|
+
function computeValueRangeForAxis(series2, axis2, plotHeightPx) {
|
|
10858
|
+
const requestedLogBase = axis2?.logBase ?? 10;
|
|
10859
|
+
const logBase = axis2?.logScale && Number.isFinite(requestedLogBase) && requestedLogBase > 1 ? requestedLogBase : axis2?.logScale ? 10 : void 0;
|
|
10860
10860
|
const automatic = logBase ? computeLogValueRange(series2, logBase) : computeAxisValueRange(series2, plotHeightPx);
|
|
10861
|
-
return withAxisBounds(automatic,
|
|
10861
|
+
return withAxisBounds(automatic, axis2, logBase);
|
|
10862
10862
|
}
|
|
10863
|
-
function computeStackedValueRangeForAxis(series2, catCount,
|
|
10863
|
+
function computeStackedValueRangeForAxis(series2, catCount, axis2, isPercent, plotSizePx) {
|
|
10864
10864
|
if (isPercent) {
|
|
10865
10865
|
return {
|
|
10866
10866
|
...percentStackedRange(series2, catCount, plotSizePx),
|
|
10867
|
-
...
|
|
10867
|
+
...axis2?.orientation === "maxMin" ? { reverseOrder: true } : {}
|
|
10868
10868
|
};
|
|
10869
10869
|
}
|
|
10870
|
-
return withAxisBounds(computeAxisStackedValueRange(series2, catCount, plotSizePx),
|
|
10870
|
+
return withAxisBounds(computeAxisStackedValueRange(series2, catCount, plotSizePx), axis2);
|
|
10871
10871
|
}
|
|
10872
10872
|
function percentStackedRange(series2, catCount, plotSizePx) {
|
|
10873
10873
|
const shares = series2.map((entry3) => ({
|
|
@@ -10890,9 +10890,9 @@ function percentStackedRange(series2, catCount, plotSizePx) {
|
|
|
10890
10890
|
...unit !== void 0 && 100 % unit === 0 && min % unit === 0 ? { majorUnit: unit } : {}
|
|
10891
10891
|
};
|
|
10892
10892
|
}
|
|
10893
|
-
function withAxisBounds(automatic,
|
|
10894
|
-
const validMin = typeof
|
|
10895
|
-
const validMax = typeof
|
|
10893
|
+
function withAxisBounds(automatic, axis2, logBase) {
|
|
10894
|
+
const validMin = typeof axis2?.min === "number" && Number.isFinite(axis2.min) && (!logBase || axis2.min > 0) ? axis2.min : void 0;
|
|
10895
|
+
const validMax = typeof axis2?.max === "number" && Number.isFinite(axis2.max) && (!logBase || axis2.max > 0) ? axis2.max : void 0;
|
|
10896
10896
|
const min = validMin ?? automatic.min;
|
|
10897
10897
|
let max = validMax ?? automatic.max;
|
|
10898
10898
|
const majorUnit = validMin === void 0 && validMax === void 0 ? automatic.majorUnit : void 0;
|
|
@@ -10906,7 +10906,7 @@ function withAxisBounds(automatic, axis, logBase) {
|
|
|
10906
10906
|
span: Math.max(span, Number.EPSILON),
|
|
10907
10907
|
...majorUnit !== void 0 ? { majorUnit } : {},
|
|
10908
10908
|
...logBase ? { logScale: true, logBase } : {},
|
|
10909
|
-
...
|
|
10909
|
+
...axis2?.orientation === "maxMin" ? { reverseOrder: true } : {}
|
|
10910
10910
|
};
|
|
10911
10911
|
}
|
|
10912
10912
|
function valueToYLog(val, range2, topY, bottomY) {
|
|
@@ -10917,10 +10917,10 @@ function valueToYLog(val, range2, topY, bottomY) {
|
|
|
10917
10917
|
return range2.reverseOrder ? topY + ratio * (bottomY - topY) : bottomY - ratio * (bottomY - topY);
|
|
10918
10918
|
}
|
|
10919
10919
|
function findLogAxis(axes) {
|
|
10920
|
-
return axes?.find((
|
|
10920
|
+
return axes?.find((axis2) => axis2.axisType === "valAx" && axis2.logScale);
|
|
10921
10921
|
}
|
|
10922
10922
|
function computeValueRangeForChart(series2, axes, plotHeightPx) {
|
|
10923
|
-
const primaryAxis = axes?.find((
|
|
10923
|
+
const primaryAxis = axes?.find((axis2) => axis2.axisType === "valAx" && axis2.axPos === "l") ?? axes?.find((axis2) => axis2.axisType === "valAx" && axis2.axPos !== "r");
|
|
10924
10924
|
return computeValueRangeForAxis(series2, primaryAxis, plotHeightPx);
|
|
10925
10925
|
}
|
|
10926
10926
|
|
|
@@ -10953,11 +10953,11 @@ function generateIntervalTicks(range2, unit) {
|
|
|
10953
10953
|
const count = Math.min(Math.max(last - first2 + 1, 0), 2e3);
|
|
10954
10954
|
return Array.from({ length: count }, (_, index) => (first2 + index) * unit);
|
|
10955
10955
|
}
|
|
10956
|
-
function generateAxisTicks(range2,
|
|
10956
|
+
function generateAxisTicks(range2, axis2, defaultIntervals) {
|
|
10957
10957
|
if (range2.logScale && range2.logBase) {
|
|
10958
10958
|
return generateLogTicks(range2);
|
|
10959
10959
|
}
|
|
10960
|
-
const explicit = generateIntervalTicks(range2,
|
|
10960
|
+
const explicit = generateIntervalTicks(range2, axis2?.majorUnit ?? 0);
|
|
10961
10961
|
if (explicit.length > 0) {
|
|
10962
10962
|
return explicit;
|
|
10963
10963
|
}
|
|
@@ -10970,12 +10970,12 @@ function generateAxisTicks(range2, axis, defaultIntervals) {
|
|
|
10970
10970
|
(_, index) => range2.min + range2.span / defaultIntervals * index
|
|
10971
10971
|
);
|
|
10972
10972
|
}
|
|
10973
|
-
function generateMinorAxisTicks(range2,
|
|
10974
|
-
const minor = generateIntervalTicks(range2,
|
|
10973
|
+
function generateMinorAxisTicks(range2, axis2) {
|
|
10974
|
+
const minor = generateIntervalTicks(range2, axis2?.minorUnit ?? 0);
|
|
10975
10975
|
if (minor.length === 0) {
|
|
10976
10976
|
return [];
|
|
10977
10977
|
}
|
|
10978
|
-
const majorUnit =
|
|
10978
|
+
const majorUnit = axis2?.majorUnit;
|
|
10979
10979
|
if (!majorUnit || !Number.isFinite(majorUnit) || majorUnit <= 0) {
|
|
10980
10980
|
return minor;
|
|
10981
10981
|
}
|
|
@@ -10986,33 +10986,33 @@ function generateMinorAxisTicks(range2, axis) {
|
|
|
10986
10986
|
}
|
|
10987
10987
|
|
|
10988
10988
|
// chart/render/chart-view-axes.ts
|
|
10989
|
-
function chartAxisRatio(value, scale,
|
|
10990
|
-
const range2 =
|
|
10989
|
+
function chartAxisRatio(value, scale, axis2) {
|
|
10990
|
+
const range2 = axis2?.range;
|
|
10991
10991
|
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);
|
|
10992
10992
|
return range2?.reverseOrder ? 1 - ratio : ratio;
|
|
10993
10993
|
}
|
|
10994
|
-
function chartAxisLabels(
|
|
10995
|
-
return
|
|
10994
|
+
function chartAxisLabels(axis2) {
|
|
10995
|
+
return axis2?.source.deleted !== true && axis2?.source.tickLabelPosition !== "none";
|
|
10996
10996
|
}
|
|
10997
|
-
function options(
|
|
10997
|
+
function options(axis2) {
|
|
10998
10998
|
return {
|
|
10999
|
-
...
|
|
11000
|
-
...
|
|
11001
|
-
...
|
|
11002
|
-
...
|
|
10999
|
+
...axis2.scaling,
|
|
11000
|
+
...axis2.scaling.logBase === void 0 ? {} : { logScale: true },
|
|
11001
|
+
...axis2.majorUnit === void 0 ? {} : { majorUnit: axis2.majorUnit },
|
|
11002
|
+
...axis2.minorUnit === void 0 ? {} : { minorUnit: axis2.minorUnit }
|
|
11003
11003
|
};
|
|
11004
11004
|
}
|
|
11005
11005
|
function applyChartAxes(model, chart, color2) {
|
|
11006
11006
|
if (!chart.axes?.length) return;
|
|
11007
11007
|
const axes = chart.axes;
|
|
11008
|
-
const linked = axes.filter((
|
|
11008
|
+
const linked = axes.filter((axis2) => axis2.id !== void 0 && chart.axisIds?.includes(axis2.id));
|
|
11009
11009
|
const candidates = linked.length ? linked : axes;
|
|
11010
11010
|
const xy = model.type === "scatter" || model.type === "bubble";
|
|
11011
|
-
const value = candidates.find((
|
|
11011
|
+
const value = candidates.find((axis2) => axis2.kind === "val" && !["b", "t"].includes(axis2.position ?? "")) ?? candidates.find((axis2) => axis2.kind === "val");
|
|
11012
11012
|
const category = candidates.find(
|
|
11013
|
-
(
|
|
11013
|
+
(axis2) => xy ? axis2.kind === "val" && axis2 !== value : axis2.kind === "cat" || axis2.kind === "date"
|
|
11014
11014
|
);
|
|
11015
|
-
const secondary = axes.find((
|
|
11015
|
+
const secondary = axes.find((axis2) => axis2.kind === "val" && axis2 !== value && axis2 !== category);
|
|
11016
11016
|
const paint2 = (shape) => {
|
|
11017
11017
|
const ln = shape?.line;
|
|
11018
11018
|
const fill = ln?.fill;
|
|
@@ -11023,8 +11023,8 @@ function applyChartAxes(model, chart, color2) {
|
|
|
11023
11023
|
...ln?.dash === void 0 ? {} : { dash: ln.dash }
|
|
11024
11024
|
};
|
|
11025
11025
|
};
|
|
11026
|
-
const bind = (
|
|
11027
|
-
const opts = options(
|
|
11026
|
+
const bind = (axis2, scale, values) => {
|
|
11027
|
+
const opts = options(axis2);
|
|
11028
11028
|
const automatic = opts.logScale ? computeLogValueRange(
|
|
11029
11029
|
[{ values: values ?? [] }],
|
|
11030
11030
|
opts.logBase && Number.isFinite(opts.logBase) && opts.logBase > 1 ? opts.logBase : 10
|
|
@@ -11042,12 +11042,12 @@ function applyChartAxes(model, chart, color2) {
|
|
|
11042
11042
|
scale.ticks = generateAxisTicks(range2, opts, 5);
|
|
11043
11043
|
}
|
|
11044
11044
|
return {
|
|
11045
|
-
source:
|
|
11045
|
+
source: axis2,
|
|
11046
11046
|
range: range2,
|
|
11047
11047
|
minorTicks: generateMinorAxisTicks(range2, opts),
|
|
11048
|
-
line: paint2(
|
|
11049
|
-
majorGrid: paint2(
|
|
11050
|
-
minorGrid: paint2(
|
|
11048
|
+
line: paint2(axis2.spPr),
|
|
11049
|
+
majorGrid: paint2(axis2.majorGridlinesSpPr),
|
|
11050
|
+
minorGrid: paint2(axis2.minorGridlinesSpPr)
|
|
11051
11051
|
};
|
|
11052
11052
|
};
|
|
11053
11053
|
const out = {};
|
|
@@ -13682,13 +13682,13 @@ function scatter(model, area, out, size) {
|
|
|
13682
13682
|
s.values.forEach((_, i) => {
|
|
13683
13683
|
reach = Math.max(reach, radiusOf(s.sizes?.[i] ?? void 0) ?? 0);
|
|
13684
13684
|
});
|
|
13685
|
-
const widen = (s, length,
|
|
13686
|
-
if (
|
|
13685
|
+
const widen = (s, length, axis2) => {
|
|
13686
|
+
if (axis2?.range.logScale) return s;
|
|
13687
13687
|
const pad2 = reach * (s.max - s.min || 1) / Math.max(1, length - 2 * reach);
|
|
13688
13688
|
return {
|
|
13689
13689
|
...s,
|
|
13690
|
-
min:
|
|
13691
|
-
max:
|
|
13690
|
+
min: axis2?.source.scaling.min === void 0 ? s.min - pad2 : s.min,
|
|
13691
|
+
max: axis2?.source.scaling.max === void 0 ? s.max + pad2 : s.max
|
|
13692
13692
|
};
|
|
13693
13693
|
};
|
|
13694
13694
|
const xView = widen(xs, plot.w, model.axes?.category);
|
|
@@ -14825,124 +14825,124 @@ function editChartGradientFill(old, edit, defaultColor, toColor = identity) {
|
|
|
14825
14825
|
|
|
14826
14826
|
// chart/edit/axes.ts
|
|
14827
14827
|
function chartAxisAt(space, target) {
|
|
14828
|
-
const
|
|
14828
|
+
const axis2 = space.plotArea.axes.find(
|
|
14829
14829
|
(item, position) => typeof target === "string" ? item.kind === target : "index" in target ? position === target.index : item.id === target.id
|
|
14830
14830
|
);
|
|
14831
|
-
if (!
|
|
14832
|
-
return
|
|
14831
|
+
if (!axis2) throw new RangeError(`No chart axis ${JSON.stringify(target)}`);
|
|
14832
|
+
return axis2;
|
|
14833
14833
|
}
|
|
14834
|
-
function setNumber(
|
|
14834
|
+
function setNumber(axis2, key, value) {
|
|
14835
14835
|
if (value === void 0) return;
|
|
14836
14836
|
if (value !== null && !(Number.isFinite(value) && value > 0))
|
|
14837
14837
|
throw new RangeError(`Chart axis ${key} must be a positive number`);
|
|
14838
|
-
assignOrDelete(
|
|
14838
|
+
assignOrDelete(axis2, key, value ?? void 0);
|
|
14839
14839
|
}
|
|
14840
|
-
function applyAxis(
|
|
14841
|
-
if (edit.position !== void 0) assignOrDelete(
|
|
14840
|
+
function applyAxis(axis2, edit) {
|
|
14841
|
+
if (edit.position !== void 0) assignOrDelete(axis2, "position", edit.position ?? void 0);
|
|
14842
14842
|
if (edit.crossBetween !== void 0)
|
|
14843
|
-
assignOrDelete(
|
|
14844
|
-
if (edit.crossAxisId !== void 0)
|
|
14845
|
-
if (edit.visible !== void 0)
|
|
14843
|
+
assignOrDelete(axis2, "crossBetween", edit.crossBetween ?? void 0);
|
|
14844
|
+
if (edit.crossAxisId !== void 0) axis2.crossAxisId = edit.crossAxisId;
|
|
14845
|
+
if (edit.visible !== void 0) axis2.deleted = !edit.visible;
|
|
14846
14846
|
if (edit.title !== void 0)
|
|
14847
14847
|
assignOrDelete(
|
|
14848
|
-
|
|
14848
|
+
axis2,
|
|
14849
14849
|
"title",
|
|
14850
|
-
edit.title ? chartTitleWithText(
|
|
14850
|
+
edit.title ? chartTitleWithText(axis2.title, edit.title) : void 0
|
|
14851
14851
|
);
|
|
14852
14852
|
for (const key of ["min", "max"]) {
|
|
14853
14853
|
const value = edit[key];
|
|
14854
14854
|
if (value === void 0) continue;
|
|
14855
14855
|
if (value !== null && !Number.isFinite(value))
|
|
14856
14856
|
throw new RangeError(`Chart axis ${key} must be a finite number`);
|
|
14857
|
-
assignOrDelete(
|
|
14857
|
+
assignOrDelete(axis2.scaling, key, value ?? void 0);
|
|
14858
14858
|
}
|
|
14859
|
-
const { min, max } =
|
|
14859
|
+
const { min, max } = axis2.scaling;
|
|
14860
14860
|
if (min !== void 0 && max !== void 0 && min >= max)
|
|
14861
14861
|
throw new RangeError("Chart axis minimum must be less than its maximum");
|
|
14862
|
-
setNumber(
|
|
14863
|
-
setNumber(
|
|
14862
|
+
setNumber(axis2, "majorUnit", edit.majorUnit);
|
|
14863
|
+
setNumber(axis2, "minorUnit", edit.minorUnit);
|
|
14864
14864
|
if (edit.majorTimeUnit !== void 0)
|
|
14865
|
-
assignOrDelete(
|
|
14865
|
+
assignOrDelete(axis2, "majorTimeUnit", edit.majorTimeUnit ?? void 0);
|
|
14866
14866
|
if (edit.minorTimeUnit !== void 0)
|
|
14867
|
-
assignOrDelete(
|
|
14867
|
+
assignOrDelete(axis2, "minorTimeUnit", edit.minorTimeUnit ?? void 0);
|
|
14868
14868
|
if (edit.baseTimeUnit !== void 0)
|
|
14869
|
-
assignOrDelete(
|
|
14869
|
+
assignOrDelete(axis2, "baseTimeUnit", edit.baseTimeUnit ?? void 0);
|
|
14870
14870
|
if (edit.logBase !== void 0) {
|
|
14871
14871
|
if (edit.logBase !== null && !(edit.logBase >= 2 && edit.logBase <= 1e3))
|
|
14872
14872
|
throw new RangeError("Chart axis log base must be from 2 to 1000");
|
|
14873
|
-
assignOrDelete(
|
|
14873
|
+
assignOrDelete(axis2.scaling, "logBase", edit.logBase ?? void 0);
|
|
14874
14874
|
}
|
|
14875
|
-
if (edit.reverse !== void 0)
|
|
14875
|
+
if (edit.reverse !== void 0) axis2.scaling.orientation = edit.reverse ? "maxMin" : "minMax";
|
|
14876
14876
|
if (edit.numberFormat !== void 0)
|
|
14877
14877
|
assignOrDelete(
|
|
14878
|
-
|
|
14878
|
+
axis2,
|
|
14879
14879
|
"numberFormat",
|
|
14880
14880
|
edit.numberFormat ? { formatCode: edit.numberFormat, sourceLinked: edit.numberFormatSourceLinked ?? false } : void 0
|
|
14881
14881
|
);
|
|
14882
|
-
else if (edit.numberFormatSourceLinked !== void 0 &&
|
|
14883
|
-
|
|
14882
|
+
else if (edit.numberFormatSourceLinked !== void 0 && axis2.numberFormat)
|
|
14883
|
+
axis2.numberFormat.sourceLinked = edit.numberFormatSourceLinked;
|
|
14884
14884
|
for (const key of ["auto", "noMultiLevelLabels"])
|
|
14885
|
-
if (edit[key] !== void 0)
|
|
14885
|
+
if (edit[key] !== void 0) axis2[key] = edit[key];
|
|
14886
14886
|
if (edit.labelAlign !== void 0)
|
|
14887
|
-
assignOrDelete(
|
|
14887
|
+
assignOrDelete(axis2, "labelAlign", edit.labelAlign ?? void 0);
|
|
14888
14888
|
for (const key of ["labelOffset", "tickLabelSkip", "tickMarkSkip"]) {
|
|
14889
14889
|
const value = edit[key];
|
|
14890
14890
|
if (value === void 0) continue;
|
|
14891
14891
|
if (value !== null && (!Number.isInteger(value) || value < (key === "labelOffset" ? 0 : 1) || value > (key === "labelOffset" ? 1e3 : 2147483647)))
|
|
14892
14892
|
throw new RangeError(`Invalid chart axis ${key}`);
|
|
14893
|
-
assignOrDelete(
|
|
14893
|
+
assignOrDelete(axis2, key, value ?? void 0);
|
|
14894
14894
|
}
|
|
14895
|
-
if (edit.majorTickMark !== void 0)
|
|
14896
|
-
if (edit.minorTickMark !== void 0)
|
|
14897
|
-
if (edit.tickLabelPosition !== void 0)
|
|
14895
|
+
if (edit.majorTickMark !== void 0) axis2.majorTickMark = edit.majorTickMark;
|
|
14896
|
+
if (edit.minorTickMark !== void 0) axis2.minorTickMark = edit.minorTickMark;
|
|
14897
|
+
if (edit.tickLabelPosition !== void 0) axis2.tickLabelPosition = edit.tickLabelPosition;
|
|
14898
14898
|
if (edit.crosses !== void 0) {
|
|
14899
14899
|
if (typeof edit.crosses === "number") {
|
|
14900
|
-
delete
|
|
14901
|
-
|
|
14900
|
+
delete axis2.crosses;
|
|
14901
|
+
axis2.crossesAt = edit.crosses;
|
|
14902
14902
|
} else {
|
|
14903
|
-
delete
|
|
14904
|
-
|
|
14903
|
+
delete axis2.crossesAt;
|
|
14904
|
+
axis2.crosses = edit.crosses;
|
|
14905
14905
|
}
|
|
14906
14906
|
}
|
|
14907
14907
|
if (edit.majorGridlines !== void 0) {
|
|
14908
|
-
|
|
14909
|
-
if (!edit.majorGridlines) delete
|
|
14908
|
+
axis2.majorGridlines = edit.majorGridlines;
|
|
14909
|
+
if (!edit.majorGridlines) delete axis2.majorGridlinesSpPr;
|
|
14910
14910
|
}
|
|
14911
14911
|
if (edit.minorGridlines !== void 0) {
|
|
14912
|
-
|
|
14913
|
-
if (!edit.minorGridlines) delete
|
|
14912
|
+
axis2.minorGridlines = edit.minorGridlines;
|
|
14913
|
+
if (!edit.minorGridlines) delete axis2.minorGridlinesSpPr;
|
|
14914
14914
|
}
|
|
14915
14915
|
if (edit.displayUnits !== void 0) {
|
|
14916
|
-
if (
|
|
14916
|
+
if (axis2.kind !== "val") throw new RangeError("Only a value axis has display units");
|
|
14917
14917
|
const units2 = edit.displayUnits;
|
|
14918
14918
|
if (typeof units2 === "number" && (!Number.isFinite(units2) || units2 <= 0))
|
|
14919
14919
|
throw new RangeError("Custom chart display units must be a positive finite number");
|
|
14920
|
-
const { builtInUnit: _builtIn, customUnit: _custom, ...kept } =
|
|
14920
|
+
const { builtInUnit: _builtIn, customUnit: _custom, ...kept } = axis2.displayUnits ?? {};
|
|
14921
14921
|
assignOrDelete(
|
|
14922
|
-
|
|
14922
|
+
axis2,
|
|
14923
14923
|
"displayUnits",
|
|
14924
14924
|
units2 === null ? void 0 : typeof units2 === "number" ? { ...kept, customUnit: units2 } : { ...kept, builtInUnit: units2 }
|
|
14925
14925
|
);
|
|
14926
14926
|
}
|
|
14927
14927
|
}
|
|
14928
14928
|
function setChartAxis(space, target, edit) {
|
|
14929
|
-
if (edit.crossAxisId !== void 0 && !space.plotArea.axes.some((
|
|
14929
|
+
if (edit.crossAxisId !== void 0 && !space.plotArea.axes.some((axis2) => axis2.id === edit.crossAxisId))
|
|
14930
14930
|
throw new RangeError("The crossing axis does not exist");
|
|
14931
14931
|
return editChartSpace(space, (draft) => applyAxis(chartAxisAt(draft, target), edit));
|
|
14932
14932
|
}
|
|
14933
14933
|
function setChartGridlineShape(space, target, which, shape) {
|
|
14934
14934
|
return editChartSpace(space, (draft) => {
|
|
14935
|
-
const
|
|
14935
|
+
const axis2 = chartAxisAt(draft, target);
|
|
14936
14936
|
const key = which === "major" ? "majorGridlinesSpPr" : "minorGridlinesSpPr";
|
|
14937
14937
|
if (shape === null) {
|
|
14938
|
-
delete
|
|
14938
|
+
delete axis2[key];
|
|
14939
14939
|
return;
|
|
14940
14940
|
}
|
|
14941
|
-
const next = { ...
|
|
14941
|
+
const next = { ...axis2[key] };
|
|
14942
14942
|
if (shape.line !== void 0) next.line = structuredClone(shape.line);
|
|
14943
14943
|
if (shape.fill !== void 0) next.fill = structuredClone(shape.fill);
|
|
14944
|
-
|
|
14945
|
-
|
|
14944
|
+
axis2[key] = next;
|
|
14945
|
+
axis2[which === "major" ? "majorGridlines" : "minorGridlines"] = true;
|
|
14946
14946
|
});
|
|
14947
14947
|
}
|
|
14948
14948
|
|
|
@@ -15150,10 +15150,10 @@ function chartTargetDraftShapes(draft, target) {
|
|
|
15150
15150
|
return [chartAxisAt(draft, { index: target.axisIndex }).spPr ??= {}];
|
|
15151
15151
|
case "majorGridlines":
|
|
15152
15152
|
case "minorGridlines": {
|
|
15153
|
-
const
|
|
15153
|
+
const axis2 = chartAxisAt(draft, { index: target.axisIndex });
|
|
15154
15154
|
const major = target.kind === "majorGridlines";
|
|
15155
|
-
|
|
15156
|
-
return [
|
|
15155
|
+
axis2[major ? "majorGridlines" : "minorGridlines"] = true;
|
|
15156
|
+
return [axis2[major ? "majorGridlinesSpPr" : "minorGridlinesSpPr"] ??= {}];
|
|
15157
15157
|
}
|
|
15158
15158
|
case "dataLabels": {
|
|
15159
15159
|
if (target.seriesIndex === void 0) {
|
|
@@ -16483,9 +16483,9 @@ var CATEGORY_ONLY = [
|
|
|
16483
16483
|
"minorTimeUnit"
|
|
16484
16484
|
];
|
|
16485
16485
|
var VALUE_ONLY = ["crossBetween", "displayUnits"];
|
|
16486
|
-
function convertChartAxis(
|
|
16487
|
-
if (
|
|
16488
|
-
const next = structuredClone(
|
|
16486
|
+
function convertChartAxis(axis2, kind) {
|
|
16487
|
+
if (axis2.kind === kind) return axis2;
|
|
16488
|
+
const next = structuredClone(axis2);
|
|
16489
16489
|
next.kind = kind;
|
|
16490
16490
|
if (kind === "val") {
|
|
16491
16491
|
for (const key of CATEGORY_ONLY) delete next[key];
|
|
@@ -16518,7 +16518,7 @@ var SWITCHABLE = {
|
|
|
16518
16518
|
stock: false,
|
|
16519
16519
|
surface: true
|
|
16520
16520
|
};
|
|
16521
|
-
function
|
|
16521
|
+
function chartGroupElement(kind, is3D) {
|
|
16522
16522
|
const match = Object.entries(CHART_GROUP_ELEMENTS).find(
|
|
16523
16523
|
([, value]) => value.kind === kind && value.is3D === is3D
|
|
16524
16524
|
);
|
|
@@ -16534,7 +16534,7 @@ function groupingFor(element2, grouping) {
|
|
|
16534
16534
|
var horizontalBars = (group2) => group2.kind === "bar" && group2.barDirection === "bar";
|
|
16535
16535
|
function newGroup(base, target, series2) {
|
|
16536
16536
|
const is3D = target.is3D ?? (base.is3D && SWITCHABLE[target.kind] === true);
|
|
16537
|
-
const element2 =
|
|
16537
|
+
const element2 = chartGroupElement(target.kind, is3D);
|
|
16538
16538
|
const group2 = { kind: target.kind, element: element2, is3D, series: series2, axisIds: [] };
|
|
16539
16539
|
const allowed = GROUP_FIELDS[element2] ?? [];
|
|
16540
16540
|
for (const key of allowed)
|
|
@@ -16560,11 +16560,11 @@ function newGroup(base, target, series2) {
|
|
|
16560
16560
|
return group2;
|
|
16561
16561
|
}
|
|
16562
16562
|
function withSeriesAxis(space, group2, axes) {
|
|
16563
|
-
if ((group2.element === "line3DChart" || group2.kind === "surface") && !axes.some((
|
|
16563
|
+
if ((group2.element === "line3DChart" || group2.kind === "surface") && !axes.some((axis2) => axis2.kind === "ser")) {
|
|
16564
16564
|
const id = Math.max(
|
|
16565
16565
|
0,
|
|
16566
16566
|
...[...space.plotArea.axes, ...axes].flatMap(
|
|
16567
|
-
(
|
|
16567
|
+
(axis2) => axis2.id === void 0 ? [] : [axis2.id]
|
|
16568
16568
|
)
|
|
16569
16569
|
) + 1;
|
|
16570
16570
|
axes.push({
|
|
@@ -16584,11 +16584,11 @@ function withSeriesAxis(space, group2, axes) {
|
|
|
16584
16584
|
function groupAxes(space, base, group2) {
|
|
16585
16585
|
if (!groupHasAxes(group2.element)) return [];
|
|
16586
16586
|
const xy = isXYChartKind(group2.kind);
|
|
16587
|
-
const byId = (id) => space.plotArea.axes.find((
|
|
16588
|
-
const old = base.axisIds.map(byId).filter((
|
|
16587
|
+
const byId = (id) => space.plotArea.axes.find((axis2) => axis2.id === id);
|
|
16588
|
+
const old = base.axisIds.map(byId).filter((axis2) => axis2 !== void 0);
|
|
16589
16589
|
if (old.length < 2) {
|
|
16590
16590
|
const taken = new Set(
|
|
16591
|
-
space.plotArea.axes.flatMap((
|
|
16591
|
+
space.plotArea.axes.flatMap((axis2) => axis2.id === void 0 ? [] : [axis2.id])
|
|
16592
16592
|
);
|
|
16593
16593
|
const free = DEFAULT_CHART_AXIS_IDS.every((id) => !taken.has(id));
|
|
16594
16594
|
const top = Math.max(0, ...taken);
|
|
@@ -16596,9 +16596,9 @@ function groupAxes(space, base, group2) {
|
|
|
16596
16596
|
return withSeriesAxis(space, group2, defaultChartAxes(horizontalBars(group2), xy, ids));
|
|
16597
16597
|
}
|
|
16598
16598
|
const rotate = horizontalBars(base) !== horizontalBars(group2);
|
|
16599
|
-
const axes = old.slice(0, group2.element === "line3DChart" || group2.is3D ? 3 : 2).map((
|
|
16600
|
-
const kind = i === 0 ? xy ? "val" :
|
|
16601
|
-
const next = convertChartAxis(
|
|
16599
|
+
const axes = old.slice(0, group2.element === "line3DChart" || group2.is3D ? 3 : 2).map((axis2, i) => {
|
|
16600
|
+
const kind = i === 0 ? xy ? "val" : axis2.kind === "val" ? "cat" : axis2.kind : axis2.kind;
|
|
16601
|
+
const next = convertChartAxis(axis2, kind);
|
|
16602
16602
|
if (rotate) assignOrDelete(next, "position", rotatedAxisPosition(next.position));
|
|
16603
16603
|
if (i === 1 && next.kind === "val" && xy !== isXYChartKind(base.kind))
|
|
16604
16604
|
next.crossBetween = xy ? "midCat" : "between";
|
|
@@ -16623,7 +16623,7 @@ function setChartType(space, target) {
|
|
|
16623
16623
|
if (group2.is3D && target.kind === "bar" && group2.grouping === "standard" && base.axisIds.length < 3)
|
|
16624
16624
|
group2.grouping = "clustered";
|
|
16625
16625
|
const axes = groupAxes(draft, base, group2);
|
|
16626
|
-
group2.axisIds = axes.flatMap((
|
|
16626
|
+
group2.axisIds = axes.flatMap((axis2) => axis2.id === void 0 ? [] : [axis2.id]);
|
|
16627
16627
|
draft.plotArea.groups = [group2];
|
|
16628
16628
|
draft.plotArea.axes = axes;
|
|
16629
16629
|
if (!group2.is3D) {
|
|
@@ -16759,15 +16759,15 @@ function chartSupportsQuickLayout(space) {
|
|
|
16759
16759
|
return !!group2 && CHART_QUICK_LAYOUT_KINDS.has(group2.kind);
|
|
16760
16760
|
}
|
|
16761
16761
|
function applyAxes(draft, layout) {
|
|
16762
|
-
for (const
|
|
16763
|
-
const value =
|
|
16764
|
-
if (!value &&
|
|
16762
|
+
for (const axis2 of draft.plotArea.axes) {
|
|
16763
|
+
const value = axis2.kind === "val";
|
|
16764
|
+
if (!value && axis2.kind !== "cat" && axis2.kind !== "date") continue;
|
|
16765
16765
|
const titled = value ? layout.valAxisTitle : layout.catAxisTitle;
|
|
16766
|
-
if (!titled) delete
|
|
16767
|
-
else
|
|
16768
|
-
|
|
16769
|
-
|
|
16770
|
-
|
|
16766
|
+
if (!titled) delete axis2.title;
|
|
16767
|
+
else axis2.title ??= newChartTitle(CHART_QUICK_LAYOUT_AXIS_TITLE);
|
|
16768
|
+
axis2.majorGridlines = value && layout.majorGridlines;
|
|
16769
|
+
axis2.minorGridlines = value && layout.minorGridlines;
|
|
16770
|
+
axis2.deleted = value ? !layout.valueAxis : false;
|
|
16771
16771
|
}
|
|
16772
16772
|
}
|
|
16773
16773
|
function applyDataTable(draft, layout) {
|
|
@@ -16818,8 +16818,8 @@ function applyChartQuickLayout(space, n2, only = ALL_PARTS) {
|
|
|
16818
16818
|
}
|
|
16819
16819
|
function matches(space, layout) {
|
|
16820
16820
|
const axes = space.plotArea.axes;
|
|
16821
|
-
const val = axes.find((
|
|
16822
|
-
const cat = axes.find((
|
|
16821
|
+
const val = axes.find((axis2) => axis2.kind === "val");
|
|
16822
|
+
const cat = axes.find((axis2) => axis2.kind === "cat" || axis2.kind === "date");
|
|
16823
16823
|
const bar = space.plotArea.groups.find((group2) => group2.kind === "bar");
|
|
16824
16824
|
const labels2 = space.plotArea.groups.some(
|
|
16825
16825
|
(group2) => group2.dataLabels && group2.dataLabels.deleted !== true && group2.dataLabels.showValue
|
|
@@ -16877,6 +16877,12 @@ var RANGES = {
|
|
|
16877
16877
|
firstSliceAngle: [0, 360],
|
|
16878
16878
|
holeSize: [1, 90]
|
|
16879
16879
|
};
|
|
16880
|
+
var isChartGroupOption = (key) => Object.hasOwn(RANGES, key);
|
|
16881
|
+
function assertChartGroupOption(key, value) {
|
|
16882
|
+
const [min, max] = RANGES[key];
|
|
16883
|
+
if (!Number.isInteger(value) || value < min || value > max)
|
|
16884
|
+
throw new RangeError(`Chart ${key} must be a whole number from ${min} to ${max}`);
|
|
16885
|
+
}
|
|
16880
16886
|
function setChartGroupOptions(space, seriesIndex, edit) {
|
|
16881
16887
|
return editChartSpace(space, (draft) => {
|
|
16882
16888
|
const { group: group2 } = chartSeriesEntryAt(draft, seriesIndex);
|
|
@@ -16889,9 +16895,7 @@ function setChartGroupOptions(space, seriesIndex, edit) {
|
|
|
16889
16895
|
delete group2[key];
|
|
16890
16896
|
continue;
|
|
16891
16897
|
}
|
|
16892
|
-
|
|
16893
|
-
if (!Number.isInteger(value) || value < min || value > max)
|
|
16894
|
-
throw new RangeError(`Chart ${key} must be a whole number from ${min} to ${max}`);
|
|
16898
|
+
assertChartGroupOption(key, value);
|
|
16895
16899
|
group2[key] = value;
|
|
16896
16900
|
}
|
|
16897
16901
|
});
|
|
@@ -17224,9 +17228,9 @@ function setChartView3D(space, edit) {
|
|
|
17224
17228
|
|
|
17225
17229
|
// chart/edit/secondary-axis.ts
|
|
17226
17230
|
function axisPair(space, group2) {
|
|
17227
|
-
if (group2.axisIds.length !== 2 || new Set(space.plotArea.axes.map((
|
|
17231
|
+
if (group2.axisIds.length !== 2 || new Set(space.plotArea.axes.map((axis2) => axis2.id)).size !== space.plotArea.axes.length)
|
|
17228
17232
|
return void 0;
|
|
17229
|
-
const [x, y] = group2.axisIds.map((id) => space.plotArea.axes.find((
|
|
17233
|
+
const [x, y] = group2.axisIds.map((id) => space.plotArea.axes.find((axis2) => axis2.id === id));
|
|
17230
17234
|
return x && y && ["cat", "date"].includes(x.kind) && y.kind === "val" && x.crossAxisId === y.id && y.crossAxisId === x.id ? [x, y] : void 0;
|
|
17231
17235
|
}
|
|
17232
17236
|
function chartSeriesSecondaryAxisSupported(space, seriesIndex) {
|
|
@@ -17255,7 +17259,7 @@ function isolateSeries(space, index) {
|
|
|
17255
17259
|
space.plotArea.groups.splice(groupIndex, 1, ...segments);
|
|
17256
17260
|
return chartSeriesEntryAt(space, index).group;
|
|
17257
17261
|
}
|
|
17258
|
-
function setChartSeriesSecondaryAxis(space, seriesIndex, secondary) {
|
|
17262
|
+
function setChartSeriesSecondaryAxis(space, seriesIndex, secondary, options2 = {}) {
|
|
17259
17263
|
if (!chartSeriesSecondaryAxisSupported(space, seriesIndex))
|
|
17260
17264
|
throw new RangeError(
|
|
17261
17265
|
"Secondary-axis editing needs a later series in a supported vertical 2D chart"
|
|
@@ -17269,12 +17273,12 @@ function setChartSeriesSecondaryAxis(space, seriesIndex, secondary) {
|
|
|
17269
17273
|
return;
|
|
17270
17274
|
}
|
|
17271
17275
|
if (group2.axisIds[1] !== primary.axisIds[1]) return;
|
|
17272
|
-
const existing = draft.plotArea.axes.filter((
|
|
17276
|
+
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]);
|
|
17273
17277
|
if (existing) {
|
|
17274
|
-
group2.axisIds = existing.map((
|
|
17278
|
+
group2.axisIds = existing.map((axis2) => axis2.id);
|
|
17275
17279
|
return;
|
|
17276
17280
|
}
|
|
17277
|
-
const used = new Set(draft.plotArea.axes.map((
|
|
17281
|
+
const used = new Set(draft.plotArea.axes.map((axis2) => axis2.id));
|
|
17278
17282
|
const allocate = () => {
|
|
17279
17283
|
let id = 500000003;
|
|
17280
17284
|
while (used.has(id)) id++;
|
|
@@ -17282,7 +17286,9 @@ function setChartSeriesSecondaryAxis(space, seriesIndex, secondary) {
|
|
|
17282
17286
|
used.add(id);
|
|
17283
17287
|
return id;
|
|
17284
17288
|
};
|
|
17285
|
-
const ids = [allocate(), allocate()];
|
|
17289
|
+
const ids = options2.axisIds ? [...options2.axisIds] : [allocate(), allocate()];
|
|
17290
|
+
if (options2.axisIds && (ids[0] === ids[1] || ids.some((id) => used.has(id) || !Number.isSafeInteger(id) || id < 0 || id > 4294967295)))
|
|
17291
|
+
throw new RangeError("Secondary axis ids must be two unused whole numbers");
|
|
17286
17292
|
const horizontal = primary.barDirection === "bar";
|
|
17287
17293
|
const axes = defaultChartAxes(horizontal, false, ids);
|
|
17288
17294
|
axes[0] = { ...structuredClone(axisPair(draft, primary)[0]), id: ids[0], crossAxisId: ids[1] };
|
|
@@ -17428,6 +17434,58 @@ function applyChartSpaceDataSheetEdits(space, edits) {
|
|
|
17428
17434
|
return editChartSpace(next, (draft) => applyStandardChartLayout(draft, layoutSheet, count));
|
|
17429
17435
|
}
|
|
17430
17436
|
|
|
17437
|
+
// chart/edit/new-chart-minimal.ts
|
|
17438
|
+
var VARIED = /* @__PURE__ */ new Set(["pie", "doughnut", "ofPie"]);
|
|
17439
|
+
function schemaGrouping(element2, grouping) {
|
|
17440
|
+
const bar = element2 === "barChart" || element2 === "bar3DChart";
|
|
17441
|
+
if (bar) return grouping ?? "clustered";
|
|
17442
|
+
return grouping === void 0 || grouping === "clustered" ? "standard" : grouping;
|
|
17443
|
+
}
|
|
17444
|
+
function minimalChartGroup(target, series2) {
|
|
17445
|
+
const is3D = target.is3D ?? false;
|
|
17446
|
+
const element2 = chartGroupElement(target.kind, is3D);
|
|
17447
|
+
const allowed = GROUP_FIELDS[element2] ?? [];
|
|
17448
|
+
const own = isXYChartKind(target.kind) ? series2.map((item) => stripSeriesForKind(item, "bar", target.kind)) : series2;
|
|
17449
|
+
const group2 = { kind: target.kind, element: element2, is3D, series: own, axisIds: [] };
|
|
17450
|
+
if (target.kind === "bar") group2.barDirection = target.barDirection ?? "col";
|
|
17451
|
+
if (allowed.includes("grouping")) group2.grouping = schemaGrouping(element2, target.grouping);
|
|
17452
|
+
if (allowed.includes("varyColors")) group2.varyColors = VARIED.has(target.kind);
|
|
17453
|
+
if (target.kind === "ofPie") group2.ofPieType = "pie";
|
|
17454
|
+
if (target.kind === "scatter") group2.scatterStyle = "lineMarker";
|
|
17455
|
+
if (target.kind === "radar") group2.radarStyle = "marker";
|
|
17456
|
+
return group2;
|
|
17457
|
+
}
|
|
17458
|
+
function axis(kind, id, crossAxisId, position) {
|
|
17459
|
+
return {
|
|
17460
|
+
kind,
|
|
17461
|
+
id,
|
|
17462
|
+
crossAxisId,
|
|
17463
|
+
position,
|
|
17464
|
+
scaling: { orientation: "minMax" },
|
|
17465
|
+
deleted: false,
|
|
17466
|
+
majorGridlines: false,
|
|
17467
|
+
minorGridlines: false
|
|
17468
|
+
};
|
|
17469
|
+
}
|
|
17470
|
+
function minimalChartAxes(group2, ids) {
|
|
17471
|
+
if (!groupHasAxes(group2.element)) return [];
|
|
17472
|
+
const [first2, second, third] = ids;
|
|
17473
|
+
const horizontal = group2.kind === "bar" && group2.barDirection === "bar";
|
|
17474
|
+
const axes = [
|
|
17475
|
+
axis(isXYChartKind(group2.kind) ? "val" : "cat", first2, second, horizontal ? "l" : "b"),
|
|
17476
|
+
axis("val", second, first2, horizontal ? "b" : "l")
|
|
17477
|
+
];
|
|
17478
|
+
if (group2.element === "line3DChart" || group2.kind === "surface")
|
|
17479
|
+
axes.push(axis("ser", third, second, "b"));
|
|
17480
|
+
return axes;
|
|
17481
|
+
}
|
|
17482
|
+
function minimalChartTitle(text2) {
|
|
17483
|
+
const rich = chartTextBodyFromXml(
|
|
17484
|
+
`<a:bodyPr/><a:lstStyle/><a:p><a:r><a:t>${escapeText(text2)}</a:t></a:r></a:p>`
|
|
17485
|
+
);
|
|
17486
|
+
return { tx: { rich, text: rich.text }, text: rich.text, overlay: false };
|
|
17487
|
+
}
|
|
17488
|
+
|
|
17431
17489
|
// chart/edit/new-chart.ts
|
|
17432
17490
|
var DEFAULT_CHART_DATA_SHEET = {
|
|
17433
17491
|
categories: ["Category 1", "Category 2", "Category 3", "Category 4"],
|
|
@@ -17437,21 +17495,84 @@ var DEFAULT_CHART_DATA_SHEET = {
|
|
|
17437
17495
|
{ name: "Series 3", values: [2, 2, 3, 5] }
|
|
17438
17496
|
]
|
|
17439
17497
|
};
|
|
17440
|
-
|
|
17498
|
+
var CATEGORY_ONLY2 = [
|
|
17499
|
+
"labelAlign",
|
|
17500
|
+
"noMultiLevelLabels",
|
|
17501
|
+
"tickLabelSkip",
|
|
17502
|
+
"tickMarkSkip"
|
|
17503
|
+
];
|
|
17504
|
+
function withDateAxis(space) {
|
|
17505
|
+
return editChartSpace(space, (draft) => {
|
|
17506
|
+
const axis2 = draft.plotArea.axes[0];
|
|
17507
|
+
if (axis2?.kind !== "cat") return;
|
|
17508
|
+
axis2.kind = "date";
|
|
17509
|
+
for (const key of CATEGORY_ONLY2) delete axis2[key];
|
|
17510
|
+
});
|
|
17511
|
+
}
|
|
17512
|
+
function series(sheet, index, options2, sheetName) {
|
|
17441
17513
|
const entry3 = sheet.series[index];
|
|
17514
|
+
if (options2.data === "literal")
|
|
17515
|
+
return {
|
|
17516
|
+
index,
|
|
17517
|
+
order: index,
|
|
17518
|
+
tx: { value: entry3.name, text: entry3.name },
|
|
17519
|
+
...options2.profile === "minimal" ? {} : { invertIfNegative: false },
|
|
17520
|
+
dataPoints: [],
|
|
17521
|
+
categories: categorySource(sheet.categories, void 0),
|
|
17522
|
+
values: numberSource(entry3.values, void 0)
|
|
17523
|
+
};
|
|
17442
17524
|
const formulas = standardChartFormulas(sheetName, index, sheet.categories.length);
|
|
17443
17525
|
return {
|
|
17444
17526
|
index,
|
|
17445
17527
|
order: index,
|
|
17446
17528
|
tx: { reference: categorySource([entry3.name], void 0, formulas.name), text: entry3.name },
|
|
17447
|
-
invertIfNegative: false,
|
|
17529
|
+
...options2.profile === "minimal" ? {} : { invertIfNegative: false },
|
|
17448
17530
|
dataPoints: [],
|
|
17449
17531
|
categories: categorySource(sheet.categories, void 0, formulas.categories),
|
|
17450
17532
|
values: numberSource(entry3.values, void 0, formulas.values)
|
|
17451
17533
|
};
|
|
17452
17534
|
}
|
|
17453
|
-
function
|
|
17454
|
-
const
|
|
17535
|
+
function axisIds(options2) {
|
|
17536
|
+
const ids = options2.axisIds ?? [];
|
|
17537
|
+
const [first2, second, third] = [
|
|
17538
|
+
ids[0] ?? DEFAULT_CHART_AXIS_IDS[0],
|
|
17539
|
+
ids[1] ?? DEFAULT_CHART_AXIS_IDS[1],
|
|
17540
|
+
ids[2] ?? DEFAULT_CHART_AXIS_IDS[1] + 1
|
|
17541
|
+
];
|
|
17542
|
+
for (const id of [first2, second, third])
|
|
17543
|
+
if (!Number.isSafeInteger(id) || id < 0)
|
|
17544
|
+
throw new RangeError("Chart axis ids must be non-negative whole numbers");
|
|
17545
|
+
if ((/* @__PURE__ */ new Set([first2, second, third])).size !== 3)
|
|
17546
|
+
throw new RangeError("Chart axis ids must differ");
|
|
17547
|
+
return [first2, second, third];
|
|
17548
|
+
}
|
|
17549
|
+
function withAxisIds(space, ids) {
|
|
17550
|
+
return editChartSpace(space, (draft) => {
|
|
17551
|
+
const map = /* @__PURE__ */ new Map();
|
|
17552
|
+
draft.plotArea.axes.forEach((axis2, position) => {
|
|
17553
|
+
if (axis2.id !== void 0 && ids[position] !== void 0) map.set(axis2.id, ids[position]);
|
|
17554
|
+
});
|
|
17555
|
+
const renumber = (id) => map.get(id) ?? id;
|
|
17556
|
+
for (const axis2 of draft.plotArea.axes) {
|
|
17557
|
+
if (axis2.id !== void 0) axis2.id = renumber(axis2.id);
|
|
17558
|
+
if (axis2.crossAxisId !== void 0) axis2.crossAxisId = renumber(axis2.crossAxisId);
|
|
17559
|
+
}
|
|
17560
|
+
for (const group2 of draft.plotArea.groups) group2.axisIds = group2.axisIds.map(renumber);
|
|
17561
|
+
});
|
|
17562
|
+
}
|
|
17563
|
+
function withGroupSettings(space, settings) {
|
|
17564
|
+
return editChartSpace(space, (draft) => {
|
|
17565
|
+
const group2 = draft.plotArea.groups[0];
|
|
17566
|
+
const allowed = GROUP_FIELDS[group2.element] ?? [];
|
|
17567
|
+
for (const [key, value] of Object.entries(settings)) {
|
|
17568
|
+
if (value === void 0) continue;
|
|
17569
|
+
if (!allowed.includes(key)) throw new RangeError(`A ${group2.element} has no ${key} setting`);
|
|
17570
|
+
if (isChartGroupOption(key)) assertChartGroupOption(key, value);
|
|
17571
|
+
Object.assign(group2, { [key]: structuredClone(value) });
|
|
17572
|
+
}
|
|
17573
|
+
});
|
|
17574
|
+
}
|
|
17575
|
+
function officeChartSpace(sheet, target, options2, sheetName) {
|
|
17455
17576
|
const group2 = {
|
|
17456
17577
|
kind: "bar",
|
|
17457
17578
|
element: "barChart",
|
|
@@ -17461,10 +17582,10 @@ function newChartSpace(sheet = DEFAULT_CHART_DATA_SHEET, target, options2 = {})
|
|
|
17461
17582
|
varyColors: false,
|
|
17462
17583
|
gapWidth: 219,
|
|
17463
17584
|
overlap: -27,
|
|
17464
|
-
series: sheet.series.map((_, index) => series(sheet, index, sheetName)),
|
|
17585
|
+
series: sheet.series.map((_, index) => series(sheet, index, options2, sheetName)),
|
|
17465
17586
|
axisIds: [...DEFAULT_CHART_AXIS_IDS]
|
|
17466
17587
|
};
|
|
17467
|
-
|
|
17588
|
+
const space = {
|
|
17468
17589
|
roundedCorners: false,
|
|
17469
17590
|
autoTitleDeleted: options2.title === void 0,
|
|
17470
17591
|
plotArea: { layout: {}, groups: [group2], axes: defaultChartAxes(false, false) },
|
|
@@ -17473,9 +17594,36 @@ function newChartSpace(sheet = DEFAULT_CHART_DATA_SHEET, target, options2 = {})
|
|
|
17473
17594
|
};
|
|
17474
17595
|
const column = !target || target.kind === "bar" && (target.barDirection ?? "col") === "col";
|
|
17475
17596
|
if (target && !(column && !target.is3D && (target.grouping ?? "clustered") === "clustered"))
|
|
17476
|
-
|
|
17477
|
-
|
|
17478
|
-
|
|
17597
|
+
return setChartType(space, target);
|
|
17598
|
+
return space;
|
|
17599
|
+
}
|
|
17600
|
+
function minimalChartSpace(sheet, target, options2, sheetName) {
|
|
17601
|
+
const group2 = minimalChartGroup(
|
|
17602
|
+
target ?? { kind: "bar" },
|
|
17603
|
+
sheet.series.map((_, index) => series(sheet, index, options2, sheetName))
|
|
17604
|
+
);
|
|
17605
|
+
if (group2.kind === "stock" && ![3, 4].includes(group2.series.length))
|
|
17606
|
+
throw new RangeError("A stock chart requires three or four price series");
|
|
17607
|
+
const axes = minimalChartAxes(group2, axisIds(options2));
|
|
17608
|
+
group2.axisIds = axes.flatMap((axis2) => axis2.id === void 0 ? [] : [axis2.id]);
|
|
17609
|
+
return {
|
|
17610
|
+
autoTitleDeleted: options2.title === void 0,
|
|
17611
|
+
plotArea: { layout: {}, groups: [group2], axes },
|
|
17612
|
+
plotVisibleOnly: true,
|
|
17613
|
+
displayBlanksAs: "gap"
|
|
17614
|
+
};
|
|
17615
|
+
}
|
|
17616
|
+
function newChartSpace(sheet = DEFAULT_CHART_DATA_SHEET, target, options2 = {}) {
|
|
17617
|
+
const sheetName = options2.sheetName ?? DEFAULT_CHART_SHEET_NAME;
|
|
17618
|
+
let space = options2.profile === "minimal" ? minimalChartSpace(sheet, target, options2, sheetName) : officeChartSpace(sheet, target, options2, sheetName);
|
|
17619
|
+
if (options2.profile !== "minimal" && options2.axisIds !== void 0)
|
|
17620
|
+
space = withAxisIds(space, axisIds(options2));
|
|
17621
|
+
if (options2.dateAxis) space = withDateAxis(space);
|
|
17622
|
+
if (options2.group) space = withGroupSettings(space, options2.group);
|
|
17623
|
+
if (options2.title !== void 0)
|
|
17624
|
+
space = options2.profile === "minimal" ? { ...space, title: minimalChartTitle(options2.title), autoTitleDeleted: false } : setChartTitle(space, options2.title);
|
|
17625
|
+
const legend = options2.legendPosition === void 0 ? "b" : options2.legendPosition;
|
|
17626
|
+
return legend === null ? space : setChartLegend(space, { position: legend });
|
|
17479
17627
|
}
|
|
17480
17628
|
|
|
17481
17629
|
// chart/edit/apply-appearance.ts
|
|
@@ -17603,21 +17751,21 @@ function chartExStyleSpace(space) {
|
|
|
17603
17751
|
} : {},
|
|
17604
17752
|
plotArea: {
|
|
17605
17753
|
...styles(space.plotArea),
|
|
17606
|
-
axes: space.plotArea.axes.map((
|
|
17607
|
-
kind:
|
|
17754
|
+
axes: space.plotArea.axes.map((axis2) => ({
|
|
17755
|
+
kind: axis2.scaling?.kind ?? "val",
|
|
17608
17756
|
scaling: {},
|
|
17609
|
-
...styles(
|
|
17610
|
-
...
|
|
17757
|
+
...styles(axis2),
|
|
17758
|
+
...axis2.title ? {
|
|
17611
17759
|
title: {
|
|
17612
|
-
...styles(
|
|
17613
|
-
...
|
|
17760
|
+
...styles(axis2.title),
|
|
17761
|
+
...axis2.title.tx?.rich ? { tx: { rich: axis2.title.tx.rich, text: axis2.title.tx.rich.text } } : {}
|
|
17614
17762
|
}
|
|
17615
17763
|
} : {},
|
|
17616
|
-
...
|
|
17617
|
-
majorGridlines: !!
|
|
17618
|
-
minorGridlines: !!
|
|
17619
|
-
...
|
|
17620
|
-
...
|
|
17764
|
+
...axis2.id === void 0 ? {} : { id: axis2.id },
|
|
17765
|
+
majorGridlines: !!axis2.majorGridlines,
|
|
17766
|
+
minorGridlines: !!axis2.minorGridlines,
|
|
17767
|
+
...axis2.majorGridlines?.spPr ? { majorGridlinesSpPr: axis2.majorGridlines.spPr } : {},
|
|
17768
|
+
...axis2.minorGridlines?.spPr ? { minorGridlinesSpPr: axis2.minorGridlines.spPr } : {}
|
|
17621
17769
|
})),
|
|
17622
17770
|
groups: space.plotArea.series.map((series2) => ({
|
|
17623
17771
|
kind: "bar",
|
|
@@ -17653,19 +17801,19 @@ function editChartExStyle(space, operation) {
|
|
|
17653
17801
|
if (after.title.tx?.rich) draft.title.tx = { ...draft.title.tx, rich: after.title.tx.rich };
|
|
17654
17802
|
}
|
|
17655
17803
|
if (draft.legend && after.legend) copyStyle(draft.legend, after.legend);
|
|
17656
|
-
draft.plotArea.axes.forEach((
|
|
17804
|
+
draft.plotArea.axes.forEach((axis2, index) => {
|
|
17657
17805
|
const edited = after.plotArea.axes[index];
|
|
17658
17806
|
if (!edited) return;
|
|
17659
|
-
copyStyle(
|
|
17660
|
-
if (
|
|
17661
|
-
copyStyle(
|
|
17662
|
-
if (edited.title.tx?.rich)
|
|
17807
|
+
copyStyle(axis2, edited);
|
|
17808
|
+
if (axis2.title && edited.title) {
|
|
17809
|
+
copyStyle(axis2.title, edited.title);
|
|
17810
|
+
if (edited.title.tx?.rich) axis2.title.tx = { ...axis2.title.tx, rich: edited.title.tx.rich };
|
|
17663
17811
|
}
|
|
17664
17812
|
for (const key of ["majorGridlines", "minorGridlines"]) {
|
|
17665
17813
|
const shape = edited[key === "majorGridlines" ? "majorGridlinesSpPr" : "minorGridlinesSpPr"];
|
|
17666
17814
|
if (shape) {
|
|
17667
|
-
|
|
17668
|
-
|
|
17815
|
+
axis2[key] ??= {};
|
|
17816
|
+
axis2[key].spPr = structuredClone(shape);
|
|
17669
17817
|
}
|
|
17670
17818
|
}
|
|
17671
17819
|
});
|
|
@@ -17710,10 +17858,10 @@ function shapes(space, target) {
|
|
|
17710
17858
|
case "axis":
|
|
17711
17859
|
case "majorGridlines":
|
|
17712
17860
|
case "minorGridlines": {
|
|
17713
|
-
const
|
|
17714
|
-
if (!
|
|
17715
|
-
if (target.kind === "axis") return [
|
|
17716
|
-
return [(
|
|
17861
|
+
const axis2 = space.plotArea.axes[target.axisIndex];
|
|
17862
|
+
if (!axis2) throw new RangeError("No chart axis at index.");
|
|
17863
|
+
if (target.kind === "axis") return [axis2.spPr ??= {}];
|
|
17864
|
+
return [(axis2[target.kind] ??= {}).spPr ??= {}];
|
|
17717
17865
|
}
|
|
17718
17866
|
case "dataLabels": {
|
|
17719
17867
|
const series2 = target.seriesIndex === void 0 ? space.plotArea.series : [chartExSeriesAt(space, target.seriesIndex)];
|
|
@@ -17803,25 +17951,25 @@ function editChartExAxis(space, index, edit) {
|
|
|
17803
17951
|
throw new RangeError("Invalid ChartEx axis scaling.");
|
|
17804
17952
|
}
|
|
17805
17953
|
return editChartExSpace(space, (draft) => {
|
|
17806
|
-
const
|
|
17954
|
+
const axis2 = chartExAxisAt(draft, index);
|
|
17807
17955
|
for (const key of ["min", "max", "majorUnit", "minorUnit"])
|
|
17808
17956
|
if (edit[key] !== void 0) {
|
|
17809
|
-
if (
|
|
17957
|
+
if (axis2.scaling?.kind !== "val")
|
|
17810
17958
|
throw new RangeError("Only a value axis supports numeric scaling.");
|
|
17811
|
-
if (edit[key] === null) delete
|
|
17812
|
-
else
|
|
17959
|
+
if (edit[key] === null) delete axis2.scaling[key];
|
|
17960
|
+
else axis2.scaling[key] = edit[key];
|
|
17813
17961
|
}
|
|
17814
|
-
if (
|
|
17962
|
+
if (axis2.scaling?.kind === "val" && typeof axis2.scaling.min === "number" && typeof axis2.scaling.max === "number" && axis2.scaling.min >= axis2.scaling.max)
|
|
17815
17963
|
throw new RangeError("Axis maximum must exceed its minimum.");
|
|
17816
|
-
if (edit.visible !== void 0)
|
|
17964
|
+
if (edit.visible !== void 0) axis2.hidden = !edit.visible;
|
|
17817
17965
|
if (edit.tickLabels !== void 0) {
|
|
17818
|
-
if (edit.tickLabels)
|
|
17819
|
-
else delete
|
|
17966
|
+
if (edit.tickLabels) axis2.tickLabels ??= {};
|
|
17967
|
+
else delete axis2.tickLabels;
|
|
17820
17968
|
}
|
|
17821
17969
|
for (const key of ["majorGridlines", "minorGridlines"])
|
|
17822
17970
|
if (edit[key] !== void 0) {
|
|
17823
|
-
if (edit[key])
|
|
17824
|
-
else delete
|
|
17971
|
+
if (edit[key]) axis2[key] ??= {};
|
|
17972
|
+
else delete axis2[key];
|
|
17825
17973
|
}
|
|
17826
17974
|
for (const [key, target] of [
|
|
17827
17975
|
["majorTickMark", "majorTickMarks"],
|
|
@@ -17829,28 +17977,28 @@ function editChartExAxis(space, index, edit) {
|
|
|
17829
17977
|
])
|
|
17830
17978
|
if (edit[key] !== void 0) {
|
|
17831
17979
|
const value = edit[key];
|
|
17832
|
-
if (value === null) delete
|
|
17980
|
+
if (value === null) delete axis2[target];
|
|
17833
17981
|
else {
|
|
17834
17982
|
if (!["in", "out", "cross", "none"].includes(value))
|
|
17835
17983
|
throw new RangeError("Invalid tick mark.");
|
|
17836
|
-
|
|
17984
|
+
axis2[target] = { type: value };
|
|
17837
17985
|
}
|
|
17838
17986
|
}
|
|
17839
17987
|
if (edit.title !== void 0) {
|
|
17840
17988
|
const { title: _chartTitle, ...base } = draft;
|
|
17841
17989
|
const title = setChartExTitle(
|
|
17842
|
-
{ ...base, ...
|
|
17990
|
+
{ ...base, ...axis2.title ? { title: axis2.title } : {} },
|
|
17843
17991
|
edit.title ?? void 0
|
|
17844
17992
|
).title;
|
|
17845
|
-
if (title)
|
|
17846
|
-
else delete
|
|
17993
|
+
if (title) axis2.title = title;
|
|
17994
|
+
else delete axis2.title;
|
|
17847
17995
|
}
|
|
17848
17996
|
if (edit.numberFormat !== void 0) {
|
|
17849
|
-
if (edit.numberFormat === null) delete
|
|
17850
|
-
else
|
|
17997
|
+
if (edit.numberFormat === null) delete axis2.numberFormat;
|
|
17998
|
+
else axis2.numberFormat = structuredClone(edit.numberFormat);
|
|
17851
17999
|
}
|
|
17852
18000
|
if (edit.units !== void 0) {
|
|
17853
|
-
if (edit.units === null) delete
|
|
18001
|
+
if (edit.units === null) delete axis2.units;
|
|
17854
18002
|
else {
|
|
17855
18003
|
if (![
|
|
17856
18004
|
"hundreds",
|
|
@@ -17865,7 +18013,7 @@ function editChartExAxis(space, index, edit) {
|
|
|
17865
18013
|
"percentage"
|
|
17866
18014
|
].includes(edit.units))
|
|
17867
18015
|
throw new RangeError("Unsupported ChartEx display units.");
|
|
17868
|
-
|
|
18016
|
+
axis2.units = { ...axis2.units, unit: edit.units };
|
|
17869
18017
|
}
|
|
17870
18018
|
}
|
|
17871
18019
|
});
|
|
@@ -17961,9 +18109,9 @@ function applyChartExEditAction(space, action) {
|
|
|
17961
18109
|
return setChartExAxis(space, action.axisIndex, action.edit);
|
|
17962
18110
|
case "tickLabels":
|
|
17963
18111
|
return editChartExSpace(space, (draft) => {
|
|
17964
|
-
const
|
|
17965
|
-
if (action.visible)
|
|
17966
|
-
else delete
|
|
18112
|
+
const axis2 = chartExAxisAt(draft, action.axisIndex);
|
|
18113
|
+
if (action.visible) axis2.tickLabels ??= {};
|
|
18114
|
+
else delete axis2.tickLabels;
|
|
17967
18115
|
});
|
|
17968
18116
|
case "pointLabel":
|
|
17969
18117
|
return setChartExPointLabel(space, action.seriesIndex, action.pointIndex, action.label);
|
|
@@ -18260,15 +18408,15 @@ function setChartSeriesAxis(space, seriesIndex, valueAxisId2) {
|
|
|
18260
18408
|
const { group: group2 } = chartSeriesEntryAt(space, seriesIndex);
|
|
18261
18409
|
if (group2.is3D || !["bar", "line", "area", "scatter", "bubble"].includes(group2.kind))
|
|
18262
18410
|
throw new RangeError("This chart family has no editable axis pair");
|
|
18263
|
-
if (new Set(space.plotArea.axes.map((
|
|
18411
|
+
if (new Set(space.plotArea.axes.map((axis2) => axis2.id)).size !== space.plotArea.axes.length)
|
|
18264
18412
|
throw new RangeError("Ambiguous chart axis ids");
|
|
18265
18413
|
const horizontal = group2.kind === "bar" && group2.barDirection === "bar";
|
|
18266
18414
|
const candidates = space.plotArea.axes.filter(
|
|
18267
|
-
(
|
|
18415
|
+
(axis2) => axis2.kind === "val" && (valueAxisId2 === null ? axis2.position === (horizontal ? "b" : "l") : axis2.id === valueAxisId2)
|
|
18268
18416
|
);
|
|
18269
18417
|
if (candidates.length !== 1) throw new RangeError("No unique existing value axis");
|
|
18270
18418
|
const value = candidates[0];
|
|
18271
|
-
const category = space.plotArea.axes.find((
|
|
18419
|
+
const category = space.plotArea.axes.find((axis2) => axis2.id === value.crossAxisId);
|
|
18272
18420
|
const xy = group2.kind === "scatter" || group2.kind === "bubble";
|
|
18273
18421
|
if (value.id === void 0 || category?.id === void 0 || category.crossAxisId !== value.id || (xy ? category.kind !== "val" : !["cat", "date"].includes(category.kind)))
|
|
18274
18422
|
throw new RangeError("Axis references do not form a coherent pair");
|
|
@@ -18301,7 +18449,7 @@ function setChartSeriesType(space, index, target) {
|
|
|
18301
18449
|
return structuredClone(space);
|
|
18302
18450
|
if (group2.is3D || target.is3D || !["bar", "line", "area"].includes(group2.kind) || !["bar", "line", "area"].includes(target.kind) || group2.barDirection === "bar" || target.barDirection === "bar")
|
|
18303
18451
|
throw new RangeError("Series combo types need vertical 2D column, line or area families");
|
|
18304
|
-
const pair = group2.axisIds.map((id) => space.plotArea.axes.find((
|
|
18452
|
+
const pair = group2.axisIds.map((id) => space.plotArea.axes.find((axis2) => axis2.id === id));
|
|
18305
18453
|
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)
|
|
18306
18454
|
throw new RangeError("Combo types need a coherent category/value axis pair");
|
|
18307
18455
|
if (group2.series.length > 1 && group2.extLst)
|
|
@@ -18372,14 +18520,14 @@ function setChartGroupDecorations(space, edit) {
|
|
|
18372
18520
|
// chart/edit/axis-label.ts
|
|
18373
18521
|
function setChartDisplayUnitsLabel(space, target, edit) {
|
|
18374
18522
|
return editChartSpace(space, (draft) => {
|
|
18375
|
-
const
|
|
18376
|
-
if (
|
|
18523
|
+
const axis2 = chartAxisAt(draft, target);
|
|
18524
|
+
if (axis2.kind !== "val") throw new RangeError("Only a value axis has a display-units label");
|
|
18377
18525
|
if (edit === null) {
|
|
18378
|
-
if (
|
|
18526
|
+
if (axis2.displayUnits) delete axis2.displayUnits.label;
|
|
18379
18527
|
return;
|
|
18380
18528
|
}
|
|
18381
|
-
|
|
18382
|
-
const label =
|
|
18529
|
+
axis2.displayUnits ??= {};
|
|
18530
|
+
const label = axis2.displayUnits.label ??= {};
|
|
18383
18531
|
if (edit.text === null) delete label.tx;
|
|
18384
18532
|
else if (edit.text !== void 0)
|
|
18385
18533
|
assignOrDelete(
|
|
@@ -18610,6 +18758,7 @@ exports.applyChartStylePreset = applyChartStylePreset;
|
|
|
18610
18758
|
exports.applyLabelManualLayout = applyLabelManualLayout;
|
|
18611
18759
|
exports.applyStandardChartLayout = applyStandardChartLayout;
|
|
18612
18760
|
exports.assertBarClusterOptions = assertBarClusterOptions;
|
|
18761
|
+
exports.assertChartGroupOption = assertChartGroupOption;
|
|
18613
18762
|
exports.assertChartPercent = assertChartPercent;
|
|
18614
18763
|
exports.assignOrDelete = assignOrDelete;
|
|
18615
18764
|
exports.autoSeriesColor = autoSeriesColor;
|
|
@@ -18665,6 +18814,7 @@ exports.chartFillFromAppearance = chartFillFromAppearance;
|
|
|
18665
18814
|
exports.chartFormatTargetKey = chartFormatTargetKey;
|
|
18666
18815
|
exports.chartGradientMarkup = chartGradientMarkup;
|
|
18667
18816
|
exports.chartGradientStopTransparency = chartGradientStopTransparency;
|
|
18817
|
+
exports.chartGroupElement = chartGroupElement;
|
|
18668
18818
|
exports.chartGroupHasAxes = groupHasAxes;
|
|
18669
18819
|
exports.chartGroupPaintsLine = chartGroupPaintsLine;
|
|
18670
18820
|
exports.chartIssuesLostOnWrite = chartIssuesLostOnWrite;
|
|
@@ -18787,6 +18937,7 @@ exports.hierarchyBranchLabels = hierarchyBranchLabels;
|
|
|
18787
18937
|
exports.hydrateChartExSpace = hydrateChartExSpace;
|
|
18788
18938
|
exports.impliesAutoTitle = impliesAutoTitle;
|
|
18789
18939
|
exports.isChartExRoot = isChartExRoot;
|
|
18940
|
+
exports.isChartGroupOption = isChartGroupOption;
|
|
18790
18941
|
exports.isChartexOnlyType = isChartexOnlyType;
|
|
18791
18942
|
exports.isEmbeddedXlsxPart = isEmbeddedXlsxPart;
|
|
18792
18943
|
exports.isXYChartKind = isXYChartKind;
|