@oliasoft-open-source/charts-library 3.3.6-beta-4 → 3.3.6-beta-5

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 (99) hide show
  1. package/index.js +14 -0
  2. package/package.json +1 -6
  3. package/release-notes.md +378 -0
  4. package/src/assets/circle.svg +1 -0
  5. package/src/assets/icons/line-and-point.svg +1 -0
  6. package/src/assets/icons/line-only.svg +1 -0
  7. package/src/assets/icons/list-hide.svg +1 -0
  8. package/src/assets/icons/point-only.svg +1 -0
  9. package/src/assets/rect.svg +1 -0
  10. package/src/assets/rectRot.svg +1 -0
  11. package/src/assets/triangle.svg +1 -0
  12. package/src/components/bar-chart/bar-chart-prop-types.js +209 -0
  13. package/src/components/bar-chart/bar-chart.interface.ts +98 -0
  14. package/src/components/bar-chart/bar-chart.jsx +247 -0
  15. package/src/components/bar-chart/bar-chart.module.less +61 -0
  16. package/src/components/bar-chart/get-bar-chart-data-labels.js +42 -0
  17. package/src/components/bar-chart/get-bar-chart-scales.js +138 -0
  18. package/src/components/bar-chart/get-bar-chart-tooltips.js +102 -0
  19. package/src/components/controls/axes-options/axes-options.jsx +271 -0
  20. package/src/components/line-chart/constants/default-translations.js +24 -0
  21. package/src/components/line-chart/constants/line-chart-consts.js +12 -0
  22. package/src/components/line-chart/controls/axes-options/action-types.js +5 -0
  23. package/src/components/line-chart/controls/axes-options/axes-options-form-state.js +97 -0
  24. package/src/components/line-chart/controls/controls-portal.jsx +12 -0
  25. package/src/components/line-chart/controls/controls.jsx +176 -0
  26. package/src/components/line-chart/controls/controls.module.less +12 -0
  27. package/src/components/line-chart/controls/drag-options.jsx +124 -0
  28. package/src/components/line-chart/controls/line-options.jsx +64 -0
  29. package/src/components/line-chart/hooks/use-chart-functions.js +261 -0
  30. package/src/components/line-chart/hooks/use-chart-options.js +181 -0
  31. package/src/components/line-chart/hooks/use-chart-plugins.js +35 -0
  32. package/src/components/line-chart/hooks/use-toggle-handler.js +33 -0
  33. package/src/components/line-chart/initialize/config.js +23 -0
  34. package/src/components/line-chart/initialize/initialize-line-chart.js +25 -0
  35. package/src/components/line-chart/legend/legend-constants.js +1 -0
  36. package/src/components/line-chart/legend/legend-dropzone.jsx +74 -0
  37. package/src/components/line-chart/legend/legend-item.jsx +105 -0
  38. package/src/components/line-chart/legend/legend-panel.jsx +86 -0
  39. package/src/components/line-chart/legend/legend.jsx +54 -0
  40. package/src/components/line-chart/legend/legend.module.less +192 -0
  41. package/src/components/line-chart/line-chart-prop-types.js +298 -0
  42. package/src/components/line-chart/line-chart.interface.ts +128 -0
  43. package/src/components/line-chart/line-chart.jsx +180 -0
  44. package/src/components/line-chart/line-chart.module.less +78 -0
  45. package/src/components/line-chart/plugins/chart-area-text-plugin.js +246 -0
  46. package/src/components/line-chart/plugins/line-chart.minor-gridlines-plugin.js +88 -0
  47. package/src/components/line-chart/plugins/plugin-constants.js +11 -0
  48. package/src/components/line-chart/state/action-types.js +12 -0
  49. package/src/components/line-chart/state/initial-state.js +89 -0
  50. package/src/components/line-chart/state/line-chart-reducer.js +101 -0
  51. package/src/components/line-chart/state/manage-state-in-local-storage.js +86 -0
  52. package/src/components/line-chart/state/use-chart-state.js +141 -0
  53. package/src/components/line-chart/utils/axis-formatting/axis-formatting.js +69 -0
  54. package/src/components/line-chart/utils/axis-scales/axis-scales.js +165 -0
  55. package/src/components/line-chart/utils/datalabels-alignment/get-alignment-condition.js +13 -0
  56. package/src/components/line-chart/utils/datalabels-alignment/get-alignment-data.js +20 -0
  57. package/src/components/line-chart/utils/datalabels-alignment/get-datalabels-position.js +25 -0
  58. package/src/components/line-chart/utils/generate-line-chart-datasets.js +122 -0
  59. package/src/components/line-chart/utils/get-axes-ranges-from-chart.js +13 -0
  60. package/src/components/line-chart/utils/get-line-chart-data-labels.js +21 -0
  61. package/src/components/line-chart/utils/get-line-chart-scales.js +117 -0
  62. package/src/components/line-chart/utils/get-line-chart-tooltips.js +94 -0
  63. package/src/components/line-chart/utils/line-chart-utils.js +62 -0
  64. package/src/components/line-chart/utils/translations/get-translations.js +17 -0
  65. package/src/components/pie-chart/pie-chart-prop-types.js +111 -0
  66. package/src/components/pie-chart/pie-chart-utils.js +32 -0
  67. package/src/components/pie-chart/pie-chart.interface.ts +61 -0
  68. package/src/components/pie-chart/pie-chart.jsx +458 -0
  69. package/src/components/pie-chart/pie-chart.module.less +61 -0
  70. package/src/components/scatter-chart/scatter-chart.intefrace.ts +33 -0
  71. package/src/components/scatter-chart/scatter-chart.jsx +21 -0
  72. package/src/components/scatter-chart/scatter-chart.module.less +4 -0
  73. package/src/helpers/chart-border-plugin.js +19 -0
  74. package/src/helpers/chart-consts.js +64 -0
  75. package/src/helpers/chart-interface.ts +94 -0
  76. package/src/helpers/chart-utils.js +178 -0
  77. package/src/helpers/container.jsx +60 -0
  78. package/src/helpers/disabled-context.js +8 -0
  79. package/src/helpers/enums.js +107 -0
  80. package/src/helpers/get-chart-annotation.js +102 -0
  81. package/src/helpers/get-custom-legend-plugin-example.js +80 -0
  82. package/src/helpers/get-draggableData.js +32 -0
  83. package/src/helpers/range/estimate-data-series-have-close-values.js +54 -0
  84. package/src/helpers/range/range.js +100 -0
  85. package/src/helpers/text.js +6 -0
  86. package/src/style/external.less +4 -0
  87. package/src/style/fonts/lato/Lato-Bold.woff2 +0 -0
  88. package/src/style/fonts/lato/Lato-BoldItalic.woff2 +0 -0
  89. package/src/style/fonts/lato/Lato-Italic.woff2 +0 -0
  90. package/src/style/fonts/lato/Lato-Regular.woff2 +0 -0
  91. package/src/style/fonts.less +27 -0
  92. package/src/style/global.less +43 -0
  93. package/src/style/reset/reset.less +28 -0
  94. package/src/style/shared.less +11 -0
  95. package/src/style/variables.less +91 -0
  96. package/vite.config.mjs +49 -0
  97. package/vitest.config.mjs +8 -0
  98. package/dist/index.js +0 -39230
  99. package/dist/index.js.map +0 -1
