@wonderflow/charts 12.11.0 → 14.0.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/dist/components/bar-chart/bar-chart.d.ts +35 -7
- package/dist/components/bar-chart/bar-chart.d.ts.map +1 -1
- package/dist/components/bar-chart/bar-chart.js +21 -46
- package/dist/components/bar-chart/bar-chart.test.js +7 -1
- package/dist/components/cartesian-base/cartesian-base-axis.d.ts.map +1 -1
- package/dist/components/cartesian-base/cartesian-base-axis.js +10 -11
- package/dist/components/cartesian-base/cartesian-base-legend.d.ts.map +1 -1
- package/dist/components/cartesian-base/cartesian-base-legend.js +3 -3
- package/dist/components/cartesian-base/cartesian-base.d.ts +32 -0
- package/dist/components/cartesian-base/cartesian-base.d.ts.map +1 -1
- package/dist/components/cartesian-base/cartesian-base.js +8 -3
- package/dist/components/cartesian-base/cartesian-base.module.css +1 -1
- package/dist/components/headings/headings.d.ts +19 -2
- package/dist/components/headings/headings.d.ts.map +1 -1
- package/dist/components/headings/headings.js +72 -6
- package/dist/components/headings/headings.module.css +1 -0
- package/dist/components/headings/headings.test.d.ts +1 -1
- package/dist/components/headings/headings.test.d.ts.map +1 -1
- package/dist/components/headings/headings.test.js +37 -3
- package/dist/components/line-chart/line-chart.d.ts +31 -15
- package/dist/components/line-chart/line-chart.d.ts.map +1 -1
- package/dist/components/line-chart/line-chart.js +5 -3
- package/dist/components/line-chart/line-chart.test.js +2 -2
- package/dist/components/loader/bar-chart-loader.d.ts.map +1 -1
- package/dist/components/loader/bar-chart-loader.js +1 -1
- package/dist/components/loader/loader.js +2 -2
- package/dist/components/loader/loader.test.js +4 -2
- package/dist/components/shapes/bars/bars-average.d.ts +3 -0
- package/dist/components/shapes/bars/bars-average.d.ts.map +1 -0
- package/dist/components/shapes/bars/bars-average.js +30 -0
- package/dist/components/shapes/bars/bars-label.d.ts +22 -0
- package/dist/components/shapes/bars/bars-label.d.ts.map +1 -0
- package/dist/components/shapes/bars/bars-label.js +35 -0
- package/dist/components/shapes/bars/bars-layout.d.ts +3 -0
- package/dist/components/shapes/bars/bars-layout.d.ts.map +1 -0
- package/dist/components/shapes/bars/bars-layout.js +36 -0
- package/dist/components/shapes/bars/bars-overlay-labels.d.ts +6 -0
- package/dist/components/shapes/bars/bars-overlay-labels.d.ts.map +1 -0
- package/dist/components/shapes/bars/bars-overlay-labels.js +62 -0
- package/dist/components/shapes/bars/bars-overlay.d.ts +6 -0
- package/dist/components/shapes/bars/bars-overlay.d.ts.map +1 -0
- package/dist/components/shapes/bars/bars-overlay.js +59 -0
- package/dist/components/shapes/bars/bars-series-labels.d.ts +6 -0
- package/dist/components/shapes/bars/bars-series-labels.d.ts.map +1 -0
- package/dist/components/shapes/bars/bars-series-labels.js +62 -0
- package/dist/components/shapes/bars/bars-series.d.ts +6 -0
- package/dist/components/shapes/bars/bars-series.d.ts.map +1 -0
- package/dist/components/shapes/bars/bars-series.js +56 -0
- package/dist/components/shapes/bars/bars-stack-overlay-labels.d.ts +6 -0
- package/dist/components/shapes/bars/bars-stack-overlay-labels.d.ts.map +1 -0
- package/dist/components/shapes/bars/bars-stack-overlay-labels.js +50 -0
- package/dist/components/shapes/bars/bars-stack-overlay.d.ts +6 -0
- package/dist/components/shapes/bars/bars-stack-overlay.d.ts.map +1 -0
- package/dist/components/shapes/bars/bars-stack-overlay.js +50 -0
- package/dist/components/shapes/bars/bars-stack-series-labels.d.ts +6 -0
- package/dist/components/shapes/bars/bars-stack-series-labels.d.ts.map +1 -0
- package/dist/components/shapes/bars/bars-stack-series-labels.js +50 -0
- package/dist/components/shapes/bars/bars-stack-series.d.ts +6 -0
- package/dist/components/shapes/bars/bars-stack-series.d.ts.map +1 -0
- package/dist/components/shapes/bars/bars-stack-series.js +48 -0
- package/dist/components/shapes/bars/bars-tooltip.d.ts +3 -0
- package/dist/components/shapes/bars/bars-tooltip.d.ts.map +1 -0
- package/dist/components/shapes/bars/bars-tooltip.js +96 -0
- package/dist/components/shapes/bars/bars-trendline.d.ts +3 -0
- package/dist/components/shapes/bars/bars-trendline.d.ts.map +1 -0
- package/dist/components/shapes/bars/bars-trendline.js +43 -0
- package/dist/components/shapes/bars/bars.d.ts.map +1 -1
- package/dist/components/shapes/bars/bars.js +27 -18
- package/dist/components/shapes/bars/bars.module.css +1 -1
- package/dist/components/shapes/bars/bars.test.js +132 -8
- package/dist/components/shapes/bars/index.d.ts +13 -0
- package/dist/components/shapes/bars/index.d.ts.map +1 -1
- package/dist/components/shapes/bars/index.js +14 -1
- package/dist/components/shapes/lines/lines-average.d.ts.map +1 -1
- package/dist/components/shapes/lines/lines-average.js +8 -46
- package/dist/components/shapes/lines/lines-marker-labels.d.ts.map +1 -1
- package/dist/components/shapes/lines/lines-marker-labels.js +16 -12
- package/dist/components/shapes/lines/lines-overlay.d.ts.map +1 -1
- package/dist/components/shapes/lines/lines-overlay.js +21 -26
- package/dist/components/shapes/lines/lines-series.d.ts.map +1 -1
- package/dist/components/shapes/lines/lines-series.js +6 -19
- package/dist/components/shapes/lines/lines-tooltip.d.ts.map +1 -1
- package/dist/components/shapes/lines/lines-tooltip.js +21 -28
- package/dist/components/shapes/lines/lines-trendline.d.ts +3 -0
- package/dist/components/shapes/lines/lines-trendline.d.ts.map +1 -0
- package/dist/components/shapes/lines/lines-trendline.js +43 -0
- package/dist/components/shapes/lines/lines.d.ts.map +1 -1
- package/dist/components/shapes/lines/lines.js +2 -1
- package/dist/components/shapes/lines/lines.test.js +29 -8
- package/dist/hooks/hooks.test.d.ts.map +1 -1
- package/dist/hooks/hooks.test.js +162 -5
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/useAverage.d.ts +82 -0
- package/dist/hooks/useAverage.d.ts.map +1 -0
- package/dist/hooks/useAverage.js +83 -0
- package/dist/hooks/useBarChart.d.ts +17 -0
- package/dist/hooks/useBarChart.d.ts.map +1 -0
- package/dist/hooks/useBarChart.js +110 -0
- package/dist/hooks/useBars.d.ts +66 -0
- package/dist/hooks/useBars.d.ts.map +1 -0
- package/dist/hooks/useBars.js +121 -0
- package/dist/hooks/useCartesian.d.ts +12 -2
- package/dist/hooks/useCartesian.d.ts.map +1 -1
- package/dist/hooks/useCartesian.js +19 -7
- package/dist/hooks/useLineChart.d.ts +3 -27
- package/dist/hooks/useLineChart.d.ts.map +1 -1
- package/dist/hooks/useLineChart.js +27 -16
- package/dist/hooks/useLines.d.ts +51 -0
- package/dist/hooks/useLines.d.ts.map +1 -0
- package/dist/hooks/useLines.js +70 -0
- package/dist/hooks/useTrendline.d.ts +60 -0
- package/dist/hooks/useTrendline.d.ts.map +1 -0
- package/dist/hooks/useTrendline.js +84 -0
- package/dist/providers/cartesian.d.ts +5 -1
- package/dist/providers/cartesian.d.ts.map +1 -1
- package/dist/providers/cartesian.js +19 -3
- package/dist/providers/data.d.ts +6 -7
- package/dist/providers/data.d.ts.map +1 -1
- package/dist/providers/data.js +4 -3
- package/dist/style-config/axis.js +3 -3
- package/dist/style-config/bars.d.ts +3 -0
- package/dist/style-config/bars.d.ts.map +1 -0
- package/dist/style-config/bars.js +43 -0
- package/dist/style-config/cartesian.d.ts.map +1 -1
- package/dist/style-config/cartesian.js +2 -0
- package/dist/style-config/colors.d.ts +1 -4
- package/dist/style-config/colors.d.ts.map +1 -1
- package/dist/style-config/colors.js +30 -36
- package/dist/style-config/headings.d.ts.map +1 -1
- package/dist/style-config/headings.js +16 -1
- package/dist/style-config/lines.d.ts.map +1 -1
- package/dist/style-config/lines.js +6 -0
- package/dist/style-config/themes.d.ts.map +1 -1
- package/dist/style-config/themes.js +18 -0
- package/dist/types/bar-chart.d.ts +26 -22
- package/dist/types/bar-chart.d.ts.map +1 -1
- package/dist/types/bar-chart.js +1 -39
- package/dist/types/bars.d.ts +68 -0
- package/dist/types/bars.d.ts.map +1 -0
- package/dist/types/bars.js +16 -0
- package/dist/types/cartesian.d.ts +7 -0
- package/dist/types/cartesian.d.ts.map +1 -1
- package/dist/types/headings.d.ts +15 -0
- package/dist/types/headings.d.ts.map +1 -1
- package/dist/types/headings.js +1 -1
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +4 -1
- package/dist/types/line-chart.d.ts +17 -19
- package/dist/types/line-chart.d.ts.map +1 -1
- package/dist/types/lines.d.ts +6 -0
- package/dist/types/lines.d.ts.map +1 -1
- package/dist/types/main.d.ts +15 -2
- package/dist/types/main.d.ts.map +1 -1
- package/dist/types/themes.d.ts +9 -0
- package/dist/types/themes.d.ts.map +1 -1
- package/dist/utils/axis.d.ts +12 -2
- package/dist/utils/axis.d.ts.map +1 -1
- package/dist/utils/axis.js +52 -15
- package/dist/utils/axis.test.js +72 -8
- package/dist/utils/bars.d.ts +63 -0
- package/dist/utils/bars.d.ts.map +1 -0
- package/dist/utils/bars.js +316 -0
- package/dist/utils/bars.test.d.ts +2 -0
- package/dist/utils/bars.test.d.ts.map +1 -0
- package/dist/utils/bars.test.js +388 -0
- package/dist/utils/data.d.ts +14 -6
- package/dist/utils/data.d.ts.map +1 -1
- package/dist/utils/data.js +128 -21
- package/dist/utils/data.test.js +195 -86
- package/dist/utils/format.d.ts +1 -0
- package/dist/utils/format.d.ts.map +1 -1
- package/dist/utils/format.js +2 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +2 -1
- package/dist/utils/lines.d.ts +3 -3
- package/dist/utils/lines.d.ts.map +1 -1
- package/dist/utils/lines.js +3 -1
- package/dist/utils/lines.test.js +26 -1
- package/dist/utils/metadata.d.ts +5 -8
- package/dist/utils/metadata.d.ts.map +1 -1
- package/dist/utils/metadata.js +8 -20
- package/dist/utils/metadata.test.js +5 -58
- package/dist/utils/viewport.test.js +8 -0
- package/package.json +13 -11
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Except } from 'type-fest';
|
|
3
3
|
import { CartesianChartLayout, Data, ThemeVariants } from '../../types';
|
|
4
|
-
import { LineChartIndex,
|
|
4
|
+
import { LineChartIndex, LineChartRenderType, LineChartSeries } from '../../types/line-chart';
|
|
5
5
|
import { CartesianBaseProps } from '../cartesian-base/cartesian-base';
|
|
6
6
|
export declare type LineChartProps = {
|
|
7
7
|
/**
|
|
@@ -21,25 +21,33 @@ export declare type LineChartProps = {
|
|
|
21
21
|
*/
|
|
22
22
|
renderAs?: LineChartRenderType;
|
|
23
23
|
/**
|
|
24
|
-
* Set the properties associated with the Index
|
|
24
|
+
* Set the properties associated with the `Index` axis.
|
|
25
25
|
*/
|
|
26
26
|
index: LineChartIndex;
|
|
27
27
|
/**
|
|
28
|
-
* Set
|
|
28
|
+
* Set properties associated with any `Series` of lines.
|
|
29
29
|
*/
|
|
30
30
|
series: LineChartSeries;
|
|
31
31
|
/**
|
|
32
|
-
* Set
|
|
32
|
+
* Set properties associated with the `Overlay` axis.
|
|
33
33
|
*/
|
|
34
|
-
overlay?:
|
|
34
|
+
overlay?: LineChartSeries;
|
|
35
35
|
/**
|
|
36
|
-
* Display an average line and label when true
|
|
36
|
+
* Display an average line and label when `true`.
|
|
37
37
|
*/
|
|
38
38
|
showAverage?: boolean;
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
40
|
+
* Display a trend line for every single line when `true`.
|
|
41
41
|
*/
|
|
42
|
-
|
|
42
|
+
showTrendline?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Set custom content to be displayed in the tooltip below the default information.
|
|
45
|
+
*/
|
|
46
|
+
tooltipExtraContent?: React.ReactNode;
|
|
47
|
+
/**
|
|
48
|
+
* Prevent from displaying the tooltip on the chart when `true`.
|
|
49
|
+
*/
|
|
50
|
+
preventTooltipDisplay?: boolean;
|
|
43
51
|
/**
|
|
44
52
|
* Prevent showing a connecting line between points when data is missing.
|
|
45
53
|
*/
|
|
@@ -75,25 +83,33 @@ export declare const LineChart: import("react").ForwardRefExoticComponent<{
|
|
|
75
83
|
*/
|
|
76
84
|
renderAs?: LineChartRenderType | undefined;
|
|
77
85
|
/**
|
|
78
|
-
* Set the properties associated with the Index
|
|
86
|
+
* Set the properties associated with the `Index` axis.
|
|
79
87
|
*/
|
|
80
88
|
index: LineChartIndex;
|
|
81
89
|
/**
|
|
82
|
-
* Set
|
|
90
|
+
* Set properties associated with any `Series` of lines.
|
|
83
91
|
*/
|
|
84
92
|
series: LineChartSeries;
|
|
85
93
|
/**
|
|
86
|
-
* Set
|
|
94
|
+
* Set properties associated with the `Overlay` axis.
|
|
87
95
|
*/
|
|
88
|
-
overlay?:
|
|
96
|
+
overlay?: LineChartSeries | undefined;
|
|
89
97
|
/**
|
|
90
|
-
* Display an average line and label when true
|
|
98
|
+
* Display an average line and label when `true`.
|
|
91
99
|
*/
|
|
92
100
|
showAverage?: boolean | undefined;
|
|
93
101
|
/**
|
|
94
|
-
*
|
|
102
|
+
* Display a trend line for every single line when `true`.
|
|
103
|
+
*/
|
|
104
|
+
showTrendline?: boolean | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* Set custom content to be displayed in the tooltip below the default information.
|
|
107
|
+
*/
|
|
108
|
+
tooltipExtraContent?: React.ReactNode;
|
|
109
|
+
/**
|
|
110
|
+
* Prevent from displaying the tooltip on the chart when `true`.
|
|
95
111
|
*/
|
|
96
|
-
|
|
112
|
+
preventTooltipDisplay?: boolean | undefined;
|
|
97
113
|
/**
|
|
98
114
|
* Prevent showing a connecting line between points when data is missing.
|
|
99
115
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line-chart.d.ts","sourceRoot":"","sources":["../../../src/components/line-chart/line-chart.tsx"],"names":[],"mappings":";AAiBA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAOnC,OAAO,EACL,oBAAoB,EACpB,IAAI,EACJ,aAAa,EACd,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,cAAc,EACd,
|
|
1
|
+
{"version":3,"file":"line-chart.d.ts","sourceRoot":"","sources":["../../../src/components/line-chart/line-chart.tsx"],"names":[],"mappings":";AAiBA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAOnC,OAAO,EACL,oBAAoB,EACpB,IAAI,EACJ,aAAa,EACd,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,cAAc,EACd,mBAAmB,EAAE,eAAe,EACrC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAiB,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAErF,oBAAY,cAAc,GAAG;IAC3B;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB;;OAEG;IACH,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B;;OAEG;IACH,IAAI,EAAE,IAAI,CAAC;IACX;;OAEG;IACH,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B;;OAEG;IACH,KAAK,EAAE,cAAc,CAAC;IACtB;;OAEG;IACH,MAAM,EAAE,eAAe,CAAC;IACxB;;OAEG;IACH,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,mBAAmB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACtC;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;OAEG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,GAAG,MAAM,CAAC,kBAAkB,EAAE,MAAM,GAAG,cAAc,GAAG,eAAe,CAAC,CAAA;AAEzE,eAAO,MAAM,SAAS;IA9DpB;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;WACI,cAAc;IACrB;;OAEG;YACK,eAAe;IACvB;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;0BACmB,MAAM,SAAS;IACrC;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;uHAoEH,CAAC"}
|
|
@@ -19,7 +19,7 @@ import { useLineChart } from '../../hooks';
|
|
|
19
19
|
import { DataProvider, LayoutProvider, ThemeProvider, } from '../../providers';
|
|
20
20
|
import { CartesianChartLayout, } from '../../types';
|
|
21
21
|
import { CartesianBase } from '../cartesian-base/cartesian-base';
|
|
22
|
-
export const LineChart = forwardRef(({ theme = 'light', layout = CartesianChartLayout.HORIZONTAL, renderAs = 'curves', data = [], index, series, overlay,
|
|
22
|
+
export const LineChart = forwardRef(({ theme = 'light', layout = CartesianChartLayout.HORIZONTAL, renderAs = 'curves', data = [], index, series, overlay, tooltipExtraContent, preventTooltipDisplay = false, showAverage = false, showTrendline = false, hidePadding = false, hideMissingDataConnection = false, showMarker = false, showMarkerLabel = false, ...otherProps }, forwardedRef) => {
|
|
23
23
|
const { axis, axisFiltered, isHorizontal, metadata, zeroPadding, brushFilteredData, setBrushFilteredData, } = useLineChart({
|
|
24
24
|
theme,
|
|
25
25
|
layout,
|
|
@@ -28,12 +28,14 @@ export const LineChart = forwardRef(({ theme = 'light', layout = CartesianChartL
|
|
|
28
28
|
index,
|
|
29
29
|
series,
|
|
30
30
|
overlay,
|
|
31
|
-
|
|
31
|
+
tooltipExtraContent,
|
|
32
|
+
preventTooltipDisplay,
|
|
33
|
+
hidePadding,
|
|
32
34
|
showAverage,
|
|
35
|
+
showTrendline,
|
|
33
36
|
hideMissingDataConnection,
|
|
34
37
|
showMarker,
|
|
35
38
|
showMarkerLabel,
|
|
36
|
-
hidePadding,
|
|
37
39
|
});
|
|
38
40
|
return (_jsx(ThemeProvider, { theme: theme, children: _jsx(LayoutProvider, { layout: layout, children: _jsx(DataProvider, { data: data, metadata: metadata, filteredData: brushFilteredData, children: _jsx(CartesianBase, { ...otherProps, axis: axis[layout], axisFiltered: axisFiltered[layout], grid: {
|
|
39
41
|
hideRows: !isHorizontal,
|
|
@@ -8,12 +8,12 @@ global.ResizeObserver = jest.fn().mockImplementation(() => ({
|
|
|
8
8
|
}));
|
|
9
9
|
describe('<LineChart>', () => {
|
|
10
10
|
it('should render the component', () => {
|
|
11
|
-
render(_jsx(LineChart, { data: [{ date: 'a', value: 1 }, { date: 'b', value: 2 }], index: { dataKey: 'date' }, series: { dataKey: ['value'] }, overlay: { dataKey: 'value' }, title: "Title" }));
|
|
11
|
+
render(_jsx(LineChart, { data: [{ date: 'a', value: 1 }, { date: 'b', value: 2 }], index: { dataKey: 'date' }, series: { dataKey: ['value'] }, overlay: { dataKey: ['value'] }, title: "Title" }));
|
|
12
12
|
const element = screen.getByTestId('cartesian');
|
|
13
13
|
expect(element).toBeDefined();
|
|
14
14
|
});
|
|
15
15
|
it('should render the component w/o padding', () => {
|
|
16
|
-
render(_jsx(LineChart, { data: [{ date: 'a', value: 1 }, { date: 'b', value: 2 }], index: { dataKey: 'date' }, series: { dataKey: ['value'] }, overlay: { dataKey: 'value' }, hidePadding: true, hideLegend: true }));
|
|
16
|
+
render(_jsx(LineChart, { data: [{ date: 'a', value: 1 }, { date: 'b', value: 2 }], index: { dataKey: 'date' }, series: { dataKey: ['value'] }, overlay: { dataKey: ['value'] }, hidePadding: true, hideLegend: true }));
|
|
17
17
|
const element = screen.getByTestId('cartesian');
|
|
18
18
|
expect(element).toBeDefined();
|
|
19
19
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bar-chart-loader.d.ts","sourceRoot":"","sources":["../../../src/components/loader/bar-chart-loader.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,oBAAY,mBAAmB,GAAG;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,aAAa,CAAC,UAAU,GAAG,aAAa,CAAC,CAAC;CACxD,CAAA;AAED,eAAO,MAAM,cAAc;qCAIxB,mBAAmB;;
|
|
1
|
+
{"version":3,"file":"bar-chart-loader.d.ts","sourceRoot":"","sources":["../../../src/components/loader/bar-chart-loader.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,oBAAY,mBAAmB,GAAG;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,aAAa,CAAC,UAAU,GAAG,aAAa,CAAC,CAAC;CACxD,CAAA;AAED,eAAO,MAAM,cAAc;qCAIxB,mBAAmB;;CAiDrB,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
export const BarChartLoader = ({ width = 800, height = 600, otherProps, }) => (_jsx("svg", { version: "1.1", id: "Line-Chart-Loader", xmlns: "http:www.w3.org/2000/svg", viewBox: `0 0 ${width} ${height}`, "data-testid": "bar-chart-loader", ...otherProps, children: _jsx("g", { transform: `matrix(${width / 848},0,0,${height / (160 * 3)},0,0)`, children: _jsx("g", { transform: `translate(0 ${height / 3})`, children: _jsxs("g", { children: [_jsx("rect", { fill: "#454545", width: "10", height: "100", rx: "4", transform: "translate(0) rotate(180 5 50)", children: _jsx("animate", { attributeName: "height", dur: "1.1s", values: "30; 100; 30", repeatCount: "indefinite" }) }), _jsx("rect", { x: "17", fill: "#454545", width: "10", height: "100", rx: "4", transform: "translate(3) rotate(180 20 50)", children: _jsx("animate", { attributeName: "height", dur: "1.25s", values: "30; 100; 30", repeatCount: "indefinite", begin: "0.1s" }) }), _jsx("rect", { x: "40", fill: "#454545", width: "10", height: "100", rx: "4", transform: "translate(6) rotate(180 38 50)", children: _jsx("animate", { attributeName: "height", dur: "1.15s", values: "30; 100; 30", repeatCount: "indefinite", begin: "0.3s" }) }), _jsx("rect", { x: "60", fill: "#454545", width: "10", height: "100", rx: "4", transform: "translate(9) rotate(180 55 50)", children: _jsx("animate", { attributeName: "height", dur: "1.25s", values: "30; 100; 30", repeatCount: "indefinite", begin: "0.5s" }) }), _jsx("rect", { x: "80", fill: "#454545", width: "10", height: "100", rx: "4", transform: "translate(12) rotate(180 72 50)", children: _jsx("animate", { attributeName: "height", dur: "1.0s", values: "30; 100; 30", repeatCount: "indefinite", begin: "0.1s" }) })] }) }) }) }));
|
|
2
|
+
export const BarChartLoader = ({ width = 800, height = 600, otherProps, }) => (_jsx("svg", { version: "1.1", id: "Bar-Chart-Loader", xmlns: "http:www.w3.org/2000/svg", viewBox: `0 0 ${width} ${height}`, "data-testid": "bar-chart-loader", ...otherProps, children: _jsxs("g", { className: "visx-group", transform: "translate(0, 0)", clipPath: "url(#clip-path-loader)", children: [_jsx("rect", { "data-testid": "loader", x: "0", y: "62", width: "1086", height: "270", fill: "transparent" }), _jsx("svg", { version: "1.1", id: "Line-Chart-Loader", xmlns: "http:www.w3.org/2000/svg", viewBox: "0 0 1074 270", children: _jsx("g", { children: _jsxs("g", { transform: "translate(0 250)", children: [_jsx("rect", { x: "0", fill: "slateGray", fillOpacity: "0.75", width: "24", height: "51", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.5px)' }, children: _jsx("animate", { attributeName: "height", dur: "2.64s", values: "31; 201; 30", repeatCount: "indefinite", begin: "0.95s" }) }), _jsx("rect", { x: "30", fill: "slateGray", fillOpacity: "0.93", width: "24", height: "60", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.2s5px)' }, children: _jsx("animate", { attributeName: "height", dur: "2.01s", values: "30; 201; 30", repeatCount: "indefinite", begin: "0.25s" }) }), _jsx("rect", { x: "60", fill: "slateGray", fillOpacity: "0.32", width: "24", height: "100", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.5px)' }, children: _jsx("animate", { attributeName: "height", dur: "2.06s", values: "31; 201; 31", repeatCount: "indefinite", begin: "0.51s" }) }), _jsx("rect", { x: "90", fill: "slateGray", fillOpacity: "0.23", width: "24", height: "200", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.5px)' }, children: _jsx("animate", { attributeName: "height", dur: "1.96s", values: "31; 200; 30", repeatCount: "indefinite", begin: "0.60s" }) }), _jsx("rect", { x: "120", fill: "slateGray", fillOpacity: "0.51", width: "24", height: "120", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.5px)' }, children: _jsx("animate", { attributeName: "height", dur: "1.98s", values: "31; 200; 31", repeatCount: "indefinite", begin: "0.22s" }) }), _jsx("rect", { x: "150", fill: "slateGray", fillOpacity: "0.12", width: "24", height: "180", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.25px)' }, children: _jsx("animate", { attributeName: "height", dur: "1.85s", values: "30; 200; 30", repeatCount: "indefinite", begin: "0.41s" }) }), _jsx("rect", { x: "180", fill: "slateGray", fillOpacity: "0.74", width: "24", height: "130", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.5px)' }, children: _jsx("animate", { attributeName: "height", dur: "2.28s", values: "30; 201; 31", repeatCount: "indefinite", begin: "0.70s" }) }), _jsx("rect", { x: "210", fill: "slateGray", fillOpacity: "0.04", width: "24", height: "900", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.5px)' }, children: _jsx("animate", { attributeName: "height", dur: "1.90s", values: "30; 201; 31", repeatCount: "indefinite", begin: "0.34s" }) }), _jsx("rect", { x: "240", fill: "slateGray", fillOpacity: "0.14", width: "24", height: "110", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.5px)' }, children: _jsx("animate", { attributeName: "height", dur: "2.79s", values: "31; 200; 31", repeatCount: "indefinite", begin: "0.49s" }) }), _jsx("rect", { x: "270", fill: "slateGray", fillOpacity: "0.73", width: "24", height: "40", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.5px)' }, children: _jsx("animate", { attributeName: "height", dur: "2.27s", values: "30; 201; 31", repeatCount: "indefinite", begin: "0.66s" }) }), _jsx("rect", { x: "300", fill: "slateGray", fillOpacity: "0.25", width: "24", height: "60", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.5px)' }, children: _jsx("animate", { attributeName: "height", dur: "2.40s", values: "30; 200; 31", repeatCount: "indefinite", begin: "0.64s" }) }), _jsx("rect", { x: "330", fill: "slateGray", fillOpacity: "0.82", width: "24", height: "30", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.25px)' }, children: _jsx("animate", { attributeName: "height", dur: "2.33s", values: "31; 200; 30", repeatCount: "indefinite", begin: "0.64s" }) }), _jsx("rect", { x: "360", fill: "slateGray", fillOpacity: "0.67", width: "24", height: "70", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.25px)' }, children: _jsx("animate", { attributeName: "height", dur: "2.05s", values: "30; 201; 31", repeatCount: "indefinite", begin: "0.66s" }) }), _jsx("rect", { x: "390", fill: "slateGray", fillOpacity: "0.29", width: "24", height: "75", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.5px)' }, children: _jsx("animate", { attributeName: "height", dur: "1.92s", values: "30; 200; 30", repeatCount: "indefinite", begin: "0.76s" }) }), _jsx("rect", { x: "420", fill: "slateGray", fillOpacity: "0.68", width: "24", height: "130", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.5px)' }, children: _jsx("animate", { attributeName: "height", dur: "2.74s", values: "30; 200; 31", repeatCount: "indefinite", begin: "0.70s" }) }), _jsx("rect", { x: "450", fill: "slateGray", fillOpacity: "0.70", width: "24", height: "140", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.25px)' }, children: _jsx("animate", { attributeName: "height", dur: "2.45s", values: "31; 201; 30", repeatCount: "indefinite", begin: "0.41s" }) }), _jsx("rect", { x: "480", fill: "slateGray", fillOpacity: "0.76", width: "24", height: "190", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.5px)' }, children: _jsx("animate", { attributeName: "height", dur: "1.87s", values: "31; 201; 31", repeatCount: "indefinite", begin: "0.08s" }) }), _jsx("rect", { x: "510", fill: "slateGray", fillOpacity: "0.19", width: "24", height: "110", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.5px)' }, children: _jsx("animate", { attributeName: "height", dur: "2.64s", values: "31; 201; 30", repeatCount: "indefinite", begin: "0.32s" }) }), _jsx("rect", { x: "540", fill: "slateGray", fillOpacity: "0.20", width: "24", height: "90", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.5px)' }, children: _jsx("animate", { attributeName: "height", dur: "2.24s", values: "30; 200; 31", repeatCount: "indefinite", begin: "0.33s" }) }), _jsx("rect", { x: "570", fill: "slateGray", fillOpacity: "0.32", width: "24", height: "120", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.5px)' }, children: _jsx("animate", { attributeName: "height", dur: "2.06s", values: "30; 200; 30", repeatCount: "indefinite", begin: "0.59s" }) }), _jsx("rect", { x: "600", fill: "slateGray", fillOpacity: "0.49", width: "24", height: "20", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.25px)' }, children: _jsx("animate", { attributeName: "height", dur: "2.51s", values: "31; 201; 31", repeatCount: "indefinite", begin: "0.83s" }) }), _jsx("rect", { x: "630", fill: "slateGray", fillOpacity: "0.63", width: "24", height: "60", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.5px)' }, children: _jsx("animate", { attributeName: "height", dur: "2.45s", values: "30; 201; 31", repeatCount: "indefinite", begin: "0.42s" }) }), _jsx("rect", { x: "660", fill: "slateGray", fillOpacity: "0.73", width: "24", height: "90", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.5px)' }, children: _jsx("animate", { attributeName: "height", dur: "2.13s", values: "30; 200; 30", repeatCount: "indefinite", begin: "0.19s" }) }), _jsx("rect", { x: "690", fill: "slateGray", fillOpacity: "0.61", width: "24", height: "120", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.5px)' }, children: _jsx("animate", { attributeName: "height", dur: "2.77s", values: "30; 201; 30", repeatCount: "indefinite", begin: "0.23s" }) }), _jsx("rect", { x: "720", fill: "slateGray", fillOpacity: "0.76", width: "24", height: "110", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.5px)' }, children: _jsx("animate", { attributeName: "height", dur: "2.34s", values: "31; 201; 30", repeatCount: "indefinite", begin: "0.51s" }) }), _jsx("rect", { x: "750", fill: "slateGray", fillOpacity: "0.21", width: "24", height: "180", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.25px)' }, children: _jsx("animate", { attributeName: "height", dur: "2.47s", values: "30; 200; 30", repeatCount: "indefinite", begin: "0.66s" }) }), _jsx("rect", { x: "780", fill: "slateGray", fillOpacity: "0.76", width: "24", height: "150", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.5px)' }, children: _jsx("animate", { attributeName: "height", dur: "2.49s", values: "31; 200; 31", repeatCount: "indefinite", begin: "0.46s" }) }), _jsx("rect", { x: "810", fill: "slateGray", fillOpacity: "0.86", width: "24", height: "20", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.25px)' }, children: _jsx("animate", { attributeName: "height", dur: "2.50s", values: "30; 200; 30", repeatCount: "indefinite", begin: "0.56s" }) }), _jsx("rect", { x: "840", fill: "slateGray", fillOpacity: "0.86", width: "24", height: "200", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.5px)' }, children: _jsx("animate", { attributeName: "height", dur: "2.18s", values: "31; 201; 31", repeatCount: "indefinite", begin: "0.50s" }) }), _jsx("rect", { x: "870", fill: "slateGray", fillOpacity: "0.63", width: "24", height: "120", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.5px)' }, children: _jsx("animate", { attributeName: "height", dur: "1.82s", values: "30; 200; 30", repeatCount: "indefinite", begin: "0.40s" }) }), _jsx("rect", { x: "900", fill: "slateGray", fillOpacity: "0.03", width: "24", height: "100", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.5px)' }, children: _jsx("animate", { attributeName: "height", dur: "2.11s", values: "30; 201; 31", repeatCount: "indefinite", begin: "0.83s" }) }), _jsx("rect", { x: "930", fill: "slateGray", fillOpacity: "0.97", width: "24", height: "190", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.5px)' }, children: _jsx("animate", { attributeName: "height", dur: "1.80s", values: "30; 200; 30", repeatCount: "indefinite", begin: "0.26s" }) }), _jsx("rect", { x: "960", fill: "slateGray", fillOpacity: "0.04", width: "24", height: "80", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.5px)' }, children: _jsx("animate", { attributeName: "height", dur: "1.84s", values: "31; 200; 30", repeatCount: "indefinite", begin: "0.33s" }) }), _jsx("rect", { x: "990", fill: "slateGray", fillOpacity: "0.58", width: "24", height: "30", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.25px)' }, children: _jsx("animate", { attributeName: "height", dur: "1.99s", values: "30; 200; 31", repeatCount: "indefinite", begin: "0.69s" }) }), _jsx("rect", { x: "1020", fill: "slateGray", fillOpacity: "0.81", width: "24", height: "50", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.5px)' }, children: _jsx("animate", { attributeName: "height", dur: "2.57s", values: "30; 200; 31", repeatCount: "indefinite", begin: "0.48s" }) }), _jsx("rect", { x: "1050", fill: "slateGray", fillOpacity: "0.95", width: "24", height: "20", rx: "4", transform: "scale(1 -1)", style: { style: 'blur(0.5px)' }, children: _jsx("animate", { attributeName: "height", dur: "2.66s", values: "30; 201; 30", repeatCount: "indefinite", begin: "0.73s" }) })] }) }) })] }) }));
|
|
3
3
|
BarChartLoader.displayName = 'BarChartLoader';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright 2022-
|
|
3
|
+
* Copyright 2022-2024 Wonderflow Design Team
|
|
4
4
|
*
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
* you may not use this file except in compliance with the License.
|
|
@@ -31,5 +31,5 @@ export const Loader = ({ isLoading = false, left = 0, top = 0, width = 800, heig
|
|
|
31
31
|
const rightExtraPadding = metadata?.hidePadding ? 12 : 0;
|
|
32
32
|
if (!isLoading)
|
|
33
33
|
return null;
|
|
34
|
-
return (_jsxs(Group, { children: [_jsx(RectClipPath, { id: "clip-path-loader", x: left, y: top, width: width + rightExtraPadding, height: height }), _jsx(LinearGradient, { id: "loader-gradient", from: to, to: from }), _jsxs(Group, { clipPath: "url(#clip-path-loader)", children: [_jsx("rect", { "data-testid": "loader", x: left, y: top, width: width + rightExtraPadding, height: height, fill: "url(#loader-gradient)" }), isLineChart && (_jsx(LineChartLoader, { width: width, height: height })), isBarChart && (_jsx(BarChartLoader, {}))] })] }));
|
|
34
|
+
return (_jsxs(Group, { children: [_jsx(RectClipPath, { id: "clip-path-loader", x: left, y: top, width: width + rightExtraPadding, height: height }), _jsx(LinearGradient, { id: "loader-gradient", from: to, to: from }), _jsxs(Group, { clipPath: "url(#clip-path-loader)", children: [_jsx("rect", { "data-testid": "loader", x: left, y: top, width: width + rightExtraPadding, height: height, fill: "url(#loader-gradient)" }), isLineChart && (_jsx(LineChartLoader, { width: width, height: height })), isBarChart && (_jsx(BarChartLoader, { width: width, height: height }))] })] }));
|
|
35
35
|
};
|
|
@@ -13,11 +13,13 @@ const mockMetadata = {
|
|
|
13
13
|
names: ['A', 'B'],
|
|
14
14
|
colors: ['ca', 'cb'],
|
|
15
15
|
average: undefined,
|
|
16
|
+
trendline: undefined,
|
|
16
17
|
},
|
|
17
18
|
overlay: {
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
names: [''],
|
|
20
|
+
colors: [''],
|
|
20
21
|
average: undefined,
|
|
22
|
+
trendline: undefined,
|
|
21
23
|
},
|
|
22
24
|
hidePadding: true,
|
|
23
25
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bars-average.d.ts","sourceRoot":"","sources":["../../../../src/components/shapes/bars/bars-average.tsx"],"names":[],"mappings":";AAyBA,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EA+F/B,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023-2024 Wonderflow Design Team
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { Label } from '@visx/annotation';
|
|
18
|
+
import { Group } from '@visx/group';
|
|
19
|
+
import { Line } from '@visx/shape';
|
|
20
|
+
import { useAverage } from '../../../hooks';
|
|
21
|
+
import { useLayoutContext, useStyleConfigContext, useThemeContext, } from '../../../providers';
|
|
22
|
+
export const BarsAverage = () => {
|
|
23
|
+
const theme = useThemeContext();
|
|
24
|
+
const { themes } = useStyleConfigContext();
|
|
25
|
+
const { isHorizontal } = useLayoutContext();
|
|
26
|
+
const { averageSeries, averageOverlay, hasAverageSeries, hasAverageOverlay, hasAverageOverlayLabel, hasAverageSeriesLabel, coordinates, style, } = useAverage();
|
|
27
|
+
const { backgroundPadding, backgroundProps, maxLabelWidth, opacity, pointerEvents, strokeDasharray, strokeWidth, titleFontSize, titleFontWeight, titleProps, } = style;
|
|
28
|
+
return (_jsxs(Group, { children: [hasAverageSeries && (_jsx(Line, { from: coordinates.series.from, to: coordinates.series.to, stroke: themes[theme].lines.average, strokeWidth: strokeWidth, pointerEvents: pointerEvents, strokeDasharray: strokeDasharray, opacity: opacity })), hasAverageOverlay && (_jsx(Line, { from: coordinates.overlay.from, to: coordinates.overlay.to, stroke: themes[theme].lines.average, strokeWidth: strokeWidth, pointerEvents: pointerEvents, strokeDasharray: strokeDasharray, opacity: opacity })), hasAverageSeriesLabel && (_jsx(Label, { backgroundFill: themes[theme].lines.average, x: coordinates.series.label.x, y: coordinates.series.label.y, fontColor: themes[theme].lines.averageFontColor, title: `Average: ${averageSeries}`, titleFontSize: titleFontSize, titleFontWeight: titleFontWeight, titleProps: titleProps, showAnchorLine: false, horizontalAnchor: isHorizontal ? 'start' : 'middle', verticalAnchor: "middle", showBackground: true, backgroundPadding: backgroundPadding, backgroundProps: backgroundProps, maxWidth: maxLabelWidth })), hasAverageOverlayLabel && (_jsx(Label, { backgroundFill: themes[theme].lines.average, x: coordinates.overlay.label.x, y: coordinates.overlay.label.y, fontColor: themes[theme].lines.averageFontColor, title: `Average: ${averageOverlay}`, titleFontSize: titleFontSize, titleFontWeight: titleFontWeight, titleProps: titleProps, showAnchorLine: false, horizontalAnchor: isHorizontal ? 'end' : 'middle', verticalAnchor: "middle", showBackground: true, backgroundPadding: backgroundPadding, backgroundProps: backgroundProps, maxWidth: maxLabelWidth }))] }));
|
|
29
|
+
};
|
|
30
|
+
BarsAverage.displayName = 'BarsAverage';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare type BarsLabelProps = {
|
|
3
|
+
wrapper?: {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
width: number;
|
|
7
|
+
};
|
|
8
|
+
text: {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
};
|
|
12
|
+
value: string | number;
|
|
13
|
+
separator: string;
|
|
14
|
+
extraData: string;
|
|
15
|
+
fontWeightValue: number;
|
|
16
|
+
dataKey: string;
|
|
17
|
+
};
|
|
18
|
+
export declare const BarsLabel: {
|
|
19
|
+
({ dataKey, extraData, fontWeightValue, separator, text, value, wrapper, }: BarsLabelProps): JSX.Element | null;
|
|
20
|
+
displayName: string;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=bars-label.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bars-label.d.ts","sourceRoot":"","sources":["../../../../src/components/shapes/bars/bars-label.tsx"],"names":[],"mappings":";AAwBA,oBAAY,cAAc,GAAG;IAC3B,OAAO,CAAC,EAAE;QACR,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;QACV,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,IAAI,EAAE;QACJ,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;KACX,CAAC;IACF,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAA;AAED,eAAO,MAAM,SAAS;gFAQnB,cAAc;;CA0DhB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2024 Wonderflow Design Team
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { Group } from '@visx/group';
|
|
18
|
+
import { useCallback } from 'react';
|
|
19
|
+
import { useBars } from '../../../hooks';
|
|
20
|
+
import { useCartesianContext, useStyleConfigContext, useThemeContext } from '../../../providers';
|
|
21
|
+
import { BarsItem, BarsItemBlurred } from './bars.module.css';
|
|
22
|
+
export const BarsLabel = ({ dataKey, extraData, fontWeightValue, separator, text, value, wrapper, }) => {
|
|
23
|
+
const { hoveredLegendItem: overLegend } = useCartesianContext();
|
|
24
|
+
const theme = useThemeContext();
|
|
25
|
+
const { themes, bars } = useStyleConfigContext();
|
|
26
|
+
const { series, hasLabel, } = useBars();
|
|
27
|
+
const { fontFamily, fontWeight, fontSize, alignmentBaseline, height, fillOpacity, rx, } = bars.label;
|
|
28
|
+
const dynamicClassName = useCallback((overLegend, dataKey) => ((overLegend === dataKey || overLegend === '')
|
|
29
|
+
? BarsItem
|
|
30
|
+
: BarsItemBlurred), []);
|
|
31
|
+
if (!hasLabel)
|
|
32
|
+
return null;
|
|
33
|
+
return (_jsxs(Group, { className: dynamicClassName(overLegend, dataKey), children: [wrapper && (_jsx("rect", { x: wrapper.x, y: wrapper.y, width: wrapper.width, height: height, fill: themes[theme].markerLabel.background, fillOpacity: fillOpacity, rx: rx })), _jsxs("text", { x: text.x, y: text.y, fontSize: fontSize, fontWeight: fontWeight, fontFamily: fontFamily, fill: themes[theme].axis.tickLabel, alignmentBaseline: alignmentBaseline, textAnchor: wrapper ? 'middle' : undefined, children: [_jsx("tspan", { fontWeight: fontWeightValue, children: value }), series.extraData && (_jsxs(_Fragment, { children: [_jsx("tspan", { children: separator }), _jsx("tspan", { children: extraData })] }))] })] }));
|
|
34
|
+
};
|
|
35
|
+
BarsLabel.displayName = 'BarsLabel';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bars-layout.d.ts","sourceRoot":"","sources":["../../../../src/components/shapes/bars/bars-layout.tsx"],"names":[],"mappings":";AA+BA,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EA6B9B,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023-2024 Wonderflow Design Team
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { Group } from '@visx/group';
|
|
18
|
+
import { useBars } from '../../../hooks';
|
|
19
|
+
import { useLayoutContext } from '../../../providers';
|
|
20
|
+
import { BarsOverlay } from './bars-overlay';
|
|
21
|
+
import { BarsOverlayLabels } from './bars-overlay-labels';
|
|
22
|
+
import { BarsSeries } from './bars-series';
|
|
23
|
+
import { BarsSeriesLabels } from './bars-series-labels';
|
|
24
|
+
import { BarsStackOverlay } from './bars-stack-overlay';
|
|
25
|
+
import { BarsStackOverlayLabels } from './bars-stack-overlay-labels';
|
|
26
|
+
import { BarsStackSeries } from './bars-stack-series';
|
|
27
|
+
import { BarsStackSeriesLabels } from './bars-stack-series-labels';
|
|
28
|
+
import { BarsTrendline } from './bars-trendline';
|
|
29
|
+
export const BarsLayout = () => {
|
|
30
|
+
const { isHorizontal } = useLayoutContext();
|
|
31
|
+
const { isStacked } = useBars();
|
|
32
|
+
return (_jsxs(Group, { "data-testid": "bars", children: [_jsx(BarsTrendline, {}), isStacked
|
|
33
|
+
? (_jsxs(_Fragment, { children: [_jsx(BarsStackSeries, { "data-testid": "bars-stack-series" }), _jsx(BarsStackOverlay, { "data-testid": "bars-overlay" }), _jsx(BarsStackSeriesLabels, {}), _jsx(BarsStackOverlayLabels, {})] }))
|
|
34
|
+
: (_jsxs(_Fragment, { children: [_jsx(BarsSeries, { "data-testid": "bars-series" }), _jsx(BarsOverlay, { "data-testid": "bars-overlay" }), isHorizontal && _jsx(BarsSeriesLabels, {}), isHorizontal && _jsx(BarsOverlayLabels, {})] }))] }));
|
|
35
|
+
};
|
|
36
|
+
BarsLayout.displayName = 'BarsLayout';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bars-overlay-labels.d.ts","sourceRoot":"","sources":["../../../../src/components/shapes/bars/bars-overlay-labels.tsx"],"names":[],"mappings":";AAgCA,eAAO,MAAM,iBAAiB;;;CAiK7B,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2024 Wonderflow Design Team
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { Group } from '@visx/group';
|
|
18
|
+
import { BarGroup, BarGroupHorizontal } from '@visx/shape';
|
|
19
|
+
import _ from 'lodash';
|
|
20
|
+
import { useBars } from '../../../hooks';
|
|
21
|
+
import { extractBarValueFromNestedKey, getBarLabelContent, getBarLabelMorphology, getBarSizeAndPosition, getBarThickness, sortBarsBy, } from '../../../utils';
|
|
22
|
+
import { useStyleConfigContext } from '../../../providers';
|
|
23
|
+
import { BarsLabel } from './bars-label';
|
|
24
|
+
export const BarsOverlayLabels = () => {
|
|
25
|
+
const { bars } = useStyleConfigContext();
|
|
26
|
+
const { barChartLabelsMaxSize, data, isHorizontal, isVertical, fixedBarSize, maxWidth, maxHeight, scaleXY0, scaleXY1, showLabel, sortBy, hasOverlay, hasLabel, overlay, overlayAxis, style, X0Y0, } = useBars();
|
|
27
|
+
const { maxSize } = style;
|
|
28
|
+
const { fontWeight, fontWeightValue } = bars.label;
|
|
29
|
+
if (!hasOverlay || !hasLabel)
|
|
30
|
+
return null;
|
|
31
|
+
if (isVertical) {
|
|
32
|
+
return (_jsx(BarGroupHorizontal, { data: data, keys: overlay.dataKey, width: maxWidth, y0: X0Y0, y0Scale: scaleXY0, y1Scale: scaleXY1, xScale: overlayAxis.scale, color: (_, i) => overlay.colors[i], children: barGroups => barGroups.map((barGroup, i) => {
|
|
33
|
+
const updatedBars = extractBarValueFromNestedKey(barGroup, i, data, overlayAxis.scale, maxWidth, isHorizontal);
|
|
34
|
+
const sortedBars = sortBarsBy(updatedBars, sortBy, isHorizontal);
|
|
35
|
+
return (_jsx(Group, { top: barGroup.y0, children: sortedBars.map((bar, j) => {
|
|
36
|
+
const thickness = getBarThickness(bar.height, maxSize, fixedBarSize);
|
|
37
|
+
const { y } = getBarSizeAndPosition(bar, overlayAxis, thickness, isHorizontal);
|
|
38
|
+
const { value, separator, extra } = getBarLabelContent(data[i], bar, overlay.dataKey[j], overlay.extraData);
|
|
39
|
+
const { text } = getBarLabelMorphology(bar, overlay.extraData, { value, separator, extra }, barChartLabelsMaxSize, thickness, { x: undefined, y }, { xMax: maxWidth, yMax: maxHeight }, isHorizontal);
|
|
40
|
+
const weigth = overlay.extraData ? fontWeightValue : fontWeight;
|
|
41
|
+
return (_jsx(Group, { children: showLabel && (_jsx(BarsLabel, { text: text, value: value, separator: separator, extraData: extra, fontWeightValue: weigth, dataKey: bar.key })) }, _.uniqueId()));
|
|
42
|
+
}) }, _.uniqueId()));
|
|
43
|
+
}) }));
|
|
44
|
+
}
|
|
45
|
+
return (_jsx(BarGroup, { data: data, keys: overlay.dataKey, height: maxHeight, x0: X0Y0, x0Scale: scaleXY0, x1Scale: scaleXY1, yScale: overlayAxis.scale, color: (_, i) => overlay.colors[i], children: barGroups => barGroups.map((barGroup, i) => {
|
|
46
|
+
const updatedBars = extractBarValueFromNestedKey(barGroup, i, data, overlayAxis.scale, maxHeight, isHorizontal);
|
|
47
|
+
const sortedBars = sortBarsBy(updatedBars, sortBy, isHorizontal);
|
|
48
|
+
return (_jsx(Group, { left: barGroup.x0, children: sortedBars.map((bar, j) => {
|
|
49
|
+
const thickness = getBarThickness(bar.width, maxSize, fixedBarSize);
|
|
50
|
+
const { x } = getBarSizeAndPosition(bar, overlayAxis, thickness, isHorizontal);
|
|
51
|
+
const { value, separator, extra } = getBarLabelContent(data[i], bar, overlay.dataKey[j], overlay.extraData);
|
|
52
|
+
const { rect, text } = getBarLabelMorphology(bar, overlay.extraData, { value, separator, extra }, barChartLabelsMaxSize, thickness, { x, y: undefined }, { xMax: maxWidth, yMax: maxHeight }, isHorizontal);
|
|
53
|
+
const weigth = overlay.extraData ? fontWeightValue : fontWeight;
|
|
54
|
+
return (_jsx(Group, { children: showLabel && (_jsx(BarsLabel, { wrapper: {
|
|
55
|
+
x: rect.x ?? 0,
|
|
56
|
+
y: rect.y ?? 0,
|
|
57
|
+
width: rect.width,
|
|
58
|
+
}, text: text, value: value, separator: separator, extraData: extra, fontWeightValue: weigth, dataKey: bar.key })) }, _.uniqueId()));
|
|
59
|
+
}) }, _.uniqueId()));
|
|
60
|
+
}) }));
|
|
61
|
+
};
|
|
62
|
+
BarsOverlayLabels.displayName = 'BarOverlayLabels';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bars-overlay.d.ts","sourceRoot":"","sources":["../../../../src/components/shapes/bars/bars-overlay.tsx"],"names":[],"mappings":";AA8BA,eAAO,MAAM,WAAW;;;CAmJvB,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2024 Wonderflow Design Team
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { Group } from '@visx/group';
|
|
18
|
+
import { Bar, BarGroup, BarGroupHorizontal } from '@visx/shape';
|
|
19
|
+
import _ from 'lodash';
|
|
20
|
+
import { useCallback } from 'react';
|
|
21
|
+
import { useBars } from '../../../hooks';
|
|
22
|
+
import { extractBarValueFromNestedKey, getBarSizeAndPosition, getBarThickness } from '../../../utils';
|
|
23
|
+
import { useCartesianContext, useStyleConfigContext, useThemeContext, } from '../../../providers';
|
|
24
|
+
import { sortBarsBy } from '../../../utils';
|
|
25
|
+
import { BarsItem, BarsItemBlurred } from './bars.module.css';
|
|
26
|
+
export const BarsOverlay = () => {
|
|
27
|
+
const { hoveredLegendItem: overLegend } = useCartesianContext();
|
|
28
|
+
const theme = useThemeContext();
|
|
29
|
+
const { themes } = useStyleConfigContext();
|
|
30
|
+
const { data, isHorizontal, overlay, sortBy, hasBackgroundOverlay, overlayAxis, hasOverlay, maxWidth, maxHeight, X0Y0, scaleXY0, scaleXY1, fixedBarSize, style, } = useBars();
|
|
31
|
+
const { bar: barStyle, background, maxSize } = style;
|
|
32
|
+
const bgColor = themes[theme].bars.backgroundColor;
|
|
33
|
+
const dynamicClassName = useCallback((overLegend, dataKey) => ((overLegend === dataKey || overLegend === '')
|
|
34
|
+
? BarsItem
|
|
35
|
+
: BarsItemBlurred), []);
|
|
36
|
+
if (!hasOverlay)
|
|
37
|
+
return null;
|
|
38
|
+
if (!isHorizontal) {
|
|
39
|
+
return (_jsx(BarGroupHorizontal, { data: data, keys: overlay.dataKey, width: maxWidth, y0: X0Y0, y0Scale: scaleXY0, y1Scale: scaleXY1, xScale: overlayAxis.scale, color: (_, i) => overlay.colors[i], children: barGroups => barGroups.map((barGroup, i) => {
|
|
40
|
+
const updatedBars = extractBarValueFromNestedKey(barGroup, i, data, overlayAxis.scale, maxWidth, isHorizontal);
|
|
41
|
+
const sortedBars = sortBarsBy(updatedBars, sortBy, isHorizontal);
|
|
42
|
+
return (_jsx(Group, { top: barGroup.y0, children: sortedBars.map((bar) => {
|
|
43
|
+
const thickness = getBarThickness(bar.height, maxSize, fixedBarSize);
|
|
44
|
+
const { x, y, width } = getBarSizeAndPosition(bar, overlayAxis, thickness, isHorizontal);
|
|
45
|
+
return (_jsxs(Group, { children: [hasBackgroundOverlay && (_jsx(Bar, { className: dynamicClassName(overLegend, bar.key), x: 0, y: bar.y, width: maxWidth, height: thickness, fill: bgColor, opacity: background.opacity, rx: background.rx })), _jsx(Bar, { className: dynamicClassName(overLegend, bar.key), x: x, y: y, width: width, height: thickness, fill: bar.color, rx: barStyle.rx, opacity: barStyle.opacity, onClick: () => ({}) })] }, _.uniqueId()));
|
|
46
|
+
}) }, _.uniqueId()));
|
|
47
|
+
}) }));
|
|
48
|
+
}
|
|
49
|
+
return (_jsx(BarGroup, { data: data, keys: overlay.dataKey, height: maxHeight, x0: X0Y0, x0Scale: scaleXY0, x1Scale: scaleXY1, yScale: overlayAxis.scale, color: (_, i) => overlay.colors[i], children: barGroups => barGroups.map((barGroup, i) => {
|
|
50
|
+
const updatedBars = extractBarValueFromNestedKey(barGroup, i, data, overlayAxis.scale, maxHeight, isHorizontal);
|
|
51
|
+
const sortedBars = sortBarsBy(updatedBars, sortBy, isHorizontal);
|
|
52
|
+
return (_jsx(Group, { left: barGroup.x0, children: sortedBars.map((bar) => {
|
|
53
|
+
const thickness = getBarThickness(bar.width, maxSize, fixedBarSize);
|
|
54
|
+
const { x, y, height } = getBarSizeAndPosition(bar, overlayAxis, thickness, isHorizontal);
|
|
55
|
+
return (_jsxs(Group, { children: [hasBackgroundOverlay && (_jsx(Bar, { className: dynamicClassName(overLegend, bar.key), x: bar.x, y: 0, width: thickness, height: maxHeight, fill: bgColor, opacity: background.opacity, rx: background.rx })), _jsx(Bar, { className: dynamicClassName(overLegend, bar.key), x: x, y: y, width: thickness, height: height, fill: bar.color, opacity: barStyle.opacity, rx: barStyle.rx, onClick: () => ({}) })] }, _.uniqueId()));
|
|
56
|
+
}) }, _.uniqueId()));
|
|
57
|
+
}) }));
|
|
58
|
+
};
|
|
59
|
+
BarsOverlay.displayName = 'BarOverlay';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bars-series-labels.d.ts","sourceRoot":"","sources":["../../../../src/components/shapes/bars/bars-series-labels.tsx"],"names":[],"mappings":";AAgCA,eAAO,MAAM,gBAAgB;;;CA+J5B,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2024 Wonderflow Design Team
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { Group } from '@visx/group';
|
|
18
|
+
import { BarGroup, BarGroupHorizontal } from '@visx/shape';
|
|
19
|
+
import _ from 'lodash';
|
|
20
|
+
import { useBars } from '../../../hooks';
|
|
21
|
+
import { extractBarValueFromNestedKey, getBarLabelContent, getBarLabelMorphology, getBarSizeAndPosition, getBarThickness, sortBarsBy, } from '../../../utils';
|
|
22
|
+
import { useStyleConfigContext } from '../../../providers';
|
|
23
|
+
import { BarsLabel } from './bars-label';
|
|
24
|
+
export const BarsSeriesLabels = () => {
|
|
25
|
+
const { bars } = useStyleConfigContext();
|
|
26
|
+
const { barChartLabelsMaxSize, data, isHorizontal, isVertical, fixedBarSize, maxWidth, maxHeight, scaleXY0, scaleXY1, series, showLabel, hasLabel, sortBy, seriesAxis, style, X0Y0, } = useBars();
|
|
27
|
+
const { maxSize } = style;
|
|
28
|
+
const { fontWeight, fontWeightValue } = bars.label;
|
|
29
|
+
if (!hasLabel)
|
|
30
|
+
return null;
|
|
31
|
+
if (isVertical) {
|
|
32
|
+
return (_jsx(BarGroupHorizontal, { data: data, keys: series.dataKey, width: maxWidth, y0: X0Y0, y0Scale: scaleXY0, y1Scale: scaleXY1, xScale: seriesAxis.scale, color: (_, i) => series.colors[i], children: barGroups => barGroups.map((barGroup, i) => {
|
|
33
|
+
const updatedBars = extractBarValueFromNestedKey(barGroup, i, data, seriesAxis.scale, maxWidth, isHorizontal);
|
|
34
|
+
const sortedBars = sortBarsBy(updatedBars, sortBy, isHorizontal);
|
|
35
|
+
return (_jsx(Group, { top: barGroup.y0, children: sortedBars.map((bar, j) => {
|
|
36
|
+
const thickness = getBarThickness(bar.height, maxSize, fixedBarSize);
|
|
37
|
+
const { y } = getBarSizeAndPosition(bar, seriesAxis, thickness, isHorizontal);
|
|
38
|
+
const { value, separator, extra } = getBarLabelContent(data[i], bar, series.dataKey[j], series.extraData);
|
|
39
|
+
const { text } = getBarLabelMorphology(bar, series.extraData, { value, separator, extra }, barChartLabelsMaxSize, thickness, { x: undefined, y }, { xMax: maxWidth, yMax: maxHeight }, isHorizontal);
|
|
40
|
+
const weigth = series.extraData ? fontWeightValue : fontWeight;
|
|
41
|
+
return (_jsx(Group, { children: showLabel && (_jsx(BarsLabel, { text: text, value: value, separator: separator, extraData: extra, fontWeightValue: weigth, dataKey: bar.key })) }, _.uniqueId()));
|
|
42
|
+
}) }, _.uniqueId()));
|
|
43
|
+
}) }));
|
|
44
|
+
}
|
|
45
|
+
return (_jsx(BarGroup, { data: data, keys: series.dataKey, height: maxHeight, x0: X0Y0, x0Scale: scaleXY0, x1Scale: scaleXY1, yScale: seriesAxis.scale, color: (_, i) => series.colors[i], children: barGroups => barGroups.map((barGroup, i) => {
|
|
46
|
+
const updatedBars = extractBarValueFromNestedKey(barGroup, i, data, seriesAxis.scale, maxHeight, isHorizontal);
|
|
47
|
+
const sortedBars = sortBarsBy(updatedBars, sortBy, isHorizontal);
|
|
48
|
+
return (_jsx(Group, { left: barGroup.x0, children: sortedBars.map((bar, j) => {
|
|
49
|
+
const thickness = getBarThickness(bar.width, maxSize, fixedBarSize);
|
|
50
|
+
const { x } = getBarSizeAndPosition(bar, seriesAxis, thickness, isHorizontal);
|
|
51
|
+
const { value, separator, extra } = getBarLabelContent(data[i], bar, series.dataKey[j], series.extraData);
|
|
52
|
+
const { rect, text } = getBarLabelMorphology(bar, series.extraData, { value, separator, extra }, barChartLabelsMaxSize, thickness, { x, y: undefined }, { xMax: maxWidth, yMax: maxHeight }, isHorizontal);
|
|
53
|
+
const weigth = series.extraData ? fontWeightValue : fontWeight;
|
|
54
|
+
return (_jsx(Group, { children: showLabel && (_jsx(BarsLabel, { wrapper: {
|
|
55
|
+
x: rect.x ?? 0,
|
|
56
|
+
y: rect.y ?? 0,
|
|
57
|
+
width: rect.width,
|
|
58
|
+
}, text: text, value: value, separator: separator, extraData: extra, fontWeightValue: weigth, dataKey: bar.key })) }, _.uniqueId()));
|
|
59
|
+
}) }, _.uniqueId()));
|
|
60
|
+
}) }));
|
|
61
|
+
};
|
|
62
|
+
BarsSeriesLabels.displayName = 'BarSeriesLabels';
|