@redsift/charts 11.5.0 → 11.6.0-alpha.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/_internal/Arc.js +2 -0
- package/_internal/Arc.js.map +1 -0
- package/_internal/Arc2.js +117 -0
- package/_internal/Arc2.js.map +1 -0
- package/_internal/Arcs.js +2 -0
- package/_internal/Arcs.js.map +1 -0
- package/_internal/Arcs2.js +94 -0
- package/_internal/Arcs2.js.map +1 -0
- package/_internal/Axis.js +2 -0
- package/_internal/Axis.js.map +1 -0
- package/_internal/Axis2.js +388 -0
- package/_internal/Axis2.js.map +1 -0
- package/_internal/Bar.js +2 -0
- package/_internal/Bar.js.map +1 -0
- package/_internal/Bar2.js +170 -0
- package/_internal/Bar2.js.map +1 -0
- package/_internal/BarChart.js +2 -0
- package/_internal/BarChart.js.map +1 -0
- package/_internal/BarChart2.js +1419 -0
- package/_internal/BarChart2.js.map +1 -0
- package/_internal/ChartContainer.js +2 -0
- package/_internal/ChartContainer.js.map +1 -0
- package/_internal/ChartContainer2.js +266 -0
- package/_internal/ChartContainer2.js.map +1 -0
- package/_internal/DataPoint.js +2 -0
- package/_internal/DataPoint.js.map +1 -0
- package/_internal/DataPoint2.js +110 -0
- package/_internal/DataPoint2.js.map +1 -0
- package/_internal/Dot.js +2 -0
- package/_internal/Dot.js.map +1 -0
- package/_internal/Dot2.js +110 -0
- package/_internal/Dot2.js.map +1 -0
- package/_internal/Legend.js +2 -0
- package/_internal/Legend.js.map +1 -0
- package/_internal/Legend3.js +84 -0
- package/_internal/Legend3.js.map +1 -0
- package/_internal/LegendItem.js +2 -0
- package/_internal/LegendItem.js.map +1 -0
- package/_internal/LegendItem2.js +153 -0
- package/_internal/LegendItem2.js.map +1 -0
- package/_internal/Line.js +2 -0
- package/_internal/Line.js.map +1 -0
- package/_internal/Line2.js +59 -0
- package/_internal/Line2.js.map +1 -0
- package/_internal/LineChart.js +2 -0
- package/_internal/LineChart.js.map +1 -0
- package/_internal/LineChart2.js +669 -0
- package/_internal/LineChart2.js.map +1 -0
- package/_internal/PieChart.js +2 -0
- package/_internal/PieChart.js.map +1 -0
- package/_internal/PieChart2.js +605 -0
- package/_internal/PieChart2.js.map +1 -0
- package/_internal/ScatterPlot.js +2 -0
- package/_internal/ScatterPlot.js.map +1 -0
- package/_internal/ScatterPlot2.js +744 -0
- package/_internal/ScatterPlot2.js.map +1 -0
- package/_internal/_rollupPluginBabelHelpers.js +93 -0
- package/_internal/_rollupPluginBabelHelpers.js.map +1 -0
- package/_internal/config.js +13 -0
- package/_internal/config.js.map +1 -0
- package/_internal/legend2.js +21 -0
- package/_internal/legend2.js.map +1 -0
- package/_internal/scheme.js +47 -0
- package/_internal/scheme.js.map +1 -0
- package/_internal/theme.js +79 -0
- package/_internal/theme.js.map +1 -0
- package/_internal/useFormatCategoricalData.js +56 -0
- package/_internal/useFormatCategoricalData.js.map +1 -0
- package/index.js +17 -5118
- package/index.js.map +1 -1
- package/index2.js +16 -0
- package/index2.js.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,1419 @@
|
|
|
1
|
+
import { _ as _objectWithoutProperties, a as _extends, b as _objectSpread2 } from './_rollupPluginBabelHelpers.js';
|
|
2
|
+
import React__default, { forwardRef, useRef, createContext, useContext, useEffect, useMemo } from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { useTheme, useMessageFormatter, Flexbox, Text, isComponent, RedsiftColorGreenD1, RedsiftColorRedD1, RedsiftColorNeutralBlack, useId } from '@redsift/design-system';
|
|
5
|
+
import { L as LegendVariant, T as TooltipVariant } from './legend2.js';
|
|
6
|
+
import { C as ChartSize, g as getSortingMethod, i as isValidDate, u as useColor, m as mergeLegends, a as ColorTheme } from './theme.js';
|
|
7
|
+
import { scaleLinear, sum, scaleBand, extent, scaleUtc, scalePoint, utcParse, scaleLog } from 'd3';
|
|
8
|
+
import styled, { css } from 'styled-components';
|
|
9
|
+
import { C as ChartContainer, a as ChartContainerTitle, b as ChartContainerDescription } from './ChartContainer2.js';
|
|
10
|
+
import { A as Axis, a as AxisVariant, g as getAxisType } from './Axis2.js';
|
|
11
|
+
import { u as useFormatCategoricalData } from './useFormatCategoricalData.js';
|
|
12
|
+
import { a as BarOrientation, B as Bar, b as BarDirection } from './Bar2.js';
|
|
13
|
+
import { L as Legend } from './Legend3.js';
|
|
14
|
+
import { L as LegendItem } from './LegendItem2.js';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Component's labels variant.
|
|
18
|
+
*/
|
|
19
|
+
const BarChartLegendVariant = {
|
|
20
|
+
none: 'none',
|
|
21
|
+
externalLabel: 'externalLabel',
|
|
22
|
+
externalLabelValue: 'externalLabelValue',
|
|
23
|
+
externalLabelPercent: 'externalLabelPercent',
|
|
24
|
+
custom: 'custom'
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Component props.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Component style.
|
|
33
|
+
*/
|
|
34
|
+
const StyledBarChart = styled(ChartContainer)``;
|
|
35
|
+
const StyledBarChartSection = styled.g`
|
|
36
|
+
text.colored {
|
|
37
|
+
${_ref => {
|
|
38
|
+
let {
|
|
39
|
+
$textColor
|
|
40
|
+
} = _ref;
|
|
41
|
+
return css`
|
|
42
|
+
fill: ${$textColor};
|
|
43
|
+
`;
|
|
44
|
+
}}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.title {
|
|
48
|
+
font-size: 16px;
|
|
49
|
+
font-weight: 600;
|
|
50
|
+
}
|
|
51
|
+
`;
|
|
52
|
+
const StyledBarChartBars = styled.g``;
|
|
53
|
+
const StyledBarChartEmptyText = styled.div`
|
|
54
|
+
position: absolute;
|
|
55
|
+
top: 0;
|
|
56
|
+
left: 0;
|
|
57
|
+
height: 100%;
|
|
58
|
+
width: 100%;
|
|
59
|
+
display: flex;
|
|
60
|
+
flex-direction: column;
|
|
61
|
+
justify-content: center;
|
|
62
|
+
align-items: center;
|
|
63
|
+
pointer-events: none;
|
|
64
|
+
|
|
65
|
+
> * {
|
|
66
|
+
max-width: ${_ref2 => {
|
|
67
|
+
let {
|
|
68
|
+
$maxWidth
|
|
69
|
+
} = _ref2;
|
|
70
|
+
return $maxWidth;
|
|
71
|
+
}}px;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
> span {
|
|
75
|
+
font-family: var(--redsift-typography-font-family-poppins);
|
|
76
|
+
color: ${_ref3 => {
|
|
77
|
+
let {
|
|
78
|
+
$theme
|
|
79
|
+
} = _ref3;
|
|
80
|
+
return `var(--redsift-color-${$theme}-components-text-primary)`;
|
|
81
|
+
}};
|
|
82
|
+
font-size: ${_ref4 => {
|
|
83
|
+
let {
|
|
84
|
+
$textSize
|
|
85
|
+
} = _ref4;
|
|
86
|
+
return $textSize;
|
|
87
|
+
}}px;
|
|
88
|
+
line-height: ${_ref5 => {
|
|
89
|
+
let {
|
|
90
|
+
$textSize
|
|
91
|
+
} = _ref5;
|
|
92
|
+
return $textSize;
|
|
93
|
+
}}px;
|
|
94
|
+
}
|
|
95
|
+
`;
|
|
96
|
+
|
|
97
|
+
const sizeToDimension = size => {
|
|
98
|
+
if (typeof size !== 'string') {
|
|
99
|
+
return size;
|
|
100
|
+
}
|
|
101
|
+
switch (size) {
|
|
102
|
+
case ChartSize.small:
|
|
103
|
+
return {
|
|
104
|
+
width: 300,
|
|
105
|
+
height: 200,
|
|
106
|
+
fontSize: 30
|
|
107
|
+
};
|
|
108
|
+
case ChartSize.large:
|
|
109
|
+
return {
|
|
110
|
+
width: 500,
|
|
111
|
+
height: 400,
|
|
112
|
+
fontSize: 38
|
|
113
|
+
};
|
|
114
|
+
case ChartSize.medium:
|
|
115
|
+
default:
|
|
116
|
+
return {
|
|
117
|
+
width: 400,
|
|
118
|
+
height: 300,
|
|
119
|
+
fontSize: 34
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
const statsBy = (arr, sortingMethod) => {
|
|
124
|
+
const isKeyArray = Array.isArray(arr[0].key);
|
|
125
|
+
const counts = arr.reduce((prev, curr) => {
|
|
126
|
+
if (!curr.value) {
|
|
127
|
+
return prev;
|
|
128
|
+
}
|
|
129
|
+
const currentKey = isKeyArray ? curr.key[1] : 'default';
|
|
130
|
+
if (!prev[currentKey]) {
|
|
131
|
+
prev[currentKey] = {
|
|
132
|
+
value: curr.value,
|
|
133
|
+
min: curr.value,
|
|
134
|
+
max: curr.value,
|
|
135
|
+
values: [curr.value]
|
|
136
|
+
};
|
|
137
|
+
} else {
|
|
138
|
+
prev[currentKey] = {
|
|
139
|
+
value: prev[currentKey].value + curr.value,
|
|
140
|
+
min: Math.min(prev[currentKey].min, curr.value),
|
|
141
|
+
max: Math.max(prev[currentKey].max, curr.value),
|
|
142
|
+
values: [...prev[currentKey].values, curr.value]
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
return prev;
|
|
146
|
+
}, {});
|
|
147
|
+
return Object.keys(counts).map(key => ({
|
|
148
|
+
key: key,
|
|
149
|
+
value: counts[key].value,
|
|
150
|
+
min: counts[key].min,
|
|
151
|
+
max: counts[key].max,
|
|
152
|
+
values: counts[key].values,
|
|
153
|
+
first: counts[key].values[0],
|
|
154
|
+
last: counts[key].values[counts[key].values.length - 1],
|
|
155
|
+
trending: {
|
|
156
|
+
overall: (counts[key].values[counts[key].values.length - 1] - counts[key].values[0]) * 100 / counts[key].values[0]
|
|
157
|
+
}
|
|
158
|
+
})).sort(getSortingMethod(sortingMethod));
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const _excluded$6 = ["className", "emptyComponent", "size", "localeText"];
|
|
162
|
+
const EmptyBarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
163
|
+
const {
|
|
164
|
+
className,
|
|
165
|
+
emptyComponent,
|
|
166
|
+
size,
|
|
167
|
+
localeText
|
|
168
|
+
} = props,
|
|
169
|
+
forwardedProps = _objectWithoutProperties(props, _excluded$6);
|
|
170
|
+
const theme = useTheme();
|
|
171
|
+
const chartDimensions = sizeToDimension(size);
|
|
172
|
+
const width = chartDimensions.width;
|
|
173
|
+
const height = chartDimensions.height;
|
|
174
|
+
const margins = {
|
|
175
|
+
top: 16,
|
|
176
|
+
left: 16,
|
|
177
|
+
right: 16,
|
|
178
|
+
bottom: 32
|
|
179
|
+
};
|
|
180
|
+
const chartHeight = height - margins.top - margins.bottom;
|
|
181
|
+
const chartWidth = width - margins.left - margins.right;
|
|
182
|
+
const scaleRef = useRef();
|
|
183
|
+
if (!scaleRef.current) {
|
|
184
|
+
scaleRef.current = scaleLinear().domain([]).range([0, chartWidth]);
|
|
185
|
+
}
|
|
186
|
+
return /*#__PURE__*/React__default.createElement(StyledBarChart, _extends({}, forwardedProps, {
|
|
187
|
+
className: className,
|
|
188
|
+
ref: ref
|
|
189
|
+
}), emptyComponent !== null && emptyComponent !== void 0 ? emptyComponent : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(StyledBarChartEmptyText, {
|
|
190
|
+
$maxWidth: width,
|
|
191
|
+
$textSize: chartDimensions.fontSize / 2,
|
|
192
|
+
$theme: theme
|
|
193
|
+
}, /*#__PURE__*/React__default.createElement("span", null, localeText === null || localeText === void 0 ? void 0 : localeText.emptyChartText)), /*#__PURE__*/React__default.createElement("svg", {
|
|
194
|
+
width: width,
|
|
195
|
+
height: height
|
|
196
|
+
}, /*#__PURE__*/React__default.createElement("g", {
|
|
197
|
+
transform: `translate(${margins.left},${margins.top})`
|
|
198
|
+
}, /*#__PURE__*/React__default.createElement(Axis, {
|
|
199
|
+
position: "bottom",
|
|
200
|
+
length: chartWidth,
|
|
201
|
+
scale: scaleRef.current,
|
|
202
|
+
x: 0,
|
|
203
|
+
y: chartHeight,
|
|
204
|
+
tickValues: 4
|
|
205
|
+
})))));
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
const _excluded$5 = ["className"];
|
|
209
|
+
const LoadingBarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
210
|
+
const {
|
|
211
|
+
className
|
|
212
|
+
} = props,
|
|
213
|
+
forwardedProps = _objectWithoutProperties(props, _excluded$5);
|
|
214
|
+
return /*#__PURE__*/React__default.createElement(StyledBarChart, _extends({}, forwardedProps, {
|
|
215
|
+
className: className,
|
|
216
|
+
ref: ref
|
|
217
|
+
}), "Loading...");
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
var enUS = {
|
|
221
|
+
"interactive-chart": "Interactive Bar Chart",
|
|
222
|
+
"static-chart": "Static Bar Chart",
|
|
223
|
+
"definition-linear": "Linear Bar Chart with {barLength} bars.",
|
|
224
|
+
"definition-linear-with-categories": "Linear Bar Chart with {categoryLength} categories and {barLength} bars.",
|
|
225
|
+
"definition-ordinal": "Ordinal Bar Chart with {barLength} bars.",
|
|
226
|
+
"x-axis-numbers-definition": "The chart has {numAxis, plural, =0 {0 X axis} =1 {1 X axis} other {# X axes}} displaying numbers from {start, number} to {end, number}.",
|
|
227
|
+
"y-axis-numbers-definition": "The chart has {numAxis, plural, =0 {0 Y axis} =1 {1 Y axis} other {# Y axes}} displaying numbers from {start, number} to {end, number}.",
|
|
228
|
+
"x-axis-dates-definition": "The chart has {numAxis, plural, =0 {0 X axis} =1 {1 X axis} other {# X axes}} displaying dates from {start} to {end}.",
|
|
229
|
+
"y-axis-dates-definition": "The chart has {numAxis, plural, =0 {0 Y axis} =1 {1 Y axis} other {# Y axes}} displaying dates from {start} to {end}.",
|
|
230
|
+
"x-axis-categories-definition": "The chart has {numAxis, plural, =0 {0 X axis} =1 {1 X axis} other {# X axes}} displaying categories.",
|
|
231
|
+
"y-axis-categories-definition": "The chart has {numAxis, plural, =0 {0 Y axis} =1 {1 Y axis} other {# Y axes}} displaying categories.",
|
|
232
|
+
"series-legend": "{category}, category {categoryIndex} of {categoryLength} with {barLength} bars"
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
var frFR = {
|
|
236
|
+
"interactive-chart": "Diagrammes à bandes interactif",
|
|
237
|
+
"static-chart": "Diagrammes à bandes statique",
|
|
238
|
+
"definition-linear": "Diagrammes à bandes contenant {barLength} bandes réparties sur un axe linéraire.",
|
|
239
|
+
"definition-linear-with-categories": "Diagrammes à bandes contenant {categoryLength} catégories et {barLength} bandes réparties sur un axe linéraire.",
|
|
240
|
+
"definition-ordinal": "Diagrammes à bandes contenant {barLength} bandes.",
|
|
241
|
+
"x-axis-numbers-definition": "Le graphique a {numAxis, plural, =0 {0 axe X} =1 {1 axe X} other {# axes X}} affichant des nombres allant de {start, number} à {end, number}.",
|
|
242
|
+
"y-axis-numbers-definition": "Le graphique a {numAxis, plural, =0 {0 axe Y} =1 {1 axe Y} other {# axes Y}} affichant des nombres allant de {start, number} à {end, number}.",
|
|
243
|
+
"x-axis-dates-definition": "Le graphique a {numAxis, plural, =0 {0 axe X} =1 {1 axe X} other {# axes X}} affichant des dates allant de {start} à {end}.",
|
|
244
|
+
"y-axis-dates-definition": "Le graphique a {numAxis, plural, =0 {0 axe Y} =1 {1 axe Y} other {# axes Y}} affichant des dates allant de {start} à {end}.",
|
|
245
|
+
"x-axis-categories-definition": "Le graphique a {numAxis, plural, =0 {0 axe X} =1 {1 axe X} other {# axes X}} affichant des categories.",
|
|
246
|
+
"y-axis-categories-definition": "Le graphique a {numAxis, plural, =0 {0 axe Y} =1 {1 axe Y} other {# axes Y}} affichant des categories.",
|
|
247
|
+
"series-legend": "{category}, catégorie {categoryIndex} sur {categoryLength} contenant {barLength} bandes"
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
var intlMessages = {
|
|
251
|
+
'en-US': enUS,
|
|
252
|
+
'fr-FR': frFR
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
const BarChartContext = /*#__PURE__*/createContext(null);
|
|
256
|
+
function useBarChartContext() {
|
|
257
|
+
const context = useContext(BarChartContext);
|
|
258
|
+
if (!context) {
|
|
259
|
+
throw new Error('useBarChartContext must be used within a BarChart');
|
|
260
|
+
}
|
|
261
|
+
return context;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
const ChartTypeContext = /*#__PURE__*/React__default.createContext(undefined);
|
|
265
|
+
|
|
266
|
+
const _excluded$4 = ["areXLabelsRotated", "barProps", "caping", "className", "data", "disableAnimations", "id", "isBarSelected", "getBarAnchorProps", "labelDecorator", "margins", "onBarClick", "orientation", "others", "size", "sortingMethod", "barRole", "colorTheme", "tooltipVariant", "xAxisVariant", "xAxisPlacement", "xAxisTickFormat", "xAxisTickPadding", "xAxisTickRotation", "xAxisTickSize", "xAxisTickValues", "yAxisVariant", "yAxisPlacement", "yAxisTickFormat", "yAxisTickPadding", "yAxisTickRotation", "yAxisTickSize", "yAxisTickValues"];
|
|
267
|
+
const RenderedOrdinalBarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
268
|
+
const {
|
|
269
|
+
areXLabelsRotated,
|
|
270
|
+
barProps,
|
|
271
|
+
caping,
|
|
272
|
+
className,
|
|
273
|
+
data: propsData,
|
|
274
|
+
disableAnimations,
|
|
275
|
+
id,
|
|
276
|
+
isBarSelected,
|
|
277
|
+
getBarAnchorProps,
|
|
278
|
+
labelDecorator,
|
|
279
|
+
margins: propsMargins,
|
|
280
|
+
onBarClick,
|
|
281
|
+
orientation,
|
|
282
|
+
others,
|
|
283
|
+
size,
|
|
284
|
+
sortingMethod,
|
|
285
|
+
barRole,
|
|
286
|
+
colorTheme,
|
|
287
|
+
tooltipVariant,
|
|
288
|
+
xAxisVariant: propsXAxisVariant,
|
|
289
|
+
xAxisPlacement,
|
|
290
|
+
xAxisTickFormat,
|
|
291
|
+
xAxisTickPadding,
|
|
292
|
+
xAxisTickRotation,
|
|
293
|
+
xAxisTickSize,
|
|
294
|
+
xAxisTickValues,
|
|
295
|
+
yAxisVariant: propsYAxisVariant,
|
|
296
|
+
yAxisPlacement,
|
|
297
|
+
yAxisTickFormat,
|
|
298
|
+
yAxisTickPadding,
|
|
299
|
+
yAxisTickRotation,
|
|
300
|
+
yAxisTickSize,
|
|
301
|
+
yAxisTickValues
|
|
302
|
+
} = props,
|
|
303
|
+
forwardedProps = _objectWithoutProperties(props, _excluded$4);
|
|
304
|
+
const cache = useRef();
|
|
305
|
+
const theme = useTheme();
|
|
306
|
+
const format = useMessageFormatter(intlMessages);
|
|
307
|
+
const {
|
|
308
|
+
data,
|
|
309
|
+
colorScale
|
|
310
|
+
} = useFormatCategoricalData({
|
|
311
|
+
data: propsData,
|
|
312
|
+
colorTheme: colorTheme,
|
|
313
|
+
sortingMethod: sortingMethod,
|
|
314
|
+
caping,
|
|
315
|
+
others,
|
|
316
|
+
theme
|
|
317
|
+
});
|
|
318
|
+
useEffect(() => {
|
|
319
|
+
cache.current = data;
|
|
320
|
+
});
|
|
321
|
+
const isHorizontal = orientation === BarOrientation.horizontal;
|
|
322
|
+
const xAxisVariant = propsXAxisVariant ? propsXAxisVariant : isHorizontal ? AxisVariant.default : AxisVariant.tickValue;
|
|
323
|
+
const yAxisVariant = propsYAxisVariant ? propsYAxisVariant : isHorizontal ? AxisVariant.none : AxisVariant.default;
|
|
324
|
+
const chartDimensions = sizeToDimension(size);
|
|
325
|
+
const width = chartDimensions.width;
|
|
326
|
+
const height = chartDimensions.height;
|
|
327
|
+
const margins = _objectSpread2({
|
|
328
|
+
top: 16,
|
|
329
|
+
left: isHorizontal ? 16 : 64,
|
|
330
|
+
right: 16,
|
|
331
|
+
bottom: 32
|
|
332
|
+
}, propsMargins);
|
|
333
|
+
const chartHeight = height - margins.top - margins.bottom;
|
|
334
|
+
const chartWidth = width - margins.left - margins.right;
|
|
335
|
+
const numberOfRows = data.filter(datum => datum.value).length;
|
|
336
|
+
const gap = 5;
|
|
337
|
+
const barHeight = chartHeight / numberOfRows - gap;
|
|
338
|
+
const barWidth = chartWidth / numberOfRows - gap;
|
|
339
|
+
const total = sum(data, d => d.value);
|
|
340
|
+
const scale = useMemo(() => scaleLinear().domain([0, Math.max(...data.map(_ref => {
|
|
341
|
+
let {
|
|
342
|
+
value
|
|
343
|
+
} = _ref;
|
|
344
|
+
return value;
|
|
345
|
+
}))]).range(isHorizontal ? [0, chartWidth] : [chartHeight, 0]), [size]);
|
|
346
|
+
const scaleCategory = useMemo(() => scaleBand().domain(data.filter(datum => datum.value).map(datum => datum.key)).range([0, isHorizontal ? chartHeight : chartWidth]), [size]);
|
|
347
|
+
const bars = data.filter(datum => datum.value);
|
|
348
|
+
return /*#__PURE__*/React__default.createElement(ChartTypeContext.Provider, {
|
|
349
|
+
value: "bar"
|
|
350
|
+
}, /*#__PURE__*/React__default.createElement(BarChartContext.Provider, {
|
|
351
|
+
value: {}
|
|
352
|
+
}, /*#__PURE__*/React__default.createElement(StyledBarChart, _extends({
|
|
353
|
+
mode: typeof onBarClick === 'function' || typeof getBarAnchorProps === 'function' ? 'interactive' : 'static',
|
|
354
|
+
definition: format('definition-ordinal', {
|
|
355
|
+
barLength: bars.length
|
|
356
|
+
}),
|
|
357
|
+
xAxisDefinition: isHorizontal ? format('x-axis-numbers-definition', {
|
|
358
|
+
numAxis: xAxisPlacement === 'both' ? 2 : 1,
|
|
359
|
+
start: scale.domain()[0],
|
|
360
|
+
end: scale.domain()[1]
|
|
361
|
+
}) : format('x-axis-categories-definition', {
|
|
362
|
+
numAxis: xAxisPlacement === 'both' ? 2 : 1
|
|
363
|
+
}),
|
|
364
|
+
yAxisDefinition: isHorizontal ? format('y-axis-categories-definition', {
|
|
365
|
+
numAxis: yAxisPlacement === 'both' ? 2 : 1
|
|
366
|
+
}) : format('y-axis-numbers-definition', {
|
|
367
|
+
numAxis: yAxisPlacement === 'both' ? 2 : 1,
|
|
368
|
+
start: scale.domain()[0],
|
|
369
|
+
end: scale.domain()[1]
|
|
370
|
+
}),
|
|
371
|
+
dataTableRepresentation: {
|
|
372
|
+
header: /*#__PURE__*/React__default.createElement("thead", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("th", {
|
|
373
|
+
scope: "col"
|
|
374
|
+
}, "Key"), /*#__PURE__*/React__default.createElement("th", {
|
|
375
|
+
scope: "col"
|
|
376
|
+
}, "Value"))),
|
|
377
|
+
body: /*#__PURE__*/React__default.createElement("tbody", null, bars.map(datum => /*#__PURE__*/React__default.createElement("tr", {
|
|
378
|
+
key: datum.key
|
|
379
|
+
}, /*#__PURE__*/React__default.createElement("th", {
|
|
380
|
+
scope: "row"
|
|
381
|
+
}, datum.key), /*#__PURE__*/React__default.createElement("td", null, datum.value))))
|
|
382
|
+
}
|
|
383
|
+
}, forwardedProps, {
|
|
384
|
+
id: id,
|
|
385
|
+
className: className,
|
|
386
|
+
ref: ref
|
|
387
|
+
}), /*#__PURE__*/React__default.createElement("svg", {
|
|
388
|
+
width: width,
|
|
389
|
+
height: height,
|
|
390
|
+
"aria-label": typeof onBarClick === 'function' || typeof getBarAnchorProps === 'function' ? format('interactive-chart') : format('static-chart'),
|
|
391
|
+
"aria-hidden": "false"
|
|
392
|
+
}, /*#__PURE__*/React__default.createElement("g", {
|
|
393
|
+
transform: `translate(${margins.left},${margins.top})`
|
|
394
|
+
}, ['bottom', 'both'].includes(xAxisPlacement) ? /*#__PURE__*/React__default.createElement(Axis, {
|
|
395
|
+
disableAnimations: disableAnimations,
|
|
396
|
+
position: "bottom",
|
|
397
|
+
length: chartWidth,
|
|
398
|
+
scale: isHorizontal ? scale : scaleCategory,
|
|
399
|
+
x: 0,
|
|
400
|
+
y: chartHeight,
|
|
401
|
+
tickValues: xAxisTickValues !== null && xAxisTickValues !== void 0 ? xAxisTickValues : 4,
|
|
402
|
+
tickPadding: xAxisTickPadding,
|
|
403
|
+
tickRotation: xAxisTickRotation,
|
|
404
|
+
tickSize: xAxisTickSize,
|
|
405
|
+
tickFormat: xAxisTickFormat,
|
|
406
|
+
variant: xAxisVariant
|
|
407
|
+
}) : null, ['top', 'both'].includes(xAxisPlacement) ? /*#__PURE__*/React__default.createElement(Axis, {
|
|
408
|
+
disableAnimations: disableAnimations,
|
|
409
|
+
position: "top",
|
|
410
|
+
length: chartWidth,
|
|
411
|
+
scale: isHorizontal ? scale : scaleCategory,
|
|
412
|
+
x: 0,
|
|
413
|
+
y: 0,
|
|
414
|
+
tickValues: xAxisTickValues !== null && xAxisTickValues !== void 0 ? xAxisTickValues : 4,
|
|
415
|
+
tickPadding: xAxisTickPadding,
|
|
416
|
+
tickRotation: xAxisTickRotation ? xAxisTickRotation : areXLabelsRotated ? -45 : 0,
|
|
417
|
+
tickSize: xAxisTickSize,
|
|
418
|
+
tickFormat: xAxisTickFormat,
|
|
419
|
+
variant: xAxisVariant
|
|
420
|
+
}) : null, ['left', 'both'].includes(yAxisPlacement) ? /*#__PURE__*/React__default.createElement(Axis, {
|
|
421
|
+
disableAnimations: disableAnimations,
|
|
422
|
+
position: "left",
|
|
423
|
+
length: chartHeight,
|
|
424
|
+
scale: isHorizontal ? scaleCategory : scale,
|
|
425
|
+
x: 0,
|
|
426
|
+
y: chartHeight,
|
|
427
|
+
tickValues: yAxisTickValues !== null && yAxisTickValues !== void 0 ? yAxisTickValues : 4,
|
|
428
|
+
tickPadding: yAxisTickPadding,
|
|
429
|
+
tickRotation: yAxisTickRotation,
|
|
430
|
+
tickSize: yAxisTickSize,
|
|
431
|
+
tickFormat: yAxisTickFormat,
|
|
432
|
+
variant: yAxisVariant
|
|
433
|
+
}) : null, ['right', 'both'].includes(yAxisPlacement) ? /*#__PURE__*/React__default.createElement(Axis, {
|
|
434
|
+
disableAnimations: disableAnimations,
|
|
435
|
+
position: "right",
|
|
436
|
+
length: chartHeight,
|
|
437
|
+
scale: isHorizontal ? scaleCategory : scale,
|
|
438
|
+
x: chartWidth,
|
|
439
|
+
y: chartHeight,
|
|
440
|
+
tickValues: yAxisTickValues !== null && yAxisTickValues !== void 0 ? yAxisTickValues : 4,
|
|
441
|
+
tickPadding: yAxisTickPadding,
|
|
442
|
+
tickRotation: yAxisTickRotation,
|
|
443
|
+
tickSize: yAxisTickSize,
|
|
444
|
+
tickFormat: yAxisTickFormat,
|
|
445
|
+
variant: yAxisVariant
|
|
446
|
+
}) : null), /*#__PURE__*/React__default.createElement("g", {
|
|
447
|
+
transform: `translate(${margins.left},${margins.top})`
|
|
448
|
+
}, bars.map((datum, index) => {
|
|
449
|
+
const percent = datum.value / total;
|
|
450
|
+
const to = {
|
|
451
|
+
data: _objectSpread2(_objectSpread2({}, datum), {}, {
|
|
452
|
+
percent
|
|
453
|
+
})
|
|
454
|
+
};
|
|
455
|
+
const from = cache.current ? {
|
|
456
|
+
data: cache.current[index]
|
|
457
|
+
} : undefined;
|
|
458
|
+
return /*#__PURE__*/React__default.createElement(Bar, _extends({
|
|
459
|
+
color: colorScale === null || colorScale === void 0 ? void 0 : colorScale(to.data.key),
|
|
460
|
+
data: to,
|
|
461
|
+
dataset: bars,
|
|
462
|
+
disableAnimations: disableAnimations,
|
|
463
|
+
gap: gap,
|
|
464
|
+
id: `id${id}__bar-${index}`,
|
|
465
|
+
index: index,
|
|
466
|
+
isSelected: Boolean(isBarSelected(to)),
|
|
467
|
+
key: `bar _${index}`,
|
|
468
|
+
labelDecorator: labelDecorator,
|
|
469
|
+
maxHeight: isHorizontal ? undefined : chartHeight,
|
|
470
|
+
anchorProps: getBarAnchorProps ? getBarAnchorProps(to) : undefined,
|
|
471
|
+
onClick: onBarClick,
|
|
472
|
+
orientation: orientation,
|
|
473
|
+
previousData: from,
|
|
474
|
+
scale: scale,
|
|
475
|
+
scalePosition: scaleCategory,
|
|
476
|
+
tooltipVariant: tooltipVariant
|
|
477
|
+
}, barProps, {
|
|
478
|
+
width: isHorizontal ? undefined : barProps !== null && barProps !== void 0 && barProps.width && typeof barProps.width === 'number' ? barProps.width : barWidth,
|
|
479
|
+
height: isHorizontal ? barProps !== null && barProps !== void 0 && barProps.height && typeof barProps.height === 'number' ? barProps.height : barHeight : undefined,
|
|
480
|
+
role: barRole
|
|
481
|
+
}));
|
|
482
|
+
}))))));
|
|
483
|
+
});
|
|
484
|
+
|
|
485
|
+
const _excluded$3 = ["category"];
|
|
486
|
+
const COMPONENT_NAME$2 = 'BarChartBars';
|
|
487
|
+
const CLASSNAME$2 = 'redsift-bars';
|
|
488
|
+
const BarChartBars = /*#__PURE__*/forwardRef((props, ref) => {
|
|
489
|
+
const {
|
|
490
|
+
category = 'default'
|
|
491
|
+
} = props,
|
|
492
|
+
forwardedProps = _objectWithoutProperties(props, _excluded$3);
|
|
493
|
+
const {
|
|
494
|
+
barProps,
|
|
495
|
+
barRole,
|
|
496
|
+
bars,
|
|
497
|
+
barWidth,
|
|
498
|
+
cache,
|
|
499
|
+
categories,
|
|
500
|
+
colorScale,
|
|
501
|
+
direction,
|
|
502
|
+
disableAnimations,
|
|
503
|
+
format,
|
|
504
|
+
gap,
|
|
505
|
+
getBarAnchorProps,
|
|
506
|
+
hasCategory,
|
|
507
|
+
id,
|
|
508
|
+
isBarSelected,
|
|
509
|
+
labelDecorator,
|
|
510
|
+
onBarClick,
|
|
511
|
+
scaleX,
|
|
512
|
+
scaleY,
|
|
513
|
+
tooltipVariant,
|
|
514
|
+
tooltipDecorator,
|
|
515
|
+
xScaleType
|
|
516
|
+
} = useBarChartContext();
|
|
517
|
+
const filteredBarChartBars = bars.filter(bar => bar.category === category && bar.value > 0);
|
|
518
|
+
const categoryIndex = categories.indexOf(category);
|
|
519
|
+
const categoryLength = categories.length;
|
|
520
|
+
return /*#__PURE__*/React__default.createElement(StyledBarChartBars, _extends({
|
|
521
|
+
key: `${id}-series-${category}`,
|
|
522
|
+
"aria-hidden": "false",
|
|
523
|
+
role: "region"
|
|
524
|
+
}, hasCategory ? {
|
|
525
|
+
'aria-label': format('series-legend', {
|
|
526
|
+
category,
|
|
527
|
+
categoryIndex: categoryIndex + 1,
|
|
528
|
+
categoryLength,
|
|
529
|
+
barLength: filteredBarChartBars.length
|
|
530
|
+
})
|
|
531
|
+
} : {}, forwardedProps, {
|
|
532
|
+
ref: ref
|
|
533
|
+
}), filteredBarChartBars.map((bar, index) => {
|
|
534
|
+
const to = {
|
|
535
|
+
data: bar,
|
|
536
|
+
category
|
|
537
|
+
};
|
|
538
|
+
const from = cache.current ? {
|
|
539
|
+
data: cache.current[index]
|
|
540
|
+
} : undefined;
|
|
541
|
+
const groupedBars = bars.filter(b => {
|
|
542
|
+
return xScaleType === 'Date' || xScaleType === 'dateString' ? b.key.getTime() === bar.key.getTime() : b.key === bar.key;
|
|
543
|
+
});
|
|
544
|
+
return /*#__PURE__*/React__default.createElement(Bar, _extends({
|
|
545
|
+
color: colorScale === null || colorScale === void 0 ? void 0 : colorScale(to.data.category),
|
|
546
|
+
data: to,
|
|
547
|
+
dataset: bars,
|
|
548
|
+
groupedData: groupedBars,
|
|
549
|
+
disableAnimations: disableAnimations,
|
|
550
|
+
gap: gap,
|
|
551
|
+
id: `id${id}__bar-${categoryIndex}.${index}`,
|
|
552
|
+
index: index,
|
|
553
|
+
isSelected: Boolean(isBarSelected(to)),
|
|
554
|
+
key: `bar _${categoryIndex}.${index}`,
|
|
555
|
+
labelDecorator: labelDecorator,
|
|
556
|
+
maxHeight: scaleY(bar.cumulativeValue - bar.value),
|
|
557
|
+
anchorProps: getBarAnchorProps ? getBarAnchorProps(to) : undefined,
|
|
558
|
+
onClick: onBarClick,
|
|
559
|
+
orientation: BarOrientation.vertical,
|
|
560
|
+
direction: direction,
|
|
561
|
+
previousData: from,
|
|
562
|
+
scale: scaleY,
|
|
563
|
+
scalePosition: scaleX,
|
|
564
|
+
tooltipVariant: tooltipVariant,
|
|
565
|
+
tooltipDecorator: tooltipDecorator
|
|
566
|
+
}, barProps, {
|
|
567
|
+
width: barProps !== null && barProps !== void 0 && barProps.width && typeof barProps.width === 'number' ? barProps.width : barWidth,
|
|
568
|
+
height: undefined,
|
|
569
|
+
role: barRole
|
|
570
|
+
}));
|
|
571
|
+
}));
|
|
572
|
+
});
|
|
573
|
+
BarChartBars.className = CLASSNAME$2;
|
|
574
|
+
BarChartBars.displayName = COMPONENT_NAME$2;
|
|
575
|
+
const BarChartGroupedTooltip = _ref => {
|
|
576
|
+
let {
|
|
577
|
+
dateFormatter,
|
|
578
|
+
categories,
|
|
579
|
+
categoryDecorator,
|
|
580
|
+
categoryColor,
|
|
581
|
+
datum,
|
|
582
|
+
groupedData
|
|
583
|
+
} = _ref;
|
|
584
|
+
return /*#__PURE__*/React__default.createElement(Flexbox, {
|
|
585
|
+
flexDirection: "column",
|
|
586
|
+
margin: "16px",
|
|
587
|
+
gap: "0"
|
|
588
|
+
}, /*#__PURE__*/React__default.createElement(Flexbox, {
|
|
589
|
+
flexDirection: "row",
|
|
590
|
+
gap: "8px"
|
|
591
|
+
}, /*#__PURE__*/React__default.createElement(Text, {
|
|
592
|
+
fontWeight: "400",
|
|
593
|
+
fontSize: "14px"
|
|
594
|
+
}, "Date:"), /*#__PURE__*/React__default.createElement(Text, {
|
|
595
|
+
fontWeight: "700",
|
|
596
|
+
fontSize: "14px"
|
|
597
|
+
}, dateFormatter(datum.data.key))), /*#__PURE__*/React__default.createElement("div", {
|
|
598
|
+
style: {
|
|
599
|
+
width: '100%',
|
|
600
|
+
height: '1px',
|
|
601
|
+
backgroundColor: '#858585',
|
|
602
|
+
margin: '8px 0'
|
|
603
|
+
}
|
|
604
|
+
}), /*#__PURE__*/React__default.createElement(Flexbox, {
|
|
605
|
+
flexDirection: "row",
|
|
606
|
+
gap: "8px"
|
|
607
|
+
}, /*#__PURE__*/React__default.createElement(Text, {
|
|
608
|
+
fontWeight: "400",
|
|
609
|
+
fontSize: "14px"
|
|
610
|
+
}, "Total:"), /*#__PURE__*/React__default.createElement(Text, {
|
|
611
|
+
fontWeight: "600",
|
|
612
|
+
fontSize: "14px"
|
|
613
|
+
}, groupedData === null || groupedData === void 0 ? void 0 : groupedData.reduce((acc, d) => acc + d.value, 0))), /*#__PURE__*/React__default.createElement(Flexbox, {
|
|
614
|
+
flexDirection: "column",
|
|
615
|
+
marginTop: "4px",
|
|
616
|
+
gap: "8px"
|
|
617
|
+
}, categories.map(category => {
|
|
618
|
+
var _groupedData$find;
|
|
619
|
+
const value = groupedData === null || groupedData === void 0 ? void 0 : (_groupedData$find = groupedData.find(d => d.category === category)) === null || _groupedData$find === void 0 ? void 0 : _groupedData$find.value;
|
|
620
|
+
const color = categoryColor(category);
|
|
621
|
+
return value ? /*#__PURE__*/React__default.createElement(Flexbox, {
|
|
622
|
+
key: category,
|
|
623
|
+
alignItems: "center",
|
|
624
|
+
gap: "8px"
|
|
625
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
626
|
+
style: {
|
|
627
|
+
width: '16px',
|
|
628
|
+
height: '16px',
|
|
629
|
+
backgroundColor: color
|
|
630
|
+
}
|
|
631
|
+
}), /*#__PURE__*/React__default.createElement(Text, {
|
|
632
|
+
fontWeight: "400",
|
|
633
|
+
fontSize: "14px",
|
|
634
|
+
lineHeight: "18px"
|
|
635
|
+
}, categoryDecorator ? categoryDecorator(category) : category), /*#__PURE__*/React__default.createElement(Text, {
|
|
636
|
+
fontWeight: "600",
|
|
637
|
+
fontSize: "14px",
|
|
638
|
+
lineHeight: "18px"
|
|
639
|
+
}, value)) : null;
|
|
640
|
+
})));
|
|
641
|
+
};
|
|
642
|
+
|
|
643
|
+
const _excluded$2 = ["barProps", "children", "className", "data", "direction", "disableAnimations", "id", "getBarAnchorProps", "isBarSelected", "labelDecorator", "legendDecorator", "legendVariant", "legendProps", "margins", "onBarClick", "size", "sortingMethod", "barRole", "colorTheme", "tooltipVariant", "tooltipDecorator", "xAxisVariant", "xAxisPlacement", "xAxisTickFormat", "xAxisTickPadding", "xAxisTickRotation", "xAxisTickSize", "xAxisTickValues", "xAxisMinValue", "xAxisMaxValue", "xAxisTickRemodelling", "xAxisStartDateOffset", "xAxisEndDateOffset", "yAxisVariant", "yAxisPlacement", "yAxisTickFormat", "yAxisTickPadding", "yAxisTickRotation", "yAxisTickSize", "yAxisTickValues", "yAxisMinValue", "yAxisMaxValue", "yAxisTickRemodelling", "xScaleType", "yScaleLogBase", "dateParser"],
|
|
644
|
+
_excluded2 = ["extraLegendItems"];
|
|
645
|
+
const COMPONENT_TYPES = {
|
|
646
|
+
AXES: 'Axis',
|
|
647
|
+
SECTIONS: 'BarChartSection',
|
|
648
|
+
BARS: 'BarChartBars',
|
|
649
|
+
LEGENDS: 'Legend'
|
|
650
|
+
};
|
|
651
|
+
const getComponentPosition = child => {
|
|
652
|
+
var _child$type;
|
|
653
|
+
if (! /*#__PURE__*/React__default.isValidElement(child)) return null;
|
|
654
|
+
const displayName = (_child$type = child.type) === null || _child$type === void 0 ? void 0 : _child$type.displayName;
|
|
655
|
+
if (COMPONENT_TYPES.AXES === displayName) return 'axes';
|
|
656
|
+
if (COMPONENT_TYPES.SECTIONS === displayName) return 'sections';
|
|
657
|
+
if (COMPONENT_TYPES.BARS === displayName) return 'bars';
|
|
658
|
+
if (COMPONENT_TYPES.LEGENDS === displayName) return 'legend';
|
|
659
|
+
return null;
|
|
660
|
+
};
|
|
661
|
+
const getKey = datum => Array.isArray(datum.key) ? datum.key[0] : datum.key;
|
|
662
|
+
const filterData = (hasCategory, data, filterFn) => {
|
|
663
|
+
if (hasCategory) {
|
|
664
|
+
return data.filter(filterFn);
|
|
665
|
+
}
|
|
666
|
+
return data.filter(filterFn);
|
|
667
|
+
};
|
|
668
|
+
const reduceData = (hasCategory, data, reduceFn, initialValue) => {
|
|
669
|
+
if (hasCategory) {
|
|
670
|
+
return data.reduce(reduceFn, initialValue);
|
|
671
|
+
}
|
|
672
|
+
return data.reduce(reduceFn, initialValue);
|
|
673
|
+
};
|
|
674
|
+
const isSameKey = (key, previousKey, xScaleType) => xScaleType === 'Date' || xScaleType === 'dateString' ? key.getTime() === previousKey.getTime() : key === previousKey;
|
|
675
|
+
const RenderedLinearBarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
676
|
+
var _chartDimensions$maxW, _chartDimensions$minW;
|
|
677
|
+
const {
|
|
678
|
+
barProps,
|
|
679
|
+
children,
|
|
680
|
+
className,
|
|
681
|
+
data: propsData,
|
|
682
|
+
direction = BarDirection.up,
|
|
683
|
+
disableAnimations,
|
|
684
|
+
id,
|
|
685
|
+
getBarAnchorProps,
|
|
686
|
+
isBarSelected,
|
|
687
|
+
labelDecorator,
|
|
688
|
+
legendDecorator,
|
|
689
|
+
legendVariant,
|
|
690
|
+
legendProps,
|
|
691
|
+
margins: propsMargins,
|
|
692
|
+
onBarClick,
|
|
693
|
+
size,
|
|
694
|
+
sortingMethod: propsSortingMethod,
|
|
695
|
+
barRole,
|
|
696
|
+
colorTheme,
|
|
697
|
+
tooltipVariant,
|
|
698
|
+
tooltipDecorator,
|
|
699
|
+
xAxisVariant: propsXAxisVariant,
|
|
700
|
+
xAxisPlacement,
|
|
701
|
+
xAxisTickFormat: propsXAxisTickFormat,
|
|
702
|
+
xAxisTickPadding,
|
|
703
|
+
xAxisTickRotation,
|
|
704
|
+
xAxisTickSize,
|
|
705
|
+
xAxisTickValues,
|
|
706
|
+
xAxisMinValue,
|
|
707
|
+
xAxisMaxValue,
|
|
708
|
+
xAxisTickRemodelling,
|
|
709
|
+
xAxisStartDateOffset = -1,
|
|
710
|
+
xAxisEndDateOffset = 1,
|
|
711
|
+
yAxisVariant: propsYAxisVariant,
|
|
712
|
+
yAxisPlacement,
|
|
713
|
+
yAxisTickFormat,
|
|
714
|
+
yAxisTickPadding,
|
|
715
|
+
yAxisTickRotation,
|
|
716
|
+
yAxisTickSize,
|
|
717
|
+
yAxisTickValues,
|
|
718
|
+
yAxisMinValue,
|
|
719
|
+
yAxisMaxValue,
|
|
720
|
+
yAxisTickRemodelling,
|
|
721
|
+
xScaleType: propsXScaleType,
|
|
722
|
+
yScaleLogBase,
|
|
723
|
+
dateParser
|
|
724
|
+
} = props,
|
|
725
|
+
forwardedProps = _objectWithoutProperties(props, _excluded$2);
|
|
726
|
+
const cache = useRef();
|
|
727
|
+
const theme = useTheme();
|
|
728
|
+
const format = useMessageFormatter(intlMessages);
|
|
729
|
+
const hasCategory = propsData[0] && Array.isArray(propsData[0].key) && propsData[0].key.length >= 2 && propsData[0].key[1] !== null && propsData[0].key[1] !== undefined;
|
|
730
|
+
const sections = useMemo(() => {
|
|
731
|
+
const sectionList = [];
|
|
732
|
+
React__default.Children.forEach(children, child => {
|
|
733
|
+
if (isComponent('BarChartSection')(child)) {
|
|
734
|
+
const categories = React__default.Children.toArray(child.props.children).filter(c => isComponent('BarChartBars')(c)).map(c => c.props.category);
|
|
735
|
+
sectionList.push(categories);
|
|
736
|
+
}
|
|
737
|
+
});
|
|
738
|
+
return sectionList;
|
|
739
|
+
}, [children]);
|
|
740
|
+
const hasSections = sections.length > 0;
|
|
741
|
+
const sortingMethod = hasSections ? sections.flat() : propsSortingMethod;
|
|
742
|
+
const xScaleType = propsXScaleType ? propsXScaleType : getKey(propsData[0]) instanceof Date ? 'Date' : typeof getKey(propsData[0]) === 'number' ? 'number' : typeof getKey(propsData[0]) === 'string' && isValidDate(getKey(propsData[0])) ? 'dateString' : undefined;
|
|
743
|
+
const data = xScaleType === 'number' ? filterData(hasCategory, propsData, datum => typeof getKey(datum) === 'number' && !Number.isNaN(getKey(datum))) : xScaleType === 'dateString' ? filterData(hasCategory, propsData, datum => isValidDate(getKey(datum))) : xScaleType === 'Date' ? filterData(hasCategory, propsData, datum => getKey(datum) instanceof Date) : propsData;
|
|
744
|
+
useEffect(() => {
|
|
745
|
+
cache.current = data;
|
|
746
|
+
});
|
|
747
|
+
const svgRef = useRef();
|
|
748
|
+
const xAxisVariant = propsXAxisVariant ? propsXAxisVariant : AxisVariant.tickValue;
|
|
749
|
+
const yAxisVariant = propsYAxisVariant ? propsYAxisVariant : AxisVariant.default;
|
|
750
|
+
const chartDimensions = sizeToDimension(size);
|
|
751
|
+
const width = Math.max(Math.min(chartDimensions.width, (_chartDimensions$maxW = chartDimensions.maxWidth) !== null && _chartDimensions$maxW !== void 0 ? _chartDimensions$maxW : Infinity), (_chartDimensions$minW = chartDimensions.minWidth) !== null && _chartDimensions$minW !== void 0 ? _chartDimensions$minW : -Infinity);
|
|
752
|
+
const height = chartDimensions.height;
|
|
753
|
+
const margins = _objectSpread2({
|
|
754
|
+
top: xAxisVariant === AxisVariant.default || xAxisVariant === AxisVariant.tickValue ? 24 : 8,
|
|
755
|
+
left: yAxisVariant === AxisVariant.default || yAxisVariant === AxisVariant.tickValue ? 48 : 8,
|
|
756
|
+
right: yAxisVariant === AxisVariant.default || yAxisVariant === AxisVariant.tickValue ? 48 : 8,
|
|
757
|
+
bottom: xAxisVariant === AxisVariant.default || xAxisVariant === AxisVariant.tickValue ? 24 : 8
|
|
758
|
+
}, propsMargins);
|
|
759
|
+
const chartHeight = height - margins.top - margins.bottom;
|
|
760
|
+
const chartWidth = width - margins.left - margins.right;
|
|
761
|
+
const numberOfBars = filterData(hasCategory, data, datum => datum.value).length;
|
|
762
|
+
const gap = 5;
|
|
763
|
+
let barWidth = chartWidth / (numberOfBars * 2) - gap;
|
|
764
|
+
const scaleX = (() => {
|
|
765
|
+
if (xScaleType === 'number') {
|
|
766
|
+
var _ref, _ref2;
|
|
767
|
+
const domain = extent(data, d => getKey(d));
|
|
768
|
+
domain[0] = (_ref = xAxisMinValue) !== null && _ref !== void 0 ? _ref : domain[0];
|
|
769
|
+
domain[1] = (_ref2 = xAxisMaxValue) !== null && _ref2 !== void 0 ? _ref2 : domain[1];
|
|
770
|
+
const gap = domain[1] - domain[0];
|
|
771
|
+
domain[0] -= gap * 0.1;
|
|
772
|
+
domain[1] += gap * 0.1;
|
|
773
|
+
return scaleLinear().domain(domain).range([0, chartWidth]).nice();
|
|
774
|
+
} else if (xScaleType === 'dateString' || xScaleType === 'Date') {
|
|
775
|
+
var _ref3, _ref4;
|
|
776
|
+
const domain = xScaleType === 'dateString' ? extent(data, d => Date.parse(getKey(d))) : extent(data, d => getKey(d).valueOf());
|
|
777
|
+
domain[0] = (_ref3 = xAxisMinValue) !== null && _ref3 !== void 0 ? _ref3 : domain[0];
|
|
778
|
+
domain[1] = (_ref4 = xAxisMaxValue) !== null && _ref4 !== void 0 ? _ref4 : domain[1];
|
|
779
|
+
const startDate = xAxisTickValues && typeof xAxisTickValues === 'function' && typeof xAxisTickValues.offset === 'function' ? xAxisTickValues.offset(new Date(domain[0]), xAxisStartDateOffset) : new Date(domain[0]);
|
|
780
|
+
const endDate = xAxisTickValues && typeof xAxisTickValues === 'function' && typeof xAxisTickValues.offset === 'function' ? xAxisTickValues.offset(new Date(domain[1]), xAxisEndDateOffset) : new Date(domain[1]);
|
|
781
|
+
return barProps !== null && barProps !== void 0 && barProps.width && typeof barProps.width === 'number' ? scaleUtc().domain([startDate, endDate]).range([barProps.width / 2 + 10, chartWidth - (barProps.width / 2 + 5)]) : scaleUtc().domain([startDate, endDate]).range([barWidth, chartWidth - barWidth]).nice();
|
|
782
|
+
} else {
|
|
783
|
+
var _ref5, _ref6;
|
|
784
|
+
const domain = xAxisTickValues && Array.isArray(xAxisTickValues) ? xAxisTickValues : data.map(d => getKey(d));
|
|
785
|
+
domain[0] = (_ref5 = xAxisMinValue) !== null && _ref5 !== void 0 ? _ref5 : domain[0];
|
|
786
|
+
domain[1] = (_ref6 = xAxisMaxValue) !== null && _ref6 !== void 0 ? _ref6 : domain[1];
|
|
787
|
+
return scalePoint().domain(domain).range([0, chartWidth]);
|
|
788
|
+
}
|
|
789
|
+
})();
|
|
790
|
+
const xAxisTickFormat = propsXAxisTickFormat !== null && propsXAxisTickFormat !== void 0 ? propsXAxisTickFormat : xScaleType === 'Date' || xScaleType === 'dateString' ? scaleX.tickFormat() : undefined;
|
|
791
|
+
const statsByCategory = statsBy(data, sortingMethod);
|
|
792
|
+
const colorScale = useColor({
|
|
793
|
+
data: statsByCategory,
|
|
794
|
+
colorTheme: colorTheme,
|
|
795
|
+
category: d => d.key,
|
|
796
|
+
theme
|
|
797
|
+
});
|
|
798
|
+
const bars = reduceData(hasCategory, filterData(hasCategory, data.sort((a, b) => {
|
|
799
|
+
const currentKeyA = hasCategory ? a.key[0] : a.key;
|
|
800
|
+
const currentKeyB = hasCategory ? b.key[0] : b.key;
|
|
801
|
+
if (xScaleType === 'number') {
|
|
802
|
+
if (currentKeyA < currentKeyB) return -1;
|
|
803
|
+
if (currentKeyA > currentKeyB) return 1;
|
|
804
|
+
} else if (xScaleType === 'dateString') {
|
|
805
|
+
if (Date.parse(currentKeyA) < Date.parse(currentKeyB)) return -1;
|
|
806
|
+
if (Date.parse(currentKeyA) > Date.parse(currentKeyB)) return 1;
|
|
807
|
+
} else if (xScaleType === 'Date') {
|
|
808
|
+
if (currentKeyA.valueOf() < currentKeyB.valueOf()) return -1;
|
|
809
|
+
if (currentKeyA.valueOf() > currentKeyB.valueOf()) return 1;
|
|
810
|
+
} else if (xScaleType === 'string' && xAxisTickValues && Array.isArray(xAxisTickValues)) {
|
|
811
|
+
if (xAxisTickValues.indexOf(currentKeyA) < xAxisTickValues.indexOf(currentKeyB)) return -1;
|
|
812
|
+
if (xAxisTickValues.indexOf(currentKeyA) > xAxisTickValues.indexOf(currentKeyB)) return 1;
|
|
813
|
+
}
|
|
814
|
+
return hasCategory ? getSortingMethod(sortingMethod !== null && sortingMethod !== void 0 ? sortingMethod : 'asc-key')({
|
|
815
|
+
key: a.key[1],
|
|
816
|
+
value: a.value
|
|
817
|
+
}, {
|
|
818
|
+
key: b.key[1],
|
|
819
|
+
value: b.value
|
|
820
|
+
}) : 0;
|
|
821
|
+
}), d => d.value !== null), (previousValue, currentValue, currentIndex) => {
|
|
822
|
+
var _key$;
|
|
823
|
+
const currentKeyD = hasCategory ? currentValue.key[0] : currentValue.key;
|
|
824
|
+
const formattedKeyD = xScaleType === 'dateString' ? dateParser ? dateParser(currentKeyD) : utcParse('%Y-%m-%d')(currentKeyD) : currentKeyD;
|
|
825
|
+
const category = hasCategory ? (_key$ = currentValue.key[1]) !== null && _key$ !== void 0 ? _key$ : 'default' : 'default';
|
|
826
|
+
const isSameSection = !hasSections ? true : (() => {
|
|
827
|
+
var _previousValue;
|
|
828
|
+
const findSectionIndex = cat => sections.findIndex(section => section.includes(cat));
|
|
829
|
+
const currentSection = findSectionIndex(category);
|
|
830
|
+
const prevSection = findSectionIndex((_previousValue = previousValue[currentIndex - 1]) === null || _previousValue === void 0 ? void 0 : _previousValue.category);
|
|
831
|
+
return currentSection !== -1 && currentSection === prevSection;
|
|
832
|
+
})();
|
|
833
|
+
previousValue.push({
|
|
834
|
+
category,
|
|
835
|
+
key: formattedKeyD,
|
|
836
|
+
value: currentValue.value,
|
|
837
|
+
cumulativeValue: currentValue.value
|
|
838
|
+
});
|
|
839
|
+
if (hasCategory && currentIndex > 0 && isSameKey(formattedKeyD, previousValue[currentIndex - 1].key, xScaleType) && isSameSection) {
|
|
840
|
+
previousValue[currentIndex].cumulativeValue = previousValue[currentIndex].cumulativeValue + previousValue[currentIndex - 1].cumulativeValue;
|
|
841
|
+
}
|
|
842
|
+
return previousValue;
|
|
843
|
+
}, []).filter(bar => yScaleLogBase === undefined || bar.cumulativeValue !== 0);
|
|
844
|
+
const getScaleY = function (direction) {
|
|
845
|
+
var _ref7, _ref8;
|
|
846
|
+
let from = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
847
|
+
let to = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
848
|
+
let categories = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ['default'];
|
|
849
|
+
let hasSectionTitle = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
850
|
+
const domain = extent(bars.filter(bar => categories.includes(bar.category)), d => d.cumulativeValue);
|
|
851
|
+
domain[0] = (_ref7 = yAxisMinValue) !== null && _ref7 !== void 0 ? _ref7 : domain[0];
|
|
852
|
+
domain[1] = (_ref8 = yAxisMaxValue) !== null && _ref8 !== void 0 ? _ref8 : domain[1] * (hasSectionTitle ? 1.2 : 1);
|
|
853
|
+
if (domain[1] === 0 && domain[0] === 0) {
|
|
854
|
+
domain[1] = 1;
|
|
855
|
+
}
|
|
856
|
+
return (yScaleLogBase ? scaleLog().clamp(true).base(yScaleLogBase) : scaleLinear()).domain(domain).range(direction === 'down' ? [0, chartHeight * to - chartHeight * from] : [chartHeight * to - chartHeight * from, 0]).nice();
|
|
857
|
+
};
|
|
858
|
+
if (xScaleType) {
|
|
859
|
+
const minimalGap = Math.min(...bars.map((bar, i) => i > 0 ? Math.abs(bar.key - bars[i - 1].key) : undefined).filter(k => k)) * 0.9;
|
|
860
|
+
barWidth = Math.min(barWidth, chartWidth / ((scaleX.domain()[1] - scaleX.domain()[0]) / minimalGap), chartWidth / (xAxisTickValues && typeof xAxisTickValues !== 'string' ? typeof xAxisTickValues === 'number' ? xAxisTickValues : Array.isArray(xAxisTickValues) ? xAxisTickValues.length : xAxisTickValues.range(scaleX.domain()[0], scaleX.domain()[1]).length : 1));
|
|
861
|
+
}
|
|
862
|
+
const categories = sortingMethod && Array.isArray(sortingMethod) ? sortingMethod : [];
|
|
863
|
+
const pivotedTable = bars.reduce((acc, item) => {
|
|
864
|
+
const {
|
|
865
|
+
key,
|
|
866
|
+
category,
|
|
867
|
+
value
|
|
868
|
+
} = item;
|
|
869
|
+
if (!categories.includes(category)) {
|
|
870
|
+
categories.push(category);
|
|
871
|
+
}
|
|
872
|
+
const formattedKey = xAxisTickFormat ? xAxisTickFormat(key) : key.toString();
|
|
873
|
+
let entry = acc.find(e => e.key === formattedKey);
|
|
874
|
+
if (!entry) {
|
|
875
|
+
entry = {
|
|
876
|
+
key: formattedKey
|
|
877
|
+
};
|
|
878
|
+
acc.push(entry);
|
|
879
|
+
}
|
|
880
|
+
entry[category] = value;
|
|
881
|
+
return acc;
|
|
882
|
+
}, []);
|
|
883
|
+
const scaleY = getScaleY(direction, 0, 1, categories);
|
|
884
|
+
const _ref9 = legendProps || {},
|
|
885
|
+
{
|
|
886
|
+
extraLegendItems
|
|
887
|
+
} = _ref9,
|
|
888
|
+
forwardedLegendProps = _objectWithoutProperties(_ref9, _excluded2);
|
|
889
|
+
const {
|
|
890
|
+
axisComponents,
|
|
891
|
+
sectionComponents,
|
|
892
|
+
barsComponents,
|
|
893
|
+
legendComponents,
|
|
894
|
+
titleComponent,
|
|
895
|
+
descriptionComponent,
|
|
896
|
+
multipleScaleY
|
|
897
|
+
} = useMemo(() => {
|
|
898
|
+
const axisComponents = [];
|
|
899
|
+
const sectionComponents = [];
|
|
900
|
+
const barsComponents = [];
|
|
901
|
+
const legendComponents = [];
|
|
902
|
+
let titleComponent;
|
|
903
|
+
let descriptionComponent;
|
|
904
|
+
const multipleScaleY = [];
|
|
905
|
+
React__default.Children.forEach(children, (child, index) => {
|
|
906
|
+
const position = getComponentPosition(child);
|
|
907
|
+
if (isComponent('ChartContainerTitle')(child)) {
|
|
908
|
+
titleComponent = child;
|
|
909
|
+
}
|
|
910
|
+
if (isComponent('ChartContainerDescription')(child)) {
|
|
911
|
+
descriptionComponent = child;
|
|
912
|
+
}
|
|
913
|
+
if (!position || ! /*#__PURE__*/React__default.isValidElement(child)) return;
|
|
914
|
+
let enhancedChild = child;
|
|
915
|
+
if (isComponent('BarChartSection')(child)) {
|
|
916
|
+
const categories = React__default.Children.toArray(child.props.children).filter(c => isComponent('BarChartBars')(c)).map(c => c.props.category);
|
|
917
|
+
const scaleY = getScaleY(child.props.direction || 'up', child.props.from, child.props.to, categories, child.props.title !== '');
|
|
918
|
+
multipleScaleY.push(scaleY);
|
|
919
|
+
enhancedChild = /*#__PURE__*/React__default.cloneElement(child, _objectSpread2({
|
|
920
|
+
scaleX: scaleX,
|
|
921
|
+
scaleY: scaleY,
|
|
922
|
+
key: child.key || `section-${child.props.from}-${child.props.to}-${categories.join('-')}`
|
|
923
|
+
}, child.props));
|
|
924
|
+
}
|
|
925
|
+
if (isComponent('Axis')(child)) {
|
|
926
|
+
var _ref10;
|
|
927
|
+
const isX = getAxisType(child.props.position) === 'x';
|
|
928
|
+
enhancedChild = /*#__PURE__*/React__default.cloneElement(child, _objectSpread2({
|
|
929
|
+
key: child.key || `axis-${child.props.position}-${index}`,
|
|
930
|
+
chartWidth,
|
|
931
|
+
chartHeight,
|
|
932
|
+
scale: isX ? scaleX : scaleY,
|
|
933
|
+
x: child.props.position === 'right' ? chartWidth : 0,
|
|
934
|
+
y: child.props.position === 'bottom' ? chartHeight : child.props.position === 'top' ? 0 : chartHeight,
|
|
935
|
+
disableAnimations,
|
|
936
|
+
length: isX ? chartWidth : chartHeight,
|
|
937
|
+
tickValues: (_ref10 = isX ? xAxisTickValues : yAxisTickValues) !== null && _ref10 !== void 0 ? _ref10 : 8,
|
|
938
|
+
tickPadding: isX ? xAxisTickPadding : yAxisTickPadding,
|
|
939
|
+
tickRotation: isX ? xAxisTickRotation : yAxisTickRotation,
|
|
940
|
+
tickSize: isX ? xAxisTickSize : yAxisTickSize,
|
|
941
|
+
tickFormat: isX ? xAxisTickFormat : yAxisTickFormat,
|
|
942
|
+
tickRemodelling: isX ? xAxisTickRemodelling : yAxisTickRemodelling,
|
|
943
|
+
variant: isX ? xAxisVariant : yAxisVariant
|
|
944
|
+
}, child.props));
|
|
945
|
+
}
|
|
946
|
+
if (isComponent('Legend')(child)) {
|
|
947
|
+
enhancedChild = /*#__PURE__*/React__default.cloneElement(child, _objectSpread2({
|
|
948
|
+
key: child.key || `legend-${index}`,
|
|
949
|
+
data: (extraLegendItems ? mergeLegends(extraLegendItems, statsByCategory).sort(getSortingMethod(sortingMethod)) : statsByCategory).map(d => _objectSpread2(_objectSpread2({}, d), {}, {
|
|
950
|
+
color: colorScale === null || colorScale === void 0 ? void 0 : colorScale(d.key)
|
|
951
|
+
}))
|
|
952
|
+
}, child.props));
|
|
953
|
+
}
|
|
954
|
+
switch (position) {
|
|
955
|
+
case 'axes':
|
|
956
|
+
axisComponents.push(enhancedChild);
|
|
957
|
+
break;
|
|
958
|
+
case 'sections':
|
|
959
|
+
sectionComponents.push(enhancedChild);
|
|
960
|
+
break;
|
|
961
|
+
case 'bars':
|
|
962
|
+
barsComponents.push(enhancedChild);
|
|
963
|
+
break;
|
|
964
|
+
case 'legend':
|
|
965
|
+
legendComponents.push(enhancedChild);
|
|
966
|
+
break;
|
|
967
|
+
}
|
|
968
|
+
});
|
|
969
|
+
return {
|
|
970
|
+
axisComponents,
|
|
971
|
+
sectionComponents,
|
|
972
|
+
barsComponents,
|
|
973
|
+
legendComponents,
|
|
974
|
+
titleComponent,
|
|
975
|
+
descriptionComponent,
|
|
976
|
+
multipleScaleY
|
|
977
|
+
};
|
|
978
|
+
}, [children]);
|
|
979
|
+
return /*#__PURE__*/React__default.createElement(ChartTypeContext.Provider, {
|
|
980
|
+
value: "bar"
|
|
981
|
+
}, /*#__PURE__*/React__default.createElement(BarChartContext.Provider, {
|
|
982
|
+
value: {
|
|
983
|
+
barProps,
|
|
984
|
+
barRole,
|
|
985
|
+
bars: bars,
|
|
986
|
+
barWidth,
|
|
987
|
+
cache,
|
|
988
|
+
categories,
|
|
989
|
+
chartHeight,
|
|
990
|
+
chartWidth,
|
|
991
|
+
colorScale,
|
|
992
|
+
direction,
|
|
993
|
+
disableAnimations,
|
|
994
|
+
format,
|
|
995
|
+
gap,
|
|
996
|
+
getBarAnchorProps,
|
|
997
|
+
hasCategory,
|
|
998
|
+
id,
|
|
999
|
+
isBarSelected,
|
|
1000
|
+
labelDecorator,
|
|
1001
|
+
margins,
|
|
1002
|
+
onBarClick,
|
|
1003
|
+
scaleX,
|
|
1004
|
+
scaleY,
|
|
1005
|
+
tooltipVariant,
|
|
1006
|
+
tooltipDecorator,
|
|
1007
|
+
xAxisTickFormat,
|
|
1008
|
+
xAxisTickPadding,
|
|
1009
|
+
xAxisTickRemodelling,
|
|
1010
|
+
xAxisTickRotation,
|
|
1011
|
+
xAxisTickSize,
|
|
1012
|
+
xAxisTickValues,
|
|
1013
|
+
xAxisVariant,
|
|
1014
|
+
xScaleType,
|
|
1015
|
+
yAxisTickValues,
|
|
1016
|
+
yAxisTickPadding,
|
|
1017
|
+
yAxisTickRotation,
|
|
1018
|
+
yAxisTickSize,
|
|
1019
|
+
yAxisTickFormat,
|
|
1020
|
+
yAxisTickRemodelling,
|
|
1021
|
+
yAxisVariant
|
|
1022
|
+
}
|
|
1023
|
+
}, /*#__PURE__*/React__default.createElement(StyledBarChart, _extends({
|
|
1024
|
+
mode: typeof onBarClick === 'function' || typeof getBarAnchorProps === 'function' ? 'interactive' : 'static',
|
|
1025
|
+
definition: hasCategory ? format('definition-linear-with-categories', {
|
|
1026
|
+
categoryLength: categories.length,
|
|
1027
|
+
barLength: bars.length
|
|
1028
|
+
}) : format('definition-linear', {
|
|
1029
|
+
barLength: bars.length
|
|
1030
|
+
}),
|
|
1031
|
+
xAxisDefinition: format(`x-axis-${xScaleType === 'number' ? 'numbers' : 'dates'}-definition`, {
|
|
1032
|
+
numAxis: xAxisPlacement === 'both' ? 2 : 1,
|
|
1033
|
+
start: xAxisTickFormat ? xAxisTickFormat(scaleX.domain()[0]) : scaleX.domain()[0],
|
|
1034
|
+
end: xAxisTickFormat ? xAxisTickFormat(scaleX.domain()[1]) : scaleX.domain()[1]
|
|
1035
|
+
}),
|
|
1036
|
+
yAxisDefinition: multipleScaleY.length > 0 ? multipleScaleY.map(scale => format('y-axis-numbers-definition', {
|
|
1037
|
+
numAxis: yAxisPlacement === 'both' ? 2 : 1,
|
|
1038
|
+
start: scale.domain()[0],
|
|
1039
|
+
end: scale.domain()[1]
|
|
1040
|
+
})).join(' ') : format('y-axis-numbers-definition', {
|
|
1041
|
+
numAxis: yAxisPlacement === 'both' ? 2 : 1,
|
|
1042
|
+
start: scaleY.domain()[0],
|
|
1043
|
+
end: scaleY.domain()[1]
|
|
1044
|
+
}),
|
|
1045
|
+
dataTableRepresentation: hasCategory ? {
|
|
1046
|
+
header: /*#__PURE__*/React__default.createElement("thead", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("th", {
|
|
1047
|
+
scope: "col"
|
|
1048
|
+
}, xScaleType === 'Date' || xScaleType === 'dateString' ? 'Date' : 'Key'), categories.map(category => /*#__PURE__*/React__default.createElement("th", {
|
|
1049
|
+
key: category,
|
|
1050
|
+
scope: "col"
|
|
1051
|
+
}, category)))),
|
|
1052
|
+
body: /*#__PURE__*/React__default.createElement("tbody", null, pivotedTable.map(row => /*#__PURE__*/React__default.createElement("tr", {
|
|
1053
|
+
key: row.key
|
|
1054
|
+
}, /*#__PURE__*/React__default.createElement("th", {
|
|
1055
|
+
scope: "row"
|
|
1056
|
+
}, row.key), categories.map(category => /*#__PURE__*/React__default.createElement("th", {
|
|
1057
|
+
key: `${row.key}-${category}-${row[category]}`,
|
|
1058
|
+
scope: "col"
|
|
1059
|
+
}, row[category])))))
|
|
1060
|
+
} : {
|
|
1061
|
+
header: /*#__PURE__*/React__default.createElement("thead", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("th", {
|
|
1062
|
+
scope: "col"
|
|
1063
|
+
}, xScaleType === 'Date' || xScaleType === 'dateString' ? 'Date' : 'Key'), /*#__PURE__*/React__default.createElement("th", {
|
|
1064
|
+
scope: "col"
|
|
1065
|
+
}, "Value"))),
|
|
1066
|
+
body: /*#__PURE__*/React__default.createElement("tbody", null, bars.map(datum => {
|
|
1067
|
+
const key = xAxisTickFormat ? xAxisTickFormat(datum.key) : datum.key.toString();
|
|
1068
|
+
return /*#__PURE__*/React__default.createElement("tr", {
|
|
1069
|
+
key: key
|
|
1070
|
+
}, /*#__PURE__*/React__default.createElement("th", {
|
|
1071
|
+
scope: "row"
|
|
1072
|
+
}, key), /*#__PURE__*/React__default.createElement("td", null, datum.value));
|
|
1073
|
+
}))
|
|
1074
|
+
},
|
|
1075
|
+
title: titleComponent,
|
|
1076
|
+
description: descriptionComponent
|
|
1077
|
+
}, forwardedProps, {
|
|
1078
|
+
id: id,
|
|
1079
|
+
className: className,
|
|
1080
|
+
ref: ref
|
|
1081
|
+
}), /*#__PURE__*/React__default.createElement(Flexbox, {
|
|
1082
|
+
flexDirection: "column",
|
|
1083
|
+
alignItems: "center",
|
|
1084
|
+
gap: "8"
|
|
1085
|
+
}, /*#__PURE__*/React__default.createElement("svg", {
|
|
1086
|
+
ref: svgRef,
|
|
1087
|
+
width: width,
|
|
1088
|
+
height: height,
|
|
1089
|
+
"aria-label": typeof onBarClick === 'function' || typeof getBarAnchorProps === 'function' ? format('interactive-chart') : format('static-chart'),
|
|
1090
|
+
"aria-hidden": "false"
|
|
1091
|
+
}, axisComponents.length === 0 && sectionComponents.length === 0 ? /*#__PURE__*/React__default.createElement("g", {
|
|
1092
|
+
transform: `translate(${margins.left},${margins.top})`,
|
|
1093
|
+
"aria-hidden": "true"
|
|
1094
|
+
}, ['bottom', 'both'].includes(xAxisPlacement) ? /*#__PURE__*/React__default.createElement(Axis, {
|
|
1095
|
+
disableAnimations: disableAnimations,
|
|
1096
|
+
position: "bottom",
|
|
1097
|
+
length: chartWidth,
|
|
1098
|
+
scale: scaleX,
|
|
1099
|
+
x: 0,
|
|
1100
|
+
y: chartHeight,
|
|
1101
|
+
tickValues: xAxisTickValues !== null && xAxisTickValues !== void 0 ? xAxisTickValues : 8,
|
|
1102
|
+
tickPadding: xAxisTickPadding,
|
|
1103
|
+
tickRotation: xAxisTickRotation,
|
|
1104
|
+
tickSize: xAxisTickSize,
|
|
1105
|
+
tickFormat: xAxisTickFormat,
|
|
1106
|
+
tickRemodelling: xAxisTickRemodelling,
|
|
1107
|
+
variant: xAxisVariant
|
|
1108
|
+
}) : null, ['top', 'both'].includes(xAxisPlacement) ? /*#__PURE__*/React__default.createElement(Axis, {
|
|
1109
|
+
disableAnimations: disableAnimations,
|
|
1110
|
+
position: "top",
|
|
1111
|
+
length: chartWidth,
|
|
1112
|
+
scale: scaleX,
|
|
1113
|
+
x: 0,
|
|
1114
|
+
y: 0,
|
|
1115
|
+
tickValues: xAxisTickValues !== null && xAxisTickValues !== void 0 ? xAxisTickValues : 8,
|
|
1116
|
+
tickPadding: xAxisTickPadding,
|
|
1117
|
+
tickRotation: xAxisTickRotation,
|
|
1118
|
+
tickSize: xAxisTickSize,
|
|
1119
|
+
tickFormat: xAxisTickFormat,
|
|
1120
|
+
tickRemodelling: xAxisTickRemodelling,
|
|
1121
|
+
variant: xAxisVariant
|
|
1122
|
+
}) : null, ['left', 'both'].includes(yAxisPlacement) ? /*#__PURE__*/React__default.createElement(Axis, {
|
|
1123
|
+
disableAnimations: disableAnimations,
|
|
1124
|
+
position: "left",
|
|
1125
|
+
length: chartHeight,
|
|
1126
|
+
scale: scaleY,
|
|
1127
|
+
x: 0,
|
|
1128
|
+
y: chartHeight,
|
|
1129
|
+
tickValues: yAxisTickValues !== null && yAxisTickValues !== void 0 ? yAxisTickValues : 8,
|
|
1130
|
+
tickPadding: yAxisTickPadding,
|
|
1131
|
+
tickRotation: yAxisTickRotation,
|
|
1132
|
+
tickSize: yAxisTickSize,
|
|
1133
|
+
tickFormat: yAxisTickFormat,
|
|
1134
|
+
tickRemodelling: yAxisTickRemodelling,
|
|
1135
|
+
variant: yAxisVariant
|
|
1136
|
+
}) : null, ['right', 'both'].includes(yAxisPlacement) ? /*#__PURE__*/React__default.createElement(Axis, {
|
|
1137
|
+
disableAnimations: disableAnimations,
|
|
1138
|
+
position: "right",
|
|
1139
|
+
length: chartHeight,
|
|
1140
|
+
scale: scaleY,
|
|
1141
|
+
x: chartWidth,
|
|
1142
|
+
y: chartHeight,
|
|
1143
|
+
tickValues: yAxisTickValues !== null && yAxisTickValues !== void 0 ? yAxisTickValues : 8,
|
|
1144
|
+
tickPadding: yAxisTickPadding,
|
|
1145
|
+
tickRotation: yAxisTickRotation,
|
|
1146
|
+
tickSize: yAxisTickSize,
|
|
1147
|
+
tickFormat: yAxisTickFormat,
|
|
1148
|
+
tickRemodelling: yAxisTickRemodelling,
|
|
1149
|
+
variant: yAxisVariant
|
|
1150
|
+
}) : null) : /*#__PURE__*/React__default.createElement("g", {
|
|
1151
|
+
transform: `translate(${margins.left},${margins.top})`,
|
|
1152
|
+
"aria-hidden": "true"
|
|
1153
|
+
}, axisComponents), sectionComponents, barsComponents.length === 0 && sectionComponents.length === 0 ? /*#__PURE__*/React__default.createElement("g", {
|
|
1154
|
+
transform: `translate(${margins.left},${margins.top})`,
|
|
1155
|
+
"aria-hidden": "true"
|
|
1156
|
+
}, (hasSections ? sections : [categories]).map(section => section.map(category => /*#__PURE__*/React__default.createElement(BarChartBars, {
|
|
1157
|
+
key: category,
|
|
1158
|
+
category: category
|
|
1159
|
+
}))), ' ') : /*#__PURE__*/React__default.createElement("g", {
|
|
1160
|
+
transform: `translate(${margins.left},${margins.top})`,
|
|
1161
|
+
"aria-hidden": "true"
|
|
1162
|
+
}, barsComponents))), legendComponents.length === 0 && hasCategory && legendVariant !== BarChartLegendVariant.none ? /*#__PURE__*/React__default.createElement(Legend, _extends({
|
|
1163
|
+
data: (extraLegendItems ? mergeLegends(extraLegendItems, statsByCategory).sort(getSortingMethod(sortingMethod)) : statsByCategory).map(d => _objectSpread2(_objectSpread2({}, d), {}, {
|
|
1164
|
+
color: colorScale === null || colorScale === void 0 ? void 0 : colorScale(d.key)
|
|
1165
|
+
})),
|
|
1166
|
+
variant: legendVariant === BarChartLegendVariant.externalLabelValue ? LegendVariant.value : legendVariant === BarChartLegendVariant.externalLabelPercent ? LegendVariant.percent : legendVariant === BarChartLegendVariant.externalLabel ? LegendVariant.label : LegendVariant.custom,
|
|
1167
|
+
legendDecorator: legendDecorator ? (datum, props) => legendDecorator(datum, props) : undefined
|
|
1168
|
+
}, forwardedLegendProps)) : legendComponents)));
|
|
1169
|
+
});
|
|
1170
|
+
|
|
1171
|
+
const _excluded$1 = ["className", "from", "to", "color", "title", "titlePosition", "scaleX", "scaleY", "children", "direction"];
|
|
1172
|
+
const COMPONENT_NAME$1 = 'BarChartSection';
|
|
1173
|
+
const CLASSNAME$1 = 'redsift-barchart-section';
|
|
1174
|
+
const BarChartSection = /*#__PURE__*/forwardRef((props, ref) => {
|
|
1175
|
+
const {
|
|
1176
|
+
className,
|
|
1177
|
+
from = 0,
|
|
1178
|
+
to = 1,
|
|
1179
|
+
color,
|
|
1180
|
+
title,
|
|
1181
|
+
titlePosition = 'center',
|
|
1182
|
+
scaleX,
|
|
1183
|
+
scaleY,
|
|
1184
|
+
children: propsChildren,
|
|
1185
|
+
direction
|
|
1186
|
+
} = props,
|
|
1187
|
+
forwardedProps = _objectWithoutProperties(props, _excluded$1);
|
|
1188
|
+
const {
|
|
1189
|
+
textColor,
|
|
1190
|
+
backgroundColor
|
|
1191
|
+
} = useMemo(() => {
|
|
1192
|
+
if (color === 'green') {
|
|
1193
|
+
return {
|
|
1194
|
+
textColor: RedsiftColorGreenD1,
|
|
1195
|
+
backgroundColor: '#F7FBF9'
|
|
1196
|
+
};
|
|
1197
|
+
} else if (color === 'red') {
|
|
1198
|
+
return {
|
|
1199
|
+
textColor: RedsiftColorRedD1,
|
|
1200
|
+
backgroundColor: '#FFF7F7'
|
|
1201
|
+
};
|
|
1202
|
+
} else if (color === undefined) {
|
|
1203
|
+
return {
|
|
1204
|
+
textColor: RedsiftColorNeutralBlack,
|
|
1205
|
+
backgroundColor: undefined
|
|
1206
|
+
};
|
|
1207
|
+
}
|
|
1208
|
+
return color;
|
|
1209
|
+
}, [color]);
|
|
1210
|
+
const theme = useTheme();
|
|
1211
|
+
const context = useBarChartContext();
|
|
1212
|
+
const {
|
|
1213
|
+
chartHeight,
|
|
1214
|
+
chartWidth,
|
|
1215
|
+
margins,
|
|
1216
|
+
disableAnimations,
|
|
1217
|
+
xAxisTickValues,
|
|
1218
|
+
xAxisTickPadding,
|
|
1219
|
+
xAxisTickRotation,
|
|
1220
|
+
xAxisTickSize,
|
|
1221
|
+
xAxisTickFormat,
|
|
1222
|
+
xAxisTickRemodelling,
|
|
1223
|
+
xAxisVariant,
|
|
1224
|
+
yAxisTickValues,
|
|
1225
|
+
yAxisTickPadding,
|
|
1226
|
+
yAxisTickRotation,
|
|
1227
|
+
yAxisTickSize,
|
|
1228
|
+
yAxisTickFormat,
|
|
1229
|
+
yAxisTickRemodelling,
|
|
1230
|
+
yAxisVariant
|
|
1231
|
+
} = context;
|
|
1232
|
+
const sectionHeight = Math.max(0, Math.min(1, to - from)) * chartHeight;
|
|
1233
|
+
const sectionY = Math.max(0, Math.min(1, from)) * chartHeight;
|
|
1234
|
+
const titleX = titlePosition === 'center' ? chartWidth / 2 : titlePosition === 'right' ? chartWidth - 10 : 10;
|
|
1235
|
+
const titleAnchor = titlePosition === 'center' ? 'middle' : titlePosition === 'right' ? 'end' : 'start';
|
|
1236
|
+
const children = useMemo(() => {
|
|
1237
|
+
const renderedChildren = [];
|
|
1238
|
+
React__default.Children.forEach(propsChildren, child => {
|
|
1239
|
+
if (! /*#__PURE__*/React__default.isValidElement(child)) return;
|
|
1240
|
+
const isX = getAxisType(child.props.position) === 'x';
|
|
1241
|
+
let enhancedChild = child;
|
|
1242
|
+
if (isComponent('Axis')(child)) {
|
|
1243
|
+
var _ref;
|
|
1244
|
+
enhancedChild = /*#__PURE__*/React__default.cloneElement(child, _objectSpread2({
|
|
1245
|
+
key: child.key || `axis-${child.props.position}`,
|
|
1246
|
+
chartWidth,
|
|
1247
|
+
chartHeight,
|
|
1248
|
+
sectionHeight,
|
|
1249
|
+
scale: isX ? scaleX : scaleY,
|
|
1250
|
+
x: child.props.position === 'right' ? chartWidth : 0,
|
|
1251
|
+
y: child.props.position === 'bottom' ? sectionHeight : child.props.position === 'top' ? 0 : sectionHeight,
|
|
1252
|
+
disableAnimations,
|
|
1253
|
+
length: isX ? chartWidth : sectionHeight,
|
|
1254
|
+
tickValues: (_ref = isX ? xAxisTickValues : yAxisTickValues) !== null && _ref !== void 0 ? _ref : 8,
|
|
1255
|
+
tickPadding: isX ? xAxisTickPadding : yAxisTickPadding,
|
|
1256
|
+
tickRotation: isX ? xAxisTickRotation : yAxisTickRotation,
|
|
1257
|
+
tickSize: isX ? xAxisTickSize : yAxisTickSize,
|
|
1258
|
+
tickFormat: isX ? xAxisTickFormat : yAxisTickFormat,
|
|
1259
|
+
tickRemodelling: isX ? xAxisTickRemodelling : yAxisTickRemodelling,
|
|
1260
|
+
variant: isX ? xAxisVariant : yAxisVariant,
|
|
1261
|
+
textColor: isX ? undefined : color,
|
|
1262
|
+
tickToColor: (_, index) => index !== 0
|
|
1263
|
+
}, child.props));
|
|
1264
|
+
}
|
|
1265
|
+
renderedChildren.push(enhancedChild);
|
|
1266
|
+
});
|
|
1267
|
+
return renderedChildren;
|
|
1268
|
+
}, [propsChildren]);
|
|
1269
|
+
return /*#__PURE__*/React__default.createElement(BarChartContext.Provider, {
|
|
1270
|
+
value: _objectSpread2(_objectSpread2({}, context), {}, {
|
|
1271
|
+
scaleX: scaleX,
|
|
1272
|
+
scaleY: scaleY,
|
|
1273
|
+
direction,
|
|
1274
|
+
sectionHeight
|
|
1275
|
+
})
|
|
1276
|
+
}, /*#__PURE__*/React__default.createElement(StyledBarChartSection, _extends({}, forwardedProps, {
|
|
1277
|
+
className: classNames(BarChartSection.className, className),
|
|
1278
|
+
transform: `translate(${margins.left},${(margins.top || 0) + sectionY})`,
|
|
1279
|
+
ref: ref,
|
|
1280
|
+
$theme: theme,
|
|
1281
|
+
$textColor: textColor
|
|
1282
|
+
}), backgroundColor ? /*#__PURE__*/React__default.createElement("rect", {
|
|
1283
|
+
x: 0,
|
|
1284
|
+
y: 0,
|
|
1285
|
+
width: chartWidth,
|
|
1286
|
+
height: sectionHeight,
|
|
1287
|
+
fill: backgroundColor
|
|
1288
|
+
}) : null, title && /*#__PURE__*/React__default.createElement("text", {
|
|
1289
|
+
className: "title colored",
|
|
1290
|
+
x: titleX,
|
|
1291
|
+
y: direction === 'up' ? 8 : direction === 'down' ? sectionHeight - 8 : sectionHeight / 2,
|
|
1292
|
+
textAnchor: titleAnchor,
|
|
1293
|
+
fontSize: 12,
|
|
1294
|
+
dominantBaseline: direction === 'up' ? 'hanging' : direction === 'down' ? 'auto' : 'middle'
|
|
1295
|
+
}, title), children));
|
|
1296
|
+
});
|
|
1297
|
+
BarChartSection.className = CLASSNAME$1;
|
|
1298
|
+
BarChartSection.displayName = COMPONENT_NAME$1;
|
|
1299
|
+
|
|
1300
|
+
const _excluded = ["barRole", "caping", "chartRef", "className", "colorTheme", "data", "dataType", "emptyComponent", "id", "isBarSelected", "labelDecorator", "legendDecorator", "legendVariant", "localeText", "onBarClick", "orientation", "others", "size", "sortingMethod", "theme", "tooltipDecorator", "tooltipVariant", "xAxisPlacement", "yAxisPlacement"];
|
|
1301
|
+
const COMPONENT_NAME = 'BarChart';
|
|
1302
|
+
const CLASSNAME = 'redsift-barchart';
|
|
1303
|
+
const BaseBarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
1304
|
+
const {
|
|
1305
|
+
barRole,
|
|
1306
|
+
caping,
|
|
1307
|
+
chartRef,
|
|
1308
|
+
className,
|
|
1309
|
+
colorTheme = ColorTheme.default,
|
|
1310
|
+
data: propsData,
|
|
1311
|
+
dataType: propsDataType,
|
|
1312
|
+
emptyComponent,
|
|
1313
|
+
id: propsId,
|
|
1314
|
+
isBarSelected = () => true,
|
|
1315
|
+
labelDecorator,
|
|
1316
|
+
legendDecorator,
|
|
1317
|
+
legendVariant: propsLegendVariant,
|
|
1318
|
+
localeText = {
|
|
1319
|
+
emptyChartText: 'No Data'
|
|
1320
|
+
},
|
|
1321
|
+
onBarClick,
|
|
1322
|
+
orientation = BarOrientation.horizontal,
|
|
1323
|
+
others = true,
|
|
1324
|
+
size = ChartSize.medium,
|
|
1325
|
+
sortingMethod = 'desc-value',
|
|
1326
|
+
theme,
|
|
1327
|
+
tooltipDecorator,
|
|
1328
|
+
tooltipVariant = TooltipVariant.value,
|
|
1329
|
+
xAxisPlacement = 'bottom',
|
|
1330
|
+
yAxisPlacement = 'left'
|
|
1331
|
+
} = props,
|
|
1332
|
+
forwardedProps = _objectWithoutProperties(props, _excluded);
|
|
1333
|
+
const [_id] = useId();
|
|
1334
|
+
const id = propsId !== null && propsId !== void 0 ? propsId : _id;
|
|
1335
|
+
const legendVariant = propsLegendVariant !== null && propsLegendVariant !== void 0 ? propsLegendVariant : BarChartLegendVariant.externalLabel;
|
|
1336
|
+
if (propsData === undefined || propsData === null) {
|
|
1337
|
+
return /*#__PURE__*/React__default.createElement(LoadingBarChart, _extends({
|
|
1338
|
+
id: id
|
|
1339
|
+
}, forwardedProps, {
|
|
1340
|
+
ref: ref
|
|
1341
|
+
}));
|
|
1342
|
+
}
|
|
1343
|
+
if (propsData.length === 0) {
|
|
1344
|
+
return /*#__PURE__*/React__default.createElement(EmptyBarChart, _extends({
|
|
1345
|
+
data: propsData,
|
|
1346
|
+
emptyComponent: emptyComponent,
|
|
1347
|
+
id: id,
|
|
1348
|
+
localeText: localeText,
|
|
1349
|
+
size: size
|
|
1350
|
+
}, forwardedProps, {
|
|
1351
|
+
ref: ref
|
|
1352
|
+
}));
|
|
1353
|
+
}
|
|
1354
|
+
const dataType = propsDataType ? propsDataType : Array.isArray(propsData[0].key) ? 'TwoCategoryData' : propsData[0].key instanceof Date ? 'LinearData' : typeof propsData[0].key === 'number' ? 'LinearData' : typeof propsData[0].key === 'string' && isValidDate(propsData[0].key) ? 'LinearData' : typeof propsData[0].key === 'string' ? 'CategoryData' : 'CategoryData';
|
|
1355
|
+
if (dataType === 'CategoryData') {
|
|
1356
|
+
return /*#__PURE__*/React__default.createElement(RenderedOrdinalBarChart, _extends({
|
|
1357
|
+
barRole: barRole,
|
|
1358
|
+
caping: caping,
|
|
1359
|
+
chartRef: chartRef,
|
|
1360
|
+
className: classNames(BaseBarChart.className, className),
|
|
1361
|
+
data: propsData,
|
|
1362
|
+
id: id,
|
|
1363
|
+
isBarSelected: isBarSelected,
|
|
1364
|
+
labelDecorator: labelDecorator,
|
|
1365
|
+
onBarClick: onBarClick,
|
|
1366
|
+
orientation: orientation,
|
|
1367
|
+
others: others,
|
|
1368
|
+
size: size,
|
|
1369
|
+
sortingMethod: sortingMethod,
|
|
1370
|
+
theme: theme,
|
|
1371
|
+
tooltipDecorator: tooltipDecorator,
|
|
1372
|
+
colorTheme: colorTheme,
|
|
1373
|
+
tooltipVariant: tooltipVariant,
|
|
1374
|
+
xAxisPlacement: xAxisPlacement,
|
|
1375
|
+
yAxisPlacement: yAxisPlacement
|
|
1376
|
+
}, forwardedProps, {
|
|
1377
|
+
ref: ref
|
|
1378
|
+
}));
|
|
1379
|
+
} else if (dataType === 'LinearData' || dataType === 'TwoCategoryData') {
|
|
1380
|
+
return /*#__PURE__*/React__default.createElement(RenderedLinearBarChart, _extends({
|
|
1381
|
+
barRole: barRole,
|
|
1382
|
+
chartRef: chartRef,
|
|
1383
|
+
className: classNames(BaseBarChart.className, className),
|
|
1384
|
+
data: propsData,
|
|
1385
|
+
id: id,
|
|
1386
|
+
isBarSelected: isBarSelected,
|
|
1387
|
+
labelDecorator: labelDecorator,
|
|
1388
|
+
legendDecorator: legendDecorator,
|
|
1389
|
+
legendVariant: legendVariant,
|
|
1390
|
+
onBarClick: onBarClick,
|
|
1391
|
+
size: size,
|
|
1392
|
+
sortingMethod: sortingMethod,
|
|
1393
|
+
theme: theme,
|
|
1394
|
+
tooltipDecorator: tooltipDecorator,
|
|
1395
|
+
colorTheme: colorTheme,
|
|
1396
|
+
tooltipVariant: tooltipVariant,
|
|
1397
|
+
xAxisPlacement: xAxisPlacement,
|
|
1398
|
+
yAxisPlacement: yAxisPlacement
|
|
1399
|
+
}, forwardedProps, {
|
|
1400
|
+
ref: ref
|
|
1401
|
+
}));
|
|
1402
|
+
}
|
|
1403
|
+
return null;
|
|
1404
|
+
});
|
|
1405
|
+
BaseBarChart.className = CLASSNAME;
|
|
1406
|
+
BaseBarChart.displayName = COMPONENT_NAME;
|
|
1407
|
+
const BarChart = Object.assign(BaseBarChart, {
|
|
1408
|
+
Section: BarChartSection,
|
|
1409
|
+
Bars: BarChartBars,
|
|
1410
|
+
Axis: Axis,
|
|
1411
|
+
GroupedTooltip: BarChartGroupedTooltip,
|
|
1412
|
+
Legend: Legend,
|
|
1413
|
+
LegendItem: LegendItem,
|
|
1414
|
+
Title: ChartContainerTitle,
|
|
1415
|
+
Description: ChartContainerDescription
|
|
1416
|
+
});
|
|
1417
|
+
|
|
1418
|
+
export { BaseBarChart as B, StyledBarChart as S, BarChart as a, BarChartLegendVariant as b, StyledBarChartSection as c, StyledBarChartBars as d, StyledBarChartEmptyText as e };
|
|
1419
|
+
//# sourceMappingURL=BarChart2.js.map
|