package/index.js ADDED
@@ -0,0 +1,14 @@
1
+ /*
2
+ Components
3
+ */
4
+
5
+ import ScatterChart from './src/components/scatter-chart/scatter-chart';
6
+
7
+ export { LineChart } from './src/components/line-chart/line-chart';
8
+ export { initializeLineChart } from './src/components/line-chart/initialize/initialize-line-chart';
9
+
10
+ export { PieChart } from './src/components/pie-chart/pie-chart';
11
+
12
+ export { BarChart } from './src/components/bar-chart/bar-chart';
13
+
14
+ export { ScatterChart };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/charts-library",
3
- "version": "3.3.6-beta-4",
3
+ "version": "3.3.6-beta-5",
4
4
  "description": "React Chart Library (based on Chart.js and react-chart-js-2)",
5
5
  "homepage": "https://gitlab.com/oliasoft-open-source/charts-library",
6
6
  "bugs": {
@@ -12,11 +12,6 @@
12
12
  },
13
13
  "license": "MIT",
14
14
  "author": "Oliasoft AS and contributors",
15
- "main": "./dist/index.js",
16
- "module": "./dist/index.js",
17
- "files": [
18
- "dist"
19
- ],
20
15
  "scripts": {
21
16
  "build": "yarn run build:storybook",
22
17
  "build:package": "vite build --config vite.config.mjs",
@@ -0,0 +1,378 @@
1
+ # Charts Library Release Notes
2
+
3
+ ## 3.3.5
4
+
5
+ - Upgrade version of units package to resolve number display bugs
6
+
7
+ ## 3.3.4
8
+
9
+ - Fixed legends hidden by default
10
+
11
+ ## 3.3.3
12
+
13
+ - Update legend layout on chart resize ([OW-12426](https://oliasoft.atlassian.net/browse/OW-12426))
14
+
15
+ ## 3.3.2
16
+
17
+ - Fixed rounding in pie chart tooltips [OW-12129](https://oliasoft.atlassian.net/browse/OW-12129)
18
+
19
+ ## 3.3.1
20
+
21
+ - Fix annotation error in PieChart
22
+
23
+ ## 3.3.0
24
+
25
+ - Draggable on-canvas legend [OW-11861](https://oliasoft.atlassian.net/browse/OW-11861)
26
+
27
+ ## 3.2.5
28
+
29
+ - Fix bug in where reseting axes in linechart made the units selectors disappear. ([OW-12370](https://oliasoft.atlassian.net/browse/OW-12370))
30
+
31
+ ## 3.2.4
32
+
33
+ - improve axis tick label number formatting (upstream fixes from units package) ([OW-12287](https://oliasoft.atlassian.net/browse/OW-12287))
34
+
35
+ ## 3.2.3
36
+
37
+ - Updated zoom/pan button style to match other buttons [OW-11866](https://oliasoft.atlassian.net/browse/OW-11866)
38
+
39
+ ## 3.2.2
40
+
41
+ - Added option to portal controls outside of chart ([OW-11865](https://oliasoft.atlassian.net/browse/OW-11865))
42
+
43
+ ## 3.2.1
44
+
45
+ - Fix "ghost"-axis bug in multi-axis charts [OW-12061](https://oliasoft.atlassian.net/browse/OW-12061)
46
+
47
+ ## 3.2.0
48
+
49
+ - Added sourcemap for building the package ([OW-12175](https://oliasoft.atlassian.net/browse/OW-12175))
50
+
51
+ ## 3.1.0
52
+
53
+ - Improve axis tick number formatting ([OW-9589](https://oliasoft.atlassian.net/browse/OW-9589))
54
+
55
+ ## 3.0.4
56
+
57
+ - Updated UI Library to fix custom SVG handling ([OW-12065](https://oliasoft.atlassian.net/browse/OW-12065))
58
+
59
+ ## 3.0.3
60
+
61
+ - add axis label formatting test case stories
62
+
63
+ ## 3.0.2
64
+
65
+ - Fix `dependencies` and `peerDependencies` ([OW-12046](https://oliasoft.atlassian.net/browse/OW-12046))
66
+
67
+ ## 3.0.1
68
+
69
+ - upgrade version of `react-ui-library` to resolve a `NumberInput` bug ([OW-12040](https://oliasoft.atlassian.net/browse/OW-12040))
70
+
71
+ ## 3.0.0
72
+
73
+ - Switched over to Vite and Vitest.
74
+ ([OW-11983](https://oliasoft.atlassian.net/browse/OW-11983))
75
+
76
+ ## 2.17.6
77
+
78
+ - Fix `NumberInput` bug that prevented users typing decimal values with trailing zeros in charts controls
79
+ ([OW-11920](https://oliasoft.atlassian.net/browse/OW-11920))
80
+
81
+ ## 2.17.5
82
+
83
+ - Support disabling `usePointStyle` to show dashed lines in legend ([OW-11786](https://oliasoft.atlassian.net/browse/OW-11786))
84
+
85
+ ## 2.17.4
86
+
87
+ - Use new `<NumberInput>` component from GUI Library in charts controls, to simplify validation ([OW-11773](https://oliasoft.atlassian.net/browse/OW-11773))
88
+
89
+ ## 2.17.3
90
+
91
+ - Replace legacy internal implementation of `isEqualWithTolerance` with `isCloseTo` from units package ([OW-11767](https://oliasoft.atlassian.net/browse/OW-11767))
92
+
93
+ ## 2.17.2
94
+
95
+ - Fix release CI/CD pipeline ([OW-11691](https://oliasoft.atlassian.net/browse/OW-11691))
96
+
97
+ ## 2.17.1
98
+
99
+ - Added debounce to prevent maximum call stack size exceeded
100
+
101
+ ## 2.17.0
102
+
103
+ - Added initialize logic, for improve translations
104
+
105
+ ## 2.16.0
106
+
107
+ - Added common chart area text plugin
108
+
109
+ ## 2.15.0
110
+
111
+ - Added translation, by provider handled([OW-11237](https://oliasoft.atlassian.net/browse/OW-11237))
112
+
113
+ ## 2.14.1
114
+
115
+ - Fix save initAxesRange when dataset changed by parent component([OW-11332](https://oliasoft.atlassian.net/browse/OW-11332))
116
+
117
+ ## 2.14.0
118
+
119
+ - Refactored line chart, for better performance, readable and reduce not needed re-renders
120
+
121
+ ## 2.13.5
122
+
123
+ - Fixed reset range when subComponent update data, prevent extra re-renders when range have same deep values but different reference
124
+
125
+ ## 2.13.4
126
+
127
+ - Fixed legend state
128
+
129
+ ## 2.13.3
130
+
131
+ - Added story for point styling to support ([OW-11107](https://oliasoft.atlassian.net/browse/OW-11107))
132
+
133
+ ## 2.13.2
134
+
135
+ - Changed default value for zoom to true
136
+
137
+ ## 2.13.1
138
+
139
+ - Text label for drag options trigger, to make current behaviour more obvious ([OW-11102](https://oliasoft.atlassian.net/browse/OW-11102))
140
+
141
+ ## 2.13.0
142
+
143
+ - Added feature to save state to localStorage and clean when expired, fixed panEnable(state) bug.
144
+
145
+ ## 2.12.0
146
+
147
+ - Add unit selector and depth selector to axes options ([OW-9496](https://oliasoft.atlassian.net/browse/OW-9496))
148
+
149
+ ## 2.11.3
150
+
151
+ - Submit Axes option on keyboard Enter ([OW-10995](https://oliasoft.atlassian.net/browse/OW-10995))
152
+
153
+ ## 2.11.2
154
+
155
+ - remove number handling functions that were duplicated from units package
156
+ ([OW-11062](https://oliasoft.atlassian.net/browse/OW-11062))
157
+
158
+ ## 2.11.1
159
+
160
+ - updated icon import
161
+
162
+ ## 2.11.0
163
+
164
+ - added `dragData` feature ([chartjs-plugin-dragdata](https://github.com/chrispahm/chartjs-plugin-dragdata))
165
+
166
+ ## 2.10.2
167
+
168
+ - remove dead `less-vars-to-js` package ([OW-11017](https://oliasoft.atlassian.net/browse/OW-11017))
169
+
170
+ ## 2.10.1
171
+
172
+ - Use `peerDependencies` for common versions of shared packages like `units` and `react-ui-library` so reduce double
173
+ installs and conflicting versions in parent apps ([OW-10974](https://oliasoft.atlassian.net/browse/OW-10974))
174
+
175
+ ## 2.10.0
176
+
177
+ - Switch to standard `round()` function from units repo [OW-10972](https://oliasoft.atlassian.net/browse/OW-10972)
178
+
179
+ ## 2.9.4
180
+
181
+ - Updated version of UI Library
182
+
183
+ ## 2.9.3
184
+
185
+ - Add @oliasoft-open-source/units package and update pase method in BarChart ([OW-10670](https://oliasoft.atlassian.net/browse/OW-10670))
186
+
187
+ ## 2.9.2
188
+
189
+ - Fix missing axis scale when in dataset is one point with negative values ([OW-10616](https://oliasoft.atlassian.net/browse/OW-10616))
190
+
191
+ ## 2.9.1
192
+
193
+ - Fix decimal values in BarChart in tooltips for locales with comma decimal ([OW-10632](https://oliasoft.atlassian.net/browse/OW-10632))
194
+
195
+ ## 2.9.0
196
+
197
+ - Add double-click event on chart area, change reset chart ranges from one click to double click ([OW-10412](https://oliasoft.atlassian.net/browse/OW-10412))
198
+
199
+ ## 2.8.0
200
+
201
+ - Simplify dist-tag strategy for beta version releases (to reduce cleanup effort) ([OW-10003](https://oliasoft.atlassian.net/browse/OW-10003))
202
+
203
+ ## 2.7.0
204
+
205
+ - Add optional CI pipeline that automates publishing of beta releases ([OW-10003](https://oliasoft.atlassian.net/browse/OW-10003))
206
+
207
+ ## 2.6.2
208
+
209
+ - Fix asis range update correctly ([OW-10534](https://oliasoft.atlassian.net/browse/OW-10534), and [OW-10457](https://oliasoft.atlassian.net/browse/OW-10457))
210
+
211
+ ## 2.6.1
212
+
213
+ - Added Box and Ellipse annotations ([OW-10519](https://oliasoft.atlassian.net/browse/OW-10519))
214
+
215
+ ## 2.6.0
216
+
217
+ - Add support for optional `autoAxisPadding` prop, which autoscales 5% padding around data ([OW-10398](https://oliasoft.atlassian.net/browse/OW-10398))
218
+ - Fix bug in default scales when all data points similar values ([OW-4327](https://oliasoft.atlassian.net/browse/OW-4327))
219
+
220
+ ## 2.5.27
221
+
222
+ - Add guard to useEffect in line-chart
223
+
224
+ ## 2.5.26
225
+
226
+ - Add guard to getLineChartAxis method
227
+
228
+ ## 2.5.25
229
+
230
+ - Fix axis ranges updating when new chart data and ranges is passed
231
+
232
+ ## 2.5.24
233
+
234
+ - Add performance test case
235
+
236
+ ## 2.5.23
237
+
238
+ - Patch minor regression in axis limits introduced in 2.5.22
239
+
240
+ ## 2.5.22
241
+
242
+ - Improve UX and input validation for axes range inputs ([OW-10305](https://oliasoft.atlassian.net/browse/OW-10305))
243
+
244
+ ## 2.5.21
245
+
246
+ - Revert changes from `2.5.12` / [OW-10320](https://oliasoft.atlassian.net/browse/OW-10320)
247
+ - Changing thousands separators broke decimal separators in some locales
248
+ - Resolves [OW-10320](https://oliasoft.atlassian.net/browse/OW-10320)
249
+
250
+ ## 2.5.20
251
+
252
+ - Minor refactor (code cleanup)
253
+
254
+ ## 2.5.19
255
+
256
+ - Hide irregular major axis ticks ([OW-10088](https://oliasoft.atlassian.net/browse/OW-10088))
257
+
258
+ ## 2.5.18
259
+
260
+ - Fixed minor gridlines when last major tick does not reach axis bounds ([OW-10296](https://oliasoft.atlassian.net/browse/OW-10296))
261
+
262
+ ## 2.5.17
263
+
264
+ - Added some (realistic) test case stories from our app
265
+
266
+ ## 2.5.16
267
+
268
+ - Remove test artefacts from published package
269
+
270
+ ## 2.5.15
271
+
272
+ - Changed GUI library version to `^3.1`
273
+
274
+ ## 2.5.14
275
+
276
+ - Sync axis labels in chart Controls with props
277
+
278
+ ## 2.5.13
279
+
280
+ - fixed custom range inputs reset, multi-axis range placeholder values missing
281
+
282
+ ## 2.5.12
283
+
284
+ - change thousand separators in axis label from comma to space
285
+
286
+ ## 2.5.11
287
+
288
+ - Allow headerComponent and chart title to coexist
289
+
290
+ ## 2.5.10
291
+
292
+ - Fix zoom / pan bug at < 0.1 scale on charts
293
+
294
+ ## 2.5.9
295
+
296
+ - Fix validation for two and more decimal places in charts settings
297
+
298
+ ## 2.5.8
299
+
300
+ - Disable tooltip animations in `performanceMode`
301
+
302
+ ## 2.5.7
303
+
304
+ - Allow stretchy headerComponent in controls
305
+
306
+ ## 2.5.6
307
+
308
+ - Removed resizeDelay, fixed double data labels set position
309
+
310
+ ## 2.5.5
311
+
312
+ - Removed empty label annotations
313
+
314
+ ## 2.5.4
315
+
316
+ - Fixed onPointHover event
317
+
318
+ ## 2.5.3
319
+
320
+ - Fixed datalabels position, set labels position inside chart area
321
+
322
+ ## 2.5.2
323
+
324
+ - Fix crashes when type a non number into the axis range - add validation in getLinechartAxis method
325
+
326
+ ## 2.5.1
327
+
328
+ - Added resize delay for performance
329
+
330
+ ## 2.5.0
331
+
332
+ - Separate controls for points/lines, axes options, legend, download
333
+ - Standard control for table
334
+ - Box zoom
335
+
336
+ ## 2.4.6
337
+
338
+ - Fix Multiple X Axes example in LineChart
339
+
340
+ ## 2.4.5
341
+
342
+ - Fix zooming issue from OW-9960
343
+
344
+ ## 2.4.4
345
+
346
+ - Updated GUI Library version
347
+
348
+ ## 2.4.3
349
+
350
+ - Fix crashes when type a non-number into the axis range OW-9924
351
+
352
+ ## 2.4.2
353
+
354
+ - Square aspect ratio charts can fill height/width
355
+
356
+ ## 2.4.1
357
+
358
+ - Remove dependency on http-server (moved to dev dependencies)
359
+
360
+ ## 2.4.0
361
+
362
+ - Switch package manager from NPM to Yarn
363
+
364
+ ## 2.3.4
365
+
366
+ - RollBack changes regarding OW-4327
367
+
368
+ ## 2.3.3
369
+
370
+ - restrict suggestedMin/Max by X axe OW-4327
371
+
372
+ ## 2.3.2
373
+
374
+ - added default values for axis ticks (suggestedMin/Max) OW-4327
375
+
376
+ ## 2.3.0
377
+
378
+ - Text annotations in lin
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><circle cx="12" cy="12" r="12" fill="currentColor" /></svg>
@@ -0,0 +1 @@
1
+ <svg fill="none" height="12" viewBox="0 0 12 12" width="12" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><clipPath id="a"><path d="m0 0h12v12h-12z"/></clipPath><g clip-path="url(#a)"><path d="m7.937 6.5c-.11122.42912-.36179.80916-.71237 1.08047-.35058.2713-.78133.4185-1.22463.4185s-.87405-.1472-1.22463-.4185c-.35058-.27131-.60115-.65135-.71237-1.08047h-3.563v-1h3.563c.11122-.42912.36179-.80916.71237-1.08046s.78133-.41851 1.22463-.41851.87405.14721 1.22463.41851.60115.65134.71237 1.08046h3.563v1z" fill="currentColor"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg fill="none" height="12" viewBox="0 0 12 12" width="12" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><clipPath id="a"><path d="m0 0h12v12h-12z"/></clipPath><g clip-path="url(#a)"><path d="m.5 6.5v-1h11v1c-4.16104 0-6.63549 0-11 0z" fill="currentColor"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg fill="none" height="12" viewBox="0 0 12 12" width="12" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><clipPath id="a"><path d="m0 0h12v12h-12z"/></clipPath><g clip-path="url(#a)"><path clip-rule="evenodd" d="m1.85351 1.14645-.35356-.353558-.707103.707108.353553.35355.39645.39645c-.02813.07955-.0429.16401-.0429.25 0 .19891.07902.38968.21967.53033.14066.14065.33142.21967.53033.21967.08599 0 .17045-.01477.25-.04289l2.2929 2.29289h-.7929v1h1.7929l2.5 2.5h-4.2929v1h5.2929l.85355.8536.3536.3535.7071-.7071-.3536-.3536-.3535-.35351v-.79289h-.79294l-2.5-2.5h3.29294v-1h-4.29294l-3.25-3.25c-.03694-.10448-.09692-.20048-.17678-.28033-.07985-.07985-.17585-.13984-.28033-.17678zm8.64649.85355h-6.50005v1h6.50005zm-8.78038 4.53033c.14066.14065.33142.21967.53033.21967.19892 0 .38968-.07902.53033-.21967.14066-.14065.21967-.33142.21967-.53033s-.07901-.38968-.21967-.53033c-.14065-.14065-.33141-.21967-.53033-.21967-.19891 0-.38967.07902-.53033.21967-.14065.14065-.21967.33142-.21967.53033s.07902.38968.21967.53033zm0 3.45c.14066.14067.33142.21967.53033.21967.19892 0 .38968-.079.53033-.21967.14066-.14065.21967-.33142.21967-.53033s-.07901-.38968-.21967-.53033c-.14065-.14065-.33141-.21967-.53033-.21967-.19891 0-.38967.07902-.53033.21967-.14065.14065-.21967.33142-.21967.53033s.07902.38968.21967.53033z" fill="currentColor" fill-rule="evenodd"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg fill="none" height="12" viewBox="0 0 12 12" width="12" xmlns="http://www.w3.org/2000/svg"><circle cx="6" cy="6" fill="currentColor" r="2"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect x="2" y="2" width="20" height="20" fill="currentColor" /></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect x="3" y="3" width="18" height="18" fill="currentColor" transform='rotate(45 12 12)' /></svg>
@@ -0,0 +1 @@
1
+ <svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><clipPath id="a"><path d="m0 0h24v24h-24z"/></clipPath><g clip-path="url(#a)"><path d="m22.7998 22.0623h-21.5996c-.21066.0001-.417617-.0554-.600067-.1607-.182451-.1053-.333965-.2567-.439311-.4392-.1053464-.1824-.16081228-.3893-.160822-.6s.0554372-.4176.160767-.6l10.799833-18.70518c.1139-.17137.2684-.31191.4497-.40913.1814-.09722.3839-.14809.5897-.14809s.4083.05087.5897.14809c.1813.09722.3358.23776.4497.40913l10.7998 18.70518c.1054.1824.1608.3893.1608.6s-.0555.4176-.1608.6c-.1054.1825-.2569.3339-.4393.4392-.1825.1053-.3894.1608-.6001.1607z" fill="currentColor"/></g></svg>
@@ -0,0 +1,209 @@
1
+ import PropTypes from 'prop-types';
2
+
3
+ export const BarChartPropTypes = {
4
+ chart: PropTypes.shape({
5
+ testId: PropTypes.string,
6
+ data: PropTypes.object.isRequired,
7
+ options: PropTypes.shape({
8
+ title: PropTypes.oneOfType([
9
+ PropTypes.string,
10
+ PropTypes.arrayOf(PropTypes.string),
11
+ ]),
12
+ direction: PropTypes.oneOf(['vertical', 'horizontal']),
13
+ axes: PropTypes.shape({
14
+ x: PropTypes.arrayOf(
15
+ PropTypes.shape({
16
+ label: PropTypes.string,
17
+ position: PropTypes.oneOf(['top', 'bottom']),
18
+ color: PropTypes.string,
19
+ unit: PropTypes.string,
20
+ }),
21
+ ),
22
+ y: PropTypes.arrayOf(
23
+ PropTypes.shape({
24
+ label: PropTypes.string,
25
+ position: PropTypes.oneOf(['left', 'right']),
26
+ color: PropTypes.string,
27
+ unit: PropTypes.string,
28
+ }),
29
+ ),
30
+ }),
31
+ additionalAxesOptions: PropTypes.shape({
32
+ chartScaleType: PropTypes.oneOf(['linear', 'logarithmic']),
33
+ reverse: PropTypes.bool,
34
+ beginAtZero: PropTypes.bool,
35
+ stepSize: PropTypes.number,
36
+ stacked: PropTypes.bool,
37
+ suggestedMin: PropTypes.number,
38
+ suggestedMax: PropTypes.number,
39
+ min: PropTypes.number,
40
+ max: PropTypes.number,
41
+ }),
42
+ chartStyling: PropTypes.shape({
43
+ width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
44
+ height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
45
+ maintainAspectRatio: PropTypes.bool,
46
+ staticChartHeight: PropTypes.bool,
47
+ performanceMode: PropTypes.bool,
48
+ }),
49
+ tooltip: PropTypes.shape({
50
+ tooltips: PropTypes.bool,
51
+ showLabelsInTooltips: PropTypes.bool,
52
+ }),
53
+ graph: PropTypes.shape({
54
+ showDataLabels: PropTypes.bool,
55
+ showMinorGridlines: PropTypes.bool,
56
+ }),
57
+ annotations: PropTypes.shape({
58
+ showAnnotations: PropTypes.bool,
59
+ controlAnnotation: PropTypes.bool,
60
+ annotationsData: PropTypes.arrayOf(
61
+ PropTypes.shape({
62
+ annotationAxis: PropTypes.oneOf(['x', 'y']),
63
+ label: PropTypes.string,
64
+ color: PropTypes.string,
65
+ value: PropTypes.number,
66
+ endValue: PropTypes.number,
67
+ }),
68
+ ),
69
+ }),
70
+ legend: PropTypes.shape({
71
+ display: PropTypes.bool,
72
+ position: PropTypes.oneOf(['top', 'bottom', 'right']),
73
+ align: PropTypes.oneOf(['start', 'center', 'end']),
74
+ customLegend: PropTypes.shape({
75
+ customLegendPlugin: PropTypes.object,
76
+ customLegendContainerID: PropTypes.string,
77
+ }),
78
+ }),
79
+ chartOptions: PropTypes.shape({
80
+ enableZoom: PropTypes.bool,
81
+ enablePan: PropTypes.bool,
82
+ }),
83
+ interactions: PropTypes.shape({
84
+ onLegendClick: PropTypes.func,
85
+ onBarHover: PropTypes.func,
86
+ onBarUnhover: PropTypes.func,
87
+ }),
88
+ dragData: PropTypes.shape({
89
+ enableDragData: PropTypes.bool,
90
+ showTooltip: PropTypes.bool,
91
+ roundPoints: PropTypes.bool,
92
+ dragX: PropTypes.bool,
93
+ dragY: PropTypes.bool,
94
+ onDragStart: PropTypes.func,
95
+ onDrag: PropTypes.func,
96
+ onDragEnd: PropTypes.func,
97
+ }),
98
+ }),
99
+ }).isRequired,
100
+ };
101
+
102
+ export const getDefaultProps = (props) => {
103
+ // Add missing nested objects
104
+ props.chart.options = props.chart.options || {};
105
+ props.chart.options.axes = props.chart.options.axes || {};
106
+ props.chart.options.additionalAxesOptions =
107
+ props.chart.options.additionalAxesOptions || {};
108
+ props.chart.options.chartStyling = props.chart.options.chartStyling || {};
109
+ props.chart.options.tooltip = props.chart.options.tooltip || {};
110
+ props.chart.options.graph = props.chart.options.graph || {};
111
+ props.chart.options.annotations = props.chart.options.annotations || {};
112
+ props.chart.options.legend = props.chart.options.legend || {};
113
+ props.chart.options.legend.customLegend = props.chart.options.legend
114
+ .customLegend || { customLegendPlugin: null, customLegendContainerID: '' };
115
+ props.chart.options.chartOptions = props.chart.options.chartOptions || {};
116
+ props.chart.options.interactions = props.chart.options.interactions || {};
117
+ props.chart.options.dragData = props.chart.options.dragData || {};
118
+ // Set defaults for missing properties
119
+ const chart = {
120
+ testId: props.chart.testId ?? null,
121
+ data: props.chart.data,
122
+ options: {
123
+ title: props.chart.options.title || '',
124
+ direction: props.chart.options.direction || 'vertical',
125
+ axes: {
126
+ x: props.chart.options.axes.x || [{}],
127
+ y: props.chart.options.axes.y || [{}],
128
+ },
129
+ additionalAxesOptions: {
130
+ chartScaleType:
131
+ props.chart.options.additionalAxesOptions.chartScaleType || 'linear',
132
+ reverse: props.chart.options.additionalAxesOptions.reverse || false,
133
+ stacked: props.chart.options.additionalAxesOptions.stacked || false,
134
+ beginAtZero:
135
+ props.chart.options.additionalAxesOptions.beginAtZero != null
136
+ ? props.chart.options.additionalAxesOptions.beginAtZero
137
+ : true,
138
+ stepSize: props.chart.options.additionalAxesOptions.stepSize,
139
+ suggestedMin: props.chart.options.additionalAxesOptions.suggestedMin,
140
+ suggestedMax: props.chart.options.additionalAxesOptions.suggestedMax,
141
+ min: props.chart.options.additionalAxesOptions.min,
142
+ max: props.chart.options.additionalAxesOptions.max,
143
+ },
144
+ chartStyling: {
145
+ width: props.chart.options.chartStyling.width,
146
+ height: props.chart.options.chartStyling.height,
147
+ maintainAspectRatio:
148
+ props.chart.options.chartStyling.maintainAspectRatio || false,
149
+ staticChartHeight:
150
+ props.chart.options.chartStyling.staticChartHeight || false,
151
+ performanceMode:
152
+ props.chart.options.chartStyling.performanceMode != null
153
+ ? props.chart.options.chartStyling.performanceMode
154
+ : true,
155
+ },
156
+ tooltip: {
157
+ tooltips:
158
+ props.chart.options.tooltip.tooltips != null
159
+ ? props.chart.options.tooltip.tooltips
160
+ : true,
161
+ showLabelsInTooltips:
162
+ props.chart.options.tooltip.showLabelsInTooltips || false,
163
+ },
164
+ graph: {
165
+ showDataLabels: props.chart.options.graph.showDataLabels || false,
166
+ showMinorGridlines:
167
+ props.chart.options.graph.showMinorGridlines || false,
168
+ },
169
+ annotations: {
170
+ showAnnotations:
171
+ props.chart.options.annotations.showAnnotations != null
172
+ ? props.chart.options.annotations.showAnnotations
173
+ : true,
174
+ controlAnnotation:
175
+ props.chart.options.annotations.controlAnnotation || false,
176
+ annotationsData: props.chart.options.annotations.annotationsData || [],
177
+ },
178
+ legend: {
179
+ display:
180
+ props.chart.options.legend.display != null
181
+ ? props.chart.options.legend.display
182
+ : true,
183
+ position: props.chart.options.legend.position || 'bottom',
184
+ align: props.chart.options.legend.align || 'center',
185
+ customLegend: props.chart.options.legend.customLegend,
186
+ },
187
+ chartOptions: {
188
+ enableZoom: props.chart.options.chartOptions.enableZoom || false,
189
+ enablePan: props.chart.options.chartOptions.enablePan || false,
190
+ },
191
+ interactions: {
192
+ onLegendClick: props.chart.options.interactions.onLegendClick,
193
+ onBarHover: props.chart.options.interactions.onBarHover,
194
+ onBarUnhover: props.chart.options.interactions.onBarUnhover,
195
+ },
196
+ dragData: {
197
+ enableDragData: props.chart.options.dragData.enableDragData || false,
198
+ showTooltip: props.chart.options.dragData.showTooltip || true,
199
+ roundPoints: props.chart.options.dragData.roundPoints || true,
200
+ dragX: props.chart.options.dragData.dragX || true,
201
+ dragY: props.chart.options.dragData.dragY || true,
202
+ onDragStart: props.chart.options.dragData.onDragStart,
203
+ onDrag: props.chart.options.dragData.onDrag,
204
+ onDragEnd: props.chart.options.dragData.onDragEnd,
205
+ },
206
+ },
207
+ };
208
+ return chart;
209
+ };