ooxml-core 1.44.0 → 1.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/PptxHandler-FZ43IJFP.mjs +5 -0
- package/dist/{PptxHandler-3VAVJDFB.mjs → PptxHandler-HWEOIHEA.mjs} +2 -2
- package/dist/PptxHandler-XAUKKK36.cjs +14 -0
- package/dist/{PresentationBuilder-KHL6GONR.cjs → PresentationBuilder-2BCCMZW7.cjs} +6 -6
- package/dist/{PresentationBuilder-7LJMTRJ6.mjs → PresentationBuilder-66RV4F45.mjs} +2 -2
- package/dist/{PresentationBuilder-PY2GB4IG.mjs → PresentationBuilder-AFD72LIG.mjs} +3 -3
- package/dist/automation/index.cjs +22 -8
- package/dist/automation/index.mjs +22 -8
- package/dist/chart/edit/fill.d.ts +6 -2
- package/dist/chart/edit/fill.d.ts.map +1 -1
- package/dist/chart/edit/group-options.d.ts +4 -0
- package/dist/chart/edit/group-options.d.ts.map +1 -1
- package/dist/chart/edit/new-chart-minimal.d.ts +13 -0
- package/dist/chart/edit/new-chart-minimal.d.ts.map +1 -0
- package/dist/chart/edit/new-chart.d.ts +34 -1
- package/dist/chart/edit/new-chart.d.ts.map +1 -1
- package/dist/chart/edit/secondary-axis.d.ts +8 -1
- package/dist/chart/edit/secondary-axis.d.ts.map +1 -1
- package/dist/chart/edit/type.d.ts +2 -0
- package/dist/chart/edit/type.d.ts.map +1 -1
- package/dist/chart/index.cjs +426 -266
- package/dist/chart/index.mjs +424 -267
- package/dist/{chunk-3J6VIKLP.cjs → chunk-5TOVSCVT.cjs} +3 -3
- package/dist/{chunk-4LEVL6ZW.mjs → chunk-E2TTMUKU.mjs} +681 -142
- package/dist/{chunk-7T3SJQA6.cjs → chunk-E5TGYYKO.cjs} +1 -0
- package/dist/{chunk-VKFKEVHK.mjs → chunk-EI6555OK.mjs} +1 -1
- package/dist/{chunk-R7NS42KQ.mjs → chunk-FKU2Z6ZB.mjs} +1 -1
- package/dist/{chunk-243ZYX2B.mjs → chunk-G6LEU3Y5.mjs} +1 -1
- package/dist/{chunk-JHYU7HGG.mjs → chunk-H43QQVJU.mjs} +1 -1
- package/dist/{chunk-HLYOHD2Z.mjs → chunk-HH3AYM63.mjs} +664 -146
- package/dist/{chunk-RNZQ2OU4.cjs → chunk-IBRV3AK3.cjs} +1930 -1412
- package/dist/{chunk-WEAWSXUX.mjs → chunk-L6MJGE3Q.mjs} +4 -4
- package/dist/{chunk-IPV3J3I5.mjs → chunk-LXVE2VKR.mjs} +4 -1
- package/dist/{chunk-QZPOPUI5.cjs → chunk-QUAFASFC.cjs} +4 -0
- package/dist/{chunk-XTUX5RMG.cjs → chunk-T4BVZTII.cjs} +9 -9
- package/dist/{chunk-KCDLTVUI.mjs → chunk-X2DC7XRL.mjs} +17 -16
- package/dist/{chunk-OORQCSVA.mjs → chunk-ZLUHU2SU.mjs} +1 -0
- package/dist/docx/index.cjs +300 -144
- package/dist/docx/index.mjs +300 -144
- package/dist/index.cjs +496 -336
- package/dist/index.mjs +496 -336
- package/dist/pptx/automation/index.cjs +879 -310
- package/dist/pptx/automation/index.d.ts +6 -6
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{elements-PBugbKtv.d.ts → elements-B4Z6N-Gz.d.ts} +4 -477
- package/dist/pptx/chunks/elements-B4Z6N-Gz.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-CCJiD-Bm.d.ts → index-BPGaFlm5.d.ts} +6 -6
- package/dist/pptx/chunks/{index-CCJiD-Bm.d.ts.map → index-BPGaFlm5.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-Bj-hur0D.d.ts → index-D4-WJQ1r.d.ts} +4 -4
- package/dist/pptx/chunks/{index-Bj-hur0D.d.ts.map → index-D4-WJQ1r.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-CGNb1TV9.d.ts → index-DtFoPmk7.d.ts} +108 -10
- package/dist/pptx/chunks/index-DtFoPmk7.d.ts.map +1 -0
- package/dist/pptx/chunks/{table-C7ITXL3Y.d.ts → table-BfgZfw5R.d.ts} +488 -4
- package/dist/pptx/chunks/table-BfgZfw5R.d.ts.map +1 -0
- package/dist/pptx/chunks/{text-operations-BNJr7aGa.d.ts → text-operations-CVHXOSit.d.ts} +19 -4
- package/dist/pptx/chunks/{text-operations-BNJr7aGa.d.ts.map → text-operations-CVHXOSit.d.ts.map} +1 -1
- package/dist/pptx/cli/index.cjs +832 -263
- package/dist/pptx/cli/index.d.ts +1 -1
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.cjs +1 -0
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/collaboration-live-patch-target.cjs +4 -4
- package/dist/pptx/editor/render/collaboration-live-patch-target.mjs +2 -2
- package/dist/pptx/editor/render/collaboration-reconcile.cjs +8 -8
- package/dist/pptx/editor/render/collaboration-reconcile.mjs +2 -2
- package/dist/pptx/editor/render/collaboration-sync.cjs +14 -14
- package/dist/pptx/editor/render/collaboration-sync.d.ts.map +1 -1
- package/dist/pptx/editor/render/collaboration-sync.mjs +1 -1
- package/dist/pptx/editor/render/custom-show-operations.cjs +2 -2
- package/dist/pptx/editor/render/custom-show-operations.mjs +1 -1
- package/dist/pptx/editor/render/find-replace.cjs +15 -15
- package/dist/pptx/editor/render/find-replace.d.ts +2 -2
- package/dist/pptx/editor/render/find-replace.mjs +2 -2
- package/dist/pptx/editor/render/slide-operations.cjs +9 -9
- package/dist/pptx/editor/render/slide-operations.mjs +3 -3
- package/dist/pptx/editor/render/table-layout.d.ts +1 -1
- package/dist/pptx/editor/render/text-runs-style-patch.d.ts +1 -1
- package/dist/pptx/editor/render/text-style-scope.d.ts +1 -1
- package/dist/pptx/index.cjs +909 -315
- package/dist/pptx/index.d.ts +7 -7
- package/dist/pptx/index.mjs +5 -5
- package/dist/pptx/node/index.d.ts +1 -1
- package/dist/xlsx/index.cjs +22 -8
- package/dist/xlsx/index.mjs +22 -8
- package/dist/xlsx/ui/index.cjs +22 -8
- package/dist/xlsx/ui/index.mjs +22 -8
- package/package.json +1 -1
- package/dist/PptxHandler-V23RDNEX.cjs +0 -14
- package/dist/PptxHandler-WB3KL2WH.mjs +0 -5
- package/dist/pptx/chunks/elements-PBugbKtv.d.ts.map +0 -1
- package/dist/pptx/chunks/index-CGNb1TV9.d.ts.map +0 -1
- package/dist/pptx/chunks/table-C7ITXL3Y.d.ts.map +0 -1
package/dist/docx/index.cjs
CHANGED
|
@@ -8011,12 +8011,12 @@ function readScene3DValues(node, read) {
|
|
|
8011
8011
|
["lightRig", light]
|
|
8012
8012
|
]) {
|
|
8013
8013
|
const rot = read.child(source2, "rot");
|
|
8014
|
-
for (const [
|
|
8014
|
+
for (const [axis2, key] of [
|
|
8015
8015
|
["lat", "RotX"],
|
|
8016
8016
|
["lon", "RotY"],
|
|
8017
8017
|
["rev", "RotZ"]
|
|
8018
8018
|
]) {
|
|
8019
|
-
const value = integer2(read.attribute(rot,
|
|
8019
|
+
const value = integer2(read.attribute(rot, axis2));
|
|
8020
8020
|
if (value !== void 0 && value >= 0 && value < 216e5) out[`${prefix2}${key}`] = value;
|
|
8021
8021
|
}
|
|
8022
8022
|
}
|
|
@@ -8029,12 +8029,12 @@ function readScene3DValues(node, read) {
|
|
|
8029
8029
|
["up", "backdropUp", "d"]
|
|
8030
8030
|
]) {
|
|
8031
8031
|
const point = read.child(backdrop, name2);
|
|
8032
|
-
for (const [
|
|
8032
|
+
for (const [axis2, suffix] of [
|
|
8033
8033
|
["x", "X"],
|
|
8034
8034
|
["y", "Y"],
|
|
8035
8035
|
["z", "Z"]
|
|
8036
8036
|
]) {
|
|
8037
|
-
const value = integer2(read.attribute(point, `${attr3}${
|
|
8037
|
+
const value = integer2(read.attribute(point, `${attr3}${axis2}`));
|
|
8038
8038
|
if (value !== void 0) out[`${prefix2}${suffix}`] = value;
|
|
8039
8039
|
}
|
|
8040
8040
|
}
|
|
@@ -8678,12 +8678,12 @@ function writeDrawingTextScene3D(doc, value) {
|
|
|
8678
8678
|
throw new Error("A backdrop point needs three finite coordinates");
|
|
8679
8679
|
const point = child2(backdrop, name2);
|
|
8680
8680
|
const vector = attr3 === "d" ? scaleVectorToIntegers(values[0], values[1], values[2]) : { x: values[0], y: values[1], z: values[2] };
|
|
8681
|
-
for (const [
|
|
8681
|
+
for (const [axis2, suffix] of [
|
|
8682
8682
|
["x", "X"],
|
|
8683
8683
|
["y", "Y"],
|
|
8684
8684
|
["z", "Z"]
|
|
8685
8685
|
])
|
|
8686
|
-
number(point, `${attr3}${
|
|
8686
|
+
number(point, `${attr3}${axis2}`, vector[axis2], before[`${prefix2}${suffix}`]);
|
|
8687
8687
|
}
|
|
8688
8688
|
}
|
|
8689
8689
|
return node;
|
|
@@ -9057,17 +9057,17 @@ function exactDef(name2, avLst, gdLines, rect3, paths) {
|
|
|
9057
9057
|
var Glyph = class {
|
|
9058
9058
|
lines = [];
|
|
9059
9059
|
names = /* @__PURE__ */ new Map();
|
|
9060
|
-
coord(
|
|
9061
|
-
const key = `${
|
|
9060
|
+
coord(axis2, value) {
|
|
9061
|
+
const key = `${axis2}${value}`;
|
|
9062
9062
|
const known = this.names.get(key);
|
|
9063
9063
|
if (known) {
|
|
9064
9064
|
return known;
|
|
9065
9065
|
}
|
|
9066
9066
|
const id = this.names.size;
|
|
9067
|
-
const name2 = `${
|
|
9067
|
+
const name2 = `${axis2}g${id}`;
|
|
9068
9068
|
this.lines.push(
|
|
9069
9069
|
`k${id} */ ss ${Math.round(value * 1e3)} 90000`,
|
|
9070
|
-
`${name2} +- ${
|
|
9070
|
+
`${name2} +- ${axis2 === "x" ? "hc" : "vc"} k${id} 0`
|
|
9071
9071
|
);
|
|
9072
9072
|
this.names.set(key, name2);
|
|
9073
9073
|
return name2;
|
|
@@ -20605,8 +20605,8 @@ function documentOrder(point) {
|
|
|
20605
20605
|
descendants3(all[0], all);
|
|
20606
20606
|
return all;
|
|
20607
20607
|
}
|
|
20608
|
-
function axisPoints(point,
|
|
20609
|
-
switch (
|
|
20608
|
+
function axisPoints(point, axis2) {
|
|
20609
|
+
switch (axis2) {
|
|
20610
20610
|
case "self":
|
|
20611
20611
|
return [point];
|
|
20612
20612
|
case "ch":
|
|
@@ -20625,7 +20625,7 @@ function axisPoints(point, axis) {
|
|
|
20625
20625
|
return point.parent ? [point.parent] : [];
|
|
20626
20626
|
case "ancst":
|
|
20627
20627
|
case "ancstOrSelf": {
|
|
20628
|
-
const out =
|
|
20628
|
+
const out = axis2 === "ancstOrSelf" ? [point] : [];
|
|
20629
20629
|
let current = point.parent;
|
|
20630
20630
|
while (current) {
|
|
20631
20631
|
out.push(current);
|
|
@@ -20640,13 +20640,13 @@ function axisPoints(point, axis) {
|
|
|
20640
20640
|
if (index < 0) {
|
|
20641
20641
|
return [];
|
|
20642
20642
|
}
|
|
20643
|
-
return
|
|
20643
|
+
return axis2 === "followSib" ? siblings.slice(index + 1) : siblings.slice(0, index);
|
|
20644
20644
|
}
|
|
20645
20645
|
case "follow":
|
|
20646
20646
|
case "preced": {
|
|
20647
20647
|
const all = documentOrder(point);
|
|
20648
20648
|
const index = all.indexOf(point);
|
|
20649
|
-
return
|
|
20649
|
+
return axis2 === "follow" ? all.slice(index + 1) : all.slice(0, index);
|
|
20650
20650
|
}
|
|
20651
20651
|
case "root":
|
|
20652
20652
|
return [rootOf2(point)];
|
|
@@ -20718,10 +20718,10 @@ function windowPoints(points3, st = 1, cnt = 0, step = 1) {
|
|
|
20718
20718
|
return out;
|
|
20719
20719
|
}
|
|
20720
20720
|
function iterateStep(point, iterator, step) {
|
|
20721
|
-
const
|
|
20721
|
+
const axis2 = iterator.axis[step] ?? "none";
|
|
20722
20722
|
const ptType = iterator.ptType[step] ?? iterator.ptType[iterator.ptType.length - 1] ?? "all";
|
|
20723
|
-
const hideLast = (iterator.hideLastTrans[step] ?? true) && SIBLING_AXES.has(
|
|
20724
|
-
let points3 = axisPoints(point,
|
|
20723
|
+
const hideLast = (iterator.hideLastTrans[step] ?? true) && SIBLING_AXES.has(axis2);
|
|
20724
|
+
let points3 = axisPoints(point, axis2).filter((candidate) => matchesPointType(candidate, ptType));
|
|
20725
20725
|
if (hideLast) {
|
|
20726
20726
|
points3 = points3.filter((candidate) => !isLastSiblingTransition(candidate));
|
|
20727
20727
|
}
|
|
@@ -20986,8 +20986,8 @@ function valueOf(node, type) {
|
|
|
20986
20986
|
if (direct !== void 0) {
|
|
20987
20987
|
return boundedValue(node, type, direct);
|
|
20988
20988
|
}
|
|
20989
|
-
const
|
|
20990
|
-
return
|
|
20989
|
+
const axis2 = AXIS_LOOKUP[type];
|
|
20990
|
+
return axis2 ? axisValue(node, axis2[0], axis2[1]) : void 0;
|
|
20991
20991
|
}
|
|
20992
20992
|
function boundedValue(node, type, value) {
|
|
20993
20993
|
let out = value;
|
|
@@ -30817,8 +30817,8 @@ function parseGroup(context, element4) {
|
|
|
30817
30817
|
element: element4.localName,
|
|
30818
30818
|
is3D,
|
|
30819
30819
|
series: children(element4, "ser", NS.c).map((ser) => parseSeries(context, ser)),
|
|
30820
|
-
axisIds: children(element4, "axId", NS.c).flatMap((
|
|
30821
|
-
const raw2 = attribute(
|
|
30820
|
+
axisIds: children(element4, "axId", NS.c).flatMap((axis2) => {
|
|
30821
|
+
const raw2 = attribute(axis2, "val")?.trim();
|
|
30822
30822
|
const id = raw2 ? Number(raw2) : Number.NaN;
|
|
30823
30823
|
return Number.isFinite(id) ? [id] : [];
|
|
30824
30824
|
})
|
|
@@ -30967,9 +30967,9 @@ function parsePlotArea(context, element4) {
|
|
|
30967
30967
|
plotArea.groups.push(parseGroup(context, child7));
|
|
30968
30968
|
handled.add(child7.localName);
|
|
30969
30969
|
}
|
|
30970
|
-
const
|
|
30971
|
-
if (
|
|
30972
|
-
plotArea.axes.push(parseAxis(context, child7,
|
|
30970
|
+
const axis2 = AXIS_ELEMENTS[child7.localName];
|
|
30971
|
+
if (axis2) {
|
|
30972
|
+
plotArea.axes.push(parseAxis(context, child7, axis2));
|
|
30973
30973
|
handled.add(child7.localName);
|
|
30974
30974
|
}
|
|
30975
30975
|
}
|
|
@@ -31387,14 +31387,14 @@ var AXIS_ELEMENTS2 = {
|
|
|
31387
31387
|
ser: "serAx"
|
|
31388
31388
|
};
|
|
31389
31389
|
var gridlinesXml = (context, local, present2, shape2) => present2 ? elementXml(local, shapePropertiesXml(context, shape2)) : "";
|
|
31390
|
-
function axisXml(context,
|
|
31391
|
-
const { scaling } =
|
|
31390
|
+
function axisXml(context, axis2) {
|
|
31391
|
+
const { scaling } = axis2;
|
|
31392
31392
|
return elementXml(
|
|
31393
|
-
AXIS_ELEMENTS2[
|
|
31394
|
-
valXml("axId",
|
|
31393
|
+
AXIS_ELEMENTS2[axis2.kind],
|
|
31394
|
+
valXml("axId", axis2.id) + elementXml(
|
|
31395
31395
|
"scaling",
|
|
31396
31396
|
valXml("logBase", scaling.logBase) + valXml("orientation", scaling.orientation) + valXml("max", scaling.max) + valXml("min", scaling.min)
|
|
31397
|
-
) + valXml("delete",
|
|
31397
|
+
) + 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)
|
|
31398
31398
|
);
|
|
31399
31399
|
}
|
|
31400
31400
|
|
|
@@ -31468,7 +31468,7 @@ function groupXml(context, group3) {
|
|
|
31468
31468
|
function plotAreaXml(context, plotArea) {
|
|
31469
31469
|
return elementXml(
|
|
31470
31470
|
"plotArea",
|
|
31471
|
-
layoutXml(context, plotArea.layout) + plotArea.groups.map((group3) => groupXml(context, group3)).join("") + plotArea.axes.map((
|
|
31471
|
+
layoutXml(context, plotArea.layout) + plotArea.groups.map((group3) => groupXml(context, group3)).join("") + plotArea.axes.map((axis2) => axisXml(context, axis2)).join("") + dataTableXml(context, plotArea.dataTable) + shapePropertiesXml(context, plotArea.spPr) + raw(context, plotArea.extLst)
|
|
31472
31472
|
);
|
|
31473
31473
|
}
|
|
31474
31474
|
|
|
@@ -31821,14 +31821,14 @@ function parseLegend2(context, element4) {
|
|
|
31821
31821
|
}
|
|
31822
31822
|
|
|
31823
31823
|
// chart/ex/parse-axis.ts
|
|
31824
|
-
function parseScaling(context,
|
|
31825
|
-
const category = cxChild(
|
|
31824
|
+
function parseScaling(context, axis2) {
|
|
31825
|
+
const category = cxChild(axis2, "catScaling");
|
|
31826
31826
|
if (category)
|
|
31827
31827
|
return assignDefined(
|
|
31828
31828
|
{ kind: "cat" },
|
|
31829
31829
|
{ gapWidth: autoNumberAttribute(context, category, "gapWidth") }
|
|
31830
31830
|
);
|
|
31831
|
-
const value = cxChild(
|
|
31831
|
+
const value = cxChild(axis2, "valScaling");
|
|
31832
31832
|
if (!value) return void 0;
|
|
31833
31833
|
return assignDefined(
|
|
31834
31834
|
{ kind: "val" },
|
|
@@ -32039,9 +32039,9 @@ function parseSeries2(context, element4) {
|
|
|
32039
32039
|
const labels = cxChild(element4, "dataLabels");
|
|
32040
32040
|
const inline = cxChild(element4, "data");
|
|
32041
32041
|
const layout2 = cxChild(element4, "layoutPr");
|
|
32042
|
-
const
|
|
32042
|
+
const axisIds2 = cxChildren(element4, "axisId").map((axis2) => indexAttribute(context, axis2, "val")).filter((id) => id !== void 0);
|
|
32043
32043
|
return assignDefined(
|
|
32044
|
-
{ layoutId: attribute(element4, "layoutId") ?? "", dataPoints, axisIds },
|
|
32044
|
+
{ layoutId: attribute(element4, "layoutId") ?? "", dataPoints, axisIds: axisIds2 },
|
|
32045
32045
|
{
|
|
32046
32046
|
hidden: boolAttribute(context, element4, "hidden"),
|
|
32047
32047
|
ownerIndex: numberAttribute(context, element4, "ownerIdx"),
|
|
@@ -32083,7 +32083,7 @@ function parsePlotArea2(context, element4) {
|
|
|
32083
32083
|
const regionExtLst = extensionList2(region);
|
|
32084
32084
|
if (regionExtLst) out.regionExtLst = regionExtLst;
|
|
32085
32085
|
}
|
|
32086
|
-
out.axes = cxChildren(element4, "axis").map((
|
|
32086
|
+
out.axes = cxChildren(element4, "axis").map((axis2) => parseAxis2(context, axis2));
|
|
32087
32087
|
return assignDefined(out, { spPr: shapeProperties2(element4), extLst: extensionList2(element4) });
|
|
32088
32088
|
}
|
|
32089
32089
|
function namespaceDeclarations2(root) {
|
|
@@ -32334,19 +32334,19 @@ function scalingXml(scaling) {
|
|
|
32334
32334
|
);
|
|
32335
32335
|
}
|
|
32336
32336
|
var tickMarksXml = (local, marks) => marks ? cxElement(local, "", attributes([["type", marks.type]])) : "";
|
|
32337
|
-
function axisXml2(context,
|
|
32338
|
-
const units2 =
|
|
32337
|
+
function axisXml2(context, axis2) {
|
|
32338
|
+
const units2 = axis2.units;
|
|
32339
32339
|
const gridlines = (local, value) => value ? cxElement(local, shapeXml(context, value.spPr)) : "";
|
|
32340
32340
|
return cxElement(
|
|
32341
32341
|
"axis",
|
|
32342
|
-
scalingXml(
|
|
32342
|
+
scalingXml(axis2.scaling) + titleXml2(context, axis2.title) + (units2 ? cxElement(
|
|
32343
32343
|
"units",
|
|
32344
32344
|
titleXml2(context, units2.label, "unitsLabel") + raw(context, units2.extLst),
|
|
32345
32345
|
attributes([["unit", units2.unit]])
|
|
32346
|
-
) : "") + gridlines("majorGridlines",
|
|
32346
|
+
) : "") + 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),
|
|
32347
32347
|
attributes([
|
|
32348
|
-
["id",
|
|
32349
|
-
["hidden",
|
|
32348
|
+
["id", axis2.id],
|
|
32349
|
+
["hidden", axis2.hidden]
|
|
32350
32350
|
])
|
|
32351
32351
|
);
|
|
32352
32352
|
}
|
|
@@ -32381,7 +32381,7 @@ function writeChartExSpace(space, options2 = {}) {
|
|
|
32381
32381
|
);
|
|
32382
32382
|
const plotArea = cxElement(
|
|
32383
32383
|
"plotArea",
|
|
32384
|
-
region + plot.axes.map((
|
|
32384
|
+
region + plot.axes.map((axis2) => axisXml2(context, axis2)).join("") + shapeXml(context, plot.spPr) + raw(context, plot.extLst)
|
|
32385
32385
|
);
|
|
32386
32386
|
const legend = space.legend;
|
|
32387
32387
|
const legendXml2 = legend ? cxElement(
|
|
@@ -34016,8 +34016,8 @@ function chartSummarySeries(source2, chartType, groupLabels, groupSmooth) {
|
|
|
34016
34016
|
Object.assign(out, summaryAnalysis(source2));
|
|
34017
34017
|
return out;
|
|
34018
34018
|
}
|
|
34019
|
-
function valueAxisId(chartSpace,
|
|
34020
|
-
return
|
|
34019
|
+
function valueAxisId(chartSpace, axisIds2) {
|
|
34020
|
+
return axisIds2.find(
|
|
34021
34021
|
(id) => chartSpace.plotArea.axes.some((a2) => a2.id === id && a2.kind === "val")
|
|
34022
34022
|
);
|
|
34023
34023
|
}
|
|
@@ -34508,35 +34508,35 @@ function chartExSummaryFromModel(space) {
|
|
|
34508
34508
|
showLegend: legend !== void 0
|
|
34509
34509
|
};
|
|
34510
34510
|
if (chartType === "boxWhisker") {
|
|
34511
|
-
summary.axes = space.plotArea.axes.flatMap((
|
|
34512
|
-
const scaling =
|
|
34511
|
+
summary.axes = space.plotArea.axes.flatMap((axis2) => {
|
|
34512
|
+
const scaling = axis2.scaling;
|
|
34513
34513
|
if (!scaling) return [];
|
|
34514
34514
|
const value = scaling.kind === "val";
|
|
34515
34515
|
return [
|
|
34516
34516
|
{
|
|
34517
34517
|
kind: value ? "val" : "cat",
|
|
34518
|
-
...
|
|
34518
|
+
...axis2.id === void 0 ? {} : { id: axis2.id },
|
|
34519
34519
|
position: value ? "l" : "b",
|
|
34520
|
-
deleted:
|
|
34520
|
+
deleted: axis2.hidden ?? false,
|
|
34521
34521
|
scaling: {
|
|
34522
34522
|
...value && typeof scaling.min === "number" ? { min: scaling.min } : {},
|
|
34523
34523
|
...value && typeof scaling.max === "number" ? { max: scaling.max } : {}
|
|
34524
34524
|
},
|
|
34525
|
-
majorGridlines: !!
|
|
34526
|
-
minorGridlines: !!
|
|
34527
|
-
...
|
|
34528
|
-
...
|
|
34525
|
+
majorGridlines: !!axis2.majorGridlines,
|
|
34526
|
+
minorGridlines: !!axis2.minorGridlines,
|
|
34527
|
+
...axis2.majorGridlines?.spPr ? { majorGridlinesSpPr: axis2.majorGridlines.spPr } : {},
|
|
34528
|
+
...axis2.minorGridlines?.spPr ? { minorGridlinesSpPr: axis2.minorGridlines.spPr } : {},
|
|
34529
34529
|
...value && typeof scaling.majorUnit === "number" ? { majorUnit: scaling.majorUnit } : {},
|
|
34530
34530
|
...value && typeof scaling.minorUnit === "number" ? { minorUnit: scaling.minorUnit } : {},
|
|
34531
|
-
...
|
|
34532
|
-
...
|
|
34533
|
-
...
|
|
34531
|
+
...axis2.spPr ? { spPr: axis2.spPr } : {},
|
|
34532
|
+
...axis2.numberFormat ? { numberFormat: axis2.numberFormat } : {},
|
|
34533
|
+
...axis2.tickLabels ? {} : { tickLabelPosition: "none" }
|
|
34534
34534
|
}
|
|
34535
34535
|
];
|
|
34536
34536
|
});
|
|
34537
34537
|
}
|
|
34538
34538
|
if (chartType === "funnel") {
|
|
34539
|
-
const cat = space.plotArea.axes.find((
|
|
34539
|
+
const cat = space.plotArea.axes.find((axis2) => axis2.scaling?.kind === "cat")?.scaling;
|
|
34540
34540
|
if (cat?.kind === "cat" && typeof cat.gapWidth === "number")
|
|
34541
34541
|
summary.funnelGapWidth = cat.gapWidth;
|
|
34542
34542
|
}
|
|
@@ -35474,44 +35474,44 @@ function formatDate(date, unit, format) {
|
|
|
35474
35474
|
|
|
35475
35475
|
// chart/render/chart-svg-date-axis.ts
|
|
35476
35476
|
function chartDateAxis(model, plot, out) {
|
|
35477
|
-
const
|
|
35477
|
+
const axis2 = model.axes?.category?.source;
|
|
35478
35478
|
const values = model.dateCategories;
|
|
35479
|
-
if (
|
|
35479
|
+
if (axis2?.kind !== "date" || !values?.length) return void 0;
|
|
35480
35480
|
const points3 = values.flatMap(
|
|
35481
35481
|
(value, index) => value === null || !Number.isFinite(value) ? [] : [{ value, index }]
|
|
35482
35482
|
).sort((a2, b) => a2.value - b.value);
|
|
35483
35483
|
if (!points3.length) return void 0;
|
|
35484
|
-
const min =
|
|
35485
|
-
const max =
|
|
35484
|
+
const min = axis2.scaling.min ?? points3[0].value;
|
|
35485
|
+
const max = axis2.scaling.max ?? points3.at(-1).value;
|
|
35486
35486
|
if (!Number.isFinite(min) || !Number.isFinite(max) || max < min) return void 0;
|
|
35487
35487
|
const position2 = (value) => {
|
|
35488
35488
|
const ratio = max === min ? 0.5 : (value - min) / (max - min);
|
|
35489
|
-
const t =
|
|
35489
|
+
const t = axis2.scaling.orientation === "maxMin" ? 1 - ratio : ratio;
|
|
35490
35490
|
return model.horizontal ? plot.y + plot.h * (1 - t) : plot.x + plot.w * t;
|
|
35491
35491
|
};
|
|
35492
35492
|
const visible = points3.filter((p2) => p2.value >= min && p2.value <= max);
|
|
35493
35493
|
const unitOf = (unit2) => unit2 === "months" || unit2 === "years" ? unit2 : "days";
|
|
35494
|
-
const unit = unitOf(
|
|
35494
|
+
const unit = unitOf(axis2.majorTimeUnit ?? axis2.baseTimeUnit);
|
|
35495
35495
|
const ticks = calendarTicks(
|
|
35496
35496
|
min,
|
|
35497
35497
|
max,
|
|
35498
35498
|
model.date1904 ?? false,
|
|
35499
35499
|
unit,
|
|
35500
|
-
Math.max(1,
|
|
35500
|
+
Math.max(1, axis2.majorUnit ?? 1)
|
|
35501
35501
|
);
|
|
35502
35502
|
const attrs3 = chartTextAttributes(model, "categoryAxis");
|
|
35503
35503
|
const size = attrs3.size ?? 10;
|
|
35504
|
-
const y =
|
|
35504
|
+
const y = axis2.position === "t" ? plot.y : plot.y + plot.h;
|
|
35505
35505
|
const paint2 = model.axes?.category?.line;
|
|
35506
35506
|
const stroke = { color: paint2?.color ?? "#BFBFBF", width: paint2?.width ?? 1 };
|
|
35507
35507
|
const mark = (serial, placement, length) => {
|
|
35508
|
-
if (!placement || placement === "none" ||
|
|
35509
|
-
const inward =
|
|
35508
|
+
if (!placement || placement === "none" || axis2.deleted) return;
|
|
35509
|
+
const inward = axis2.position === "t" ? length : -length;
|
|
35510
35510
|
const start = placement === "cross" ? -length : 0;
|
|
35511
35511
|
const end = placement === "cross" ? length : placement === "in" ? inward : -inward;
|
|
35512
35512
|
if (model.horizontal) {
|
|
35513
|
-
const x =
|
|
35514
|
-
const direction =
|
|
35513
|
+
const x = axis2.position === "r" ? plot.x + plot.w : plot.x;
|
|
35514
|
+
const direction = axis2.position === "r" ? -1 : 1;
|
|
35515
35515
|
const a2 = placement === "cross" ? -length : 0;
|
|
35516
35516
|
const b = placement === "cross" ? length : placement === "in" ? direction * length : -direction * length;
|
|
35517
35517
|
out.push(
|
|
@@ -35523,19 +35523,19 @@ function chartDateAxis(model, plot, out) {
|
|
|
35523
35523
|
);
|
|
35524
35524
|
};
|
|
35525
35525
|
ticks.forEach((serial, index) => {
|
|
35526
|
-
if (index % Math.max(1,
|
|
35527
|
-
if (
|
|
35526
|
+
if (index % Math.max(1, axis2.tickMarkSkip ?? 1) === 0) mark(serial, axis2.majorTickMark, 4);
|
|
35527
|
+
if (axis2.deleted || model.dataTable || axis2.tickLabelPosition === "none" || index % Math.max(1, axis2.tickLabelSkip ?? 1))
|
|
35528
35528
|
return;
|
|
35529
35529
|
const label = formatDate(
|
|
35530
35530
|
excelSerialToDate(serial, model.date1904),
|
|
35531
35531
|
unit,
|
|
35532
|
-
|
|
35532
|
+
axis2.numberFormat?.formatCode
|
|
35533
35533
|
);
|
|
35534
35534
|
if (model.horizontal)
|
|
35535
35535
|
out.push(text(plot.x - 4, position2(serial) + size * 0.3, label, { ...attrs3, anchor: "end" }));
|
|
35536
35536
|
else {
|
|
35537
|
-
const above =
|
|
35538
|
-
const baseline =
|
|
35537
|
+
const above = axis2.tickLabelPosition === "high" || axis2.tickLabelPosition !== "low" && axis2.position === "t";
|
|
35538
|
+
const baseline = axis2.tickLabelPosition === "high" ? plot.y : axis2.tickLabelPosition === "low" ? plot.y + plot.h : y;
|
|
35539
35539
|
out.push(
|
|
35540
35540
|
text(position2(serial), baseline + (above ? -4 : size + 3), label, {
|
|
35541
35541
|
...attrs3,
|
|
@@ -35544,15 +35544,15 @@ function chartDateAxis(model, plot, out) {
|
|
|
35544
35544
|
);
|
|
35545
35545
|
}
|
|
35546
35546
|
});
|
|
35547
|
-
if (
|
|
35547
|
+
if (axis2.minorTickMark && axis2.minorTickMark !== "none")
|
|
35548
35548
|
for (const serial of calendarTicks(
|
|
35549
35549
|
min,
|
|
35550
35550
|
max,
|
|
35551
35551
|
model.date1904 ?? false,
|
|
35552
|
-
unitOf(
|
|
35553
|
-
Math.max(1,
|
|
35552
|
+
unitOf(axis2.minorTimeUnit ?? axis2.baseTimeUnit ?? unit),
|
|
35553
|
+
Math.max(1, axis2.minorUnit ?? 1)
|
|
35554
35554
|
))
|
|
35555
|
-
mark(serial,
|
|
35555
|
+
mark(serial, axis2.minorTickMark, 2.5);
|
|
35556
35556
|
return {
|
|
35557
35557
|
order: visible.map((p2) => p2.index),
|
|
35558
35558
|
band: (index) => position2(values[index] ?? min),
|
|
@@ -35673,12 +35673,12 @@ function chartLineDashArray(style, width) {
|
|
|
35673
35673
|
}
|
|
35674
35674
|
|
|
35675
35675
|
// chart/render/chart-svg-axes.ts
|
|
35676
|
-
function axisTickText(value,
|
|
35677
|
-
return formatChartNumber(value,
|
|
35676
|
+
function axisTickText(value, axis2, percent = false) {
|
|
35677
|
+
return formatChartNumber(value, axis2?.source.numberFormat?.formatCode) ?? formatAxisValue(value, percent);
|
|
35678
35678
|
}
|
|
35679
|
-
function axisLine(model,
|
|
35680
|
-
if (
|
|
35681
|
-
return styledAxisLine(x1, y1, x2, y2,
|
|
35679
|
+
function axisLine(model, axis2, part, x1, y1, x2, y2) {
|
|
35680
|
+
if (axis2?.source.deleted) return "";
|
|
35681
|
+
return styledAxisLine(x1, y1, x2, y2, axis2?.line, chartStroke(model, part));
|
|
35682
35682
|
}
|
|
35683
35683
|
function styledAxisLine(x1, y1, x2, y2, paint2, fallback) {
|
|
35684
35684
|
const color = paint2?.color ?? fallback.color;
|
|
@@ -35690,7 +35690,7 @@ function styledAxisLine(x1, y1, x2, y2, paint2, fallback) {
|
|
|
35690
35690
|
dash ? ` stroke-dasharray="${dash}"/>` : "/>"
|
|
35691
35691
|
);
|
|
35692
35692
|
}
|
|
35693
|
-
function axisGridlines(model,
|
|
35693
|
+
function axisGridlines(model, axis2, ticks, position2, plot, vertical) {
|
|
35694
35694
|
const draw2 = (values, paint2, minor2) => {
|
|
35695
35695
|
const fallback = chartStroke(model, minor2 ? "gridlineMinor" : "gridlineMajor");
|
|
35696
35696
|
return values.map((value) => {
|
|
@@ -35698,8 +35698,8 @@ function axisGridlines(model, axis, ticks, position2, plot, vertical) {
|
|
|
35698
35698
|
return vertical ? styledAxisLine(p2, plot.y, p2, plot.y + plot.h, paint2, fallback) : styledAxisLine(plot.x, p2, plot.x + plot.w, p2, paint2, fallback);
|
|
35699
35699
|
}).join("");
|
|
35700
35700
|
};
|
|
35701
|
-
const major = !
|
|
35702
|
-
const minor =
|
|
35701
|
+
const major = !axis2 || axis2.source.majorGridlines ? draw2(ticks, axis2?.majorGrid, false) : "";
|
|
35702
|
+
const minor = axis2?.source.minorGridlines ? draw2(axis2.minorTicks, axis2.minorGrid, true) : "";
|
|
35703
35703
|
return major + minor;
|
|
35704
35704
|
}
|
|
35705
35705
|
|
|
@@ -35722,9 +35722,9 @@ function computeLogValueRange(series2, logBase) {
|
|
|
35722
35722
|
logBase
|
|
35723
35723
|
};
|
|
35724
35724
|
}
|
|
35725
|
-
function withAxisBounds(automatic,
|
|
35726
|
-
const validMin = typeof
|
|
35727
|
-
const validMax = typeof
|
|
35725
|
+
function withAxisBounds(automatic, axis2, logBase) {
|
|
35726
|
+
const validMin = typeof axis2?.min === "number" && Number.isFinite(axis2.min) && (!logBase || axis2.min > 0) ? axis2.min : void 0;
|
|
35727
|
+
const validMax = typeof axis2?.max === "number" && Number.isFinite(axis2.max) && (!logBase || axis2.max > 0) ? axis2.max : void 0;
|
|
35728
35728
|
const min = validMin ?? automatic.min;
|
|
35729
35729
|
let max = validMax ?? automatic.max;
|
|
35730
35730
|
const majorUnit = validMin === void 0 && validMax === void 0 ? automatic.majorUnit : void 0;
|
|
@@ -35738,7 +35738,7 @@ function withAxisBounds(automatic, axis, logBase) {
|
|
|
35738
35738
|
span: Math.max(span, Number.EPSILON),
|
|
35739
35739
|
...majorUnit !== void 0 ? { majorUnit } : {},
|
|
35740
35740
|
...logBase ? { logScale: true, logBase } : {},
|
|
35741
|
-
...
|
|
35741
|
+
...axis2?.orientation === "maxMin" ? { reverseOrder: true } : {}
|
|
35742
35742
|
};
|
|
35743
35743
|
}
|
|
35744
35744
|
|
|
@@ -35771,11 +35771,11 @@ function generateIntervalTicks(range2, unit) {
|
|
|
35771
35771
|
const count = Math.min(Math.max(last - first3 + 1, 0), 2e3);
|
|
35772
35772
|
return Array.from({ length: count }, (_, index) => (first3 + index) * unit);
|
|
35773
35773
|
}
|
|
35774
|
-
function generateAxisTicks(range2,
|
|
35774
|
+
function generateAxisTicks(range2, axis2, defaultIntervals) {
|
|
35775
35775
|
if (range2.logScale && range2.logBase) {
|
|
35776
35776
|
return generateLogTicks(range2);
|
|
35777
35777
|
}
|
|
35778
|
-
const explicit = generateIntervalTicks(range2,
|
|
35778
|
+
const explicit = generateIntervalTicks(range2, axis2?.majorUnit ?? 0);
|
|
35779
35779
|
if (explicit.length > 0) {
|
|
35780
35780
|
return explicit;
|
|
35781
35781
|
}
|
|
@@ -35788,12 +35788,12 @@ function generateAxisTicks(range2, axis, defaultIntervals) {
|
|
|
35788
35788
|
(_, index) => range2.min + range2.span / defaultIntervals * index
|
|
35789
35789
|
);
|
|
35790
35790
|
}
|
|
35791
|
-
function generateMinorAxisTicks(range2,
|
|
35792
|
-
const minor = generateIntervalTicks(range2,
|
|
35791
|
+
function generateMinorAxisTicks(range2, axis2) {
|
|
35792
|
+
const minor = generateIntervalTicks(range2, axis2?.minorUnit ?? 0);
|
|
35793
35793
|
if (minor.length === 0) {
|
|
35794
35794
|
return [];
|
|
35795
35795
|
}
|
|
35796
|
-
const majorUnit =
|
|
35796
|
+
const majorUnit = axis2?.majorUnit;
|
|
35797
35797
|
if (!majorUnit || !Number.isFinite(majorUnit) || majorUnit <= 0) {
|
|
35798
35798
|
return minor;
|
|
35799
35799
|
}
|
|
@@ -35804,33 +35804,33 @@ function generateMinorAxisTicks(range2, axis) {
|
|
|
35804
35804
|
}
|
|
35805
35805
|
|
|
35806
35806
|
// chart/render/chart-view-axes.ts
|
|
35807
|
-
function chartAxisRatio(value, scale,
|
|
35808
|
-
const range2 =
|
|
35807
|
+
function chartAxisRatio(value, scale, axis2) {
|
|
35808
|
+
const range2 = axis2?.range;
|
|
35809
35809
|
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);
|
|
35810
35810
|
return range2?.reverseOrder ? 1 - ratio : ratio;
|
|
35811
35811
|
}
|
|
35812
|
-
function chartAxisLabels(
|
|
35813
|
-
return
|
|
35812
|
+
function chartAxisLabels(axis2) {
|
|
35813
|
+
return axis2?.source.deleted !== true && axis2?.source.tickLabelPosition !== "none";
|
|
35814
35814
|
}
|
|
35815
|
-
function options(
|
|
35815
|
+
function options(axis2) {
|
|
35816
35816
|
return {
|
|
35817
|
-
...
|
|
35818
|
-
...
|
|
35819
|
-
...
|
|
35820
|
-
...
|
|
35817
|
+
...axis2.scaling,
|
|
35818
|
+
...axis2.scaling.logBase === void 0 ? {} : { logScale: true },
|
|
35819
|
+
...axis2.majorUnit === void 0 ? {} : { majorUnit: axis2.majorUnit },
|
|
35820
|
+
...axis2.minorUnit === void 0 ? {} : { minorUnit: axis2.minorUnit }
|
|
35821
35821
|
};
|
|
35822
35822
|
}
|
|
35823
35823
|
function applyChartAxes(model, chart, color) {
|
|
35824
35824
|
if (!chart.axes?.length) return;
|
|
35825
35825
|
const axes = chart.axes;
|
|
35826
|
-
const linked = axes.filter((
|
|
35826
|
+
const linked = axes.filter((axis2) => axis2.id !== void 0 && chart.axisIds?.includes(axis2.id));
|
|
35827
35827
|
const candidates = linked.length ? linked : axes;
|
|
35828
35828
|
const xy = model.type === "scatter" || model.type === "bubble";
|
|
35829
|
-
const value = candidates.find((
|
|
35829
|
+
const value = candidates.find((axis2) => axis2.kind === "val" && !["b", "t"].includes(axis2.position ?? "")) ?? candidates.find((axis2) => axis2.kind === "val");
|
|
35830
35830
|
const category = candidates.find(
|
|
35831
|
-
(
|
|
35831
|
+
(axis2) => xy ? axis2.kind === "val" && axis2 !== value : axis2.kind === "cat" || axis2.kind === "date"
|
|
35832
35832
|
);
|
|
35833
|
-
const secondary = axes.find((
|
|
35833
|
+
const secondary = axes.find((axis2) => axis2.kind === "val" && axis2 !== value && axis2 !== category);
|
|
35834
35834
|
const paint2 = (shape2) => {
|
|
35835
35835
|
const ln = shape2?.line;
|
|
35836
35836
|
const fill = ln?.fill;
|
|
@@ -35841,8 +35841,8 @@ function applyChartAxes(model, chart, color) {
|
|
|
35841
35841
|
...ln?.dash === void 0 ? {} : { dash: ln.dash }
|
|
35842
35842
|
};
|
|
35843
35843
|
};
|
|
35844
|
-
const bind = (
|
|
35845
|
-
const opts = options(
|
|
35844
|
+
const bind = (axis2, scale, values) => {
|
|
35845
|
+
const opts = options(axis2);
|
|
35846
35846
|
const automatic = opts.logScale ? computeLogValueRange(
|
|
35847
35847
|
[{ values: values ?? [] }],
|
|
35848
35848
|
opts.logBase && Number.isFinite(opts.logBase) && opts.logBase > 1 ? opts.logBase : 10
|
|
@@ -35860,12 +35860,12 @@ function applyChartAxes(model, chart, color) {
|
|
|
35860
35860
|
scale.ticks = generateAxisTicks(range2, opts, 5);
|
|
35861
35861
|
}
|
|
35862
35862
|
return {
|
|
35863
|
-
source:
|
|
35863
|
+
source: axis2,
|
|
35864
35864
|
range: range2,
|
|
35865
35865
|
minorTicks: generateMinorAxisTicks(range2, opts),
|
|
35866
|
-
line: paint2(
|
|
35867
|
-
majorGrid: paint2(
|
|
35868
|
-
minorGrid: paint2(
|
|
35866
|
+
line: paint2(axis2.spPr),
|
|
35867
|
+
majorGrid: paint2(axis2.majorGridlinesSpPr),
|
|
35868
|
+
minorGrid: paint2(axis2.minorGridlinesSpPr)
|
|
35869
35869
|
};
|
|
35870
35870
|
};
|
|
35871
35871
|
const out = {};
|
|
@@ -38152,13 +38152,13 @@ function scatter(model, area, out, size) {
|
|
|
38152
38152
|
s.values.forEach((_, i2) => {
|
|
38153
38153
|
reach = Math.max(reach, radiusOf(s.sizes?.[i2] ?? void 0) ?? 0);
|
|
38154
38154
|
});
|
|
38155
|
-
const widen = (s, length,
|
|
38156
|
-
if (
|
|
38155
|
+
const widen = (s, length, axis2) => {
|
|
38156
|
+
if (axis2?.range.logScale) return s;
|
|
38157
38157
|
const pad4 = reach * (s.max - s.min || 1) / Math.max(1, length - 2 * reach);
|
|
38158
38158
|
return {
|
|
38159
38159
|
...s,
|
|
38160
|
-
min:
|
|
38161
|
-
max:
|
|
38160
|
+
min: axis2?.source.scaling.min === void 0 ? s.min - pad4 : s.min,
|
|
38161
|
+
max: axis2?.source.scaling.max === void 0 ? s.max + pad4 : s.max
|
|
38162
38162
|
};
|
|
38163
38163
|
};
|
|
38164
38164
|
const xView = widen(xs, plot.w, model.axes?.category);
|
|
@@ -39491,9 +39491,9 @@ var CATEGORY_ONLY = [
|
|
|
39491
39491
|
"minorTimeUnit"
|
|
39492
39492
|
];
|
|
39493
39493
|
var VALUE_ONLY = ["crossBetween", "displayUnits"];
|
|
39494
|
-
function convertChartAxis(
|
|
39495
|
-
if (
|
|
39496
|
-
const next = structuredClone(
|
|
39494
|
+
function convertChartAxis(axis2, kind) {
|
|
39495
|
+
if (axis2.kind === kind) return axis2;
|
|
39496
|
+
const next = structuredClone(axis2);
|
|
39497
39497
|
next.kind = kind;
|
|
39498
39498
|
if (kind === "val") {
|
|
39499
39499
|
for (const key of CATEGORY_ONLY) delete next[key];
|
|
@@ -39526,7 +39526,7 @@ var SWITCHABLE = {
|
|
|
39526
39526
|
stock: false,
|
|
39527
39527
|
surface: true
|
|
39528
39528
|
};
|
|
39529
|
-
function
|
|
39529
|
+
function chartGroupElement(kind, is3D) {
|
|
39530
39530
|
const match = Object.entries(CHART_GROUP_ELEMENTS).find(
|
|
39531
39531
|
([, value]) => value.kind === kind && value.is3D === is3D
|
|
39532
39532
|
);
|
|
@@ -39542,7 +39542,7 @@ function groupingFor(element4, grouping) {
|
|
|
39542
39542
|
var horizontalBars = (group3) => group3.kind === "bar" && group3.barDirection === "bar";
|
|
39543
39543
|
function newGroup(base, target, series2) {
|
|
39544
39544
|
const is3D = target.is3D ?? (base.is3D && SWITCHABLE[target.kind] === true);
|
|
39545
|
-
const element4 =
|
|
39545
|
+
const element4 = chartGroupElement(target.kind, is3D);
|
|
39546
39546
|
const group3 = { kind: target.kind, element: element4, is3D, series: series2, axisIds: [] };
|
|
39547
39547
|
const allowed = GROUP_FIELDS[element4] ?? [];
|
|
39548
39548
|
for (const key of allowed)
|
|
@@ -39568,11 +39568,11 @@ function newGroup(base, target, series2) {
|
|
|
39568
39568
|
return group3;
|
|
39569
39569
|
}
|
|
39570
39570
|
function withSeriesAxis(space, group3, axes) {
|
|
39571
|
-
if ((group3.element === "line3DChart" || group3.kind === "surface") && !axes.some((
|
|
39571
|
+
if ((group3.element === "line3DChart" || group3.kind === "surface") && !axes.some((axis2) => axis2.kind === "ser")) {
|
|
39572
39572
|
const id = Math.max(
|
|
39573
39573
|
0,
|
|
39574
39574
|
...[...space.plotArea.axes, ...axes].flatMap(
|
|
39575
|
-
(
|
|
39575
|
+
(axis2) => axis2.id === void 0 ? [] : [axis2.id]
|
|
39576
39576
|
)
|
|
39577
39577
|
) + 1;
|
|
39578
39578
|
axes.push({
|
|
@@ -39592,11 +39592,11 @@ function withSeriesAxis(space, group3, axes) {
|
|
|
39592
39592
|
function groupAxes(space, base, group3) {
|
|
39593
39593
|
if (!groupHasAxes(group3.element)) return [];
|
|
39594
39594
|
const xy = isXYChartKind(group3.kind);
|
|
39595
|
-
const byId = (id) => space.plotArea.axes.find((
|
|
39596
|
-
const old = base.axisIds.map(byId).filter((
|
|
39595
|
+
const byId = (id) => space.plotArea.axes.find((axis2) => axis2.id === id);
|
|
39596
|
+
const old = base.axisIds.map(byId).filter((axis2) => axis2 !== void 0);
|
|
39597
39597
|
if (old.length < 2) {
|
|
39598
39598
|
const taken = new Set(
|
|
39599
|
-
space.plotArea.axes.flatMap((
|
|
39599
|
+
space.plotArea.axes.flatMap((axis2) => axis2.id === void 0 ? [] : [axis2.id])
|
|
39600
39600
|
);
|
|
39601
39601
|
const free = DEFAULT_CHART_AXIS_IDS.every((id) => !taken.has(id));
|
|
39602
39602
|
const top = Math.max(0, ...taken);
|
|
@@ -39604,9 +39604,9 @@ function groupAxes(space, base, group3) {
|
|
|
39604
39604
|
return withSeriesAxis(space, group3, defaultChartAxes(horizontalBars(group3), xy, ids));
|
|
39605
39605
|
}
|
|
39606
39606
|
const rotate2 = horizontalBars(base) !== horizontalBars(group3);
|
|
39607
|
-
const axes = old.slice(0, group3.element === "line3DChart" || group3.is3D ? 3 : 2).map((
|
|
39608
|
-
const kind = i2 === 0 ? xy ? "val" :
|
|
39609
|
-
const next = convertChartAxis(
|
|
39607
|
+
const axes = old.slice(0, group3.element === "line3DChart" || group3.is3D ? 3 : 2).map((axis2, i2) => {
|
|
39608
|
+
const kind = i2 === 0 ? xy ? "val" : axis2.kind === "val" ? "cat" : axis2.kind : axis2.kind;
|
|
39609
|
+
const next = convertChartAxis(axis2, kind);
|
|
39610
39610
|
if (rotate2) assignOrDelete(next, "position", rotatedAxisPosition(next.position));
|
|
39611
39611
|
if (i2 === 1 && next.kind === "val" && xy !== isXYChartKind(base.kind))
|
|
39612
39612
|
next.crossBetween = xy ? "midCat" : "between";
|
|
@@ -39631,7 +39631,7 @@ function setChartType(space, target) {
|
|
|
39631
39631
|
if (group3.is3D && target.kind === "bar" && group3.grouping === "standard" && base.axisIds.length < 3)
|
|
39632
39632
|
group3.grouping = "clustered";
|
|
39633
39633
|
const axes = groupAxes(draft, base, group3);
|
|
39634
|
-
group3.axisIds = axes.flatMap((
|
|
39634
|
+
group3.axisIds = axes.flatMap((axis2) => axis2.id === void 0 ? [] : [axis2.id]);
|
|
39635
39635
|
draft.plotArea.groups = [group3];
|
|
39636
39636
|
draft.plotArea.axes = axes;
|
|
39637
39637
|
if (!group3.is3D) {
|
|
@@ -39644,6 +39644,20 @@ function setChartType(space, target) {
|
|
|
39644
39644
|
});
|
|
39645
39645
|
}
|
|
39646
39646
|
|
|
39647
|
+
// chart/edit/group-options.ts
|
|
39648
|
+
var RANGES = {
|
|
39649
|
+
gapWidth: [0, 500],
|
|
39650
|
+
overlap: [-100, 100],
|
|
39651
|
+
firstSliceAngle: [0, 360],
|
|
39652
|
+
holeSize: [1, 90]
|
|
39653
|
+
};
|
|
39654
|
+
var isChartGroupOption = (key) => Object.hasOwn(RANGES, key);
|
|
39655
|
+
function assertChartGroupOption(key, value) {
|
|
39656
|
+
const [min, max] = RANGES[key];
|
|
39657
|
+
if (!Number.isInteger(value) || value < min || value > max)
|
|
39658
|
+
throw new RangeError(`Chart ${key} must be a whole number from ${min} to ${max}`);
|
|
39659
|
+
}
|
|
39660
|
+
|
|
39647
39661
|
// chart/edit/data-sheet.ts
|
|
39648
39662
|
function chartSpaceDataSheet(space) {
|
|
39649
39663
|
const entries = chartSeriesEntries(space);
|
|
@@ -39722,6 +39736,58 @@ function applyChartSpaceDataSheetEdits(space, edits) {
|
|
|
39722
39736
|
return editChartSpace(next, (draft) => applyStandardChartLayout(draft, layoutSheet, count));
|
|
39723
39737
|
}
|
|
39724
39738
|
|
|
39739
|
+
// chart/edit/new-chart-minimal.ts
|
|
39740
|
+
var VARIED = /* @__PURE__ */ new Set(["pie", "doughnut", "ofPie"]);
|
|
39741
|
+
function schemaGrouping(element4, grouping) {
|
|
39742
|
+
const bar = element4 === "barChart" || element4 === "bar3DChart";
|
|
39743
|
+
if (bar) return grouping ?? "clustered";
|
|
39744
|
+
return grouping === void 0 || grouping === "clustered" ? "standard" : grouping;
|
|
39745
|
+
}
|
|
39746
|
+
function minimalChartGroup(target, series2) {
|
|
39747
|
+
const is3D = target.is3D ?? false;
|
|
39748
|
+
const element4 = chartGroupElement(target.kind, is3D);
|
|
39749
|
+
const allowed = GROUP_FIELDS[element4] ?? [];
|
|
39750
|
+
const own2 = isXYChartKind(target.kind) ? series2.map((item2) => stripSeriesForKind(item2, "bar", target.kind)) : series2;
|
|
39751
|
+
const group3 = { kind: target.kind, element: element4, is3D, series: own2, axisIds: [] };
|
|
39752
|
+
if (target.kind === "bar") group3.barDirection = target.barDirection ?? "col";
|
|
39753
|
+
if (allowed.includes("grouping")) group3.grouping = schemaGrouping(element4, target.grouping);
|
|
39754
|
+
if (allowed.includes("varyColors")) group3.varyColors = VARIED.has(target.kind);
|
|
39755
|
+
if (target.kind === "ofPie") group3.ofPieType = "pie";
|
|
39756
|
+
if (target.kind === "scatter") group3.scatterStyle = "lineMarker";
|
|
39757
|
+
if (target.kind === "radar") group3.radarStyle = "marker";
|
|
39758
|
+
return group3;
|
|
39759
|
+
}
|
|
39760
|
+
function axis(kind, id, crossAxisId, position2) {
|
|
39761
|
+
return {
|
|
39762
|
+
kind,
|
|
39763
|
+
id,
|
|
39764
|
+
crossAxisId,
|
|
39765
|
+
position: position2,
|
|
39766
|
+
scaling: { orientation: "minMax" },
|
|
39767
|
+
deleted: false,
|
|
39768
|
+
majorGridlines: false,
|
|
39769
|
+
minorGridlines: false
|
|
39770
|
+
};
|
|
39771
|
+
}
|
|
39772
|
+
function minimalChartAxes(group3, ids) {
|
|
39773
|
+
if (!groupHasAxes(group3.element)) return [];
|
|
39774
|
+
const [first3, second, third] = ids;
|
|
39775
|
+
const horizontal = group3.kind === "bar" && group3.barDirection === "bar";
|
|
39776
|
+
const axes = [
|
|
39777
|
+
axis(isXYChartKind(group3.kind) ? "val" : "cat", first3, second, horizontal ? "l" : "b"),
|
|
39778
|
+
axis("val", second, first3, horizontal ? "b" : "l")
|
|
39779
|
+
];
|
|
39780
|
+
if (group3.element === "line3DChart" || group3.kind === "surface")
|
|
39781
|
+
axes.push(axis("ser", third, second, "b"));
|
|
39782
|
+
return axes;
|
|
39783
|
+
}
|
|
39784
|
+
function minimalChartTitle(text2) {
|
|
39785
|
+
const rich = chartTextBodyFromXml(
|
|
39786
|
+
`<a:bodyPr/><a:lstStyle/><a:p><a:r><a:t>${escapeText2(text2)}</a:t></a:r></a:p>`
|
|
39787
|
+
);
|
|
39788
|
+
return { tx: { rich, text: rich.text }, text: rich.text, overlay: false };
|
|
39789
|
+
}
|
|
39790
|
+
|
|
39725
39791
|
// chart/edit/new-chart.ts
|
|
39726
39792
|
var DEFAULT_CHART_DATA_SHEET = {
|
|
39727
39793
|
categories: ["Category 1", "Category 2", "Category 3", "Category 4"],
|
|
@@ -39731,21 +39797,84 @@ var DEFAULT_CHART_DATA_SHEET = {
|
|
|
39731
39797
|
{ name: "Series 3", values: [2, 2, 3, 5] }
|
|
39732
39798
|
]
|
|
39733
39799
|
};
|
|
39734
|
-
|
|
39800
|
+
var CATEGORY_ONLY2 = [
|
|
39801
|
+
"labelAlign",
|
|
39802
|
+
"noMultiLevelLabels",
|
|
39803
|
+
"tickLabelSkip",
|
|
39804
|
+
"tickMarkSkip"
|
|
39805
|
+
];
|
|
39806
|
+
function withDateAxis(space) {
|
|
39807
|
+
return editChartSpace(space, (draft) => {
|
|
39808
|
+
const axis2 = draft.plotArea.axes[0];
|
|
39809
|
+
if (axis2?.kind !== "cat") return;
|
|
39810
|
+
axis2.kind = "date";
|
|
39811
|
+
for (const key of CATEGORY_ONLY2) delete axis2[key];
|
|
39812
|
+
});
|
|
39813
|
+
}
|
|
39814
|
+
function series(sheet, index, options2, sheetName) {
|
|
39735
39815
|
const entry2 = sheet.series[index];
|
|
39816
|
+
if (options2.data === "literal")
|
|
39817
|
+
return {
|
|
39818
|
+
index,
|
|
39819
|
+
order: index,
|
|
39820
|
+
tx: { value: entry2.name, text: entry2.name },
|
|
39821
|
+
...options2.profile === "minimal" ? {} : { invertIfNegative: false },
|
|
39822
|
+
dataPoints: [],
|
|
39823
|
+
categories: categorySource(sheet.categories, void 0),
|
|
39824
|
+
values: numberSource(entry2.values, void 0)
|
|
39825
|
+
};
|
|
39736
39826
|
const formulas = standardChartFormulas(sheetName, index, sheet.categories.length);
|
|
39737
39827
|
return {
|
|
39738
39828
|
index,
|
|
39739
39829
|
order: index,
|
|
39740
39830
|
tx: { reference: categorySource([entry2.name], void 0, formulas.name), text: entry2.name },
|
|
39741
|
-
invertIfNegative: false,
|
|
39831
|
+
...options2.profile === "minimal" ? {} : { invertIfNegative: false },
|
|
39742
39832
|
dataPoints: [],
|
|
39743
39833
|
categories: categorySource(sheet.categories, void 0, formulas.categories),
|
|
39744
39834
|
values: numberSource(entry2.values, void 0, formulas.values)
|
|
39745
39835
|
};
|
|
39746
39836
|
}
|
|
39747
|
-
function
|
|
39748
|
-
const
|
|
39837
|
+
function axisIds(options2) {
|
|
39838
|
+
const ids = options2.axisIds ?? [];
|
|
39839
|
+
const [first3, second, third] = [
|
|
39840
|
+
ids[0] ?? DEFAULT_CHART_AXIS_IDS[0],
|
|
39841
|
+
ids[1] ?? DEFAULT_CHART_AXIS_IDS[1],
|
|
39842
|
+
ids[2] ?? DEFAULT_CHART_AXIS_IDS[1] + 1
|
|
39843
|
+
];
|
|
39844
|
+
for (const id of [first3, second, third])
|
|
39845
|
+
if (!Number.isSafeInteger(id) || id < 0)
|
|
39846
|
+
throw new RangeError("Chart axis ids must be non-negative whole numbers");
|
|
39847
|
+
if ((/* @__PURE__ */ new Set([first3, second, third])).size !== 3)
|
|
39848
|
+
throw new RangeError("Chart axis ids must differ");
|
|
39849
|
+
return [first3, second, third];
|
|
39850
|
+
}
|
|
39851
|
+
function withAxisIds(space, ids) {
|
|
39852
|
+
return editChartSpace(space, (draft) => {
|
|
39853
|
+
const map = /* @__PURE__ */ new Map();
|
|
39854
|
+
draft.plotArea.axes.forEach((axis2, position2) => {
|
|
39855
|
+
if (axis2.id !== void 0 && ids[position2] !== void 0) map.set(axis2.id, ids[position2]);
|
|
39856
|
+
});
|
|
39857
|
+
const renumber = (id) => map.get(id) ?? id;
|
|
39858
|
+
for (const axis2 of draft.plotArea.axes) {
|
|
39859
|
+
if (axis2.id !== void 0) axis2.id = renumber(axis2.id);
|
|
39860
|
+
if (axis2.crossAxisId !== void 0) axis2.crossAxisId = renumber(axis2.crossAxisId);
|
|
39861
|
+
}
|
|
39862
|
+
for (const group3 of draft.plotArea.groups) group3.axisIds = group3.axisIds.map(renumber);
|
|
39863
|
+
});
|
|
39864
|
+
}
|
|
39865
|
+
function withGroupSettings(space, settings) {
|
|
39866
|
+
return editChartSpace(space, (draft) => {
|
|
39867
|
+
const group3 = draft.plotArea.groups[0];
|
|
39868
|
+
const allowed = GROUP_FIELDS[group3.element] ?? [];
|
|
39869
|
+
for (const [key, value] of Object.entries(settings)) {
|
|
39870
|
+
if (value === void 0) continue;
|
|
39871
|
+
if (!allowed.includes(key)) throw new RangeError(`A ${group3.element} has no ${key} setting`);
|
|
39872
|
+
if (isChartGroupOption(key)) assertChartGroupOption(key, value);
|
|
39873
|
+
Object.assign(group3, { [key]: structuredClone(value) });
|
|
39874
|
+
}
|
|
39875
|
+
});
|
|
39876
|
+
}
|
|
39877
|
+
function officeChartSpace(sheet, target, options2, sheetName) {
|
|
39749
39878
|
const group3 = {
|
|
39750
39879
|
kind: "bar",
|
|
39751
39880
|
element: "barChart",
|
|
@@ -39755,10 +39884,10 @@ function newChartSpace(sheet = DEFAULT_CHART_DATA_SHEET, target, options2 = {})
|
|
|
39755
39884
|
varyColors: false,
|
|
39756
39885
|
gapWidth: 219,
|
|
39757
39886
|
overlap: -27,
|
|
39758
|
-
series: sheet.series.map((_, index) => series(sheet, index, sheetName)),
|
|
39887
|
+
series: sheet.series.map((_, index) => series(sheet, index, options2, sheetName)),
|
|
39759
39888
|
axisIds: [...DEFAULT_CHART_AXIS_IDS]
|
|
39760
39889
|
};
|
|
39761
|
-
|
|
39890
|
+
const space = {
|
|
39762
39891
|
roundedCorners: false,
|
|
39763
39892
|
autoTitleDeleted: options2.title === void 0,
|
|
39764
39893
|
plotArea: { layout: {}, groups: [group3], axes: defaultChartAxes(false, false) },
|
|
@@ -39767,9 +39896,36 @@ function newChartSpace(sheet = DEFAULT_CHART_DATA_SHEET, target, options2 = {})
|
|
|
39767
39896
|
};
|
|
39768
39897
|
const column = !target || target.kind === "bar" && (target.barDirection ?? "col") === "col";
|
|
39769
39898
|
if (target && !(column && !target.is3D && (target.grouping ?? "clustered") === "clustered"))
|
|
39770
|
-
|
|
39771
|
-
|
|
39772
|
-
|
|
39899
|
+
return setChartType(space, target);
|
|
39900
|
+
return space;
|
|
39901
|
+
}
|
|
39902
|
+
function minimalChartSpace(sheet, target, options2, sheetName) {
|
|
39903
|
+
const group3 = minimalChartGroup(
|
|
39904
|
+
target ?? { kind: "bar" },
|
|
39905
|
+
sheet.series.map((_, index) => series(sheet, index, options2, sheetName))
|
|
39906
|
+
);
|
|
39907
|
+
if (group3.kind === "stock" && ![3, 4].includes(group3.series.length))
|
|
39908
|
+
throw new RangeError("A stock chart requires three or four price series");
|
|
39909
|
+
const axes = minimalChartAxes(group3, axisIds(options2));
|
|
39910
|
+
group3.axisIds = axes.flatMap((axis2) => axis2.id === void 0 ? [] : [axis2.id]);
|
|
39911
|
+
return {
|
|
39912
|
+
autoTitleDeleted: options2.title === void 0,
|
|
39913
|
+
plotArea: { layout: {}, groups: [group3], axes },
|
|
39914
|
+
plotVisibleOnly: true,
|
|
39915
|
+
displayBlanksAs: "gap"
|
|
39916
|
+
};
|
|
39917
|
+
}
|
|
39918
|
+
function newChartSpace(sheet = DEFAULT_CHART_DATA_SHEET, target, options2 = {}) {
|
|
39919
|
+
const sheetName = options2.sheetName ?? DEFAULT_CHART_SHEET_NAME;
|
|
39920
|
+
let space = options2.profile === "minimal" ? minimalChartSpace(sheet, target, options2, sheetName) : officeChartSpace(sheet, target, options2, sheetName);
|
|
39921
|
+
if (options2.profile !== "minimal" && options2.axisIds !== void 0)
|
|
39922
|
+
space = withAxisIds(space, axisIds(options2));
|
|
39923
|
+
if (options2.dateAxis) space = withDateAxis(space);
|
|
39924
|
+
if (options2.group) space = withGroupSettings(space, options2.group);
|
|
39925
|
+
if (options2.title !== void 0)
|
|
39926
|
+
space = options2.profile === "minimal" ? { ...space, title: minimalChartTitle(options2.title), autoTitleDeleted: false } : setChartTitle(space, options2.title);
|
|
39927
|
+
const legend = options2.legendPosition === void 0 ? "b" : options2.legendPosition;
|
|
39928
|
+
return legend === null ? space : setChartLegend(space, { position: legend });
|
|
39773
39929
|
}
|
|
39774
39930
|
|
|
39775
39931
|
// chart/workbook/package-save.ts
|
|
@@ -40419,8 +40575,8 @@ function wrapElement(doc, placement) {
|
|
|
40419
40575
|
return el2(doc, WP_NS3, "wp:wrapNone");
|
|
40420
40576
|
}
|
|
40421
40577
|
}
|
|
40422
|
-
function position(doc,
|
|
40423
|
-
const node = attrs2(el2(doc, WP_NS3, `wp:position${
|
|
40578
|
+
function position(doc, axis2, relativeFrom, align, offsetPx) {
|
|
40579
|
+
const node = attrs2(el2(doc, WP_NS3, `wp:position${axis2}`), { relativeFrom });
|
|
40424
40580
|
if (align) {
|
|
40425
40581
|
const a2 = el2(doc, WP_NS3, "wp:align");
|
|
40426
40582
|
a2.textContent = align;
|