@extend-ai/react-xlsx 0.20.2 → 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-IQ4UDS5M.js +209 -0
- package/dist/browser-IQ4UDS5M.js.map +1 -0
- package/dist/browser-S6E2BS5S.cjs +212 -0
- package/dist/browser-S6E2BS5S.cjs.map +1 -0
- package/dist/{chart-renderer-F355CYSE.js → chart-renderer-4HTNG3SX.js} +94 -180
- package/dist/chart-renderer-4HTNG3SX.js.map +1 -0
- package/dist/{chart-renderer-7DTEXXG6.js → chart-renderer-5IN2B3YS.js} +94 -180
- package/dist/chart-renderer-5IN2B3YS.js.map +1 -0
- package/dist/{chart-renderer-LGW4EH4M.cjs → chart-renderer-6CWSXOSC.cjs} +324 -410
- package/dist/chart-renderer-6CWSXOSC.cjs.map +1 -0
- package/dist/{chart-renderer-3QDNTMRN.cjs → chart-renderer-H4BLRO5P.cjs} +324 -410
- 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-GXYDJPHM.js → chunk-H62SZBEY.js} +401 -132
- package/dist/chunk-H62SZBEY.js.map +1 -0
- package/dist/{chunk-3LMOGW6A.js → chunk-IISMO3AX.js} +30 -15
- package/dist/chunk-IISMO3AX.js.map +1 -0
- package/dist/{chunk-ZJ76CZAL.cjs → chunk-KQSUAIZD.cjs} +1168 -899
- package/dist/chunk-KQSUAIZD.cjs.map +1 -0
- package/dist/{chunk-IYGZTLDY.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-D2UA4P6N.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/rust-office-charts-LICENSE.txt +21 -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 +7 -15
- package/dist/chart-renderer-3QDNTMRN.cjs.map +0 -1
- package/dist/chart-renderer-7DTEXXG6.js.map +0 -1
- package/dist/chart-renderer-F355CYSE.js.map +0 -1
- package/dist/chart-renderer-LGW4EH4M.cjs.map +0 -1
- package/dist/chunk-3LMOGW6A.js.map +0 -1
- package/dist/chunk-D2UA4P6N.cjs.map +0 -1
- package/dist/chunk-GXYDJPHM.js.map +0 -1
- package/dist/chunk-IYGZTLDY.js.map +0 -1
- package/dist/chunk-OCF75R75.cjs +0 -90
- package/dist/chunk-OCF75R75.cjs.map +0 -1
- package/dist/chunk-ZJ76CZAL.cjs.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
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
regionMapResources,
|
|
3
|
-
surfaceRenderer,
|
|
4
|
-
useChartModule
|
|
5
|
-
} from "./chunk-IYGZTLDY.js";
|
|
6
|
-
import {
|
|
7
|
-
renderSelectionPointHandles,
|
|
8
|
-
renderSelectionRectHandles,
|
|
9
|
-
useChartEvents
|
|
10
|
-
} from "./chunk-A4S3AMON.js";
|
|
11
1
|
import {
|
|
12
2
|
clipSurfaceBand,
|
|
13
3
|
groupSurfaceBandEdges,
|
|
@@ -18,16 +8,54 @@ import {
|
|
|
18
8
|
transformSurfaceNormal,
|
|
19
9
|
triangulateSurfaceQuad
|
|
20
10
|
} from "./chunk-VXBNYHW5.js";
|
|
11
|
+
import {
|
|
12
|
+
surfaceRenderer,
|
|
13
|
+
useChartModule
|
|
14
|
+
} from "./chunk-LZXL5E4W.js";
|
|
21
15
|
import {
|
|
22
16
|
getBuiltinChartColor,
|
|
23
17
|
getBuiltinChartSurfaceLine,
|
|
24
18
|
resolveBuiltinChartColor
|
|
25
19
|
} from "./chunk-VWGKYABF.js";
|
|
20
|
+
import {
|
|
21
|
+
renderSelectionPointHandles,
|
|
22
|
+
renderSelectionRectHandles,
|
|
23
|
+
useChartEvents
|
|
24
|
+
} from "./chunk-A4S3AMON.js";
|
|
26
25
|
|
|
27
26
|
// src/chart-renderer.tsx
|
|
28
27
|
import { hierarchy as d3Hierarchy, partition as d3Partition, treemap as d3Treemap, treemapBinary, treemapDice } from "d3-hierarchy";
|
|
29
28
|
import * as React from "react";
|
|
30
|
-
|
|
29
|
+
|
|
30
|
+
// src/chart-scales.ts
|
|
31
|
+
function linearScale([low, high], [start, end]) {
|
|
32
|
+
if (high < low) return linearScale([high, low], [end, start]);
|
|
33
|
+
const span = high - low;
|
|
34
|
+
return (value) => {
|
|
35
|
+
const t = span === 0 ? 0.5 : (value - low) / span;
|
|
36
|
+
return start * (1 - t) + end * t;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function bandScale(domain, [from, to], inner, outer) {
|
|
40
|
+
const indices = /* @__PURE__ */ new Map();
|
|
41
|
+
for (const value of domain) {
|
|
42
|
+
if (!indices.has(value)) indices.set(value, indices.size);
|
|
43
|
+
}
|
|
44
|
+
const count = indices.size;
|
|
45
|
+
const width = Math.abs(to - from);
|
|
46
|
+
const step = width / Math.max(1, count - inner + 2 * outer);
|
|
47
|
+
const origin = Math.min(from, to) + (width - step * (count - inner)) / 2;
|
|
48
|
+
const locate = (value) => {
|
|
49
|
+
const index = indices.get(value);
|
|
50
|
+
return index == null ? void 0 : origin + step * (to < from ? count - 1 - index : index);
|
|
51
|
+
};
|
|
52
|
+
return Object.assign(locate, { bandwidth: step * (1 - inner) });
|
|
53
|
+
}
|
|
54
|
+
function pointScale(domain, range) {
|
|
55
|
+
return bandScale(domain, range, 1, 0);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// src/chart-renderer.tsx
|
|
31
59
|
import {
|
|
32
60
|
arc as d3Arc,
|
|
33
61
|
area as d3Area,
|
|
@@ -39,10 +67,6 @@ import {
|
|
|
39
67
|
} from "d3-shape";
|
|
40
68
|
import { Fragment as Fragment2, jsx, jsxs } from "react/jsx-runtime";
|
|
41
69
|
import { createElement } from "react";
|
|
42
|
-
function RegionMapPlot({ chart, palette, layout, selectedChartElement }) {
|
|
43
|
-
const resources = useChartModule(regionMapResources);
|
|
44
|
-
return resources ? renderRegionMapChart(chart, palette, layout, selectedChartElement, resources) : null;
|
|
45
|
-
}
|
|
46
70
|
function SurfaceChartComposite({
|
|
47
71
|
loadingFallback,
|
|
48
72
|
...props
|
|
@@ -221,9 +245,6 @@ function isHistogramLikeSeries(series) {
|
|
|
221
245
|
function isHistogramLikeChart(chart) {
|
|
222
246
|
return chart.series.some((series) => isHistogramLikeSeries(series));
|
|
223
247
|
}
|
|
224
|
-
function resolveRegionMapBaseColor(chart, seriesIndex) {
|
|
225
|
-
return chart.series[seriesIndex]?.color ?? chart.series[seriesIndex]?.lineColor ?? chart.chartColorPalette?.[0] ?? chartSeriesColor(chart, seriesIndex);
|
|
226
|
-
}
|
|
227
248
|
function resolveRegionMapDataColor(chart, seriesIndex) {
|
|
228
249
|
const pointColor = normalizeRendererHexColor(chartPointColor(chart, 0, seriesIndex));
|
|
229
250
|
if (pointColor) {
|
|
@@ -251,10 +272,6 @@ function resolveRegionMapColorStrings(series) {
|
|
|
251
272
|
const values = Array.isArray(raw?.chartExColorStrings) ? raw.chartExColorStrings.map((value) => typeof value === "string" ? value.trim() : "") : [];
|
|
252
273
|
return values.some((value) => value.length > 0) ? values : null;
|
|
253
274
|
}
|
|
254
|
-
function resolveRegionMapLayoutProperties(series) {
|
|
255
|
-
const raw = series?.raw && typeof series.raw === "object" ? series.raw : null;
|
|
256
|
-
return raw?.layoutProperties && typeof raw.layoutProperties === "object" ? raw.layoutProperties : null;
|
|
257
|
-
}
|
|
258
275
|
function resolveRegionMapValueColorFromStops(stops, ratio) {
|
|
259
276
|
if (stops.length === 0) {
|
|
260
277
|
return "#4f81bd";
|
|
@@ -281,10 +298,6 @@ function resolveRegionMapValueColor(chart, seriesIndex, ratio) {
|
|
|
281
298
|
darkenColor(baseColor, 0.08)
|
|
282
299
|
], ratio);
|
|
283
300
|
}
|
|
284
|
-
function resolveRegionMapNoDataColor(chart, seriesIndex) {
|
|
285
|
-
const baseColor = resolveRegionMapBaseColor(chart, seriesIndex);
|
|
286
|
-
return normalizeRendererHexColor(baseColor) ?? chartSeriesColor(chart, seriesIndex);
|
|
287
|
-
}
|
|
288
301
|
function buildRegionMapLegendItems(chart) {
|
|
289
302
|
const primarySeriesIndex = Math.max(0, chart.series.findIndex((series) => series.hidden !== true));
|
|
290
303
|
const categoricalValues = resolveRegionMapColorStrings(chart.series[primarySeriesIndex] ?? null);
|
|
@@ -2263,8 +2276,18 @@ function renderBarChart(chart, palette, layout, chartType, selectedChartElement)
|
|
|
2263
2276
|
minValue = valueDomain.min;
|
|
2264
2277
|
maxValue = valueDomain.max;
|
|
2265
2278
|
const categoryBandPadding = isHistogramLike ? { inner: 0, outer: 0 } : resolveCategoryBandPadding(chart.gapWidth);
|
|
2266
|
-
const categoryScale =
|
|
2267
|
-
|
|
2279
|
+
const categoryScale = bandScale(
|
|
2280
|
+
categories,
|
|
2281
|
+
isHorizontal ? [plot.top, plot.top + plot.height] : [plot.left, plot.left + plot.width],
|
|
2282
|
+
categoryBandPadding.inner,
|
|
2283
|
+
categoryBandPadding.outer
|
|
2284
|
+
);
|
|
2285
|
+
const seriesScale = bandScale(
|
|
2286
|
+
Array.from({ length: seriesCount }, (_, index) => String(index)),
|
|
2287
|
+
[0, categoryScale.bandwidth],
|
|
2288
|
+
isHistogramLike ? 0 : 0.16,
|
|
2289
|
+
isHistogramLike ? 0 : 0.08
|
|
2290
|
+
);
|
|
2268
2291
|
const usesSeriesDepthAxis = chart.is3d === true && !isHorizontal && !isStacked && seriesCount > 1 && chart.seriesAxis != null;
|
|
2269
2292
|
const depthLaneSpread = usesSeriesDepthAxis ? clamp(1.26 + seriesCount * 0.16, 1.4, 1.96) : 1;
|
|
2270
2293
|
const depthGridSpanX = usesSeriesDepthAxis && frameOffsets ? frameOffsets.depthX * depthLaneSpread : 0;
|
|
@@ -2274,13 +2297,14 @@ function renderBarChart(chart, palette, layout, chartType, selectedChartElement)
|
|
|
2274
2297
|
const depthBarX = usesSeriesDepthAxis ? Math.sign(depthSlotX || frameOffsets?.depthX || 1) * Math.max(8, Math.abs(depthSlotX) * 1.14) : frameOffsets?.depthX;
|
|
2275
2298
|
const depthBarY = usesSeriesDepthAxis ? Math.sign(depthSlotY || frameOffsets?.depthY || -1) * Math.max(5.5, Math.abs(depthSlotY) * 1.12) : frameOffsets?.depthY;
|
|
2276
2299
|
const shouldReverseValueAxis = chart.valueAxis?.orientation === "maxMin";
|
|
2277
|
-
const valueScale =
|
|
2300
|
+
const valueScale = linearScale(
|
|
2301
|
+
[minValue, maxValue],
|
|
2278
2302
|
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]
|
|
2279
2303
|
);
|
|
2280
2304
|
const ticks = isPercentStacked ? buildNumericTickValues(minValue, maxValue, chart.valueAxis?.majorUnit ?? 20) : valueDomain.ticks;
|
|
2281
2305
|
const categoryPositions = categories.map((category) => {
|
|
2282
2306
|
const bandStart = categoryScale(category) ?? 0;
|
|
2283
|
-
return bandStart + categoryScale.bandwidth
|
|
2307
|
+
return bandStart + categoryScale.bandwidth / 2;
|
|
2284
2308
|
});
|
|
2285
2309
|
const bars = [];
|
|
2286
2310
|
const positive = Array.from({ length: categoryCount }, () => 0);
|
|
@@ -2326,8 +2350,8 @@ function renderBarChart(chart, palette, layout, chartType, selectedChartElement)
|
|
|
2326
2350
|
}
|
|
2327
2351
|
const category = categories[categoryIndex];
|
|
2328
2352
|
const categoryStart = categoryScale(category) ?? 0;
|
|
2329
|
-
const barThickness = usesSeriesDepthAxis ? Math.max(7, categoryScale.bandwidth
|
|
2330
|
-
const barOffset = usesSeriesDepthAxis ? Math.max(0, (categoryScale.bandwidth
|
|
2353
|
+
const barThickness = usesSeriesDepthAxis ? Math.max(7, categoryScale.bandwidth * 0.4) : isHistogramLike ? categoryScale.bandwidth : isStacked ? categoryScale.bandwidth : seriesScale.bandwidth;
|
|
2354
|
+
const barOffset = usesSeriesDepthAxis ? Math.max(0, (categoryScale.bandwidth - barThickness) * 0.5) : isHistogramLike ? 0 : isStacked ? 0 : seriesScale(String(seriesIndex)) ?? 0;
|
|
2331
2355
|
const depthOffsetX = usesSeriesDepthAxis ? depthSlotX * seriesIndex : 0;
|
|
2332
2356
|
const depthOffsetY = usesSeriesDepthAxis ? depthSlotY * seriesIndex : 0;
|
|
2333
2357
|
const depthOrder = depthOffsetX * (frameOffsets?.depthX ?? 0) + depthOffsetY * (frameOffsets?.depthY ?? 0);
|
|
@@ -2645,8 +2669,8 @@ function renderLineOrAreaChart(chart, palette, layout, chartType, selectedChartE
|
|
|
2645
2669
|
minValue = valueDomain.min;
|
|
2646
2670
|
maxValue = valueDomain.max;
|
|
2647
2671
|
}
|
|
2648
|
-
const xScale =
|
|
2649
|
-
const yScale =
|
|
2672
|
+
const xScale = pointScale(categories, [plot.left, plot.left + plot.width]);
|
|
2673
|
+
const yScale = linearScale([minValue, maxValue], [plot.top + plot.height, plot.top]);
|
|
2650
2674
|
const ticks = isPercentStackedSeries ? buildNumericTickValues(minValue, maxValue, chart.valueAxis?.majorUnit ?? 20) : resolveAxisDomainWithChartOverrides(
|
|
2651
2675
|
chart.valueAxis,
|
|
2652
2676
|
minValue,
|
|
@@ -2837,9 +2861,19 @@ function renderComboChart(chart, palette, layout, selectedChartElement) {
|
|
|
2837
2861
|
const groupGapWidth = typeof columnGroup.raw?.gapWidth === "number" && Number.isFinite(columnGroup.raw.gapWidth) ? columnGroup.raw.gapWidth : columnGroup.gapWidth ?? chart.gapWidth;
|
|
2838
2862
|
const histogramColumns = columnGroup.series.some((series) => isHistogramLikeSeries(series));
|
|
2839
2863
|
const categoryBandPadding = histogramColumns ? { inner: 0, outer: 0 } : resolveCategoryBandPadding(groupGapWidth);
|
|
2840
|
-
const categoryScale =
|
|
2841
|
-
|
|
2842
|
-
|
|
2864
|
+
const categoryScale = bandScale(
|
|
2865
|
+
categories,
|
|
2866
|
+
[plot.left, plot.left + plot.width],
|
|
2867
|
+
categoryBandPadding.inner,
|
|
2868
|
+
categoryBandPadding.outer
|
|
2869
|
+
);
|
|
2870
|
+
const seriesScale = bandScale(
|
|
2871
|
+
Array.from({ length: columnGroup.series.length }, (_, index) => String(index)),
|
|
2872
|
+
[0, categoryScale.bandwidth],
|
|
2873
|
+
histogramColumns ? 0 : 0.16,
|
|
2874
|
+
histogramColumns ? 0 : 0.08
|
|
2875
|
+
);
|
|
2876
|
+
const categoryPositions = categories.map((category) => (categoryScale(category) ?? plot.left) + categoryScale.bandwidth / 2);
|
|
2843
2877
|
const resolveGlobalSeriesIndex = (series) => {
|
|
2844
2878
|
const index = chart.series.findIndex((candidate) => candidate.id === series.id);
|
|
2845
2879
|
return index >= 0 ? index : 0;
|
|
@@ -2861,8 +2895,8 @@ function renderComboChart(chart, palette, layout, selectedChartElement) {
|
|
|
2861
2895
|
lineGroup.valueAxis?.majorUnit,
|
|
2862
2896
|
false
|
|
2863
2897
|
);
|
|
2864
|
-
const primaryScale =
|
|
2865
|
-
const secondaryScale =
|
|
2898
|
+
const primaryScale = linearScale([primaryDomain.min, primaryDomain.max], [plot.top + plot.height, plot.top]);
|
|
2899
|
+
const secondaryScale = linearScale([secondaryDomain.min, secondaryDomain.max], [plot.top + plot.height, plot.top]);
|
|
2866
2900
|
const axisColor = chart.axisLineColor ?? chart.chartAreaBorderColor ?? palette.border;
|
|
2867
2901
|
const labelColor = resolveChartAxisTextColor(chart);
|
|
2868
2902
|
return /* @__PURE__ */ jsxs("g", { children: [
|
|
@@ -2906,7 +2940,7 @@ function renderComboChart(chart, palette, layout, selectedChartElement) {
|
|
|
2906
2940
|
const globalSeriesIndex = resolveGlobalSeriesIndex(series);
|
|
2907
2941
|
const value = safeNumber(series.values[categoryIndex]) ?? 0;
|
|
2908
2942
|
const categoryStart = categoryScale(category) ?? plot.left;
|
|
2909
|
-
const barWidth = Math.max(1, histogramColumns ? categoryScale.bandwidth
|
|
2943
|
+
const barWidth = Math.max(1, histogramColumns ? categoryScale.bandwidth : seriesScale.bandwidth);
|
|
2910
2944
|
const x = categoryStart + (histogramColumns ? 0 : seriesScale(String(seriesIndex)) ?? 0);
|
|
2911
2945
|
const y = primaryScale(Math.max(0, value));
|
|
2912
2946
|
const zeroY = primaryScale(0);
|
|
@@ -2938,7 +2972,7 @@ function renderComboChart(chart, palette, layout, selectedChartElement) {
|
|
|
2938
2972
|
lineGroup.series.map((series, seriesIndex) => {
|
|
2939
2973
|
const globalSeriesIndex = resolveGlobalSeriesIndex(series);
|
|
2940
2974
|
const points = categories.map((category, categoryIndex) => ({
|
|
2941
|
-
x: (categoryScale(category) ?? plot.left) + categoryScale.bandwidth
|
|
2975
|
+
x: (categoryScale(category) ?? plot.left) + categoryScale.bandwidth / 2,
|
|
2942
2976
|
y: safeNumber(series.values[categoryIndex])
|
|
2943
2977
|
}));
|
|
2944
2978
|
const lineStrokePoints = chart.displayBlanksAs === "span" ? points.filter((point) => point.y != null) : points;
|
|
@@ -3084,8 +3118,8 @@ function renderScatterChart(chart, palette, layout, smooth, selectedChartElement
|
|
|
3084
3118
|
}
|
|
3085
3119
|
const safeMaxX = maxX <= minX ? minX + 1 : maxX;
|
|
3086
3120
|
const safeMaxY = maxY <= minY ? minY + 1 : maxY;
|
|
3087
|
-
const xScale =
|
|
3088
|
-
const yScale =
|
|
3121
|
+
const xScale = linearScale([minX, safeMaxX], [plot.left, plot.left + plot.width]);
|
|
3122
|
+
const yScale = linearScale([minY, safeMaxY], [plot.top + plot.height, plot.top]);
|
|
3089
3123
|
const xMajorUnit = typeof chart.categoryAxis?.majorUnit === "number" && chart.categoryAxis.majorUnit > 0 ? chart.categoryAxis.majorUnit : hasSyntheticIndexAxis ? 1 : void 0;
|
|
3090
3124
|
const yMajorUnit = typeof chart.valueAxis?.majorUnit === "number" && chart.valueAxis.majorUnit > 0 ? chart.valueAxis.majorUnit : buildNiceStep(minY, safeMaxY, 6);
|
|
3091
3125
|
const xTicks = buildNumericTickValues(minX, safeMaxX, xMajorUnit);
|
|
@@ -3224,7 +3258,7 @@ function renderBubbleChart(chart, palette, layout, selectedChartElement) {
|
|
|
3224
3258
|
const bubbleScaleFactor = clamp((chart.bubbleScale ?? 100) / 100, 0.2, 4);
|
|
3225
3259
|
const minRadius = 4;
|
|
3226
3260
|
const maxRadius = Math.max(minRadius + 2, 12 * bubbleScaleFactor);
|
|
3227
|
-
const radiusScale =
|
|
3261
|
+
const radiusScale = linearScale([minBubbleMagnitude, maxBubbleMagnitude <= minBubbleMagnitude ? minBubbleMagnitude + 1 : maxBubbleMagnitude], [minRadius, maxRadius]);
|
|
3228
3262
|
const safeMaxX = maxX <= minX ? minX + 1 : maxX;
|
|
3229
3263
|
const safeMaxY = maxY <= minY ? minY + 1 : maxY;
|
|
3230
3264
|
const xSpan = safeMaxX - minX;
|
|
@@ -3243,8 +3277,8 @@ function renderBubbleChart(chart, palette, layout, selectedChartElement) {
|
|
|
3243
3277
|
safeMaxY + yPad,
|
|
3244
3278
|
chart.valueAxis?.crosses === "autoZero"
|
|
3245
3279
|
);
|
|
3246
|
-
const xScale =
|
|
3247
|
-
const yScale =
|
|
3280
|
+
const xScale = linearScale([xDomain.min, xDomain.max], [plot.left, plot.left + plot.width]);
|
|
3281
|
+
const yScale = linearScale([yDomain.min, yDomain.max], [plot.top + plot.height, plot.top]);
|
|
3248
3282
|
const xTicks = xDomain.ticks;
|
|
3249
3283
|
const yTicks = yDomain.ticks;
|
|
3250
3284
|
const axisColor = chart.axisLineColor ?? chart.chartAreaBorderColor ?? palette.border;
|
|
@@ -4174,7 +4208,12 @@ function renderWaterfallChart(chart, palette, layout, selectedChartElement) {
|
|
|
4174
4208
|
}
|
|
4175
4209
|
const plot = layout.plot;
|
|
4176
4210
|
const labels = stages.map((stage) => stage.label);
|
|
4177
|
-
const xScale =
|
|
4211
|
+
const xScale = bandScale(
|
|
4212
|
+
labels,
|
|
4213
|
+
[plot.left, plot.left + plot.width],
|
|
4214
|
+
0.34,
|
|
4215
|
+
0.18
|
|
4216
|
+
);
|
|
4178
4217
|
const bars = [];
|
|
4179
4218
|
let runningTotal = 0;
|
|
4180
4219
|
stages.forEach((stage, index) => {
|
|
@@ -4191,7 +4230,7 @@ function renderWaterfallChart(chart, palette, layout, selectedChartElement) {
|
|
|
4191
4230
|
if (maxValue <= minValue) {
|
|
4192
4231
|
maxValue = minValue + 1;
|
|
4193
4232
|
}
|
|
4194
|
-
const yScale =
|
|
4233
|
+
const yScale = linearScale([minValue, maxValue], [plot.top + plot.height, plot.top]);
|
|
4195
4234
|
const ticks = buildNumericTickValues(minValue, maxValue, chart.valueAxis?.majorUnit);
|
|
4196
4235
|
const axisColor = chart.axisLineColor ?? chart.chartAreaBorderColor ?? palette.border;
|
|
4197
4236
|
const labelColor = resolveChartAxisTextColor(chart);
|
|
@@ -4214,7 +4253,7 @@ function renderWaterfallChart(chart, palette, layout, selectedChartElement) {
|
|
|
4214
4253
|
/* @__PURE__ */ jsx("line", { stroke: axisColor, strokeWidth: 1.2, x1: plot.left, x2: plot.left + plot.width, y1: yScale(0), y2: yScale(0) }),
|
|
4215
4254
|
bars.map((bar, index) => {
|
|
4216
4255
|
const bandLeft = xScale(bar.label) ?? plot.left;
|
|
4217
|
-
const bandWidth = xScale.bandwidth
|
|
4256
|
+
const bandWidth = xScale.bandwidth;
|
|
4218
4257
|
const topValue = Math.max(bar.start, bar.end);
|
|
4219
4258
|
const bottomValue = Math.min(bar.start, bar.end);
|
|
4220
4259
|
const top = yScale(topValue);
|
|
@@ -4230,7 +4269,7 @@ function renderWaterfallChart(chart, palette, layout, selectedChartElement) {
|
|
|
4230
4269
|
stroke: lightenColor(axisColor, 0.35),
|
|
4231
4270
|
strokeDasharray: "3 3",
|
|
4232
4271
|
strokeWidth: 1,
|
|
4233
|
-
x1: (xScale(connectorStart.label) ?? plot.left) + xScale.bandwidth
|
|
4272
|
+
x1: (xScale(connectorStart.label) ?? plot.left) + xScale.bandwidth,
|
|
4234
4273
|
x2: bandLeft,
|
|
4235
4274
|
y1: connectorY,
|
|
4236
4275
|
y2: connectorY
|
|
@@ -4466,8 +4505,8 @@ function renderBoxWhiskerChart(chart, palette, layout, selectedChartElement) {
|
|
|
4466
4505
|
const minValue = Math.min(...allValues);
|
|
4467
4506
|
const maxValue = Math.max(...allValues);
|
|
4468
4507
|
const valueDomain = resolveAxisDomainWithChartOverrides(chart.valueAxis, minValue, maxValue, false);
|
|
4469
|
-
const yScale =
|
|
4470
|
-
const xScale =
|
|
4508
|
+
const yScale = linearScale([valueDomain.min, valueDomain.max], [layout.plot.top + layout.plot.height, layout.plot.top]);
|
|
4509
|
+
const xScale = pointScale(seriesStats.map((_, index) => index), [layout.plot.left + 24, layout.plot.left + layout.plot.width - 24]);
|
|
4471
4510
|
const gap = seriesStats.length > 1 ? Math.abs((xScale(1) ?? 0) - (xScale(0) ?? 0)) : layout.plot.width * 0.5;
|
|
4472
4511
|
const boxWidth = clamp(gap * 0.34, 20, 54);
|
|
4473
4512
|
const capWidth = Math.max(8, boxWidth * 0.52);
|
|
@@ -4682,132 +4721,6 @@ function renderBoxWhiskerChart(chart, palette, layout, selectedChartElement) {
|
|
|
4682
4721
|
})
|
|
4683
4722
|
] });
|
|
4684
4723
|
}
|
|
4685
|
-
function renderRegionMapChart(chart, palette, layout, selectedChartElement, { geoIdentity, geoMercator, geoNaturalEarth1, geoPath, resolveRegionMapFeatureSet, resolveRegionMapFeature, getRegionMapBaseFeatures }) {
|
|
4686
|
-
const primarySeriesIndex = Math.max(0, chart.series.findIndex((series) => series.hidden !== true));
|
|
4687
|
-
const primarySeries = chart.series[primarySeriesIndex] ?? null;
|
|
4688
|
-
if (!primarySeries) {
|
|
4689
|
-
return null;
|
|
4690
|
-
}
|
|
4691
|
-
const labels = getCategoryLabels(chart);
|
|
4692
|
-
const layoutProperties = resolveRegionMapLayoutProperties(primarySeries);
|
|
4693
|
-
const geography = layoutProperties?.geography && typeof layoutProperties.geography === "object" ? layoutProperties.geography : null;
|
|
4694
|
-
const featureSet = resolveRegionMapFeatureSet(labels, geography);
|
|
4695
|
-
const viewedRegionType = typeof geography?.viewedRegionType === "string" ? geography.viewedRegionType : null;
|
|
4696
|
-
const projectionType = typeof geography?.projectionType === "string" ? geography.projectionType : null;
|
|
4697
|
-
const projection = featureSet === "us-state" ? geoIdentity() : projectionType === "miller" ? geoMercator() : geoNaturalEarth1();
|
|
4698
|
-
const availableFeatures = getRegionMapBaseFeatures(featureSet);
|
|
4699
|
-
const categoricalValues = resolveRegionMapColorStrings(primarySeries);
|
|
4700
|
-
const categoricalColorByLabel = categoricalValues ? new Map(
|
|
4701
|
-
Array.from(new Set(categoricalValues.filter(Boolean))).map((value, index) => [
|
|
4702
|
-
value,
|
|
4703
|
-
chartPointColor(chart, index, primarySeriesIndex)
|
|
4704
|
-
])
|
|
4705
|
-
) : null;
|
|
4706
|
-
const entries = labels.map((label, index) => {
|
|
4707
|
-
const feature = resolveRegionMapFeature(label, featureSet);
|
|
4708
|
-
const value = safeNumber(primarySeries.values[index]);
|
|
4709
|
-
const colorLabel = categoricalValues?.[index] || null;
|
|
4710
|
-
return {
|
|
4711
|
-
colorLabel,
|
|
4712
|
-
feature,
|
|
4713
|
-
key: normalizeCategoryLabel(label),
|
|
4714
|
-
label: normalizeCategoryLabel(label),
|
|
4715
|
-
value
|
|
4716
|
-
};
|
|
4717
|
-
}).filter((entry) => entry.feature != null && (entry.value != null || entry.colorLabel != null));
|
|
4718
|
-
const fitToMatchedData = entries.length > 0 && (viewedRegionType === "dataOnly" || entries.length === 1);
|
|
4719
|
-
const fitFeatures = fitToMatchedData ? entries.map((entry) => entry.feature) : availableFeatures;
|
|
4720
|
-
projection.fitExtent(
|
|
4721
|
-
[
|
|
4722
|
-
[layout.plot.left + 8, layout.plot.top + 8],
|
|
4723
|
-
[layout.plot.left + layout.plot.width - 8, layout.plot.top + layout.plot.height - 8]
|
|
4724
|
-
],
|
|
4725
|
-
{
|
|
4726
|
-
type: "FeatureCollection",
|
|
4727
|
-
features: fitFeatures
|
|
4728
|
-
}
|
|
4729
|
-
);
|
|
4730
|
-
const path = geoPath(projection);
|
|
4731
|
-
const baseFeatures = fitToMatchedData ? fitFeatures : availableFeatures;
|
|
4732
|
-
const noDataFill = resolveRegionMapNoDataColor(chart, primarySeriesIndex);
|
|
4733
|
-
const outlineColor = chart.chartAreaBorderColor && chart.chartAreaBorderColor !== "transparent" ? chart.chartAreaBorderColor : darkenColor(noDataFill, 0.22);
|
|
4734
|
-
const numericEntryValues = primarySeries.values.map(safeNumber).filter((value) => typeof value === "number" && Number.isFinite(value));
|
|
4735
|
-
const minValue = numericEntryValues.length > 0 ? Math.min(...numericEntryValues) : 0;
|
|
4736
|
-
const maxValue = numericEntryValues.length > 0 ? Math.max(...numericEntryValues) : 1;
|
|
4737
|
-
const showRegionLabels = layoutProperties?.regionLabelLayout !== "none";
|
|
4738
|
-
return /* @__PURE__ */ jsxs("g", { children: [
|
|
4739
|
-
baseFeatures.map((feature, index) => {
|
|
4740
|
-
const d = path(feature);
|
|
4741
|
-
if (!d) {
|
|
4742
|
-
return null;
|
|
4743
|
-
}
|
|
4744
|
-
return /* @__PURE__ */ jsx(
|
|
4745
|
-
"path",
|
|
4746
|
-
{
|
|
4747
|
-
d,
|
|
4748
|
-
fill: noDataFill,
|
|
4749
|
-
stroke: outlineColor,
|
|
4750
|
-
strokeLinejoin: "round",
|
|
4751
|
-
strokeWidth: 0.6
|
|
4752
|
-
},
|
|
4753
|
-
`region-map-base-${feature.id ?? "feature"}-${index}`
|
|
4754
|
-
);
|
|
4755
|
-
}),
|
|
4756
|
-
entries.map((entry, index) => {
|
|
4757
|
-
const d = path(entry.feature);
|
|
4758
|
-
if (!d) {
|
|
4759
|
-
return null;
|
|
4760
|
-
}
|
|
4761
|
-
const fill = entry.value != null ? (() => {
|
|
4762
|
-
const ratio = maxValue <= minValue ? 1 : (entry.value - minValue) / Math.max(1e-6, maxValue - minValue);
|
|
4763
|
-
return resolveRegionMapValueColor(chart, primarySeriesIndex, ratio);
|
|
4764
|
-
})() : categoricalColorByLabel?.get(entry.colorLabel ?? "") ?? resolveRegionMapDataColor(chart, primarySeriesIndex);
|
|
4765
|
-
const selected = isSelectedChartPointOrSeries(selectedChartElement, chart.id, primarySeriesIndex, index);
|
|
4766
|
-
const centroid = path.centroid(entry.feature);
|
|
4767
|
-
const canShowSelectionDot = Number.isFinite(centroid[0]) && Number.isFinite(centroid[1]);
|
|
4768
|
-
return /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
4769
|
-
/* @__PURE__ */ jsx(
|
|
4770
|
-
"path",
|
|
4771
|
-
{
|
|
4772
|
-
...chartElementDataProps(primarySeriesIndex, index),
|
|
4773
|
-
d,
|
|
4774
|
-
fill,
|
|
4775
|
-
stroke: selected ? "#64748b" : darkenColor(fill, 0.18),
|
|
4776
|
-
strokeLinejoin: "round",
|
|
4777
|
-
strokeWidth: selected ? 1.8 : 0.85
|
|
4778
|
-
}
|
|
4779
|
-
),
|
|
4780
|
-
selected && canShowSelectionDot ? renderSelectionPointHandles(`region-map-selection-${index}`, [{ x: centroid[0], y: centroid[1] }]) : null
|
|
4781
|
-
] }, `region-map-value-${entry.key || index}`);
|
|
4782
|
-
}),
|
|
4783
|
-
showRegionLabels ? entries.map((entry, index) => {
|
|
4784
|
-
const bounds = path.bounds(entry.feature);
|
|
4785
|
-
const [[x0, y0], [x1, y1]] = bounds;
|
|
4786
|
-
const width = x1 - x0;
|
|
4787
|
-
const height = y1 - y0;
|
|
4788
|
-
if (!Number.isFinite(width) || !Number.isFinite(height) || width < 26 || height < 12) {
|
|
4789
|
-
return null;
|
|
4790
|
-
}
|
|
4791
|
-
const centroid = path.centroid(entry.feature);
|
|
4792
|
-
if (!Number.isFinite(centroid[0]) || !Number.isFinite(centroid[1])) {
|
|
4793
|
-
return null;
|
|
4794
|
-
}
|
|
4795
|
-
return /* @__PURE__ */ jsx(
|
|
4796
|
-
"text",
|
|
4797
|
-
{
|
|
4798
|
-
fill: resolveChartTextColor(chart),
|
|
4799
|
-
fontSize: 9,
|
|
4800
|
-
fontWeight: 600,
|
|
4801
|
-
textAnchor: "middle",
|
|
4802
|
-
x: centroid[0],
|
|
4803
|
-
y: centroid[1],
|
|
4804
|
-
children: truncateSvgText(entry.label, Math.max(28, width - 4), 9)
|
|
4805
|
-
},
|
|
4806
|
-
`region-map-label-${entry.key || index}`
|
|
4807
|
-
);
|
|
4808
|
-
}) : null
|
|
4809
|
-
] });
|
|
4810
|
-
}
|
|
4811
4724
|
function renderUnsupported(chart, palette, layout, chartType) {
|
|
4812
4725
|
return /* @__PURE__ */ jsxs("g", { children: [
|
|
4813
4726
|
/* @__PURE__ */ jsx(
|
|
@@ -4888,7 +4801,7 @@ function renderChartPlot(chart, palette, layout, chartType, selectedChartElement
|
|
|
4888
4801
|
return renderTreemapChart(chart, palette, layout, selectedChartElement);
|
|
4889
4802
|
}
|
|
4890
4803
|
if (chartType === "RegionMap") {
|
|
4891
|
-
return
|
|
4804
|
+
return renderUnsupported(chart, palette, layout, chartType);
|
|
4892
4805
|
}
|
|
4893
4806
|
return renderUnsupported(chart, palette, layout, chartType);
|
|
4894
4807
|
}
|
|
@@ -4921,6 +4834,7 @@ var MemoChartSvg = React.memo(function MemoChartSvg2({
|
|
|
4921
4834
|
"svg",
|
|
4922
4835
|
{
|
|
4923
4836
|
"aria-label": chart.title ?? chart.name ?? "Chart",
|
|
4837
|
+
"data-xlsx-chart-renderer": "legacy",
|
|
4924
4838
|
onDoubleClick: handleDoubleClick,
|
|
4925
4839
|
onPointerDown: handlePointerDown,
|
|
4926
4840
|
role: "img",
|
|
@@ -4963,4 +4877,4 @@ var MemoChartSvg = React.memo(function MemoChartSvg2({
|
|
|
4963
4877
|
export {
|
|
4964
4878
|
MemoChartSvg
|
|
4965
4879
|
};
|
|
4966
|
-
//# sourceMappingURL=chart-renderer-
|
|
4880
|
+
//# sourceMappingURL=chart-renderer-4HTNG3SX.js.map
|