@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,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { colorPaletteDefault } from '../style-config/colors';
|
|
2
|
+
import { handleLineChartSeriesColors, handleSeriesNames, } from './metadata';
|
|
3
3
|
describe('handleSeriesNames()', () => {
|
|
4
4
|
it('should return formatted labels', () => {
|
|
5
5
|
const series = {
|
|
@@ -12,15 +12,15 @@ describe('handleSeriesNames()', () => {
|
|
|
12
12
|
it('should return renamed labels', () => {
|
|
13
13
|
const series = {
|
|
14
14
|
dataKey: ['test1', 'test2'],
|
|
15
|
-
rename:
|
|
15
|
+
rename: k => k.replace('test', 'item'),
|
|
16
16
|
};
|
|
17
17
|
const res = handleSeriesNames(series);
|
|
18
|
-
const exp = ['
|
|
18
|
+
const exp = ['Item 1', 'Item 2'];
|
|
19
19
|
expect(res).toStrictEqual(exp);
|
|
20
20
|
});
|
|
21
21
|
});
|
|
22
22
|
describe('handleLineChartSeriesColors()', () => {
|
|
23
|
-
const colors =
|
|
23
|
+
const colors = colorPaletteDefault.light;
|
|
24
24
|
it('should return custom styled color', () => {
|
|
25
25
|
const series = {
|
|
26
26
|
dataKey: ['test1', 'test2'],
|
|
@@ -47,56 +47,3 @@ describe('handleLineChartSeriesColors()', () => {
|
|
|
47
47
|
expect(res).toStrictEqual(exp);
|
|
48
48
|
});
|
|
49
49
|
});
|
|
50
|
-
describe('handleOverlayName()', () => {
|
|
51
|
-
it('should return default formatted datakey', () => {
|
|
52
|
-
const overlay = {
|
|
53
|
-
dataKey: 'test',
|
|
54
|
-
};
|
|
55
|
-
const res = handleOverlayName(overlay);
|
|
56
|
-
const exp = 'Test';
|
|
57
|
-
expect(res).toStrictEqual(exp);
|
|
58
|
-
});
|
|
59
|
-
it('should return preferred formatted labels', () => {
|
|
60
|
-
const overlay = {
|
|
61
|
-
dataKey: 'test',
|
|
62
|
-
label: 'best',
|
|
63
|
-
};
|
|
64
|
-
const res = handleOverlayName(overlay);
|
|
65
|
-
const exp = 'Best';
|
|
66
|
-
expect(res).toStrictEqual(exp);
|
|
67
|
-
});
|
|
68
|
-
it('should return renamed labels', () => {
|
|
69
|
-
const overlay = {
|
|
70
|
-
dataKey: 'test',
|
|
71
|
-
rename: 'fest',
|
|
72
|
-
};
|
|
73
|
-
const res = handleOverlayName(overlay);
|
|
74
|
-
const exp = 'fest';
|
|
75
|
-
expect(res).toStrictEqual(exp);
|
|
76
|
-
});
|
|
77
|
-
it('should return empty string w/o overlay', () => {
|
|
78
|
-
const res = handleOverlayName(undefined);
|
|
79
|
-
const exp = '';
|
|
80
|
-
expect(res).toStrictEqual(exp);
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
describe('handleLineChartOverlayColor()', () => {
|
|
84
|
-
const colors = defaultLineChartPalette.light.overlay;
|
|
85
|
-
it('should return the default color', () => {
|
|
86
|
-
const overlay = {
|
|
87
|
-
dataKey: 'test',
|
|
88
|
-
};
|
|
89
|
-
const res = handleLineChartOverlayColor(overlay, colors);
|
|
90
|
-
const exp = 'hsl(14 63% 53%)';
|
|
91
|
-
expect(res).toStrictEqual(exp);
|
|
92
|
-
});
|
|
93
|
-
it('should return a custom styled color', () => {
|
|
94
|
-
const overlay = {
|
|
95
|
-
dataKey: 'test',
|
|
96
|
-
style: { stroke: 'salmon' },
|
|
97
|
-
};
|
|
98
|
-
const res = handleLineChartOverlayColor(overlay, colors);
|
|
99
|
-
const exp = 'salmon';
|
|
100
|
-
expect(res).toStrictEqual(exp);
|
|
101
|
-
});
|
|
102
|
-
});
|
|
@@ -2,6 +2,11 @@ import { viewportStyleConfig } from '../style-config';
|
|
|
2
2
|
import { computeAxisProperties } from './axis';
|
|
3
3
|
import { manageViewport } from './viewport';
|
|
4
4
|
describe('manageViewport()', () => {
|
|
5
|
+
const config = {
|
|
6
|
+
hasReversedIndex: false,
|
|
7
|
+
hasMirroredDomainsHorizontal: false,
|
|
8
|
+
hasMirroredDomainsVertical: false,
|
|
9
|
+
};
|
|
5
10
|
it('should return correct number of ticks - horizontal/linear', () => {
|
|
6
11
|
const axis = {
|
|
7
12
|
domain: [0, 1],
|
|
@@ -16,6 +21,7 @@ describe('manageViewport()', () => {
|
|
|
16
21
|
positionRight: 2,
|
|
17
22
|
positionBottom: 3,
|
|
18
23
|
positionLeft: 4,
|
|
24
|
+
config,
|
|
19
25
|
});
|
|
20
26
|
const res = manageViewport(800, 600, cartesian, viewportStyleConfig);
|
|
21
27
|
const exp = { numTicks: 10 };
|
|
@@ -35,6 +41,7 @@ describe('manageViewport()', () => {
|
|
|
35
41
|
positionRight: 2,
|
|
36
42
|
positionBottom: 3,
|
|
37
43
|
positionLeft: 4,
|
|
44
|
+
config,
|
|
38
45
|
});
|
|
39
46
|
const res = manageViewport(800, 600, cartesian, viewportStyleConfig);
|
|
40
47
|
const exp = { numTicks: 2 };
|
|
@@ -55,6 +62,7 @@ describe('manageViewport()', () => {
|
|
|
55
62
|
positionRight: 2,
|
|
56
63
|
positionBottom: 3,
|
|
57
64
|
positionLeft: 4,
|
|
65
|
+
config,
|
|
58
66
|
});
|
|
59
67
|
const res = manageViewport(800, 600, cartesian, viewportStyleConfig);
|
|
60
68
|
const exp = { numTicks: 10 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wonderflow/charts",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.0.0",
|
|
4
4
|
"description": "Wonderflow's Wanda Design System Charting Library",
|
|
5
5
|
"author": "Wonderflow Design Team",
|
|
6
6
|
"contributors": [
|
|
@@ -59,28 +59,29 @@
|
|
|
59
59
|
"react-dom": ">=17.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@babel/core": "7.
|
|
63
|
-
"@babel/preset-typescript": "7.
|
|
62
|
+
"@babel/core": "7.24.3",
|
|
63
|
+
"@babel/preset-typescript": "7.24.1",
|
|
64
64
|
"@types/d3": "7.4.3",
|
|
65
|
+
"@types/lodash": "4.17.0",
|
|
65
66
|
"@types/react": "17.0.43",
|
|
66
67
|
"@types/react-dom": "17.0.14",
|
|
67
68
|
"@types/react-test-renderer": "18.0.7",
|
|
68
|
-
"@types/uuid": "9.0.
|
|
69
|
-
"@wonderflow/config": "
|
|
69
|
+
"@types/uuid": "9.0.8",
|
|
70
|
+
"@wonderflow/config": "14.0.0",
|
|
70
71
|
"babel-loader": "8.2.5",
|
|
71
72
|
"cpy-cli": "3.1.1",
|
|
72
|
-
"postcss": "8.4.
|
|
73
|
+
"postcss": "8.4.38",
|
|
73
74
|
"postcss-cli": "10.0.0",
|
|
74
75
|
"react": "17.0.2",
|
|
75
76
|
"react-dom": "17.0.2",
|
|
76
77
|
"tsconfig": "10.0.0",
|
|
77
|
-
"typed-css-modules": "0.
|
|
78
|
+
"typed-css-modules": "0.9.1",
|
|
78
79
|
"typescript": "4.8.4",
|
|
79
80
|
"typescript-plugin-css-modules": "3.4.0"
|
|
80
81
|
},
|
|
81
82
|
"dependencies": {
|
|
82
83
|
"@visx/annotation": "3.3.0",
|
|
83
|
-
"@visx/axis": "3.
|
|
84
|
+
"@visx/axis": "3.10.1",
|
|
84
85
|
"@visx/brush": "3.6.1",
|
|
85
86
|
"@visx/clip-path": "3.3.0",
|
|
86
87
|
"@visx/curve": "3.3.0",
|
|
@@ -89,17 +90,18 @@
|
|
|
89
90
|
"@visx/grid": "3.5.0",
|
|
90
91
|
"@visx/group": "3.3.0",
|
|
91
92
|
"@visx/mock-data": "3.3.0",
|
|
92
|
-
"@visx/responsive": "3.
|
|
93
|
+
"@visx/responsive": "3.10.2",
|
|
93
94
|
"@visx/scale": "3.5.0",
|
|
94
95
|
"@visx/shape": "3.5.0",
|
|
95
96
|
"@visx/text": "3.3.0",
|
|
96
97
|
"@visx/tooltip": "3.3.0",
|
|
97
98
|
"@visx/vendor": "3.5.0",
|
|
98
|
-
"ahooks": "3.7.
|
|
99
|
+
"ahooks": "3.7.10",
|
|
99
100
|
"clsx": "1.2.1",
|
|
100
|
-
"d3": "7.
|
|
101
|
+
"d3": "7.9.0",
|
|
101
102
|
"framer-motion": "6.5.1",
|
|
102
103
|
"lodash": "4.17.21",
|
|
104
|
+
"ml-regression-simple-linear": "3.0.0",
|
|
103
105
|
"react-merge-refs": "2.1.1",
|
|
104
106
|
"type-fest": "3.0.0",
|
|
105
107
|
"uuid": "9.0.1"
|