@extend-ai/react-xlsx 0.20.3 → 0.20.4
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/{browser-KWIEUO2X.js → browser-IQ4UDS5M.js} +8 -27
- package/dist/{browser-KWIEUO2X.js.map → browser-IQ4UDS5M.js.map} +1 -1
- package/dist/{browser-B73UAN6E.cjs → browser-S6E2BS5S.cjs} +8 -28
- package/dist/browser-S6E2BS5S.cjs.map +1 -0
- package/dist/{chart-renderer-XBF7EPUS.js → chart-renderer-4HTNG3SX.js} +94 -180
- package/dist/chart-renderer-4HTNG3SX.js.map +1 -0
- package/dist/{chart-renderer-ZLJVPLGN.js → chart-renderer-5IN2B3YS.js} +86 -172
- package/dist/chart-renderer-5IN2B3YS.js.map +1 -0
- package/dist/{chart-renderer-2EKXNHUD.cjs → chart-renderer-6CWSXOSC.cjs} +324 -410
- package/dist/chart-renderer-6CWSXOSC.cjs.map +1 -0
- package/dist/{chart-renderer-W7XW24JI.cjs → chart-renderer-H4BLRO5P.cjs} +321 -407
- package/dist/chart-renderer-H4BLRO5P.cjs.map +1 -0
- package/dist/chunk-GX5LAENE.cjs +108 -0
- package/dist/chunk-GX5LAENE.cjs.map +1 -0
- package/dist/{chunk-HEEFCVWS.js → chunk-H62SZBEY.js} +401 -132
- package/dist/chunk-H62SZBEY.js.map +1 -0
- package/dist/{chunk-VG4JELEQ.js → chunk-IISMO3AX.js} +30 -15
- package/dist/chunk-IISMO3AX.js.map +1 -0
- package/dist/{chunk-XISBYOD5.cjs → chunk-KQSUAIZD.cjs} +1168 -899
- package/dist/chunk-KQSUAIZD.cjs.map +1 -0
- package/dist/{chunk-HKMFMIKE.js → chunk-LZXL5E4W.js} +16 -7
- package/dist/chunk-LZXL5E4W.js.map +1 -0
- package/dist/chunk-MYN475JP.cjs +32 -0
- package/dist/chunk-MYN475JP.cjs.map +1 -0
- package/dist/{chunk-WGRRI25I.cjs → chunk-NAYVSTCX.cjs} +22 -9
- package/dist/chunk-NAYVSTCX.cjs.map +1 -0
- package/dist/chunk-PK3MCNDK.js +32 -0
- package/dist/chunk-PK3MCNDK.js.map +1 -0
- package/dist/full-3FSPB3R6.cjs +212 -0
- package/dist/full-3FSPB3R6.cjs.map +1 -0
- package/dist/full-GPY27HZY.js +209 -0
- package/dist/full-GPY27HZY.js.map +1 -0
- package/dist/index.cjs +834 -602
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +57 -1
- package/dist/index.d.ts +57 -1
- package/dist/index.js +347 -115
- package/dist/index.js.map +1 -1
- package/dist/{internal-BJsg5os3.d.cts → internal-Cks9H21d.d.cts} +56 -1
- package/dist/{internal-BJsg5os3.d.ts → internal-Cks9H21d.d.ts} +56 -1
- package/dist/internal.cjs +3 -3
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +2 -2
- package/dist/office_charts_bg.wasm +0 -0
- package/dist/office_charts_full_bg.wasm +0 -0
- package/dist/payload-B55ZKNYO.js +6 -0
- package/dist/payload-B55ZKNYO.js.map +1 -0
- package/dist/payload-E2KM77DZ.js +6 -0
- package/dist/payload-E2KM77DZ.js.map +1 -0
- package/dist/payload-K4S5RLJN.cjs +8 -0
- package/dist/payload-K4S5RLJN.cjs.map +1 -0
- package/dist/payload-PL4646XV.cjs +8 -0
- package/dist/payload-PL4646XV.cjs.map +1 -0
- package/dist/{shared-chart-3STFRVWT.js → shared-chart-5KTGZEZ5.js} +38 -20
- package/dist/shared-chart-5KTGZEZ5.js.map +1 -0
- package/dist/{shared-chart-DVC5S2P6.cjs → shared-chart-ACR4M7BP.cjs} +37 -20
- package/dist/shared-chart-ACR4M7BP.cjs.map +1 -0
- package/dist/{shared-chart-BFQNYOIQ.js → shared-chart-EGN5JTKT.js} +37 -20
- package/dist/shared-chart-EGN5JTKT.js.map +1 -0
- package/dist/{shared-chart-MFQSQG4K.cjs → shared-chart-XAV7VA45.cjs} +37 -19
- package/dist/shared-chart-XAV7VA45.cjs.map +1 -0
- package/dist/{surface-regl-R2N54JT2.js → surface-webgl-2ZZ6JQR2.js} +87 -151
- package/dist/surface-webgl-2ZZ6JQR2.js.map +1 -0
- package/dist/{surface-regl-BBJ6OIKK.cjs → surface-webgl-3HS6VBCK.cjs} +88 -152
- package/dist/surface-webgl-3HS6VBCK.cjs.map +1 -0
- package/dist/{surface-regl-7CDGGVDG.js → surface-webgl-4DQXDDXU.js} +87 -151
- package/dist/surface-webgl-4DQXDDXU.js.map +1 -0
- package/dist/{surface-regl-SUJ2TFZA.cjs → surface-webgl-SVYD564V.cjs} +88 -152
- package/dist/surface-webgl-SVYD564V.cjs.map +1 -0
- package/dist/vanilla.cjs +3 -3
- package/dist/vanilla.d.cts +2 -2
- package/dist/vanilla.d.ts +2 -2
- package/dist/vanilla.js +2 -2
- package/dist/xlsx-worker.js +298 -92
- package/dist/xlsx-worker.js.map +1 -1
- package/package.json +6 -15
- package/dist/browser-B73UAN6E.cjs.map +0 -1
- package/dist/chart-renderer-2EKXNHUD.cjs.map +0 -1
- package/dist/chart-renderer-W7XW24JI.cjs.map +0 -1
- package/dist/chart-renderer-XBF7EPUS.js.map +0 -1
- package/dist/chart-renderer-ZLJVPLGN.js.map +0 -1
- package/dist/chunk-6IGWCJU5.cjs +0 -90
- package/dist/chunk-6IGWCJU5.cjs.map +0 -1
- package/dist/chunk-HEEFCVWS.js.map +0 -1
- package/dist/chunk-HKMFMIKE.js.map +0 -1
- package/dist/chunk-VG4JELEQ.js.map +0 -1
- package/dist/chunk-WGRRI25I.cjs.map +0 -1
- package/dist/chunk-XISBYOD5.cjs.map +0 -1
- package/dist/payload-JBPE7GEG.cjs +0 -8
- package/dist/payload-JBPE7GEG.cjs.map +0 -1
- package/dist/payload-KYNCVJT5.js +0 -6
- package/dist/payload-KYNCVJT5.js.map +0 -1
- package/dist/region-map-geography-24TXETDP.cjs +0 -184
- package/dist/region-map-geography-24TXETDP.cjs.map +0 -1
- package/dist/region-map-geography-OR6DHAF7.js +0 -182
- package/dist/region-map-geography-OR6DHAF7.js.map +0 -1
- package/dist/shared-chart-3STFRVWT.js.map +0 -1
- package/dist/shared-chart-BFQNYOIQ.js.map +0 -1
- package/dist/shared-chart-DVC5S2P6.cjs.map +0 -1
- package/dist/shared-chart-MFQSQG4K.cjs.map +0 -1
- package/dist/surface-regl-7CDGGVDG.js.map +0 -1
- package/dist/surface-regl-BBJ6OIKK.cjs.map +0 -1
- package/dist/surface-regl-R2N54JT2.js.map +0 -1
- package/dist/surface-regl-SUJ2TFZA.cjs.map +0 -1
- package/dist/world-atlas-LICENSE.txt +0 -13
- /package/dist/{us-atlas-LICENSE.txt → rust-office-charts-MAP-DATA-LICENSE.txt} +0 -0
|
@@ -9,10 +9,9 @@ import {
|
|
|
9
9
|
triangulateSurfaceQuad
|
|
10
10
|
} from "./chunk-VXBNYHW5.js";
|
|
11
11
|
import {
|
|
12
|
-
regionMapResources,
|
|
13
12
|
surfaceRenderer,
|
|
14
13
|
useChartModule
|
|
15
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-IISMO3AX.js";
|
|
16
15
|
import {
|
|
17
16
|
getBuiltinChartColor,
|
|
18
17
|
getBuiltinChartSurfaceLine,
|
|
@@ -32,7 +31,36 @@ import {
|
|
|
32
31
|
|
|
33
32
|
// src/chart-renderer.tsx
|
|
34
33
|
import { hierarchy as d3Hierarchy, partition as d3Partition, treemap as d3Treemap, treemapBinary, treemapDice } from "d3-hierarchy";
|
|
35
|
-
|
|
34
|
+
|
|
35
|
+
// src/chart-scales.ts
|
|
36
|
+
function linearScale([low, high], [start, end]) {
|
|
37
|
+
if (high < low) return linearScale([high, low], [end, start]);
|
|
38
|
+
const span = high - low;
|
|
39
|
+
return (value) => {
|
|
40
|
+
const t = span === 0 ? 0.5 : (value - low) / span;
|
|
41
|
+
return start * (1 - t) + end * t;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function bandScale(domain, [from, to], inner, outer) {
|
|
45
|
+
const indices = /* @__PURE__ */ new Map();
|
|
46
|
+
for (const value of domain) {
|
|
47
|
+
if (!indices.has(value)) indices.set(value, indices.size);
|
|
48
|
+
}
|
|
49
|
+
const count = indices.size;
|
|
50
|
+
const width = Math.abs(to - from);
|
|
51
|
+
const step = width / Math.max(1, count - inner + 2 * outer);
|
|
52
|
+
const origin = Math.min(from, to) + (width - step * (count - inner)) / 2;
|
|
53
|
+
const locate = (value) => {
|
|
54
|
+
const index = indices.get(value);
|
|
55
|
+
return index == null ? void 0 : origin + step * (to < from ? count - 1 - index : index);
|
|
56
|
+
};
|
|
57
|
+
return Object.assign(locate, { bandwidth: step * (1 - inner) });
|
|
58
|
+
}
|
|
59
|
+
function pointScale(domain, range) {
|
|
60
|
+
return bandScale(domain, range, 1, 0);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// src/chart-renderer.tsx
|
|
36
64
|
import {
|
|
37
65
|
arc as d3Arc,
|
|
38
66
|
area as d3Area,
|
|
@@ -42,10 +70,6 @@ import {
|
|
|
42
70
|
line as d3Line,
|
|
43
71
|
pie as d3Pie
|
|
44
72
|
} from "d3-shape";
|
|
45
|
-
function RegionMapPlot({ chart, palette, layout, selectedChartElement }) {
|
|
46
|
-
const resources = useChartModule(regionMapResources);
|
|
47
|
-
return resources ? renderRegionMapChart(chart, palette, layout, selectedChartElement, resources) : null;
|
|
48
|
-
}
|
|
49
73
|
function SurfaceChartComposite({
|
|
50
74
|
loadingFallback,
|
|
51
75
|
...props
|
|
@@ -224,9 +248,6 @@ function isHistogramLikeSeries(series) {
|
|
|
224
248
|
function isHistogramLikeChart(chart) {
|
|
225
249
|
return chart.series.some((series) => isHistogramLikeSeries(series));
|
|
226
250
|
}
|
|
227
|
-
function resolveRegionMapBaseColor(chart, seriesIndex) {
|
|
228
|
-
return chart.series[seriesIndex]?.color ?? chart.series[seriesIndex]?.lineColor ?? chart.chartColorPalette?.[0] ?? chartSeriesColor(chart, seriesIndex);
|
|
229
|
-
}
|
|
230
251
|
function resolveRegionMapDataColor(chart, seriesIndex) {
|
|
231
252
|
const pointColor = normalizeRendererHexColor(chartPointColor(chart, 0, seriesIndex));
|
|
232
253
|
if (pointColor) {
|
|
@@ -254,10 +275,6 @@ function resolveRegionMapColorStrings(series) {
|
|
|
254
275
|
const values = Array.isArray(raw?.chartExColorStrings) ? raw.chartExColorStrings.map((value) => typeof value === "string" ? value.trim() : "") : [];
|
|
255
276
|
return values.some((value) => value.length > 0) ? values : null;
|
|
256
277
|
}
|
|
257
|
-
function resolveRegionMapLayoutProperties(series) {
|
|
258
|
-
const raw = series?.raw && typeof series.raw === "object" ? series.raw : null;
|
|
259
|
-
return raw?.layoutProperties && typeof raw.layoutProperties === "object" ? raw.layoutProperties : null;
|
|
260
|
-
}
|
|
261
278
|
function resolveRegionMapValueColorFromStops(stops, ratio) {
|
|
262
279
|
if (stops.length === 0) {
|
|
263
280
|
return "#4f81bd";
|
|
@@ -284,10 +301,6 @@ function resolveRegionMapValueColor(chart, seriesIndex, ratio) {
|
|
|
284
301
|
darkenColor(baseColor, 0.08)
|
|
285
302
|
], ratio);
|
|
286
303
|
}
|
|
287
|
-
function resolveRegionMapNoDataColor(chart, seriesIndex) {
|
|
288
|
-
const baseColor = resolveRegionMapBaseColor(chart, seriesIndex);
|
|
289
|
-
return normalizeRendererHexColor(baseColor) ?? chartSeriesColor(chart, seriesIndex);
|
|
290
|
-
}
|
|
291
304
|
function buildRegionMapLegendItems(chart) {
|
|
292
305
|
const primarySeriesIndex = Math.max(0, chart.series.findIndex((series) => series.hidden !== true));
|
|
293
306
|
const categoricalValues = resolveRegionMapColorStrings(chart.series[primarySeriesIndex] ?? null);
|
|
@@ -2266,8 +2279,18 @@ function renderBarChart(chart, palette, layout, chartType, selectedChartElement)
|
|
|
2266
2279
|
minValue = valueDomain.min;
|
|
2267
2280
|
maxValue = valueDomain.max;
|
|
2268
2281
|
const categoryBandPadding = isHistogramLike ? { inner: 0, outer: 0 } : resolveCategoryBandPadding(chart.gapWidth);
|
|
2269
|
-
const categoryScale =
|
|
2270
|
-
|
|
2282
|
+
const categoryScale = bandScale(
|
|
2283
|
+
categories,
|
|
2284
|
+
isHorizontal ? [plot.top, plot.top + plot.height] : [plot.left, plot.left + plot.width],
|
|
2285
|
+
categoryBandPadding.inner,
|
|
2286
|
+
categoryBandPadding.outer
|
|
2287
|
+
);
|
|
2288
|
+
const seriesScale = bandScale(
|
|
2289
|
+
Array.from({ length: seriesCount }, (_, index) => String(index)),
|
|
2290
|
+
[0, categoryScale.bandwidth],
|
|
2291
|
+
isHistogramLike ? 0 : 0.16,
|
|
2292
|
+
isHistogramLike ? 0 : 0.08
|
|
2293
|
+
);
|
|
2271
2294
|
const usesSeriesDepthAxis = chart.is3d === true && !isHorizontal && !isStacked && seriesCount > 1 && chart.seriesAxis != null;
|
|
2272
2295
|
const depthLaneSpread = usesSeriesDepthAxis ? clamp(1.26 + seriesCount * 0.16, 1.4, 1.96) : 1;
|
|
2273
2296
|
const depthGridSpanX = usesSeriesDepthAxis && frameOffsets ? frameOffsets.depthX * depthLaneSpread : 0;
|
|
@@ -2277,13 +2300,14 @@ function renderBarChart(chart, palette, layout, chartType, selectedChartElement)
|
|
|
2277
2300
|
const depthBarX = usesSeriesDepthAxis ? Math.sign(depthSlotX || frameOffsets?.depthX || 1) * Math.max(8, Math.abs(depthSlotX) * 1.14) : frameOffsets?.depthX;
|
|
2278
2301
|
const depthBarY = usesSeriesDepthAxis ? Math.sign(depthSlotY || frameOffsets?.depthY || -1) * Math.max(5.5, Math.abs(depthSlotY) * 1.12) : frameOffsets?.depthY;
|
|
2279
2302
|
const shouldReverseValueAxis = chart.valueAxis?.orientation === "maxMin";
|
|
2280
|
-
const valueScale =
|
|
2303
|
+
const valueScale = linearScale(
|
|
2304
|
+
[minValue, maxValue],
|
|
2281
2305
|
isHorizontal ? shouldReverseValueAxis ? [plot.left + plot.width, plot.left] : [plot.left, plot.left + plot.width] : shouldReverseValueAxis ? [plot.top, plot.top + plot.height] : [plot.top + plot.height, plot.top]
|
|
2282
2306
|
);
|
|
2283
2307
|
const ticks = isPercentStacked ? buildNumericTickValues(minValue, maxValue, chart.valueAxis?.majorUnit ?? 20) : valueDomain.ticks;
|
|
2284
2308
|
const categoryPositions = categories.map((category) => {
|
|
2285
2309
|
const bandStart = categoryScale(category) ?? 0;
|
|
2286
|
-
return bandStart + categoryScale.bandwidth
|
|
2310
|
+
return bandStart + categoryScale.bandwidth / 2;
|
|
2287
2311
|
});
|
|
2288
2312
|
const bars = [];
|
|
2289
2313
|
const positive = Array.from({ length: categoryCount }, () => 0);
|
|
@@ -2329,8 +2353,8 @@ function renderBarChart(chart, palette, layout, chartType, selectedChartElement)
|
|
|
2329
2353
|
}
|
|
2330
2354
|
const category = categories[categoryIndex];
|
|
2331
2355
|
const categoryStart = categoryScale(category) ?? 0;
|
|
2332
|
-
const barThickness = usesSeriesDepthAxis ? Math.max(7, categoryScale.bandwidth
|
|
2333
|
-
const barOffset = usesSeriesDepthAxis ? Math.max(0, (categoryScale.bandwidth
|
|
2356
|
+
const barThickness = usesSeriesDepthAxis ? Math.max(7, categoryScale.bandwidth * 0.4) : isHistogramLike ? categoryScale.bandwidth : isStacked ? categoryScale.bandwidth : seriesScale.bandwidth;
|
|
2357
|
+
const barOffset = usesSeriesDepthAxis ? Math.max(0, (categoryScale.bandwidth - barThickness) * 0.5) : isHistogramLike ? 0 : isStacked ? 0 : seriesScale(String(seriesIndex)) ?? 0;
|
|
2334
2358
|
const depthOffsetX = usesSeriesDepthAxis ? depthSlotX * seriesIndex : 0;
|
|
2335
2359
|
const depthOffsetY = usesSeriesDepthAxis ? depthSlotY * seriesIndex : 0;
|
|
2336
2360
|
const depthOrder = depthOffsetX * (frameOffsets?.depthX ?? 0) + depthOffsetY * (frameOffsets?.depthY ?? 0);
|
|
@@ -2648,8 +2672,8 @@ function renderLineOrAreaChart(chart, palette, layout, chartType, selectedChartE
|
|
|
2648
2672
|
minValue = valueDomain.min;
|
|
2649
2673
|
maxValue = valueDomain.max;
|
|
2650
2674
|
}
|
|
2651
|
-
const xScale =
|
|
2652
|
-
const yScale =
|
|
2675
|
+
const xScale = pointScale(categories, [plot.left, plot.left + plot.width]);
|
|
2676
|
+
const yScale = linearScale([minValue, maxValue], [plot.top + plot.height, plot.top]);
|
|
2653
2677
|
const ticks = isPercentStackedSeries ? buildNumericTickValues(minValue, maxValue, chart.valueAxis?.majorUnit ?? 20) : resolveAxisDomainWithChartOverrides(
|
|
2654
2678
|
chart.valueAxis,
|
|
2655
2679
|
minValue,
|
|
@@ -2840,9 +2864,19 @@ function renderComboChart(chart, palette, layout, selectedChartElement) {
|
|
|
2840
2864
|
const groupGapWidth = typeof columnGroup.raw?.gapWidth === "number" && Number.isFinite(columnGroup.raw.gapWidth) ? columnGroup.raw.gapWidth : columnGroup.gapWidth ?? chart.gapWidth;
|
|
2841
2865
|
const histogramColumns = columnGroup.series.some((series) => isHistogramLikeSeries(series));
|
|
2842
2866
|
const categoryBandPadding = histogramColumns ? { inner: 0, outer: 0 } : resolveCategoryBandPadding(groupGapWidth);
|
|
2843
|
-
const categoryScale =
|
|
2844
|
-
|
|
2845
|
-
|
|
2867
|
+
const categoryScale = bandScale(
|
|
2868
|
+
categories,
|
|
2869
|
+
[plot.left, plot.left + plot.width],
|
|
2870
|
+
categoryBandPadding.inner,
|
|
2871
|
+
categoryBandPadding.outer
|
|
2872
|
+
);
|
|
2873
|
+
const seriesScale = bandScale(
|
|
2874
|
+
Array.from({ length: columnGroup.series.length }, (_, index) => String(index)),
|
|
2875
|
+
[0, categoryScale.bandwidth],
|
|
2876
|
+
histogramColumns ? 0 : 0.16,
|
|
2877
|
+
histogramColumns ? 0 : 0.08
|
|
2878
|
+
);
|
|
2879
|
+
const categoryPositions = categories.map((category) => (categoryScale(category) ?? plot.left) + categoryScale.bandwidth / 2);
|
|
2846
2880
|
const resolveGlobalSeriesIndex = (series) => {
|
|
2847
2881
|
const index = chart.series.findIndex((candidate) => candidate.id === series.id);
|
|
2848
2882
|
return index >= 0 ? index : 0;
|
|
@@ -2864,8 +2898,8 @@ function renderComboChart(chart, palette, layout, selectedChartElement) {
|
|
|
2864
2898
|
lineGroup.valueAxis?.majorUnit,
|
|
2865
2899
|
false
|
|
2866
2900
|
);
|
|
2867
|
-
const primaryScale =
|
|
2868
|
-
const secondaryScale =
|
|
2901
|
+
const primaryScale = linearScale([primaryDomain.min, primaryDomain.max], [plot.top + plot.height, plot.top]);
|
|
2902
|
+
const secondaryScale = linearScale([secondaryDomain.min, secondaryDomain.max], [plot.top + plot.height, plot.top]);
|
|
2869
2903
|
const axisColor = chart.axisLineColor ?? chart.chartAreaBorderColor ?? palette.border;
|
|
2870
2904
|
const labelColor = resolveChartAxisTextColor(chart);
|
|
2871
2905
|
return /* @__PURE__ */ u("g", { children: [
|
|
@@ -2909,7 +2943,7 @@ function renderComboChart(chart, palette, layout, selectedChartElement) {
|
|
|
2909
2943
|
const globalSeriesIndex = resolveGlobalSeriesIndex(series);
|
|
2910
2944
|
const value = safeNumber(series.values[categoryIndex]) ?? 0;
|
|
2911
2945
|
const categoryStart = categoryScale(category) ?? plot.left;
|
|
2912
|
-
const barWidth = Math.max(1, histogramColumns ? categoryScale.bandwidth
|
|
2946
|
+
const barWidth = Math.max(1, histogramColumns ? categoryScale.bandwidth : seriesScale.bandwidth);
|
|
2913
2947
|
const x = categoryStart + (histogramColumns ? 0 : seriesScale(String(seriesIndex)) ?? 0);
|
|
2914
2948
|
const y = primaryScale(Math.max(0, value));
|
|
2915
2949
|
const zeroY = primaryScale(0);
|
|
@@ -2941,7 +2975,7 @@ function renderComboChart(chart, palette, layout, selectedChartElement) {
|
|
|
2941
2975
|
lineGroup.series.map((series, seriesIndex) => {
|
|
2942
2976
|
const globalSeriesIndex = resolveGlobalSeriesIndex(series);
|
|
2943
2977
|
const points = categories.map((category, categoryIndex) => ({
|
|
2944
|
-
x: (categoryScale(category) ?? plot.left) + categoryScale.bandwidth
|
|
2978
|
+
x: (categoryScale(category) ?? plot.left) + categoryScale.bandwidth / 2,
|
|
2945
2979
|
y: safeNumber(series.values[categoryIndex])
|
|
2946
2980
|
}));
|
|
2947
2981
|
const lineStrokePoints = chart.displayBlanksAs === "span" ? points.filter((point) => point.y != null) : points;
|
|
@@ -3087,8 +3121,8 @@ function renderScatterChart(chart, palette, layout, smooth, selectedChartElement
|
|
|
3087
3121
|
}
|
|
3088
3122
|
const safeMaxX = maxX <= minX ? minX + 1 : maxX;
|
|
3089
3123
|
const safeMaxY = maxY <= minY ? minY + 1 : maxY;
|
|
3090
|
-
const xScale =
|
|
3091
|
-
const yScale =
|
|
3124
|
+
const xScale = linearScale([minX, safeMaxX], [plot.left, plot.left + plot.width]);
|
|
3125
|
+
const yScale = linearScale([minY, safeMaxY], [plot.top + plot.height, plot.top]);
|
|
3092
3126
|
const xMajorUnit = typeof chart.categoryAxis?.majorUnit === "number" && chart.categoryAxis.majorUnit > 0 ? chart.categoryAxis.majorUnit : hasSyntheticIndexAxis ? 1 : void 0;
|
|
3093
3127
|
const yMajorUnit = typeof chart.valueAxis?.majorUnit === "number" && chart.valueAxis.majorUnit > 0 ? chart.valueAxis.majorUnit : buildNiceStep(minY, safeMaxY, 6);
|
|
3094
3128
|
const xTicks = buildNumericTickValues(minX, safeMaxX, xMajorUnit);
|
|
@@ -3227,7 +3261,7 @@ function renderBubbleChart(chart, palette, layout, selectedChartElement) {
|
|
|
3227
3261
|
const bubbleScaleFactor = clamp((chart.bubbleScale ?? 100) / 100, 0.2, 4);
|
|
3228
3262
|
const minRadius = 4;
|
|
3229
3263
|
const maxRadius = Math.max(minRadius + 2, 12 * bubbleScaleFactor);
|
|
3230
|
-
const radiusScale =
|
|
3264
|
+
const radiusScale = linearScale([minBubbleMagnitude, maxBubbleMagnitude <= minBubbleMagnitude ? minBubbleMagnitude + 1 : maxBubbleMagnitude], [minRadius, maxRadius]);
|
|
3231
3265
|
const safeMaxX = maxX <= minX ? minX + 1 : maxX;
|
|
3232
3266
|
const safeMaxY = maxY <= minY ? minY + 1 : maxY;
|
|
3233
3267
|
const xSpan = safeMaxX - minX;
|
|
@@ -3246,8 +3280,8 @@ function renderBubbleChart(chart, palette, layout, selectedChartElement) {
|
|
|
3246
3280
|
safeMaxY + yPad,
|
|
3247
3281
|
chart.valueAxis?.crosses === "autoZero"
|
|
3248
3282
|
);
|
|
3249
|
-
const xScale =
|
|
3250
|
-
const yScale =
|
|
3283
|
+
const xScale = linearScale([xDomain.min, xDomain.max], [plot.left, plot.left + plot.width]);
|
|
3284
|
+
const yScale = linearScale([yDomain.min, yDomain.max], [plot.top + plot.height, plot.top]);
|
|
3251
3285
|
const xTicks = xDomain.ticks;
|
|
3252
3286
|
const yTicks = yDomain.ticks;
|
|
3253
3287
|
const axisColor = chart.axisLineColor ?? chart.chartAreaBorderColor ?? palette.border;
|
|
@@ -4177,7 +4211,12 @@ function renderWaterfallChart(chart, palette, layout, selectedChartElement) {
|
|
|
4177
4211
|
}
|
|
4178
4212
|
const plot = layout.plot;
|
|
4179
4213
|
const labels = stages.map((stage) => stage.label);
|
|
4180
|
-
const xScale =
|
|
4214
|
+
const xScale = bandScale(
|
|
4215
|
+
labels,
|
|
4216
|
+
[plot.left, plot.left + plot.width],
|
|
4217
|
+
0.34,
|
|
4218
|
+
0.18
|
|
4219
|
+
);
|
|
4181
4220
|
const bars = [];
|
|
4182
4221
|
let runningTotal = 0;
|
|
4183
4222
|
stages.forEach((stage, index) => {
|
|
@@ -4194,7 +4233,7 @@ function renderWaterfallChart(chart, palette, layout, selectedChartElement) {
|
|
|
4194
4233
|
if (maxValue <= minValue) {
|
|
4195
4234
|
maxValue = minValue + 1;
|
|
4196
4235
|
}
|
|
4197
|
-
const yScale =
|
|
4236
|
+
const yScale = linearScale([minValue, maxValue], [plot.top + plot.height, plot.top]);
|
|
4198
4237
|
const ticks = buildNumericTickValues(minValue, maxValue, chart.valueAxis?.majorUnit);
|
|
4199
4238
|
const axisColor = chart.axisLineColor ?? chart.chartAreaBorderColor ?? palette.border;
|
|
4200
4239
|
const labelColor = resolveChartAxisTextColor(chart);
|
|
@@ -4217,7 +4256,7 @@ function renderWaterfallChart(chart, palette, layout, selectedChartElement) {
|
|
|
4217
4256
|
/* @__PURE__ */ u("line", { stroke: axisColor, strokeWidth: 1.2, x1: plot.left, x2: plot.left + plot.width, y1: yScale(0), y2: yScale(0) }),
|
|
4218
4257
|
bars.map((bar, index) => {
|
|
4219
4258
|
const bandLeft = xScale(bar.label) ?? plot.left;
|
|
4220
|
-
const bandWidth = xScale.bandwidth
|
|
4259
|
+
const bandWidth = xScale.bandwidth;
|
|
4221
4260
|
const topValue = Math.max(bar.start, bar.end);
|
|
4222
4261
|
const bottomValue = Math.min(bar.start, bar.end);
|
|
4223
4262
|
const top = yScale(topValue);
|
|
@@ -4233,7 +4272,7 @@ function renderWaterfallChart(chart, palette, layout, selectedChartElement) {
|
|
|
4233
4272
|
stroke: lightenColor(axisColor, 0.35),
|
|
4234
4273
|
strokeDasharray: "3 3",
|
|
4235
4274
|
strokeWidth: 1,
|
|
4236
|
-
x1: (xScale(connectorStart.label) ?? plot.left) + xScale.bandwidth
|
|
4275
|
+
x1: (xScale(connectorStart.label) ?? plot.left) + xScale.bandwidth,
|
|
4237
4276
|
x2: bandLeft,
|
|
4238
4277
|
y1: connectorY,
|
|
4239
4278
|
y2: connectorY
|
|
@@ -4469,8 +4508,8 @@ function renderBoxWhiskerChart(chart, palette, layout, selectedChartElement) {
|
|
|
4469
4508
|
const minValue = Math.min(...allValues);
|
|
4470
4509
|
const maxValue = Math.max(...allValues);
|
|
4471
4510
|
const valueDomain = resolveAxisDomainWithChartOverrides(chart.valueAxis, minValue, maxValue, false);
|
|
4472
|
-
const yScale =
|
|
4473
|
-
const xScale =
|
|
4511
|
+
const yScale = linearScale([valueDomain.min, valueDomain.max], [layout.plot.top + layout.plot.height, layout.plot.top]);
|
|
4512
|
+
const xScale = pointScale(seriesStats.map((_, index) => index), [layout.plot.left + 24, layout.plot.left + layout.plot.width - 24]);
|
|
4474
4513
|
const gap = seriesStats.length > 1 ? Math.abs((xScale(1) ?? 0) - (xScale(0) ?? 0)) : layout.plot.width * 0.5;
|
|
4475
4514
|
const boxWidth = clamp(gap * 0.34, 20, 54);
|
|
4476
4515
|
const capWidth = Math.max(8, boxWidth * 0.52);
|
|
@@ -4685,132 +4724,6 @@ function renderBoxWhiskerChart(chart, palette, layout, selectedChartElement) {
|
|
|
4685
4724
|
})
|
|
4686
4725
|
] });
|
|
4687
4726
|
}
|
|
4688
|
-
function renderRegionMapChart(chart, palette, layout, selectedChartElement, { geoIdentity, geoMercator, geoNaturalEarth1, geoPath, resolveRegionMapFeatureSet, resolveRegionMapFeature, getRegionMapBaseFeatures }) {
|
|
4689
|
-
const primarySeriesIndex = Math.max(0, chart.series.findIndex((series) => series.hidden !== true));
|
|
4690
|
-
const primarySeries = chart.series[primarySeriesIndex] ?? null;
|
|
4691
|
-
if (!primarySeries) {
|
|
4692
|
-
return null;
|
|
4693
|
-
}
|
|
4694
|
-
const labels = getCategoryLabels(chart);
|
|
4695
|
-
const layoutProperties = resolveRegionMapLayoutProperties(primarySeries);
|
|
4696
|
-
const geography = layoutProperties?.geography && typeof layoutProperties.geography === "object" ? layoutProperties.geography : null;
|
|
4697
|
-
const featureSet = resolveRegionMapFeatureSet(labels, geography);
|
|
4698
|
-
const viewedRegionType = typeof geography?.viewedRegionType === "string" ? geography.viewedRegionType : null;
|
|
4699
|
-
const projectionType = typeof geography?.projectionType === "string" ? geography.projectionType : null;
|
|
4700
|
-
const projection = featureSet === "us-state" ? geoIdentity() : projectionType === "miller" ? geoMercator() : geoNaturalEarth1();
|
|
4701
|
-
const availableFeatures = getRegionMapBaseFeatures(featureSet);
|
|
4702
|
-
const categoricalValues = resolveRegionMapColorStrings(primarySeries);
|
|
4703
|
-
const categoricalColorByLabel = categoricalValues ? new Map(
|
|
4704
|
-
Array.from(new Set(categoricalValues.filter(Boolean))).map((value, index) => [
|
|
4705
|
-
value,
|
|
4706
|
-
chartPointColor(chart, index, primarySeriesIndex)
|
|
4707
|
-
])
|
|
4708
|
-
) : null;
|
|
4709
|
-
const entries = labels.map((label, index) => {
|
|
4710
|
-
const feature = resolveRegionMapFeature(label, featureSet);
|
|
4711
|
-
const value = safeNumber(primarySeries.values[index]);
|
|
4712
|
-
const colorLabel = categoricalValues?.[index] || null;
|
|
4713
|
-
return {
|
|
4714
|
-
colorLabel,
|
|
4715
|
-
feature,
|
|
4716
|
-
key: normalizeCategoryLabel(label),
|
|
4717
|
-
label: normalizeCategoryLabel(label),
|
|
4718
|
-
value
|
|
4719
|
-
};
|
|
4720
|
-
}).filter((entry) => entry.feature != null && (entry.value != null || entry.colorLabel != null));
|
|
4721
|
-
const fitToMatchedData = entries.length > 0 && (viewedRegionType === "dataOnly" || entries.length === 1);
|
|
4722
|
-
const fitFeatures = fitToMatchedData ? entries.map((entry) => entry.feature) : availableFeatures;
|
|
4723
|
-
projection.fitExtent(
|
|
4724
|
-
[
|
|
4725
|
-
[layout.plot.left + 8, layout.plot.top + 8],
|
|
4726
|
-
[layout.plot.left + layout.plot.width - 8, layout.plot.top + layout.plot.height - 8]
|
|
4727
|
-
],
|
|
4728
|
-
{
|
|
4729
|
-
type: "FeatureCollection",
|
|
4730
|
-
features: fitFeatures
|
|
4731
|
-
}
|
|
4732
|
-
);
|
|
4733
|
-
const path = geoPath(projection);
|
|
4734
|
-
const baseFeatures = fitToMatchedData ? fitFeatures : availableFeatures;
|
|
4735
|
-
const noDataFill = resolveRegionMapNoDataColor(chart, primarySeriesIndex);
|
|
4736
|
-
const outlineColor = chart.chartAreaBorderColor && chart.chartAreaBorderColor !== "transparent" ? chart.chartAreaBorderColor : darkenColor(noDataFill, 0.22);
|
|
4737
|
-
const numericEntryValues = primarySeries.values.map(safeNumber).filter((value) => typeof value === "number" && Number.isFinite(value));
|
|
4738
|
-
const minValue = numericEntryValues.length > 0 ? Math.min(...numericEntryValues) : 0;
|
|
4739
|
-
const maxValue = numericEntryValues.length > 0 ? Math.max(...numericEntryValues) : 1;
|
|
4740
|
-
const showRegionLabels = layoutProperties?.regionLabelLayout !== "none";
|
|
4741
|
-
return /* @__PURE__ */ u("g", { children: [
|
|
4742
|
-
baseFeatures.map((feature, index) => {
|
|
4743
|
-
const d = path(feature);
|
|
4744
|
-
if (!d) {
|
|
4745
|
-
return null;
|
|
4746
|
-
}
|
|
4747
|
-
return /* @__PURE__ */ u(
|
|
4748
|
-
"path",
|
|
4749
|
-
{
|
|
4750
|
-
d,
|
|
4751
|
-
fill: noDataFill,
|
|
4752
|
-
stroke: outlineColor,
|
|
4753
|
-
strokeLinejoin: "round",
|
|
4754
|
-
strokeWidth: 0.6
|
|
4755
|
-
},
|
|
4756
|
-
`region-map-base-${feature.id ?? "feature"}-${index}`
|
|
4757
|
-
);
|
|
4758
|
-
}),
|
|
4759
|
-
entries.map((entry, index) => {
|
|
4760
|
-
const d = path(entry.feature);
|
|
4761
|
-
if (!d) {
|
|
4762
|
-
return null;
|
|
4763
|
-
}
|
|
4764
|
-
const fill = entry.value != null ? (() => {
|
|
4765
|
-
const ratio = maxValue <= minValue ? 1 : (entry.value - minValue) / Math.max(1e-6, maxValue - minValue);
|
|
4766
|
-
return resolveRegionMapValueColor(chart, primarySeriesIndex, ratio);
|
|
4767
|
-
})() : categoricalColorByLabel?.get(entry.colorLabel ?? "") ?? resolveRegionMapDataColor(chart, primarySeriesIndex);
|
|
4768
|
-
const selected = isSelectedChartPointOrSeries(selectedChartElement, chart.id, primarySeriesIndex, index);
|
|
4769
|
-
const centroid = path.centroid(entry.feature);
|
|
4770
|
-
const canShowSelectionDot = Number.isFinite(centroid[0]) && Number.isFinite(centroid[1]);
|
|
4771
|
-
return /* @__PURE__ */ u(S, { children: [
|
|
4772
|
-
/* @__PURE__ */ u(
|
|
4773
|
-
"path",
|
|
4774
|
-
{
|
|
4775
|
-
...chartElementDataProps(primarySeriesIndex, index),
|
|
4776
|
-
d,
|
|
4777
|
-
fill,
|
|
4778
|
-
stroke: selected ? "#64748b" : darkenColor(fill, 0.18),
|
|
4779
|
-
strokeLinejoin: "round",
|
|
4780
|
-
strokeWidth: selected ? 1.8 : 0.85
|
|
4781
|
-
}
|
|
4782
|
-
),
|
|
4783
|
-
selected && canShowSelectionDot ? renderSelectionPointHandles(`region-map-selection-${index}`, [{ x: centroid[0], y: centroid[1] }]) : null
|
|
4784
|
-
] }, `region-map-value-${entry.key || index}`);
|
|
4785
|
-
}),
|
|
4786
|
-
showRegionLabels ? entries.map((entry, index) => {
|
|
4787
|
-
const bounds = path.bounds(entry.feature);
|
|
4788
|
-
const [[x0, y0], [x1, y1]] = bounds;
|
|
4789
|
-
const width = x1 - x0;
|
|
4790
|
-
const height = y1 - y0;
|
|
4791
|
-
if (!Number.isFinite(width) || !Number.isFinite(height) || width < 26 || height < 12) {
|
|
4792
|
-
return null;
|
|
4793
|
-
}
|
|
4794
|
-
const centroid = path.centroid(entry.feature);
|
|
4795
|
-
if (!Number.isFinite(centroid[0]) || !Number.isFinite(centroid[1])) {
|
|
4796
|
-
return null;
|
|
4797
|
-
}
|
|
4798
|
-
return /* @__PURE__ */ u(
|
|
4799
|
-
"text",
|
|
4800
|
-
{
|
|
4801
|
-
fill: resolveChartTextColor(chart),
|
|
4802
|
-
fontSize: 9,
|
|
4803
|
-
fontWeight: 600,
|
|
4804
|
-
textAnchor: "middle",
|
|
4805
|
-
x: centroid[0],
|
|
4806
|
-
y: centroid[1],
|
|
4807
|
-
children: truncateSvgText(entry.label, Math.max(28, width - 4), 9)
|
|
4808
|
-
},
|
|
4809
|
-
`region-map-label-${entry.key || index}`
|
|
4810
|
-
);
|
|
4811
|
-
}) : null
|
|
4812
|
-
] });
|
|
4813
|
-
}
|
|
4814
4727
|
function renderUnsupported(chart, palette, layout, chartType) {
|
|
4815
4728
|
return /* @__PURE__ */ u("g", { children: [
|
|
4816
4729
|
/* @__PURE__ */ u(
|
|
@@ -4891,7 +4804,7 @@ function renderChartPlot(chart, palette, layout, chartType, selectedChartElement
|
|
|
4891
4804
|
return renderTreemapChart(chart, palette, layout, selectedChartElement);
|
|
4892
4805
|
}
|
|
4893
4806
|
if (chartType === "RegionMap") {
|
|
4894
|
-
return
|
|
4807
|
+
return renderUnsupported(chart, palette, layout, chartType);
|
|
4895
4808
|
}
|
|
4896
4809
|
return renderUnsupported(chart, palette, layout, chartType);
|
|
4897
4810
|
}
|
|
@@ -4924,6 +4837,7 @@ var MemoChartSvg = N(function MemoChartSvg2({
|
|
|
4924
4837
|
"svg",
|
|
4925
4838
|
{
|
|
4926
4839
|
"aria-label": chart.title ?? chart.name ?? "Chart",
|
|
4840
|
+
"data-xlsx-chart-renderer": "legacy",
|
|
4927
4841
|
onDoubleClick: handleDoubleClick,
|
|
4928
4842
|
onPointerDown: handlePointerDown,
|
|
4929
4843
|
role: "img",
|
|
@@ -4966,4 +4880,4 @@ var MemoChartSvg = N(function MemoChartSvg2({
|
|
|
4966
4880
|
export {
|
|
4967
4881
|
MemoChartSvg
|
|
4968
4882
|
};
|
|
4969
|
-
//# sourceMappingURL=chart-renderer-
|
|
4883
|
+
//# sourceMappingURL=chart-renderer-5IN2B3YS.js.map
|