@office-kit/pptx-preview 0.9.8 → 0.9.10
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/LICENSE +21 -0
- package/dist/index.js +1 -1
- package/dist/node.js +1 -1
- package/dist/{src-B73Pj0gv.js → src-DC6HxO-i.js} +50 -37
- package/dist/src-DC6HxO-i.js.map +1 -0
- package/package.json +3 -3
- package/dist/src-B73Pj0gv.js.map +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Yuichiro Yamashita
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as MONO, c as TIMES, d as substituteFamily, l as defaultMeasurer, n as renderSlideSvg, o as SANS, r as ARIAL, s as SERIF, t as auditTextLayout } from "./src-
|
|
1
|
+
import { a as MONO, c as TIMES, d as substituteFamily, l as defaultMeasurer, n as renderSlideSvg, o as SANS, r as ARIAL, s as SERIF, t as auditTextLayout } from "./src-DC6HxO-i.js";
|
|
2
2
|
export { ARIAL, MONO, SANS, SERIF, TIMES, auditTextLayout, defaultMeasurer, renderSlideSvg as renderSlideToSvg, substituteFamily };
|
package/dist/node.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as MONO, c as TIMES, d as substituteFamily, i as AVG_GLYPH_W_RATIO, l as defaultMeasurer, n as renderSlideSvg, o as SANS, r as ARIAL, s as SERIF, t as auditTextLayout, u as isCjk } from "./src-
|
|
1
|
+
import { a as MONO, c as TIMES, d as substituteFamily, i as AVG_GLYPH_W_RATIO, l as defaultMeasurer, n as renderSlideSvg, o as SANS, r as ARIAL, s as SERIF, t as auditTextLayout, u as isCjk } from "./src-DC6HxO-i.js";
|
|
2
2
|
import { getSlideSize } from "@office-kit/pptx";
|
|
3
3
|
import { Resvg } from "@resvg/resvg-js";
|
|
4
4
|
import * as fontkit from "fontkit";
|
|
@@ -2781,7 +2781,7 @@ const accentSequence = (theme) => {
|
|
|
2781
2781
|
return hexes.length > 0 ? hexes : fallbacks;
|
|
2782
2782
|
};
|
|
2783
2783
|
const DEFAULT_CHART_TITLE_PT = 13;
|
|
2784
|
-
const layoutChart = (xEmu, yEmu, wEmu, hEmu, hasTitle, hasAxes, titleOverlay = false, legendOverlay = false, hasLegend = true, titlePx = DEFAULT_CHART_TITLE_PT * PX_PER_PT) => {
|
|
2784
|
+
const layoutChart = (xEmu, yEmu, wEmu, hEmu, hasTitle, hasAxes, titleOverlay = false, legendOverlay = false, hasLegend = true, titlePx = DEFAULT_CHART_TITLE_PT * PX_PER_PT, plotAreaLayout) => {
|
|
2785
2785
|
const x = xEmu / EMU_PER_PX;
|
|
2786
2786
|
const y = yEmu / EMU_PER_PX;
|
|
2787
2787
|
const w = wEmu / EMU_PER_PX;
|
|
@@ -2791,15 +2791,18 @@ const layoutChart = (xEmu, yEmu, wEmu, hEmu, hasTitle, hasAxes, titleOverlay = f
|
|
|
2791
2791
|
const padding = 8;
|
|
2792
2792
|
const yAxisGutter = hasAxes ? 32 : 0;
|
|
2793
2793
|
const xAxisGutter = hasAxes ? 18 : 0;
|
|
2794
|
+
const inner = plotAreaLayout?.target === "inner" ? plotAreaLayout : void 0;
|
|
2795
|
+
const plotX = inner ? x + Math.max(0, Math.min(1, inner.x)) * w : x + padding + yAxisGutter;
|
|
2796
|
+
const plotY = inner ? y + Math.max(0, Math.min(1, inner.y)) * h : y + titleStrip + padding;
|
|
2794
2797
|
return {
|
|
2795
2798
|
x,
|
|
2796
2799
|
y,
|
|
2797
2800
|
w,
|
|
2798
2801
|
h,
|
|
2799
|
-
plotX
|
|
2800
|
-
plotY
|
|
2801
|
-
plotW: Math.max(0, w - 2 * padding - yAxisGutter),
|
|
2802
|
-
plotH: Math.max(0, h - titleStrip - legendStrip - xAxisGutter - 2 * padding),
|
|
2802
|
+
plotX,
|
|
2803
|
+
plotY,
|
|
2804
|
+
plotW: inner ? Math.max(0, Math.min(x + w, x + (inner.x + inner.w) * w) - plotX) : Math.max(0, w - 2 * padding - yAxisGutter),
|
|
2805
|
+
plotH: inner ? Math.max(0, Math.min(y + h, y + (inner.y + inner.h) * h) - plotY) : Math.max(0, h - titleStrip - legendStrip - xAxisGutter - 2 * padding),
|
|
2803
2806
|
titleY: y + (titleOverlay ? 14 : padding + titlePx * .7),
|
|
2804
2807
|
legendY: y + h - (legendOverlay ? 18 : legendStrip / 2)
|
|
2805
2808
|
};
|
|
@@ -2888,6 +2891,7 @@ const DISPLAY_UNIT_LABEL = {
|
|
|
2888
2891
|
const DEFAULT_AXIS_COLOR = "#000000";
|
|
2889
2892
|
const DEFAULT_GRID_COLOR = "#D9D9D9";
|
|
2890
2893
|
const AXIS_TICK_LEN = 5;
|
|
2894
|
+
const AXIS_MINOR_TICK_LEN = 3;
|
|
2891
2895
|
const chartFontPx = (sizePt) => (sizePt * PX_PER_PT).toFixed(1);
|
|
2892
2896
|
const axisTickAttrs = (style) => {
|
|
2893
2897
|
const sz = style?.sizePt ?? 10;
|
|
@@ -2949,7 +2953,7 @@ const renderValueAxis = (f, axis) => {
|
|
|
2949
2953
|
out.push(`<text x="${px(lblX)}" y="${px(lblY)}" text-anchor="middle" font-family="sans-serif" font-size="9" fill="#6B7280" font-style="italic" transform="rotate(-90 ${px(lblX)} ${px(lblY)})">${escapeXml(lbl)}</text>`);
|
|
2950
2954
|
} else out.push(`<text x="${px(f.plotX + f.plotW)}" y="${px(f.plotY + f.plotH + 22)}" text-anchor="end" font-family="sans-serif" font-size="9" fill="#6B7280" font-style="italic">${escapeXml(lbl)}</text>`);
|
|
2951
2955
|
}
|
|
2952
|
-
if (axis.orientation === "vertical") out.push(`<line x1="${px(f.plotX)}" y1="${px(f.plotY)}" x2="${px(f.plotX)}" y2="${px(f.plotY + f.plotH)}" stroke="${axisColor}" stroke-width="1"/>`);
|
|
2956
|
+
if (!axis.lineHidden) if (axis.orientation === "vertical") out.push(`<line x1="${px(f.plotX)}" y1="${px(f.plotY)}" x2="${px(f.plotX)}" y2="${px(f.plotY + f.plotH)}" stroke="${axisColor}" stroke-width="1"/>`);
|
|
2953
2957
|
else {
|
|
2954
2958
|
const zeroY = f.plotY + f.plotH - (0 - axis.min) / range * f.plotH;
|
|
2955
2959
|
const spineY = axis.min <= 0 && axis.max >= 0 ? zeroY : f.plotY + f.plotH;
|
|
@@ -2957,7 +2961,7 @@ const renderValueAxis = (f, axis) => {
|
|
|
2957
2961
|
}
|
|
2958
2962
|
return out.join("");
|
|
2959
2963
|
};
|
|
2960
|
-
const renderCategoryAxis = (f, orientation, cats, pointCount, skip = 1, labelStyle, labelRotationDeg, labelAlign, lineColor) => {
|
|
2964
|
+
const renderCategoryAxis = (f, orientation, cats, pointCount, skip = 1, labelStyle, labelRotationDeg, labelAlign, lineColor, lineHidden = false, majorTickMark = "out", minorTickMark = "none") => {
|
|
2961
2965
|
const labels = [];
|
|
2962
2966
|
for (let i = 0; i < pointCount; i++) labels.push(cats[i] ?? (i + 1).toString());
|
|
2963
2967
|
const out = [];
|
|
@@ -2986,22 +2990,23 @@ const renderCategoryAxis = (f, orientation, cats, pointCount, skip = 1, labelSty
|
|
|
2986
2990
|
}
|
|
2987
2991
|
}
|
|
2988
2992
|
const axisColor = lineColor ?? DEFAULT_AXIS_COLOR;
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
out.push(`<line x1="${px(f.plotX - AXIS_TICK_LEN)}" y1="${px(by)}" x2="${px(f.plotX)}" y2="${px(by)}" stroke="${axisColor}" stroke-width="1"/>`);
|
|
2993
|
+
const horizontal = orientation === "horizontal";
|
|
2994
|
+
const edge = horizontal ? f.plotY + f.plotH : f.plotX;
|
|
2995
|
+
const start = horizontal ? f.plotX : f.plotY;
|
|
2996
|
+
const span = horizontal ? f.plotW : f.plotH;
|
|
2997
|
+
if (!lineHidden) out.push(horizontal ? `<line x1="${px(start)}" y1="${px(edge)}" x2="${px(start + span)}" y2="${px(edge)}" stroke="${axisColor}" stroke-width="1"/>` : `<line x1="${px(edge)}" y1="${px(start)}" x2="${px(edge)}" y2="${px(start + span)}" stroke="${axisColor}" stroke-width="1"/>`);
|
|
2998
|
+
const step = pointCount > 0 ? span / pointCount : 0;
|
|
2999
|
+
const ticks = (mark, length, offset) => {
|
|
3000
|
+
if (mark === "none") return;
|
|
3001
|
+
const outward = mark === "in" ? 0 : length;
|
|
3002
|
+
const inward = mark === "out" ? 0 : -length;
|
|
3003
|
+
for (let i = offset; i <= pointCount; i++) {
|
|
3004
|
+
const pos = start + i * step;
|
|
3005
|
+
out.push(horizontal ? `<line x1="${px(pos)}" y1="${px(edge + outward)}" x2="${px(pos)}" y2="${px(edge + inward)}" stroke="${axisColor}" stroke-width="1"/>` : `<line x1="${px(edge - outward)}" y1="${px(pos)}" x2="${px(edge - inward)}" y2="${px(pos)}" stroke="${axisColor}" stroke-width="1"/>`);
|
|
3003
3006
|
}
|
|
3004
|
-
}
|
|
3007
|
+
};
|
|
3008
|
+
ticks(majorTickMark, AXIS_TICK_LEN, 0);
|
|
3009
|
+
ticks(minorTickMark, AXIS_MINOR_TICK_LEN, .5);
|
|
3005
3010
|
return out.join("");
|
|
3006
3011
|
};
|
|
3007
3012
|
const seriesMinMax = (spec) => {
|
|
@@ -3113,6 +3118,8 @@ const pointCount = (spec) => {
|
|
|
3113
3118
|
for (const s of spec.series) if (s.values.length > n) n = s.values.length;
|
|
3114
3119
|
return n;
|
|
3115
3120
|
};
|
|
3121
|
+
const chartFillOpacityAttr = (opacity = 1) => opacity === 1 ? "" : ` fill-opacity="${opacity.toFixed(3)}"`;
|
|
3122
|
+
const chartPointBaseColor = (spec, colors, seriesIndex, pointIndex) => spec.series[seriesIndex]?.pointColors?.[pointIndex] ?? (spec.varyColors && spec.series.length === 1 ? colors[pointIndex % colors.length] : spec.series[seriesIndex]?.color ?? colors[seriesIndex % colors.length]);
|
|
3116
3123
|
const renderColumnChart = (f, spec, colors) => {
|
|
3117
3124
|
const N = pointCount(spec);
|
|
3118
3125
|
if (N === 0 || spec.series.length === 0) return "";
|
|
@@ -3148,7 +3155,7 @@ const renderColumnChart = (f, spec, colors) => {
|
|
|
3148
3155
|
const y0 = f.plotY + f.plotH - (Math.max(stackedTop, stackedBase) - min) / range * f.plotH;
|
|
3149
3156
|
const y1 = f.plotY + f.plotH - (Math.min(stackedTop, stackedBase) - min) / range * f.plotH;
|
|
3150
3157
|
const h = Math.abs(y1 - y0);
|
|
3151
|
-
out.push(`<rect x="${px(x0)}" y="${px(y0)}" width="${px(barW)}" height="${px(h)}" fill="${spec.series[s]?.
|
|
3158
|
+
out.push(`<rect x="${px(x0)}" y="${px(y0)}" width="${px(barW)}" height="${px(h)}" fill="${chartPointBaseColor(spec, colors, s, c)}"${chartFillOpacityAttr(spec.series[s]?.fillOpacity)}/>`);
|
|
3152
3159
|
if (showLabelFor(s) && Math.abs(v) > 0) {
|
|
3153
3160
|
const labelY = (y0 + y1) / 2 + 3;
|
|
3154
3161
|
const labelText = isPercent ? `${Math.round(v * 100)}%` : formatDataLabelValue(spec, s, v);
|
|
@@ -3167,9 +3174,9 @@ const renderColumnChart = (f, spec, colors) => {
|
|
|
3167
3174
|
const top = f.plotY + f.plotH - (v - min) / range * f.plotH;
|
|
3168
3175
|
const y0 = Math.min(top, baseY);
|
|
3169
3176
|
const h = Math.abs(top - baseY);
|
|
3170
|
-
const baseColor =
|
|
3177
|
+
const baseColor = chartPointBaseColor(spec, colors, s, c);
|
|
3171
3178
|
const fillColor = v < 0 && spec.series[s]?.invertIfNegative ? mixHex(baseColor, "#000000", .55) : baseColor;
|
|
3172
|
-
out.push(`<rect x="${px(x0)}" y="${px(y0)}" width="${px(barW)}" height="${px(h)}" fill="${fillColor}"/>`);
|
|
3179
|
+
out.push(`<rect x="${px(x0)}" y="${px(y0)}" width="${px(barW)}" height="${px(h)}" fill="${fillColor}"${chartFillOpacityAttr(spec.series[s]?.fillOpacity)}/>`);
|
|
3173
3180
|
if (showLabelFor(s)) {
|
|
3174
3181
|
const pos = spec.series[s]?.dataLabels?.position ?? spec.dataLabels?.position;
|
|
3175
3182
|
let labelY;
|
|
@@ -3188,7 +3195,7 @@ const renderColumnChart = (f, spec, colors) => {
|
|
|
3188
3195
|
}
|
|
3189
3196
|
}
|
|
3190
3197
|
}
|
|
3191
|
-
out.push(`<line x1="${px(f.plotX)}" y1="${px(baseY)}" x2="${px(f.plotX + f.plotW)}" y2="${px(baseY)}" stroke="#9CA3AF" stroke-width="0.5"/>`);
|
|
3198
|
+
if (!(spec.categoryAxisHidden || spec.categoryAxisLineHidden)) out.push(`<line x1="${px(f.plotX)}" y1="${px(baseY)}" x2="${px(f.plotX + f.plotW)}" y2="${px(baseY)}" stroke="#9CA3AF" stroke-width="0.5"/>`);
|
|
3192
3199
|
for (let s = 0; s < spec.series.length; s++) {
|
|
3193
3200
|
const series = spec.series[s];
|
|
3194
3201
|
if (!series?.trendline) continue;
|
|
@@ -3391,7 +3398,7 @@ const renderBarChart = (f, spec, colors) => {
|
|
|
3391
3398
|
const x0 = f.plotX + (Math.min(base, stackedTop) - min) / range * f.plotW;
|
|
3392
3399
|
const x1 = f.plotX + (Math.max(base, stackedTop) - min) / range * f.plotW;
|
|
3393
3400
|
const w = Math.abs(x1 - x0);
|
|
3394
|
-
out.push(`<rect x="${px(x0)}" y="${px(y0)}" width="${px(w)}" height="${px(barH)}" fill="${spec.series[s]?.
|
|
3401
|
+
out.push(`<rect x="${px(x0)}" y="${px(y0)}" width="${px(w)}" height="${px(barH)}" fill="${chartPointBaseColor(spec, colors, s, c)}"${chartFillOpacityAttr(spec.series[s]?.fillOpacity)}/>`);
|
|
3395
3402
|
if (showLabelForBar(s) && Math.abs(v) > 0) {
|
|
3396
3403
|
const labelX = (x0 + x1) / 2;
|
|
3397
3404
|
const labelText = isPercent ? `${Math.round(v * 100)}%` : formatDataLabelValue(spec, s, v);
|
|
@@ -3410,9 +3417,9 @@ const renderBarChart = (f, spec, colors) => {
|
|
|
3410
3417
|
const tip = f.plotX + (v - min) / range * f.plotW;
|
|
3411
3418
|
const x0 = Math.min(tip, baseX);
|
|
3412
3419
|
const w = Math.abs(tip - baseX);
|
|
3413
|
-
const baseColor =
|
|
3420
|
+
const baseColor = chartPointBaseColor(spec, colors, s, c);
|
|
3414
3421
|
const fillColor = v < 0 && spec.series[s]?.invertIfNegative ? mixHex(baseColor, "#000000", .55) : baseColor;
|
|
3415
|
-
out.push(`<rect x="${px(x0)}" y="${px(y0)}" width="${px(w)}" height="${px(barH)}" fill="${fillColor}"/>`);
|
|
3422
|
+
out.push(`<rect x="${px(x0)}" y="${px(y0)}" width="${px(w)}" height="${px(barH)}" fill="${fillColor}"${chartFillOpacityAttr(spec.series[s]?.fillOpacity)}/>`);
|
|
3416
3423
|
if (showLabelForBar(s)) {
|
|
3417
3424
|
const pos = spec.series[s]?.dataLabels?.position ?? spec.dataLabels?.position;
|
|
3418
3425
|
let labelX;
|
|
@@ -3438,7 +3445,7 @@ const renderBarChart = (f, spec, colors) => {
|
|
|
3438
3445
|
}
|
|
3439
3446
|
}
|
|
3440
3447
|
}
|
|
3441
|
-
out.push(`<line x1="${px(baseX)}" y1="${px(f.plotY)}" x2="${px(baseX)}" y2="${px(f.plotY + f.plotH)}" stroke="#9CA3AF" stroke-width="0.5"/>`);
|
|
3448
|
+
if (!(spec.categoryAxisHidden || spec.categoryAxisLineHidden)) out.push(`<line x1="${px(baseX)}" y1="${px(f.plotY)}" x2="${px(baseX)}" y2="${px(f.plotY + f.plotH)}" stroke="#9CA3AF" stroke-width="0.5"/>`);
|
|
3442
3449
|
return out.join("");
|
|
3443
3450
|
};
|
|
3444
3451
|
const renderLineChart = (f, spec, colors, fill) => {
|
|
@@ -3453,7 +3460,7 @@ const renderLineChart = (f, spec, colors, fill) => {
|
|
|
3453
3460
|
const xAt = (c) => fill ? f.plotX + c * band : f.plotX + (c + .5) * band;
|
|
3454
3461
|
const baseY = f.plotY + f.plotH - (0 - min) / range * f.plotH;
|
|
3455
3462
|
const out = [];
|
|
3456
|
-
out.push(`<line x1="${px(f.plotX)}" y1="${px(baseY)}" x2="${px(f.plotX + f.plotW)}" y2="${px(baseY)}" stroke="#E5E7EB" stroke-width="0.5"/>`);
|
|
3463
|
+
if (!(spec.categoryAxisHidden || spec.categoryAxisLineHidden)) out.push(`<line x1="${px(f.plotX)}" y1="${px(baseY)}" x2="${px(f.plotX + f.plotW)}" y2="${px(baseY)}" stroke="#E5E7EB" stroke-width="0.5"/>`);
|
|
3457
3464
|
const accumulated = Array.from({ length: N }, () => 0);
|
|
3458
3465
|
const perSeries = [];
|
|
3459
3466
|
for (let s = 0; s < spec.series.length; s++) {
|
|
@@ -3728,14 +3735,16 @@ const renderScatterAxes = (f, spec, xB, yB) => {
|
|
|
3728
3735
|
orientation: "vertical",
|
|
3729
3736
|
min: yB.min,
|
|
3730
3737
|
max: yB.max,
|
|
3738
|
+
...spec.valueAxisLineHidden !== void 0 ? { lineHidden: spec.valueAxisLineHidden } : {},
|
|
3731
3739
|
...spec.valueAxis?.numberFormat !== void 0 ? { numberFormat: spec.valueAxis.numberFormat } : {}
|
|
3732
3740
|
};
|
|
3733
3741
|
const xAxis = {
|
|
3734
3742
|
orientation: "horizontal",
|
|
3735
3743
|
min: xB.min,
|
|
3736
|
-
max: xB.max
|
|
3744
|
+
max: xB.max,
|
|
3745
|
+
...spec.categoryAxisLineHidden !== void 0 ? { lineHidden: spec.categoryAxisLineHidden } : {}
|
|
3737
3746
|
};
|
|
3738
|
-
return renderValueAxis(f, yAxis) + renderValueAxis(f, xAxis);
|
|
3747
|
+
return (spec.valueAxisHidden ? "" : renderValueAxis(f, yAxis)) + (spec.categoryAxisHidden ? "" : renderValueAxis(f, xAxis));
|
|
3739
3748
|
};
|
|
3740
3749
|
const renderScatterChart = (f, spec, colors) => {
|
|
3741
3750
|
const perSeries = spec.series.map((s) => xyPoints(s));
|
|
@@ -3910,7 +3919,7 @@ const renderChart = (shape, x, y, w, h, transform, theme) => {
|
|
|
3910
3919
|
const isCartesian = spec.kind === "column" || spec.kind === "bar" || spec.kind === "line" || spec.kind === "area";
|
|
3911
3920
|
const hasAxes = isCartesian || spec.kind === "scatter" || spec.kind === "bubble";
|
|
3912
3921
|
const hasLegend = spec.legend !== void 0 && spec.legend.position !== null;
|
|
3913
|
-
const f = layoutChart(x, y, w, h, !!spec.title, hasAxes, spec.titleOverlay ?? false, spec.legend?.overlay ?? false, hasLegend, (spec.titleStyle?.sizePt ?? DEFAULT_CHART_TITLE_PT) * PX_PER_PT);
|
|
3922
|
+
const f = layoutChart(x, y, w, h, !!spec.title, hasAxes, spec.titleOverlay ?? false, spec.legend?.overlay ?? false, hasLegend, (spec.titleStyle?.sizePt ?? DEFAULT_CHART_TITLE_PT) * PX_PER_PT, spec.plotAreaLayout);
|
|
3914
3923
|
const allNamesForLegend = spec.kind === "pie" || spec.kind === "doughnut" ? Array.from(spec.categories) : spec.series.map((s) => s.name);
|
|
3915
3924
|
const allColorsForLegend = spec.kind === "pie" || spec.kind === "doughnut" ? spec.categories.map((_, i) => spec.series[0]?.pointColors?.[i] ?? spec.series[0]?.color ?? colors[i % colors.length] ?? "#888") : spec.series.map((s, i) => s.color ?? colors[i % colors.length] ?? "#888");
|
|
3916
3925
|
const hiddenSet = new Set(spec.legend?.hiddenIndices ?? []);
|
|
@@ -3945,6 +3954,9 @@ const renderChart = (shape, x, y, w, h, transform, theme) => {
|
|
|
3945
3954
|
min: primaryScale.min,
|
|
3946
3955
|
max: primaryScale.max,
|
|
3947
3956
|
majorUnit: spec.valueAxis?.majorUnit ?? primaryScale.step,
|
|
3957
|
+
...spec.valueAxisLineHidden !== void 0 ? { lineHidden: spec.valueAxisLineHidden } : {},
|
|
3958
|
+
...spec.valueAxisLineColor !== void 0 ? { lineColor: spec.valueAxisLineColor } : {},
|
|
3959
|
+
...spec.valueAxisMajorTickMark !== void 0 ? { majorTickMark: spec.valueAxisMajorTickMark } : {},
|
|
3948
3960
|
...spec.valueAxis?.numberFormat !== void 0 ? { numberFormat: spec.valueAxis.numberFormat } : {},
|
|
3949
3961
|
...spec.valueAxisMajorGridlines !== void 0 ? { majorGridlines: spec.valueAxisMajorGridlines } : {},
|
|
3950
3962
|
...spec.valueAxisLabelStyle !== void 0 ? { labelStyle: spec.valueAxisLabelStyle } : {}
|
|
@@ -3958,7 +3970,7 @@ const renderChart = (shape, x, y, w, h, transform, theme) => {
|
|
|
3958
3970
|
majorGridlines: false,
|
|
3959
3971
|
...spec.valueAxisLabelStyle !== void 0 ? { labelStyle: spec.valueAxisLabelStyle } : {}
|
|
3960
3972
|
});
|
|
3961
|
-
if (N > 0 && !(spec.categoryAxisHidden || spec.categoryAxisTickLabelPos === "none")) axes += renderCategoryAxis(f, "horizontal", spec.categories, N, spec.categoryAxisTickLabelSkip ?? 1, spec.categoryAxisLabelStyle, spec.categoryAxisLabelRotationDeg, spec.categoryAxisLabelAlign, spec.categoryAxisLineColor);
|
|
3973
|
+
if (N > 0 && !(spec.categoryAxisHidden || spec.categoryAxisTickLabelPos === "none")) axes += renderCategoryAxis(f, "horizontal", spec.categories, N, spec.categoryAxisTickLabelSkip ?? 1, spec.categoryAxisLabelStyle, spec.categoryAxisLabelRotationDeg, spec.categoryAxisLabelAlign, spec.categoryAxisLineColor, spec.categoryAxisLineHidden, spec.categoryAxisMajorTickMark, spec.categoryAxisMinorTickMark);
|
|
3962
3974
|
const groups = /* @__PURE__ */ new Map();
|
|
3963
3975
|
for (const s of baked) {
|
|
3964
3976
|
const kind = s.chartKind ?? spec.kind;
|
|
@@ -3993,6 +4005,7 @@ const renderChart = (shape, x, y, w, h, transform, theme) => {
|
|
|
3993
4005
|
const majorUnit = spec.valueAxis?.majorUnit ?? step;
|
|
3994
4006
|
const numberFormat = spec.valueAxis?.numberFormat;
|
|
3995
4007
|
const axisExtras = {
|
|
4008
|
+
...spec.valueAxisLineHidden !== void 0 ? { lineHidden: spec.valueAxisLineHidden } : {},
|
|
3996
4009
|
...majorUnit !== void 0 ? { majorUnit } : {},
|
|
3997
4010
|
...numberFormat !== void 0 ? { numberFormat } : {},
|
|
3998
4011
|
...spec.valueAxisMajorGridlines !== void 0 ? { majorGridlines: spec.valueAxisMajorGridlines } : {},
|
|
@@ -4019,7 +4032,7 @@ const renderChart = (shape, x, y, w, h, transform, theme) => {
|
|
|
4019
4032
|
};
|
|
4020
4033
|
if (!spec.valueAxisHidden) axes = renderValueAxis(f, valueAxis);
|
|
4021
4034
|
const labelsHidden = spec.categoryAxisHidden || spec.categoryAxisTickLabelPos === "none";
|
|
4022
|
-
if (N > 0 && !labelsHidden) axes += renderCategoryAxis(f, spec.kind === "bar" ? "vertical" : "horizontal", spec.categories, N, spec.categoryAxisTickLabelSkip ?? 1, spec.categoryAxisLabelStyle, spec.categoryAxisLabelRotationDeg, spec.categoryAxisLabelAlign, spec.categoryAxisLineColor);
|
|
4035
|
+
if (N > 0 && !labelsHidden) axes += renderCategoryAxis(f, spec.kind === "bar" ? "vertical" : "horizontal", spec.categories, N, spec.categoryAxisTickLabelSkip ?? 1, spec.categoryAxisLabelStyle, spec.categoryAxisLabelRotationDeg, spec.categoryAxisLabelAlign, spec.categoryAxisLineColor, spec.categoryAxisLineHidden, spec.categoryAxisMajorTickMark, spec.categoryAxisMinorTickMark);
|
|
4023
4036
|
}
|
|
4024
4037
|
if (!isCombo) switch (spec.kind) {
|
|
4025
4038
|
case "column":
|
|
@@ -4991,4 +5004,4 @@ const auditTextLayout = (pres, options = {}) => {
|
|
|
4991
5004
|
//#endregion
|
|
4992
5005
|
export { MONO as a, TIMES as c, substituteFamily as d, AVG_GLYPH_W_RATIO as i, defaultMeasurer as l, renderSlideSvg as n, SANS as o, ARIAL as r, SERIF as s, auditTextLayout as t, isCjk as u };
|
|
4993
5006
|
|
|
4994
|
-
//# sourceMappingURL=src-
|
|
5007
|
+
//# sourceMappingURL=src-DC6HxO-i.js.map
|