@coinbase/cds-web-visualization 3.4.0-beta.8 → 3.4.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/CHANGELOG.md +130 -0
- package/dts/chart/CartesianChart.d.ts +40 -4
- package/dts/chart/CartesianChart.d.ts.map +1 -1
- package/dts/chart/ChartProvider.d.ts +3 -0
- package/dts/chart/ChartProvider.d.ts.map +1 -1
- package/dts/chart/Path.d.ts +51 -12
- package/dts/chart/Path.d.ts.map +1 -1
- package/dts/chart/PeriodSelector.d.ts +25 -4
- package/dts/chart/PeriodSelector.d.ts.map +1 -1
- package/dts/chart/area/Area.d.ts +13 -11
- package/dts/chart/area/Area.d.ts.map +1 -1
- package/dts/chart/area/AreaChart.d.ts +18 -5
- package/dts/chart/area/AreaChart.d.ts.map +1 -1
- package/dts/chart/area/DottedArea.d.ts.map +1 -1
- package/dts/chart/area/GradientArea.d.ts.map +1 -1
- package/dts/chart/area/SolidArea.d.ts.map +1 -1
- package/dts/chart/axis/Axis.d.ts +29 -29
- package/dts/chart/axis/Axis.d.ts.map +1 -1
- package/dts/chart/axis/XAxis.d.ts +6 -0
- package/dts/chart/axis/XAxis.d.ts.map +1 -1
- package/dts/chart/axis/YAxis.d.ts +2 -1
- package/dts/chart/axis/YAxis.d.ts.map +1 -1
- package/dts/chart/bar/Bar.d.ts +51 -51
- package/dts/chart/bar/Bar.d.ts.map +1 -1
- package/dts/chart/bar/BarChart.d.ts +29 -6
- package/dts/chart/bar/BarChart.d.ts.map +1 -1
- package/dts/chart/bar/BarPlot.d.ts +2 -1
- package/dts/chart/bar/BarPlot.d.ts.map +1 -1
- package/dts/chart/bar/BarStack.d.ts +58 -20
- package/dts/chart/bar/BarStack.d.ts.map +1 -1
- package/dts/chart/bar/BarStackGroup.d.ts +2 -1
- package/dts/chart/bar/BarStackGroup.d.ts.map +1 -1
- package/dts/chart/bar/DefaultBar.d.ts.map +1 -1
- package/dts/chart/bar/DefaultBarStack.d.ts.map +1 -1
- package/dts/chart/gradient/Gradient.d.ts +7 -0
- package/dts/chart/gradient/Gradient.d.ts.map +1 -1
- package/dts/chart/index.d.ts +1 -0
- package/dts/chart/index.d.ts.map +1 -1
- package/dts/chart/legend/DefaultLegendEntry.d.ts +21 -0
- package/dts/chart/legend/DefaultLegendEntry.d.ts.map +1 -0
- package/dts/chart/legend/DefaultLegendShape.d.ts +7 -0
- package/dts/chart/legend/DefaultLegendShape.d.ts.map +1 -0
- package/dts/chart/legend/Legend.d.ts +169 -0
- package/dts/chart/legend/Legend.d.ts.map +1 -0
- package/dts/chart/legend/index.d.ts +4 -0
- package/dts/chart/legend/index.d.ts.map +1 -0
- package/dts/chart/line/DottedLine.d.ts.map +1 -1
- package/dts/chart/line/Line.d.ts +45 -24
- package/dts/chart/line/Line.d.ts.map +1 -1
- package/dts/chart/line/LineChart.d.ts +5 -3
- package/dts/chart/line/LineChart.d.ts.map +1 -1
- package/dts/chart/line/ReferenceLine.d.ts +9 -0
- package/dts/chart/line/ReferenceLine.d.ts.map +1 -1
- package/dts/chart/line/SolidLine.d.ts.map +1 -1
- package/dts/chart/point/Point.d.ts +26 -2
- package/dts/chart/point/Point.d.ts.map +1 -1
- package/dts/chart/scrubber/DefaultScrubberBeacon.d.ts +34 -17
- package/dts/chart/scrubber/DefaultScrubberBeacon.d.ts.map +1 -1
- package/dts/chart/scrubber/DefaultScrubberBeaconLabel.d.ts.map +1 -1
- package/dts/chart/scrubber/DefaultScrubberLabel.d.ts +2 -1
- package/dts/chart/scrubber/DefaultScrubberLabel.d.ts.map +1 -1
- package/dts/chart/scrubber/Scrubber.d.ts +148 -46
- package/dts/chart/scrubber/Scrubber.d.ts.map +1 -1
- package/dts/chart/scrubber/ScrubberBeaconGroup.d.ts +10 -0
- package/dts/chart/scrubber/ScrubberBeaconGroup.d.ts.map +1 -1
- package/dts/chart/scrubber/ScrubberBeaconLabelGroup.d.ts +25 -1
- package/dts/chart/scrubber/ScrubberBeaconLabelGroup.d.ts.map +1 -1
- package/dts/chart/scrubber/ScrubberProvider.d.ts.map +1 -1
- package/dts/chart/text/ChartText.d.ts.map +1 -1
- package/dts/chart/utils/axis.d.ts +48 -9
- package/dts/chart/utils/axis.d.ts.map +1 -1
- package/dts/chart/utils/bar.d.ts +188 -0
- package/dts/chart/utils/bar.d.ts.map +1 -1
- package/dts/chart/utils/chart.d.ts +32 -0
- package/dts/chart/utils/chart.d.ts.map +1 -1
- package/dts/chart/utils/context.d.ts +20 -4
- package/dts/chart/utils/context.d.ts.map +1 -1
- package/dts/chart/utils/gradient.d.ts +3 -1
- package/dts/chart/utils/gradient.d.ts.map +1 -1
- package/dts/chart/utils/path.d.ts +26 -0
- package/dts/chart/utils/path.d.ts.map +1 -1
- package/dts/chart/utils/point.d.ts +18 -7
- package/dts/chart/utils/point.d.ts.map +1 -1
- package/dts/chart/utils/scale.d.ts +11 -0
- package/dts/chart/utils/scale.d.ts.map +1 -1
- package/dts/chart/utils/scrubber.d.ts +2 -1
- package/dts/chart/utils/scrubber.d.ts.map +1 -1
- package/dts/chart/utils/transition.d.ts +50 -14
- package/dts/chart/utils/transition.d.ts.map +1 -1
- package/dts/sparkline/Sparkline.d.ts +2 -1
- package/dts/sparkline/Sparkline.d.ts.map +1 -1
- package/dts/sparkline/SparklineArea.d.ts +2 -1
- package/dts/sparkline/SparklineArea.d.ts.map +1 -1
- package/dts/sparkline/SparklineGradient.d.ts +2 -1
- package/dts/sparkline/SparklineGradient.d.ts.map +1 -1
- package/dts/sparkline/sparkline-interactive/SparklineInteractive.d.ts +2 -1
- package/dts/sparkline/sparkline-interactive/SparklineInteractive.d.ts.map +1 -1
- package/esm/chart/CartesianChart.js +154 -90
- package/esm/chart/ChartProvider.js +2 -2
- package/esm/chart/Path.js +35 -19
- package/esm/chart/PeriodSelector.js +33 -15
- package/esm/chart/area/Area.js +21 -9
- package/esm/chart/area/AreaChart.js +28 -25
- package/esm/chart/area/DottedArea.js +18 -9
- package/esm/chart/area/GradientArea.js +16 -8
- package/esm/chart/area/SolidArea.js +8 -3
- package/esm/chart/axis/Axis.js +3 -17
- package/esm/chart/axis/XAxis.js +153 -50
- package/esm/chart/axis/YAxis.js +146 -36
- package/esm/chart/bar/Bar.js +16 -8
- package/esm/chart/bar/BarChart.js +38 -33
- package/esm/chart/bar/BarPlot.js +20 -25
- package/esm/chart/bar/BarStack.js +109 -505
- package/esm/chart/bar/BarStackGroup.js +36 -27
- package/esm/chart/bar/DefaultBar.js +34 -26
- package/esm/chart/bar/DefaultBarStack.js +31 -18
- package/esm/chart/gradient/Gradient.js +3 -2
- package/esm/chart/index.js +1 -0
- package/esm/chart/legend/DefaultLegendEntry.css +1 -0
- package/esm/chart/legend/DefaultLegendEntry.js +50 -0
- package/esm/chart/legend/DefaultLegendShape.css +5 -0
- package/esm/chart/legend/DefaultLegendShape.js +47 -0
- package/esm/chart/legend/Legend.js +76 -0
- package/esm/chart/legend/index.js +3 -0
- package/esm/chart/line/DottedLine.js +7 -2
- package/esm/chart/line/Line.js +41 -42
- package/esm/chart/line/LineChart.js +18 -13
- package/esm/chart/line/ReferenceLine.js +6 -2
- package/esm/chart/line/SolidLine.js +8 -3
- package/esm/chart/point/Point.js +41 -24
- package/esm/chart/scrubber/DefaultScrubberBeacon.js +64 -65
- package/esm/chart/scrubber/DefaultScrubberBeaconLabel.js +25 -14
- package/esm/chart/scrubber/DefaultScrubberLabel.js +26 -8
- package/esm/chart/scrubber/Scrubber.js +54 -43
- package/esm/chart/scrubber/ScrubberBeaconGroup.js +60 -35
- package/esm/chart/scrubber/ScrubberBeaconLabelGroup.js +31 -8
- package/esm/chart/scrubber/ScrubberProvider.js +44 -39
- package/esm/chart/text/ChartText.js +3 -2
- package/esm/chart/utils/axis.js +90 -43
- package/esm/chart/utils/bar.js +863 -0
- package/esm/chart/utils/chart.js +34 -7
- package/esm/chart/utils/context.js +7 -0
- package/esm/chart/utils/gradient.js +6 -4
- package/esm/chart/utils/path.js +88 -61
- package/esm/chart/utils/point.js +57 -30
- package/esm/chart/utils/scale.js +13 -2
- package/esm/chart/utils/scrubber.js +9 -4
- package/esm/chart/utils/transition.js +68 -41
- package/esm/sparkline/Sparkline.js +2 -1
- package/esm/sparkline/SparklineArea.js +2 -1
- package/esm/sparkline/SparklineGradient.js +2 -1
- package/esm/sparkline/__figma__/Sparkline.figma.js +1 -1
- package/esm/sparkline/sparkline-interactive/SparklineInteractive.js +2 -1
- package/esm/sparkline/sparkline-interactive/__figma__/SparklineInteractive.figma.js +1 -1
- package/esm/sparkline/sparkline-interactive-header/__figma__/SparklineInteractiveHeader.figma.js +1 -1
- package/package.json +12 -11
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
4
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
5
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
1
|
import React, { memo, useMemo } from 'react';
|
|
7
2
|
import { useCartesianChartContext } from '../ChartProvider';
|
|
8
|
-
import {
|
|
3
|
+
import { EPSILON, getBars, getStackBaseline, getStackOrigin } from '../utils/bar';
|
|
4
|
+
import { getGradientConfig } from '../utils/gradient';
|
|
9
5
|
import { Bar } from './Bar';
|
|
10
6
|
import { DefaultBarStack } from './DefaultBarStack';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Extended series type that includes bar-specific properties.
|
|
10
|
+
*/
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
const EPSILON = 1e-4;
|
|
13
12
|
/**
|
|
14
13
|
* BarStack component that renders a single stack of bars at a specific category index.
|
|
15
14
|
* Handles the stacking logic for bars within a single category.
|
|
@@ -18,10 +17,13 @@ export const BarStack = /*#__PURE__*/memo(_ref => {
|
|
|
18
17
|
let {
|
|
19
18
|
series,
|
|
20
19
|
categoryIndex,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
indexPos,
|
|
21
|
+
thickness,
|
|
22
|
+
indexScale,
|
|
23
|
+
valueScale,
|
|
24
24
|
rect,
|
|
25
|
+
xAxisId,
|
|
26
|
+
yAxisId,
|
|
25
27
|
BarComponent: defaultBarComponent,
|
|
26
28
|
fillOpacity: defaultFillOpacity,
|
|
27
29
|
stroke: defaultStroke,
|
|
@@ -32,530 +34,132 @@ export const BarStack = /*#__PURE__*/memo(_ref => {
|
|
|
32
34
|
barMinSize,
|
|
33
35
|
stackMinSize,
|
|
34
36
|
roundBaseline,
|
|
37
|
+
transitions,
|
|
35
38
|
transition
|
|
36
39
|
} = _ref;
|
|
37
40
|
const {
|
|
41
|
+
layout,
|
|
38
42
|
getSeriesData,
|
|
39
43
|
getXAxis,
|
|
40
|
-
|
|
41
|
-
getSeries
|
|
44
|
+
getYAxis
|
|
42
45
|
} = useCartesianChartContext();
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
const stackMinSizePx = stackMinSize;
|
|
46
|
-
const xAxis = getXAxis();
|
|
46
|
+
const xAxis = getXAxis(xAxisId);
|
|
47
|
+
const yAxis = getYAxis(yAxisId);
|
|
47
48
|
const baseline = useMemo(() => {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const [domainMin, domainMax] = domain;
|
|
51
|
-
const baselineValue = domainMin >= 0 ? domainMin : domainMax <= 0 ? domainMax : 0;
|
|
52
|
-
const baseline = (_yScale = yScale(baselineValue)) !== null && _yScale !== void 0 ? _yScale : rect.y + rect.height;
|
|
53
|
-
return Math.max(rect.y, Math.min(baseline, rect.y + rect.height));
|
|
54
|
-
}, [rect.height, rect.y, yScale]);
|
|
49
|
+
return getStackBaseline(valueScale, rect, layout);
|
|
50
|
+
}, [rect, valueScale, layout]);
|
|
55
51
|
const seriesGradients = useMemo(() => {
|
|
56
52
|
return series.map(s => {
|
|
57
|
-
if (!s.gradient
|
|
58
|
-
const
|
|
59
|
-
|
|
53
|
+
if (!s.gradient) return null;
|
|
54
|
+
const evalScale = s.gradient.axis === 'x' ? layout === 'vertical' ? indexScale : valueScale : layout === 'vertical' ? valueScale : indexScale;
|
|
55
|
+
|
|
56
|
+
// We need to pass original xScale/yScale to getGradientConfig for legacy reasons
|
|
57
|
+
// For now let's assume getGradientConfig can handle these scales if we pass them correctly.
|
|
58
|
+
const stops = getGradientConfig(s.gradient, layout === 'vertical' ? indexScale : valueScale, layout === 'vertical' ? valueScale : indexScale);
|
|
60
59
|
if (!stops) return null;
|
|
61
60
|
return {
|
|
62
61
|
seriesId: s.id,
|
|
63
62
|
gradient: s.gradient,
|
|
64
|
-
scale:
|
|
63
|
+
scale: evalScale,
|
|
65
64
|
stops
|
|
66
65
|
};
|
|
67
66
|
});
|
|
68
|
-
}, [series,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
if (isAboveBaseline) {
|
|
107
|
-
positiveBarCount++;
|
|
108
|
-
} else if (isBelowBaseline) {
|
|
109
|
-
negativeBarCount++;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// Calculate height (remember SVG y coordinates are inverted)
|
|
114
|
-
const height = Math.abs(barBottom - barTop);
|
|
115
|
-
const y = Math.min(barBottom, barTop);
|
|
116
|
-
|
|
117
|
-
// Skip bars that would have zero or negative height
|
|
118
|
-
if (height <= 0) {
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// Update stack bounds
|
|
123
|
-
minY = Math.min(minY, y);
|
|
124
|
-
maxY = Math.max(maxY, y + height);
|
|
125
|
-
let barFill = (_s$color = s.color) !== null && _s$color !== void 0 ? _s$color : 'var(--color-fgPrimary)';
|
|
126
|
-
|
|
127
|
-
// Evaluate gradient if provided (using precomputed stops)
|
|
128
|
-
const seriesGradientConfig = seriesGradients.find(g => (g === null || g === void 0 ? void 0 : g.seriesId) === s.id);
|
|
129
|
-
if (seriesGradientConfig && originalValue !== null && originalValue !== undefined) {
|
|
130
|
-
var _seriesGradientConfig;
|
|
131
|
-
const axis = (_seriesGradientConfig = seriesGradientConfig.gradient.axis) !== null && _seriesGradientConfig !== void 0 ? _seriesGradientConfig : 'y';
|
|
132
|
-
// For x-axis gradient, use the categoryIndex
|
|
133
|
-
// For y-axis gradient, use the ORIGINAL data value (not the processed top value)
|
|
134
|
-
// This is important for bar charts where originalValue might be a single number (e.g., -40, 15)
|
|
135
|
-
// or a tuple (e.g., [0, 10] for range bars)
|
|
136
|
-
let evalValue;
|
|
137
|
-
if (axis === 'x') {
|
|
138
|
-
evalValue = categoryIndex;
|
|
139
|
-
} else {
|
|
140
|
-
// Use original value for evaluation - handles both single numbers and tuples
|
|
141
|
-
evalValue = Array.isArray(originalValue) ? originalValue[1] : originalValue;
|
|
142
|
-
}
|
|
143
|
-
const evaluatedColor = evaluateGradientAtValue(seriesGradientConfig.stops, evalValue, seriesGradientConfig.scale);
|
|
144
|
-
if (evaluatedColor) {
|
|
145
|
-
// Only apply gradient color if fill is not explicitly set
|
|
146
|
-
barFill = evaluatedColor;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
allBars.push({
|
|
150
|
-
seriesId: s.id,
|
|
151
|
-
x,
|
|
152
|
-
y,
|
|
153
|
-
width,
|
|
154
|
-
height,
|
|
155
|
-
dataY: value,
|
|
156
|
-
// Store the actual data value
|
|
157
|
-
fill: barFill,
|
|
158
|
-
// Check if the bar should be rounded based on the baseline, with an epsilon to handle floating-point rounding
|
|
159
|
-
roundTop: roundBaseline || Math.abs(barTop - baseline) >= EPSILON,
|
|
160
|
-
roundBottom: roundBaseline || Math.abs(barBottom - baseline) >= EPSILON,
|
|
161
|
-
shouldApplyGap
|
|
162
|
-
});
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
// Apply proportional gap distribution to maintain total stack height
|
|
166
|
-
if (stackGap && allBars.length > 1) {
|
|
167
|
-
// Separate bars by baseline side
|
|
168
|
-
const barsAboveBaseline = allBars.filter(bar => {
|
|
169
|
-
const [bottom, top] = bar.dataY.sort((a, b) => a - b);
|
|
170
|
-
return bottom >= 0 && top !== bottom && bar.shouldApplyGap;
|
|
171
|
-
});
|
|
172
|
-
const barsBelowBaseline = allBars.filter(bar => {
|
|
173
|
-
const [bottom, top] = bar.dataY.sort((a, b) => a - b);
|
|
174
|
-
return bottom <= 0 && bottom !== top && bar.shouldApplyGap;
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
// Apply proportional gaps to bars above baseline
|
|
178
|
-
if (barsAboveBaseline.length > 1) {
|
|
179
|
-
const totalGapSpace = stackGap * (barsAboveBaseline.length - 1);
|
|
180
|
-
const totalDataHeight = barsAboveBaseline.reduce((sum, bar) => sum + bar.height, 0);
|
|
181
|
-
const heightReduction = totalGapSpace / totalDataHeight;
|
|
182
|
-
|
|
183
|
-
// Sort bars by position (from baseline upward)
|
|
184
|
-
const sortedBars = barsAboveBaseline.sort((a, b) => b.y - a.y);
|
|
185
|
-
let currentY = baseline;
|
|
186
|
-
sortedBars.forEach((bar, index) => {
|
|
187
|
-
// Reduce bar height proportionally
|
|
188
|
-
const newHeight = bar.height * (1 - heightReduction);
|
|
189
|
-
const newY = currentY - newHeight;
|
|
190
|
-
|
|
191
|
-
// Update the bar in allBars array
|
|
192
|
-
const barIndex = allBars.findIndex(b => b.seriesId === bar.seriesId);
|
|
193
|
-
if (barIndex !== -1) {
|
|
194
|
-
allBars[barIndex] = _objectSpread(_objectSpread({}, allBars[barIndex]), {}, {
|
|
195
|
-
height: newHeight,
|
|
196
|
-
y: newY
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
// Move to next position (include gap for next bar)
|
|
201
|
-
currentY = newY - (index < sortedBars.length - 1 ? stackGap : 0);
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// Apply proportional gaps to bars below baseline
|
|
206
|
-
if (barsBelowBaseline.length > 1) {
|
|
207
|
-
const totalGapSpace = stackGap * (barsBelowBaseline.length - 1);
|
|
208
|
-
const totalDataHeight = barsBelowBaseline.reduce((sum, bar) => sum + bar.height, 0);
|
|
209
|
-
const heightReduction = totalGapSpace / totalDataHeight;
|
|
210
|
-
|
|
211
|
-
// Sort bars by position (from baseline downward)
|
|
212
|
-
const sortedBars = barsBelowBaseline.sort((a, b) => a.y - b.y);
|
|
213
|
-
let currentY = baseline;
|
|
214
|
-
sortedBars.forEach((bar, index) => {
|
|
215
|
-
// Reduce bar height proportionally
|
|
216
|
-
const newHeight = bar.height * (1 - heightReduction);
|
|
217
|
-
|
|
218
|
-
// Update the bar in allBars array
|
|
219
|
-
const barIndex = allBars.findIndex(b => b.seriesId === bar.seriesId);
|
|
220
|
-
if (barIndex !== -1) {
|
|
221
|
-
allBars[barIndex] = _objectSpread(_objectSpread({}, allBars[barIndex]), {}, {
|
|
222
|
-
height: newHeight,
|
|
223
|
-
y: currentY
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
// Move to next position (include gap for next bar)
|
|
228
|
-
currentY = currentY + newHeight + (index < sortedBars.length - 1 ? stackGap : 0);
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
// Recalculate stack bounds after gap adjustments
|
|
233
|
-
if (allBars.length > 0) {
|
|
234
|
-
minY = Math.min(...allBars.map(bar => bar.y));
|
|
235
|
-
maxY = Math.max(...allBars.map(bar => bar.y + bar.height));
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
// Apply barMinSize constraints
|
|
240
|
-
if (barMinSizePx) {
|
|
241
|
-
// First, expand bars that need it and track the expansion
|
|
242
|
-
const expandedBars = allBars.map((bar, index) => {
|
|
243
|
-
if (bar.height < barMinSizePx) {
|
|
244
|
-
var _yScale4, _yScale5, _yScale6, _yScale7;
|
|
245
|
-
const heightIncrease = barMinSizePx - bar.height;
|
|
246
|
-
const bottom = 0;
|
|
247
|
-
const top = 0;
|
|
248
|
-
|
|
249
|
-
// Determine how to expand the bar
|
|
250
|
-
let newBottom = bottom;
|
|
251
|
-
let newTop = top;
|
|
252
|
-
const scaleUnit = Math.abs(((_yScale4 = yScale(1)) !== null && _yScale4 !== void 0 ? _yScale4 : 0) - ((_yScale5 = yScale(0)) !== null && _yScale5 !== void 0 ? _yScale5 : 0));
|
|
253
|
-
if (bottom === 0) {
|
|
254
|
-
// Expand away from baseline (upward for positive)
|
|
255
|
-
newTop = top + heightIncrease / scaleUnit;
|
|
256
|
-
} else if (top === 0) {
|
|
257
|
-
// Expand away from baseline (downward for negative)
|
|
258
|
-
newBottom = bottom - heightIncrease / scaleUnit;
|
|
259
|
-
} else {
|
|
260
|
-
// Expand in both directions
|
|
261
|
-
const halfIncrease = heightIncrease / scaleUnit / 2;
|
|
262
|
-
newBottom = bottom - halfIncrease;
|
|
263
|
-
newTop = top + halfIncrease;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
// Recalculate bar position with new data values
|
|
267
|
-
const newBarBottom = (_yScale6 = yScale(newBottom)) !== null && _yScale6 !== void 0 ? _yScale6 : baseline;
|
|
268
|
-
const newBarTop = (_yScale7 = yScale(newTop)) !== null && _yScale7 !== void 0 ? _yScale7 : baseline;
|
|
269
|
-
const newHeight = Math.abs(newBarBottom - newBarTop);
|
|
270
|
-
const newY = Math.min(newBarBottom, newBarTop);
|
|
271
|
-
return _objectSpread(_objectSpread({}, bar), {}, {
|
|
272
|
-
height: newHeight,
|
|
273
|
-
y: newY,
|
|
274
|
-
wasExpanded: true
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
return _objectSpread(_objectSpread({}, bar), {}, {
|
|
278
|
-
wasExpanded: false
|
|
279
|
-
});
|
|
280
|
-
});
|
|
281
|
-
|
|
282
|
-
// Now reposition all bars to avoid overlaps, similar to stackMinSize logic
|
|
283
|
-
|
|
284
|
-
// Sort bars by position to maintain order
|
|
285
|
-
const sortedExpandedBars = [...expandedBars].sort((a, b) => a.y - b.y);
|
|
286
|
-
|
|
287
|
-
// Determine if we have bars above and below baseline
|
|
288
|
-
const barsAboveBaseline = sortedExpandedBars.filter(bar => bar.y + bar.height <= baseline);
|
|
289
|
-
const barsBelowBaseline = sortedExpandedBars.filter(bar => bar.y >= baseline);
|
|
290
|
-
|
|
291
|
-
// Create a map of new positions
|
|
292
|
-
const newPositions = new Map();
|
|
293
|
-
|
|
294
|
-
// Start positioning from the baseline and work outward
|
|
295
|
-
let currentYAbove = baseline; // Start at baseline, work upward (decreasing Y)
|
|
296
|
-
let currentYBelow = baseline; // Start at baseline, work downward (increasing Y)
|
|
297
|
-
|
|
298
|
-
// Position bars above baseline (positive values, decreasing Y)
|
|
299
|
-
for (let i = barsAboveBaseline.length - 1; i >= 0; i--) {
|
|
300
|
-
const bar = barsAboveBaseline[i];
|
|
301
|
-
const newY = currentYAbove - bar.height;
|
|
302
|
-
newPositions.set(bar.seriesId, {
|
|
303
|
-
y: newY,
|
|
304
|
-
height: bar.height
|
|
305
|
-
});
|
|
306
|
-
|
|
307
|
-
// Update currentYAbove for next bar (preserve gaps)
|
|
308
|
-
if (i > 0) {
|
|
309
|
-
const currentBar = barsAboveBaseline[i];
|
|
310
|
-
const nextBar = barsAboveBaseline[i - 1];
|
|
311
|
-
// Find original bars to get original gap
|
|
312
|
-
const originalCurrent = allBars.find(b => b.seriesId === currentBar.seriesId);
|
|
313
|
-
const originalNext = allBars.find(b => b.seriesId === nextBar.seriesId);
|
|
314
|
-
const originalGap = originalCurrent.y - (originalNext.y + originalNext.height);
|
|
315
|
-
currentYAbove = newY - originalGap;
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
// Position bars below baseline (negative values, increasing Y)
|
|
320
|
-
for (let i = 0; i < barsBelowBaseline.length; i++) {
|
|
321
|
-
const bar = barsBelowBaseline[i];
|
|
322
|
-
const newY = currentYBelow;
|
|
323
|
-
newPositions.set(bar.seriesId, {
|
|
324
|
-
y: newY,
|
|
325
|
-
height: bar.height
|
|
326
|
-
});
|
|
327
|
-
|
|
328
|
-
// Update currentYBelow for next bar (preserve gaps)
|
|
329
|
-
if (i < barsBelowBaseline.length - 1) {
|
|
330
|
-
const currentBar = barsBelowBaseline[i];
|
|
331
|
-
const nextBar = barsBelowBaseline[i + 1];
|
|
332
|
-
// Find original bars to get original gap
|
|
333
|
-
const originalCurrent = allBars.find(b => b.seriesId === currentBar.seriesId);
|
|
334
|
-
const originalNext = allBars.find(b => b.seriesId === nextBar.seriesId);
|
|
335
|
-
const originalGap = originalNext.y - (originalCurrent.y + originalCurrent.height);
|
|
336
|
-
currentYBelow = newY + bar.height + originalGap;
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
// Apply new positions to all bars
|
|
341
|
-
allBars = expandedBars.map(bar => {
|
|
342
|
-
const newPos = newPositions.get(bar.seriesId);
|
|
343
|
-
if (newPos) {
|
|
344
|
-
return _objectSpread(_objectSpread({}, bar), {}, {
|
|
345
|
-
y: newPos.y,
|
|
346
|
-
height: newPos.height
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
|
-
return bar;
|
|
350
|
-
});
|
|
351
|
-
|
|
352
|
-
// Recalculate stack bounds after barMinSize expansion and repositioning
|
|
353
|
-
if (allBars.length > 0) {
|
|
354
|
-
minY = Math.min(...allBars.map(bar => bar.y));
|
|
355
|
-
maxY = Math.max(...allBars.map(bar => bar.y + bar.height));
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
// Apply border radius logic (will be reapplied after stackMinSize if needed)
|
|
360
|
-
const applyBorderRadiusLogic = bars => {
|
|
361
|
-
return bars.sort((a, b) => b.y - a.y).map((a, index) => {
|
|
362
|
-
const barBefore = index > 0 ? bars[index - 1] : null;
|
|
363
|
-
const barAfter = index < bars.length - 1 ? bars[index + 1] : null;
|
|
364
|
-
const shouldRoundTop = index === bars.length - 1 || a.shouldApplyGap && stackGap || !a.shouldApplyGap && barAfter && barAfter.y + barAfter.height !== a.y;
|
|
365
|
-
const shouldRoundBottom = index === 0 || a.shouldApplyGap && stackGap || !a.shouldApplyGap && barBefore && barBefore.y !== a.y + a.height;
|
|
366
|
-
return _objectSpread(_objectSpread({}, a), {}, {
|
|
367
|
-
roundTop: Boolean(a.roundTop && shouldRoundTop),
|
|
368
|
-
roundBottom: Boolean(a.roundBottom && shouldRoundBottom)
|
|
369
|
-
});
|
|
370
|
-
});
|
|
371
|
-
};
|
|
372
|
-
allBars = applyBorderRadiusLogic(allBars);
|
|
373
|
-
|
|
374
|
-
// Calculate the bounding rect for the entire stack
|
|
375
|
-
let stackBounds = {
|
|
376
|
-
x,
|
|
377
|
-
y: minY === Infinity ? baseline : minY,
|
|
378
|
-
width,
|
|
379
|
-
height: maxY === -Infinity ? 0 : maxY - minY
|
|
380
|
-
};
|
|
381
|
-
|
|
382
|
-
// Apply stackMinSize constraints
|
|
383
|
-
if (stackMinSizePx) {
|
|
384
|
-
if (allBars.length === 1 && stackBounds.height < stackMinSizePx) {
|
|
385
|
-
var _yScale8, _yScale9, _yScale0, _yScale1;
|
|
386
|
-
// For single bars (non-stacked), treat stackMinSize like barMinSize
|
|
387
|
-
|
|
388
|
-
const bar = allBars[0];
|
|
389
|
-
const heightIncrease = stackMinSizePx - bar.height;
|
|
390
|
-
const bottom = 0;
|
|
391
|
-
const top = 0;
|
|
392
|
-
|
|
393
|
-
// Determine how to expand the bar (same logic as barMinSize)
|
|
394
|
-
let newBottom = bottom;
|
|
395
|
-
let newTop = top;
|
|
396
|
-
const scaleUnit = Math.abs(((_yScale8 = yScale(1)) !== null && _yScale8 !== void 0 ? _yScale8 : 0) - ((_yScale9 = yScale(0)) !== null && _yScale9 !== void 0 ? _yScale9 : 0));
|
|
397
|
-
if (bottom === 0) {
|
|
398
|
-
// Expand away from baseline (upward for positive)
|
|
399
|
-
newTop = top + heightIncrease / scaleUnit;
|
|
400
|
-
} else if (top === 0) {
|
|
401
|
-
// Expand away from baseline (downward for negative)
|
|
402
|
-
newBottom = bottom - heightIncrease / scaleUnit;
|
|
403
|
-
} else {
|
|
404
|
-
// Expand in both directions
|
|
405
|
-
const halfIncrease = heightIncrease / scaleUnit / 2;
|
|
406
|
-
newBottom = bottom - halfIncrease;
|
|
407
|
-
newTop = top + halfIncrease;
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
// Recalculate bar position with new data values
|
|
411
|
-
const newBarBottom = (_yScale0 = yScale(newBottom)) !== null && _yScale0 !== void 0 ? _yScale0 : baseline;
|
|
412
|
-
const newBarTop = (_yScale1 = yScale(newTop)) !== null && _yScale1 !== void 0 ? _yScale1 : baseline;
|
|
413
|
-
const newHeight = Math.abs(newBarBottom - newBarTop);
|
|
414
|
-
const newY = Math.min(newBarBottom, newBarTop);
|
|
415
|
-
allBars[0] = _objectSpread(_objectSpread({}, bar), {}, {
|
|
416
|
-
height: newHeight,
|
|
417
|
-
y: newY
|
|
418
|
-
});
|
|
419
|
-
|
|
420
|
-
// Recalculate stack bounds
|
|
421
|
-
stackBounds = {
|
|
422
|
-
x,
|
|
423
|
-
y: newY,
|
|
424
|
-
width,
|
|
425
|
-
height: newHeight
|
|
426
|
-
};
|
|
427
|
-
} else if (allBars.length > 1 && stackBounds.height < stackMinSizePx) {
|
|
428
|
-
// For multiple bars (stacked), scale heights while preserving gaps
|
|
429
|
-
|
|
430
|
-
// Calculate total bar height (excluding gaps)
|
|
431
|
-
const totalBarHeight = allBars.reduce((sum, bar) => sum + bar.height, 0);
|
|
432
|
-
const totalGapHeight = stackBounds.height - totalBarHeight;
|
|
433
|
-
|
|
434
|
-
// Calculate how much we need to increase bar heights
|
|
435
|
-
const requiredBarHeight = stackMinSizePx - totalGapHeight;
|
|
436
|
-
const barScaleFactor = requiredBarHeight / totalBarHeight;
|
|
437
|
-
|
|
438
|
-
// Sort bars by position to maintain order
|
|
439
|
-
const sortedBars = [...allBars].sort((a, b) => a.y - b.y);
|
|
440
|
-
|
|
441
|
-
// Determine if we have bars above and below baseline
|
|
442
|
-
const barsAboveBaseline = sortedBars.filter(bar => bar.y + bar.height <= baseline);
|
|
443
|
-
const barsBelowBaseline = sortedBars.filter(bar => bar.y >= baseline);
|
|
444
|
-
|
|
445
|
-
// Create a map of new positions
|
|
446
|
-
const newPositions = new Map();
|
|
447
|
-
|
|
448
|
-
// Start positioning from the baseline and work outward
|
|
449
|
-
let currentYAbove = baseline; // Start at baseline, work upward (decreasing Y)
|
|
450
|
-
let currentYBelow = baseline; // Start at baseline, work downward (increasing Y)
|
|
451
|
-
|
|
452
|
-
// Position bars above baseline (positive values, decreasing Y)
|
|
453
|
-
for (let i = barsAboveBaseline.length - 1; i >= 0; i--) {
|
|
454
|
-
const bar = barsAboveBaseline[i];
|
|
455
|
-
const newHeight = bar.height * barScaleFactor;
|
|
456
|
-
const newY = currentYAbove - newHeight;
|
|
457
|
-
newPositions.set(bar.seriesId, {
|
|
458
|
-
y: newY,
|
|
459
|
-
height: newHeight
|
|
460
|
-
});
|
|
461
|
-
|
|
462
|
-
// Update currentYAbove for next bar (preserve gaps)
|
|
463
|
-
if (i > 0) {
|
|
464
|
-
const currentBar = barsAboveBaseline[i];
|
|
465
|
-
const nextBar = barsAboveBaseline[i - 1];
|
|
466
|
-
const originalGap = currentBar.y - (nextBar.y + nextBar.height);
|
|
467
|
-
currentYAbove = newY - originalGap;
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
// Position bars below baseline (negative values, increasing Y)
|
|
472
|
-
for (let i = 0; i < barsBelowBaseline.length; i++) {
|
|
473
|
-
const bar = barsBelowBaseline[i];
|
|
474
|
-
const newHeight = bar.height * barScaleFactor;
|
|
475
|
-
const newY = currentYBelow;
|
|
476
|
-
newPositions.set(bar.seriesId, {
|
|
477
|
-
y: newY,
|
|
478
|
-
height: newHeight
|
|
479
|
-
});
|
|
480
|
-
|
|
481
|
-
// Update currentYBelow for next bar (preserve gaps)
|
|
482
|
-
if (i < barsBelowBaseline.length - 1) {
|
|
483
|
-
const currentBar = barsBelowBaseline[i];
|
|
484
|
-
const nextBar = barsBelowBaseline[i + 1];
|
|
485
|
-
const originalGap = nextBar.y - (currentBar.y + currentBar.height);
|
|
486
|
-
currentYBelow = newY + newHeight + originalGap;
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
// Apply new positions to all bars
|
|
491
|
-
allBars = allBars.map(bar => {
|
|
492
|
-
const newPos = newPositions.get(bar.seriesId);
|
|
493
|
-
if (!newPos) return bar;
|
|
494
|
-
return _objectSpread(_objectSpread({}, bar), {}, {
|
|
495
|
-
height: newPos.height,
|
|
496
|
-
y: newPos.y
|
|
497
|
-
});
|
|
498
|
-
});
|
|
499
|
-
|
|
500
|
-
// Recalculate stack bounds
|
|
501
|
-
const newMinY = Math.min(...allBars.map(bar => bar.y));
|
|
502
|
-
const newMaxY = Math.max(...allBars.map(bar => bar.y + bar.height));
|
|
503
|
-
stackBounds = {
|
|
504
|
-
x,
|
|
505
|
-
y: newMinY,
|
|
506
|
-
width,
|
|
507
|
-
height: newMaxY - newMinY
|
|
508
|
-
};
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
// Reapply border radius logic only if we actually scaled
|
|
512
|
-
if (stackBounds.height < stackMinSizePx) {
|
|
513
|
-
allBars = applyBorderRadiusLogic(allBars);
|
|
514
|
-
}
|
|
67
|
+
}, [series, indexScale, valueScale, layout]);
|
|
68
|
+
const categoryAxis = layout === 'vertical' ? xAxis : yAxis;
|
|
69
|
+
const categoryData = categoryAxis !== null && categoryAxis !== void 0 && categoryAxis.data && Array.isArray(categoryAxis.data) && typeof categoryAxis.data[0] === 'number' ? categoryAxis.data : undefined;
|
|
70
|
+
const categoryValue = categoryData ? categoryData[categoryIndex] : categoryIndex;
|
|
71
|
+
const seriesData = useMemo(() => Object.fromEntries(series.map(s => {
|
|
72
|
+
var _getSeriesData;
|
|
73
|
+
return [s.id, (_getSeriesData = getSeriesData(s.id)) !== null && _getSeriesData !== void 0 ? _getSeriesData : []];
|
|
74
|
+
})), [series, getSeriesData]);
|
|
75
|
+
const bars = useMemo(() => getBars({
|
|
76
|
+
series,
|
|
77
|
+
seriesData,
|
|
78
|
+
categoryIndex,
|
|
79
|
+
categoryValue,
|
|
80
|
+
indexPos,
|
|
81
|
+
thickness,
|
|
82
|
+
valueScale,
|
|
83
|
+
seriesGradients,
|
|
84
|
+
roundBaseline,
|
|
85
|
+
layout,
|
|
86
|
+
baseline,
|
|
87
|
+
stackGap,
|
|
88
|
+
barMinSize,
|
|
89
|
+
stackMinSize,
|
|
90
|
+
defaultFill: 'var(--color-fgPrimary)',
|
|
91
|
+
borderRadius,
|
|
92
|
+
defaultFillOpacity,
|
|
93
|
+
defaultStroke,
|
|
94
|
+
defaultStrokeWidth,
|
|
95
|
+
defaultBarComponent
|
|
96
|
+
}), [series, seriesData, stackGap, barMinSize, stackMinSize, indexPos, baseline, thickness, categoryIndex, categoryValue, valueScale, seriesGradients, roundBaseline, layout, borderRadius, defaultFillOpacity, defaultStroke, defaultStrokeWidth, defaultBarComponent]);
|
|
97
|
+
const stackRect = useMemo(() => {
|
|
98
|
+
if (bars.length === 0) {
|
|
99
|
+
return {
|
|
100
|
+
x: layout === 'vertical' ? indexPos : baseline,
|
|
101
|
+
y: layout === 'vertical' ? baseline : indexPos,
|
|
102
|
+
width: layout === 'vertical' ? thickness : 0,
|
|
103
|
+
height: layout === 'vertical' ? 0 : thickness
|
|
104
|
+
};
|
|
515
105
|
}
|
|
106
|
+
const minX = Math.min(...bars.map(b => b.x));
|
|
107
|
+
const minY = Math.min(...bars.map(b => b.y));
|
|
108
|
+
const maxX = Math.max(...bars.map(b => b.x + b.width));
|
|
109
|
+
const maxY = Math.max(...bars.map(b => b.y + b.height));
|
|
516
110
|
return {
|
|
517
|
-
|
|
518
|
-
|
|
111
|
+
x: minX,
|
|
112
|
+
y: minY,
|
|
113
|
+
width: maxX - minX,
|
|
114
|
+
height: maxY - minY
|
|
519
115
|
};
|
|
520
|
-
}, [
|
|
521
|
-
const
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
116
|
+
}, [bars, baseline, indexPos, layout, thickness]);
|
|
117
|
+
const stackOrigin = useMemo(() => {
|
|
118
|
+
var _getStackOrigin;
|
|
119
|
+
return (_getStackOrigin = getStackOrigin(bars.map(b => b.origin), bars.map(b => {
|
|
120
|
+
var _b$minSize;
|
|
121
|
+
return (_b$minSize = b.minSize) !== null && _b$minSize !== void 0 ? _b$minSize : 0;
|
|
122
|
+
}))) !== null && _getStackOrigin !== void 0 ? _getStackOrigin : baseline;
|
|
123
|
+
}, [bars, baseline]);
|
|
124
|
+
const barElements = bars.map((bar, index) => /*#__PURE__*/_jsx(Bar, {
|
|
125
|
+
BarComponent: bar.BarComponent,
|
|
126
|
+
borderRadius: bar.borderRadius,
|
|
127
|
+
dataX: bar.dataX,
|
|
128
|
+
dataY: bar.dataY,
|
|
129
|
+
fill: bar.fill,
|
|
130
|
+
fillOpacity: bar.fillOpacity,
|
|
131
|
+
height: bar.height,
|
|
132
|
+
minSize: bar.minSize,
|
|
133
|
+
origin: bar.origin,
|
|
134
|
+
roundBottom: bar.roundBottom,
|
|
135
|
+
roundTop: bar.roundTop,
|
|
136
|
+
seriesId: bar.seriesId,
|
|
137
|
+
stroke: bar.stroke,
|
|
138
|
+
strokeWidth: bar.strokeWidth,
|
|
139
|
+
transition: transition,
|
|
140
|
+
transitions: transitions,
|
|
141
|
+
width: bar.width,
|
|
142
|
+
x: bar.x,
|
|
143
|
+
y: bar.y
|
|
144
|
+
}, "".concat(bar.seriesId, "-").concat(categoryIndex, "-").concat(index)));
|
|
145
|
+
const edge = layout === 'vertical' ? stackRect.y : stackRect.x;
|
|
146
|
+
const size = layout === 'vertical' ? stackRect.height : stackRect.width;
|
|
147
|
+
const stackRoundLower = roundBaseline || Math.abs(edge - baseline) >= EPSILON;
|
|
148
|
+
const stackRoundHigher = roundBaseline || Math.abs(edge + size - baseline) >= EPSILON;
|
|
149
|
+
const stackRoundTop = layout === 'vertical' ? stackRoundLower : stackRoundHigher;
|
|
150
|
+
const stackRoundBottom = layout === 'vertical' ? stackRoundHigher : stackRoundLower;
|
|
548
151
|
return /*#__PURE__*/_jsx(BarStackComponent, {
|
|
549
152
|
borderRadius: borderRadius,
|
|
550
153
|
categoryIndex: categoryIndex,
|
|
551
154
|
height: stackRect.height,
|
|
155
|
+
origin: stackOrigin,
|
|
552
156
|
roundBottom: stackRoundBottom,
|
|
553
157
|
roundTop: stackRoundTop,
|
|
554
158
|
transition: transition,
|
|
159
|
+
transitions: transitions,
|
|
555
160
|
width: stackRect.width,
|
|
556
161
|
x: stackRect.x,
|
|
557
162
|
y: stackRect.y,
|
|
558
|
-
yOrigin: baseline,
|
|
559
163
|
children: barElements
|
|
560
164
|
});
|
|
561
165
|
});
|