@wonderflow/charts 12.10.0 → 13.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.
Files changed (161) hide show
  1. package/dist/components/bar-chart/bar-chart.d.ts +33 -5
  2. package/dist/components/bar-chart/bar-chart.d.ts.map +1 -1
  3. package/dist/components/bar-chart/bar-chart.js +20 -45
  4. package/dist/components/bar-chart/bar-chart.test.js +7 -1
  5. package/dist/components/cartesian-base/cartesian-base-axis.d.ts.map +1 -1
  6. package/dist/components/cartesian-base/cartesian-base-axis.js +10 -11
  7. package/dist/components/cartesian-base/cartesian-base-legend.d.ts.map +1 -1
  8. package/dist/components/cartesian-base/cartesian-base-legend.js +3 -3
  9. package/dist/components/cartesian-base/cartesian-base.d.ts +27 -0
  10. package/dist/components/cartesian-base/cartesian-base.d.ts.map +1 -1
  11. package/dist/components/cartesian-base/cartesian-base.js +7 -3
  12. package/dist/components/cartesian-base/cartesian-base.module.css +1 -1
  13. package/dist/components/headings/headings.d.ts +19 -2
  14. package/dist/components/headings/headings.d.ts.map +1 -1
  15. package/dist/components/headings/headings.js +72 -6
  16. package/dist/components/headings/headings.module.css +1 -0
  17. package/dist/components/headings/headings.test.d.ts +1 -1
  18. package/dist/components/headings/headings.test.d.ts.map +1 -1
  19. package/dist/components/headings/headings.test.js +37 -3
  20. package/dist/components/line-chart/line-chart.d.ts +29 -13
  21. package/dist/components/line-chart/line-chart.d.ts.map +1 -1
  22. package/dist/components/line-chart/line-chart.js +4 -2
  23. package/dist/components/line-chart/line-chart.test.js +2 -2
  24. package/dist/components/loader/bar-chart-loader.d.ts.map +1 -1
  25. package/dist/components/loader/bar-chart-loader.js +1 -1
  26. package/dist/components/loader/loader.js +2 -2
  27. package/dist/components/loader/loader.test.js +4 -2
  28. package/dist/components/shapes/bars/bars-average.d.ts +3 -0
  29. package/dist/components/shapes/bars/bars-average.d.ts.map +1 -0
  30. package/dist/components/shapes/bars/bars-average.js +30 -0
  31. package/dist/components/shapes/bars/bars-overlay.d.ts +6 -0
  32. package/dist/components/shapes/bars/bars-overlay.d.ts.map +1 -0
  33. package/dist/components/shapes/bars/bars-overlay.js +59 -0
  34. package/dist/components/shapes/bars/bars-series.d.ts +6 -0
  35. package/dist/components/shapes/bars/bars-series.d.ts.map +1 -0
  36. package/dist/components/shapes/bars/bars-series.js +56 -0
  37. package/dist/components/shapes/bars/bars-tooltip.d.ts +3 -0
  38. package/dist/components/shapes/bars/bars-tooltip.d.ts.map +1 -0
  39. package/dist/components/shapes/bars/bars-tooltip.js +85 -0
  40. package/dist/components/shapes/bars/bars-trendline.d.ts +3 -0
  41. package/dist/components/shapes/bars/bars-trendline.d.ts.map +1 -0
  42. package/dist/components/shapes/bars/bars-trendline.js +43 -0
  43. package/dist/components/shapes/bars/bars.d.ts.map +1 -1
  44. package/dist/components/shapes/bars/bars.js +25 -18
  45. package/dist/components/shapes/bars/bars.module.css +1 -1
  46. package/dist/components/shapes/bars/bars.test.js +39 -8
  47. package/dist/components/shapes/bars/index.d.ts +5 -0
  48. package/dist/components/shapes/bars/index.d.ts.map +1 -1
  49. package/dist/components/shapes/bars/index.js +6 -1
  50. package/dist/components/shapes/lines/lines-average.d.ts.map +1 -1
  51. package/dist/components/shapes/lines/lines-average.js +8 -46
  52. package/dist/components/shapes/lines/lines-marker-labels.d.ts.map +1 -1
  53. package/dist/components/shapes/lines/lines-marker-labels.js +10 -10
  54. package/dist/components/shapes/lines/lines-overlay.d.ts.map +1 -1
  55. package/dist/components/shapes/lines/lines-overlay.js +21 -26
  56. package/dist/components/shapes/lines/lines-series.d.ts.map +1 -1
  57. package/dist/components/shapes/lines/lines-series.js +6 -19
  58. package/dist/components/shapes/lines/lines-tooltip.d.ts.map +1 -1
  59. package/dist/components/shapes/lines/lines-tooltip.js +20 -27
  60. package/dist/components/shapes/lines/lines-trendline.d.ts +3 -0
  61. package/dist/components/shapes/lines/lines-trendline.d.ts.map +1 -0
  62. package/dist/components/shapes/lines/lines-trendline.js +43 -0
  63. package/dist/components/shapes/lines/lines.d.ts.map +1 -1
  64. package/dist/components/shapes/lines/lines.js +2 -1
  65. package/dist/components/shapes/lines/lines.test.js +29 -8
  66. package/dist/hooks/hooks.test.d.ts.map +1 -1
  67. package/dist/hooks/hooks.test.js +157 -5
  68. package/dist/hooks/index.d.ts +4 -0
  69. package/dist/hooks/index.d.ts.map +1 -1
  70. package/dist/hooks/index.js +4 -0
  71. package/dist/hooks/useAverage.d.ts +82 -0
  72. package/dist/hooks/useAverage.d.ts.map +1 -0
  73. package/dist/hooks/useAverage.js +83 -0
  74. package/dist/hooks/useBarChart.d.ts +16 -0
  75. package/dist/hooks/useBarChart.d.ts.map +1 -0
  76. package/dist/hooks/useBarChart.js +104 -0
  77. package/dist/hooks/useBars.d.ts +52 -0
  78. package/dist/hooks/useBars.d.ts.map +1 -0
  79. package/dist/hooks/useBars.js +82 -0
  80. package/dist/hooks/useCartesian.d.ts +11 -2
  81. package/dist/hooks/useCartesian.d.ts.map +1 -1
  82. package/dist/hooks/useCartesian.js +16 -5
  83. package/dist/hooks/useLineChart.d.ts +3 -27
  84. package/dist/hooks/useLineChart.d.ts.map +1 -1
  85. package/dist/hooks/useLineChart.js +22 -13
  86. package/dist/hooks/useLines.d.ts +48 -0
  87. package/dist/hooks/useLines.d.ts.map +1 -0
  88. package/dist/hooks/useLines.js +70 -0
  89. package/dist/hooks/useTrendline.d.ts +56 -0
  90. package/dist/hooks/useTrendline.d.ts.map +1 -0
  91. package/dist/hooks/useTrendline.js +84 -0
  92. package/dist/providers/cartesian.d.ts +5 -1
  93. package/dist/providers/cartesian.d.ts.map +1 -1
  94. package/dist/providers/cartesian.js +19 -3
  95. package/dist/providers/data.d.ts +6 -7
  96. package/dist/providers/data.d.ts.map +1 -1
  97. package/dist/providers/data.js +4 -3
  98. package/dist/style-config/axis.js +3 -3
  99. package/dist/style-config/bars.d.ts +3 -0
  100. package/dist/style-config/bars.d.ts.map +1 -0
  101. package/dist/style-config/bars.js +33 -0
  102. package/dist/style-config/cartesian.d.ts.map +1 -1
  103. package/dist/style-config/cartesian.js +2 -0
  104. package/dist/style-config/colors.d.ts +1 -4
  105. package/dist/style-config/colors.d.ts.map +1 -1
  106. package/dist/style-config/colors.js +30 -36
  107. package/dist/style-config/headings.d.ts.map +1 -1
  108. package/dist/style-config/headings.js +16 -1
  109. package/dist/style-config/lines.d.ts.map +1 -1
  110. package/dist/style-config/lines.js +6 -0
  111. package/dist/style-config/themes.d.ts.map +1 -1
  112. package/dist/style-config/themes.js +18 -0
  113. package/dist/types/bar-chart.d.ts +20 -15
  114. package/dist/types/bar-chart.d.ts.map +1 -1
  115. package/dist/types/bar-chart.js +1 -39
  116. package/dist/types/bars.d.ts +29 -0
  117. package/dist/types/bars.d.ts.map +1 -0
  118. package/dist/types/bars.js +16 -0
  119. package/dist/types/cartesian.d.ts +3 -0
  120. package/dist/types/cartesian.d.ts.map +1 -1
  121. package/dist/types/headings.d.ts +15 -0
  122. package/dist/types/headings.d.ts.map +1 -1
  123. package/dist/types/headings.js +1 -1
  124. package/dist/types/index.d.ts +3 -0
  125. package/dist/types/index.d.ts.map +1 -1
  126. package/dist/types/index.js +4 -1
  127. package/dist/types/line-chart.d.ts +12 -12
  128. package/dist/types/line-chart.d.ts.map +1 -1
  129. package/dist/types/lines.d.ts +6 -0
  130. package/dist/types/lines.d.ts.map +1 -1
  131. package/dist/types/main.d.ts +14 -1
  132. package/dist/types/main.d.ts.map +1 -1
  133. package/dist/types/themes.d.ts +9 -0
  134. package/dist/types/themes.d.ts.map +1 -1
  135. package/dist/utils/axis.d.ts +12 -2
  136. package/dist/utils/axis.d.ts.map +1 -1
  137. package/dist/utils/axis.js +52 -15
  138. package/dist/utils/axis.test.js +72 -8
  139. package/dist/utils/bars.d.ts +15 -0
  140. package/dist/utils/bars.d.ts.map +1 -0
  141. package/dist/utils/bars.js +71 -0
  142. package/dist/utils/bars.test.d.ts +2 -0
  143. package/dist/utils/bars.test.d.ts.map +1 -0
  144. package/dist/utils/bars.test.js +95 -0
  145. package/dist/utils/data.d.ts +9 -6
  146. package/dist/utils/data.d.ts.map +1 -1
  147. package/dist/utils/data.js +87 -15
  148. package/dist/utils/data.test.js +173 -80
  149. package/dist/utils/format.d.ts +1 -0
  150. package/dist/utils/format.d.ts.map +1 -1
  151. package/dist/utils/format.js +2 -1
  152. package/dist/utils/index.d.ts +1 -0
  153. package/dist/utils/index.d.ts.map +1 -1
  154. package/dist/utils/index.js +2 -1
  155. package/dist/utils/lines.test.js +25 -0
  156. package/dist/utils/metadata.d.ts +7 -8
  157. package/dist/utils/metadata.d.ts.map +1 -1
  158. package/dist/utils/metadata.js +3 -20
  159. package/dist/utils/metadata.test.js +3 -56
  160. package/dist/utils/viewport.test.js +8 -0
  161. package/package.json +4 -2
@@ -1,4 +1,5 @@
1
1
  export * from './axis';
2
+ export * from './bars';
2
3
  export * from './colors';
3
4
  export * from './data';
4
5
  export * from './format';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAgBA,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAgBA,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Wonderflow Design Team
2
+ * Copyright 2023-2024 Wonderflow Design Team
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -14,6 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export * from './axis';
17
+ export * from './bars';
17
18
  export * from './colors';
18
19
  export * from './data';
19
20
  export * from './format';
@@ -3,6 +3,11 @@ import { themes } from '../style-config';
3
3
  import { computeAxisProperties } from './axis';
4
4
  import { accessor, accessorInvert, bisectIndex, createSubArrays, createSubPaths, getCoordinates, getLinesRenderer, getMarkerLabelProps, isMarkerLabelVisible, } from './lines';
5
5
  describe('accessor()', () => {
6
+ const config = {
7
+ hasReversedIndex: false,
8
+ hasMirroredDomainsHorizontal: false,
9
+ hasMirroredDomainsVertical: false,
10
+ };
6
11
  it('should return an integer for linear scale', () => {
7
12
  const axis = {
8
13
  domain: [0, 100],
@@ -19,6 +24,7 @@ describe('accessor()', () => {
19
24
  positionRight: 2,
20
25
  positionBottom: 3,
21
26
  positionLeft: 4,
27
+ config,
22
28
  });
23
29
  const res = accessor(cartesian, 'value', { value: 50 });
24
30
  const exp = 400;
@@ -40,6 +46,7 @@ describe('accessor()', () => {
40
46
  positionRight: 2,
41
47
  positionBottom: 3,
42
48
  positionLeft: 4,
49
+ config,
43
50
  });
44
51
  const res = accessor(cartesian, 'date', { date: '01-01-2021' });
45
52
  const exp = 401;
@@ -61,6 +68,7 @@ describe('accessor()', () => {
61
68
  positionRight: 2,
62
69
  positionBottom: 3,
63
70
  positionLeft: 4,
71
+ config,
64
72
  });
65
73
  const res = accessor(cartesian, 'date', { date: '01-01-2021' });
66
74
  const exp = 400;
@@ -82,6 +90,7 @@ describe('accessor()', () => {
82
90
  positionRight: 2,
83
91
  positionBottom: 3,
84
92
  positionLeft: 4,
93
+ config,
85
94
  });
86
95
  const res = accessor(cartesian, 'date', { date: undefined });
87
96
  const exp = undefined;
@@ -89,6 +98,11 @@ describe('accessor()', () => {
89
98
  });
90
99
  });
91
100
  describe('accessorInvert()', () => {
101
+ const config = {
102
+ hasReversedIndex: false,
103
+ hasMirroredDomainsHorizontal: false,
104
+ hasMirroredDomainsVertical: false,
105
+ };
92
106
  it('should return the correct value from domain - top axis', () => {
93
107
  const axis = {
94
108
  domain: [0, 100],
@@ -105,6 +119,7 @@ describe('accessorInvert()', () => {
105
119
  positionRight: 2,
106
120
  positionBottom: 3,
107
121
  positionLeft: 4,
122
+ config,
108
123
  });
109
124
  const res = accessorInvert(cartesian, 400);
110
125
  const exp = 49.5;
@@ -126,6 +141,7 @@ describe('accessorInvert()', () => {
126
141
  positionRight: 2,
127
142
  positionBottom: 3,
128
143
  positionLeft: 4,
144
+ config,
129
145
  });
130
146
  const res = accessorInvert(cartesian, 300);
131
147
  const exp = 50;
@@ -147,6 +163,7 @@ describe('accessorInvert()', () => {
147
163
  positionRight: 2,
148
164
  positionBottom: 3,
149
165
  positionLeft: 4,
166
+ config,
150
167
  });
151
168
  const res = accessorInvert(cartesian, 400);
152
169
  const exp = 'c';
@@ -168,6 +185,7 @@ describe('accessorInvert()', () => {
168
185
  positionRight: 2,
169
186
  positionBottom: 3,
170
187
  positionLeft: 4,
188
+ config,
171
189
  });
172
190
  const res = accessorInvert(cartesian, 350);
173
191
  const exp = 'b';
@@ -197,6 +215,11 @@ describe('getCoordinates()', () => {
197
215
  scaleType: 'linear',
198
216
  orientation: 'left',
199
217
  };
218
+ const config = {
219
+ hasReversedIndex: false,
220
+ hasMirroredDomainsHorizontal: false,
221
+ hasMirroredDomainsVertical: false,
222
+ };
200
223
  const i = computeAxisProperties({
201
224
  axis: indexAxis,
202
225
  maxRangeX: 800,
@@ -205,6 +228,7 @@ describe('getCoordinates()', () => {
205
228
  positionRight: 2,
206
229
  positionBottom: 3,
207
230
  positionLeft: 4,
231
+ config,
208
232
  });
209
233
  const s = computeAxisProperties({
210
234
  axis: seriesAxis,
@@ -214,6 +238,7 @@ describe('getCoordinates()', () => {
214
238
  positionRight: 2,
215
239
  positionBottom: 3,
216
240
  positionLeft: 4,
241
+ config,
217
242
  });
218
243
  it('should return data - horizontal', () => {
219
244
  const res = getCoordinates({
@@ -1,9 +1,8 @@
1
- import { LineChartOverlay, LineChartSeries } from '../types';
2
- import { BarChartOverlay, BarChartSeries } from '../types/bar-chart';
3
- export declare const handleSeriesNames: (series: LineChartSeries | BarChartSeries) => string[];
4
- export declare const handleLineChartSeriesColors: (series: LineChartSeries, palette: string[]) => (string | undefined)[];
5
- export declare const handleBarChartSeriesColors: (series: BarChartSeries, palette: string[]) => (string | undefined)[];
6
- export declare const handleOverlayName: (overlay: LineChartOverlay | BarChartOverlay | undefined) => string;
7
- export declare const handleLineChartOverlayColor: (overlay: LineChartOverlay | undefined, palette: string) => string;
8
- export declare const handleBarChartOverlayColor: (overlay: BarChartOverlay | undefined, palette: string) => string;
1
+ import { LineChartSeries } from '../types';
2
+ import { BarChartSeries } from '../types/bar-chart';
3
+ declare type ChartSeries = LineChartSeries | BarChartSeries;
4
+ export declare const handleSeriesNames: (series: ChartSeries) => string[];
5
+ export declare const handleLineChartSeriesColors: (series: LineChartSeries, palette: string[]) => string[];
6
+ export declare const handleBarChartSeriesColors: (series: BarChartSeries, palette: string[]) => string[];
7
+ export {};
9
8
  //# sourceMappingURL=metadata.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/utils/metadata.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGrE,eAAO,MAAM,iBAAiB,WACpB,eAAe,GAAG,cAAc,aAIxC,CAAC;AAEH,eAAO,MAAM,2BAA2B,WAC9B,eAAe,WACd,MAAM,EAAE,2BAKjB,CAAC;AAEH,eAAO,MAAM,0BAA0B,WAC7B,cAAc,WACb,MAAM,EAAE,2BAKjB,CAAC;AAEH,eAAO,MAAM,iBAAiB,YAAa,gBAAgB,GAAG,eAAe,GAAE,SAAS,WASvF,CAAC;AAEF,eAAO,MAAM,2BAA2B,YAC7B,gBAAgB,GAAG,SAAS,WAC5B,MAAM,WACqB,CAAC;AAEvC,eAAO,MAAM,0BAA0B,YAC5B,eAAe,GAAG,SAAS,WAC3B,MAAM,WACmB,CAAC"}
1
+ {"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/utils/metadata.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,aAAK,WAAW,GAAG,eAAe,GAAG,cAAc,CAAC;AAEpD,eAAO,MAAM,iBAAiB,WACpB,WAAW,aAInB,CAAC;AAEH,eAAO,MAAM,2BAA2B,WAC9B,eAAe,WACd,MAAM,EAAE,aAGjB,CAAC;AAEH,eAAO,MAAM,0BAA0B,WAC7B,cAAc,WACb,MAAM,EAAE,aAGjB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Wonderflow Design Team
2
+ * Copyright 2023-2024 Wonderflow Design Team
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -19,22 +19,5 @@ export const handleSeriesNames = (series) => series.dataKey.map((s, i) => {
19
19
  const renamed = series.rename ? series.rename(s, i) : getLabelFromPath(s);
20
20
  return _.startCase(renamed);
21
21
  });
22
- export const handleLineChartSeriesColors = (series, palette) => series.dataKey.map((_, i) => (series.style?.[i]
23
- ? series.style[i]?.stroke
24
- : palette[i % palette.length]));
25
- export const handleBarChartSeriesColors = (series, palette) => series.dataKey.map((_, i) => (series.style?.[i]
26
- ? series.style[i]?.fill
27
- : palette[i % palette.length]));
28
- export const handleOverlayName = (overlay) => {
29
- if (overlay) {
30
- const { rename, label, dataKey } = overlay;
31
- if (rename)
32
- return rename;
33
- if (label)
34
- return _.startCase(label);
35
- return _.startCase(dataKey);
36
- }
37
- return '';
38
- };
39
- export const handleLineChartOverlayColor = (overlay, palette) => overlay?.style?.stroke ?? palette;
40
- export const handleBarChartOverlayColor = (overlay, palette) => overlay?.style?.fill ?? palette;
22
+ export const handleLineChartSeriesColors = (series, palette) => series.dataKey.map((_, i) => (series.style?.[i]?.stroke ?? palette[i % palette.length]));
23
+ export const handleBarChartSeriesColors = (series, palette) => series.dataKey.map((_, i) => (series.style?.[i]?.fill ?? palette[i % palette.length]));
@@ -1,5 +1,5 @@
1
- import { defaultLineChartPalette } from '../style-config';
2
- import { handleLineChartOverlayColor, handleLineChartSeriesColors, handleOverlayName, handleSeriesNames, } from './metadata';
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 = {
@@ -20,7 +20,7 @@ describe('handleSeriesNames()', () => {
20
20
  });
21
21
  });
22
22
  describe('handleLineChartSeriesColors()', () => {
23
- const colors = defaultLineChartPalette.light.series;
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": "12.10.0",
3
+ "version": "13.0.0",
4
4
  "description": "Wonderflow's Wanda Design System Charting Library",
5
5
  "author": "Wonderflow Design Team",
6
6
  "contributors": [
@@ -62,11 +62,12 @@
62
62
  "@babel/core": "7.19.3",
63
63
  "@babel/preset-typescript": "7.18.6",
64
64
  "@types/d3": "7.4.3",
65
+ "@types/lodash": "4.14.202",
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
69
  "@types/uuid": "9.0.7",
69
- "@wonderflow/config": "12.10.0",
70
+ "@wonderflow/config": "13.0.0",
70
71
  "babel-loader": "8.2.5",
71
72
  "cpy-cli": "3.1.1",
72
73
  "postcss": "8.4.32",
@@ -100,6 +101,7 @@
100
101
  "d3": "7.8.5",
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"