@oliasoft-open-source/charts-library 2.17.6 → 2.18.0-beta-1

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 (84) hide show
  1. package/package.json +26 -34
  2. package/index.js +0 -14
  3. package/release-notes.md +0 -310
  4. package/src/assets/icons/line-and-point.svg +0 -1
  5. package/src/assets/icons/line-only.svg +0 -1
  6. package/src/assets/icons/list-hide.svg +0 -1
  7. package/src/assets/icons/point-only.svg +0 -1
  8. package/src/components/bar-chart/bar-chart-prop-types.js +0 -209
  9. package/src/components/bar-chart/bar-chart.interface.ts +0 -91
  10. package/src/components/bar-chart/bar-chart.jsx +0 -247
  11. package/src/components/bar-chart/bar-chart.module.less +0 -61
  12. package/src/components/bar-chart/get-bar-chart-data-labels.js +0 -42
  13. package/src/components/bar-chart/get-bar-chart-scales.js +0 -123
  14. package/src/components/bar-chart/get-bar-chart-tooltips.js +0 -102
  15. package/src/components/controls/axes-options/axes-options.jsx +0 -270
  16. package/src/components/line-chart/constants/default-translations.js +0 -24
  17. package/src/components/line-chart/constants/line-chart-consts.js +0 -12
  18. package/src/components/line-chart/controls/axes-options/action-types.js +0 -5
  19. package/src/components/line-chart/controls/axes-options/axes-options-form-state.js +0 -97
  20. package/src/components/line-chart/controls/controls.jsx +0 -174
  21. package/src/components/line-chart/controls/controls.module.less +0 -12
  22. package/src/components/line-chart/controls/drag-options.jsx +0 -112
  23. package/src/components/line-chart/controls/legend-options.jsx +0 -36
  24. package/src/components/line-chart/controls/line-options.jsx +0 -64
  25. package/src/components/line-chart/hooks/use-chart-functions.js +0 -257
  26. package/src/components/line-chart/hooks/use-chart-options.js +0 -181
  27. package/src/components/line-chart/hooks/use-chart-plugins.js +0 -35
  28. package/src/components/line-chart/hooks/use-toggle-handler.js +0 -33
  29. package/src/components/line-chart/initialize/config.js +0 -23
  30. package/src/components/line-chart/initialize/initialize-line-chart.js +0 -25
  31. package/src/components/line-chart/line-chart-prop-types.js +0 -292
  32. package/src/components/line-chart/line-chart.interface.ts +0 -121
  33. package/src/components/line-chart/line-chart.jsx +0 -161
  34. package/src/components/line-chart/line-chart.module.less +0 -77
  35. package/src/components/line-chart/plugins/chart-area-text-plugin.js +0 -246
  36. package/src/components/line-chart/plugins/line-chart.minor-gridlines-plugin.js +0 -88
  37. package/src/components/line-chart/plugins/plugin-constants.js +0 -11
  38. package/src/components/line-chart/state/action-types.js +0 -12
  39. package/src/components/line-chart/state/initial-state.js +0 -89
  40. package/src/components/line-chart/state/line-chart-reducer.js +0 -100
  41. package/src/components/line-chart/state/manage-state-in-local-storage.js +0 -86
  42. package/src/components/line-chart/state/use-chart-state.js +0 -141
  43. package/src/components/line-chart/utils/axis-scales/axis-scales.js +0 -165
  44. package/src/components/line-chart/utils/datalabels-alignment/get-alignment-condition.js +0 -13
  45. package/src/components/line-chart/utils/datalabels-alignment/get-alignment-data.js +0 -20
  46. package/src/components/line-chart/utils/datalabels-alignment/get-datalabels-position.js +0 -25
  47. package/src/components/line-chart/utils/generate-line-chart-datasets.js +0 -114
  48. package/src/components/line-chart/utils/get-axes-ranges-from-chart.js +0 -13
  49. package/src/components/line-chart/utils/get-line-chart-data-labels.js +0 -21
  50. package/src/components/line-chart/utils/get-line-chart-scales.js +0 -120
  51. package/src/components/line-chart/utils/get-line-chart-tooltips.js +0 -94
  52. package/src/components/line-chart/utils/line-chart-utils.js +0 -77
  53. package/src/components/line-chart/utils/translations/get-translations.js +0 -17
  54. package/src/components/pie-chart/pie-chart-prop-types.js +0 -111
  55. package/src/components/pie-chart/pie-chart-utils.js +0 -32
  56. package/src/components/pie-chart/pie-chart.interface.ts +0 -61
  57. package/src/components/pie-chart/pie-chart.jsx +0 -450
  58. package/src/components/pie-chart/pie-chart.module.less +0 -61
  59. package/src/components/scatter-chart/scatter-chart.intefrace.ts +0 -33
  60. package/src/components/scatter-chart/scatter-chart.jsx +0 -21
  61. package/src/components/scatter-chart/scatter-chart.module.less +0 -4
  62. package/src/helpers/chart-border-plugin.js +0 -19
  63. package/src/helpers/chart-consts.js +0 -64
  64. package/src/helpers/chart-interface.ts +0 -94
  65. package/src/helpers/chart-utils.js +0 -182
  66. package/src/helpers/container.jsx +0 -60
  67. package/src/helpers/disabled-context.js +0 -8
  68. package/src/helpers/enums.js +0 -96
  69. package/src/helpers/get-chart-annotation.js +0 -106
  70. package/src/helpers/get-custom-legend-plugin-example.js +0 -80
  71. package/src/helpers/get-draggableData.js +0 -32
  72. package/src/helpers/range/estimate-data-series-have-close-values.js +0 -54
  73. package/src/helpers/range/range.js +0 -100
  74. package/src/helpers/text.js +0 -6
  75. package/src/style/external.less +0 -4
  76. package/src/style/fonts/lato/Lato-Bold.woff2 +0 -0
  77. package/src/style/fonts/lato/Lato-BoldItalic.woff2 +0 -0
  78. package/src/style/fonts/lato/Lato-Italic.woff2 +0 -0
  79. package/src/style/fonts/lato/Lato-Regular.woff2 +0 -0
  80. package/src/style/fonts.less +0 -27
  81. package/src/style/global.less +0 -43
  82. package/src/style/reset/reset.less +0 -28
  83. package/src/style/shared.less +0 -11
  84. package/src/style/variables.less +0 -91
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/charts-library",
3
- "version": "2.17.6",
3
+ "version": "2.18.0-beta-1",
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": {
@@ -10,13 +10,18 @@
10
10
  "type": "git",
11
11
  "url": "git+https://gitlab.com/oliasoft-open-source/charts-library.git"
12
12
  },
13
+ "main": "./dist/index.js",
14
+ "module": "./dist/index.js",
15
+ "files": [
16
+ "dist"
17
+ ],
13
18
  "license": "MIT",
14
19
  "author": "Oliasoft AS and contributors",
15
- "main": "index.js",
16
20
  "scripts": {
17
21
  "build": "yarn run build:storybook",
18
- "build:storybook": "build-storybook --quiet --output-dir ./public",
19
- "dev:storybook": "start-storybook -p 6006",
22
+ "build:package": "vite build --config vite.config.mjs",
23
+ "build:storybook": "storybook build --quiet --output-dir ./public",
24
+ "dev:storybook": "storybook dev -p 6006",
20
25
  "lint:check": "eslint \"**/*.{js,jsx}\"",
21
26
  "lint:fix": "eslint --fix \"**/*.{js,jsx}\"",
22
27
  "prepare": "husky install",
@@ -24,7 +29,8 @@
24
29
  "prettier:fix": "prettier --write \"**/*.{js,jsx,json,css,less}\"",
25
30
  "preview:storybook": " http-server ./public -o -p 9002 -c-1",
26
31
  "test": "yarn run prettier:check && yarn run lint:check && yarn run test:unit",
27
- "test:unit": "jest"
32
+ "test:unit": "vitest run",
33
+ "test:unit:coverage": "vitest run --coverage"
28
34
  },
29
35
  "lint-staged": {
30
36
  "*.js": "eslint --cache --fix",
@@ -33,38 +39,31 @@
33
39
  ]
34
40
  },
35
41
  "dependencies": {
42
+ "@storybook/addon-docs": "^7.0.18",
43
+ "@vitejs/plugin-react-swc": "^3.3.2",
36
44
  "chart.js": "^4.2.1",
37
45
  "chartjs-plugin-annotation": "^1.4.0",
38
46
  "chartjs-plugin-datalabels": "^2.1.0",
39
47
  "chartjs-plugin-dragdata": "^2.2.5",
40
48
  "chartjs-plugin-zoom": "^1.2.1",
41
49
  "classnames": "^2.3.1",
50
+ "eslint-plugin-vitest": "^0.2.5",
42
51
  "lodash": "^4",
43
52
  "react-base64-downloader": "^2.1.7",
44
53
  "react-chartjs-2": "^4.3.1",
45
- "react-icons": "^4"
54
+ "react-icons": "^4",
55
+ "rollup-plugin-peer-deps-external": "^2.2.4",
56
+ "storybook-dark-mode": "^3.0.0",
57
+ "vite": "^4.3.9",
58
+ "vitest": "^0.31.4"
46
59
  },
47
60
  "devDependencies": {
48
- "@babel/core": "^7.18.13",
49
- "@babel/eslint-parser": "^7.18.9",
50
- "@babel/preset-env": "^7.18.10",
51
- "@babel/preset-react": "^7.18.6",
52
61
  "@oliasoft-open-source/react-ui-library": "^3.5.6",
53
62
  "@oliasoft-open-source/units": "^2.6.1",
54
- "@storybook/addon-actions": "^6.5.10",
55
- "@storybook/addon-docs": "^6.5.10",
56
- "@storybook/addon-links": "^6.5.10",
57
- "@storybook/addon-storysource": "^6.5.10",
58
- "@storybook/addons": "^6.5.10",
59
- "@storybook/builder-webpack5": "^6.5.10",
60
- "@storybook/manager-webpack5": "^6.5.10",
61
- "@storybook/react": "^6.5.10",
62
- "@storybook/source-loader": "^6.5.10",
63
+ "@storybook/react": "^7.0.18",
64
+ "@storybook/react-vite": "^7.0.18",
65
+ "@storybook/testing-library": "^0.0.14-next.2",
63
66
  "@types/react": "^17.0.49",
64
- "babel-jest": "^29.0.1",
65
- "babel-plugin-webpack-aliases": "^1.1.3",
66
- "css-loader": "^6.7.1",
67
- "css-minimizer-webpack-plugin": "^4.0.0",
68
67
  "eslint": "^8.23.0",
69
68
  "eslint-config-airbnb": "^19.0.4",
70
69
  "eslint-config-prettier": "^8.5.0",
@@ -73,26 +72,19 @@
73
72
  "eslint-plugin-jsx-a11y": "^6.6.1",
74
73
  "eslint-plugin-react": "^7.31.1",
75
74
  "eslint-plugin-react-hooks": "^4.6.0",
76
- "html-webpack-plugin": "^5.5.0",
75
+ "eslint-plugin-storybook": "^0.6.12",
76
+ "eslint-plugin-vitest-globals": "^1.3.1",
77
77
  "http-server": "^14.1.1",
78
78
  "husky": "^8.0.1",
79
79
  "immer": "^9",
80
- "jest": "^29.0.1",
81
- "jest-transform-stub": "^2.0.0",
80
+ "jsdom": "^22.1.0",
82
81
  "less": "^4.1.3",
83
- "less-loader": "^11.0.0",
84
82
  "lint-staged": "^13.0.3",
85
- "mini-css-extract-plugin": "^2.6.1",
86
83
  "prettier": "2.7.1",
87
84
  "prop-types": "^15",
88
85
  "react": "^17",
89
86
  "react-dom": "^17",
90
- "storybook-dark-mode": "^1.1.0",
91
- "terser-webpack-plugin": "^5.3.6",
92
- "webpack": "^5.74.0",
93
- "webpack-cli": "^4.10.0",
94
- "webpack-dev-server": "^4.10.1",
95
- "webpack-merge": "^5.8.0"
87
+ "storybook": "^7.0.18"
96
88
  },
97
89
  "peerDependencies": {
98
90
  "@oliasoft-open-source/react-ui-library": "^3.5.6",
package/index.js DELETED
@@ -1,14 +0,0 @@
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/release-notes.md DELETED
@@ -1,310 +0,0 @@
1
- # Charts Library Release Notes
2
-
3
- ## 2.17.6
4
-
5
- - Fix `NumberInput` bug that prevented users typing decimal values with trailing zeros in charts controls
6
- ([OW-11920](https://oliasoft.atlassian.net/browse/OW-11920))
7
-
8
- ## 2.17.5
9
-
10
- - Support disabling `usePointStyle` to show dashed lines in legend ([OW-11786](https://oliasoft.atlassian.net/browse/OW-11786))
11
-
12
- ## 2.17.4
13
-
14
- - Use new `<NumberInput>` component from GUI Library in charts controls, to simplify validation ([OW-11773](https://oliasoft.atlassian.net/browse/OW-11773))
15
-
16
- ## 2.17.3
17
-
18
- - Replace legacy internal implementation of `isEqualWithTolerance` with `isCloseTo` from units package ([OW-11767](https://oliasoft.atlassian.net/browse/OW-11767))
19
-
20
- ## 2.17.2
21
-
22
- - Fix release CI/CD pipeline ([OW-11691](https://oliasoft.atlassian.net/browse/OW-11691))
23
-
24
- ## 2.17.1
25
-
26
- - Added debounce to prevent maximum call stack size exceeded
27
-
28
- ## 2.17.0
29
-
30
- - Added initialize logic, for improve translations
31
-
32
- ## 2.16.0
33
-
34
- - Added common chart area text plugin
35
-
36
- ## 2.15.0
37
- - Added translation, by provider handled([OW-11237](https://oliasoft.atlassian.net/browse/OW-11237))
38
-
39
- ## 2.14.1
40
- - Fix save initAxesRange when dataset changed by parent component([OW-11332](https://oliasoft.atlassian.net/browse/OW-11332))
41
-
42
- ## 2.14.0
43
- - Refactored line chart, for better performance, readable and reduce not needed re-renders
44
-
45
- ## 2.13.5
46
-
47
- - Fixed reset range when subComponent update data, prevent extra re-renders when range have same deep values but different reference
48
-
49
- ## 2.13.4
50
-
51
- - Fixed legend state
52
-
53
- ## 2.13.3
54
-
55
- - Added story for point styling to support ([OW-11107](https://oliasoft.atlassian.net/browse/OW-11107))
56
-
57
- ## 2.13.2
58
-
59
- - Changed default value for zoom to true
60
-
61
- ## 2.13.1
62
-
63
- - Text label for drag options trigger, to make current behaviour more obvious ([OW-11102](https://oliasoft.atlassian.net/browse/OW-11102))
64
-
65
- ## 2.13.0
66
-
67
- - Added feature to save state to localStorage and clean when expired, fixed panEnable(state) bug.
68
-
69
- ## 2.12.0
70
-
71
- - Add unit selector and depth selector to axes options ([OW-9496](https://oliasoft.atlassian.net/browse/OW-9496))
72
-
73
- ## 2.11.3
74
-
75
- - Submit Axes option on keyboard Enter ([OW-10995](https://oliasoft.atlassian.net/browse/OW-10995))
76
-
77
- ## 2.11.2
78
-
79
- - remove number handling functions that were duplicated from units package
80
- ([OW-11062](https://oliasoft.atlassian.net/browse/OW-11062))
81
-
82
- ## 2.11.1
83
-
84
- - updated icon import
85
-
86
- ## 2.11.0
87
-
88
- - added `dragData` feature ([chartjs-plugin-dragdata](https://github.com/chrispahm/chartjs-plugin-dragdata))
89
-
90
- ## 2.10.2
91
-
92
- - remove dead `less-vars-to-js` package ([OW-11017](https://oliasoft.atlassian.net/browse/OW-11017))
93
-
94
- ## 2.10.1
95
-
96
- - Use `peerDependencies` for common versions of shared packages like `units` and `react-ui-library` so reduce double
97
- installs and conflicting versions in parent apps ([OW-10974](https://oliasoft.atlassian.net/browse/OW-10974))
98
-
99
- ## 2.10.0
100
-
101
- - Switch to standard `round()` function from units repo [OW-10972](https://oliasoft.atlassian.net/browse/OW-10972)
102
-
103
- ## 2.9.4
104
-
105
- - Updated version of UI Library
106
-
107
- ## 2.9.3
108
-
109
- - Add @oliasoft-open-source/units package and update pase method in BarChart ([OW-10670](https://oliasoft.atlassian.net/browse/OW-10670))
110
-
111
- ## 2.9.2
112
-
113
- - Fix missing axis scale when in dataset is one point with negative values ([OW-10616](https://oliasoft.atlassian.net/browse/OW-10616))
114
-
115
- ## 2.9.1
116
-
117
- - Fix decimal values in BarChart in tooltips for locales with comma decimal ([OW-10632](https://oliasoft.atlassian.net/browse/OW-10632))
118
-
119
- ## 2.9.0
120
-
121
- - 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))
122
-
123
- ## 2.8.0
124
-
125
- - Simplify dist-tag strategy for beta version releases (to reduce cleanup effort) ([OW-10003](https://oliasoft.atlassian.net/browse/OW-10003))
126
-
127
- ## 2.7.0
128
-
129
- - Add optional CI pipeline that automates publishing of beta releases ([OW-10003](https://oliasoft.atlassian.net/browse/OW-10003))
130
-
131
- ## 2.6.2
132
-
133
- - Fix asis range update correctly ([OW-10534](https://oliasoft.atlassian.net/browse/OW-10534), and [OW-10457](https://oliasoft.atlassian.net/browse/OW-10457))
134
-
135
- ## 2.6.1
136
-
137
- - Added Box and Ellipse annotations ([OW-10519](https://oliasoft.atlassian.net/browse/OW-10519))
138
-
139
- ## 2.6.0
140
-
141
- - Add support for optional `autoAxisPadding` prop, which autoscales 5% padding around data ([OW-10398](https://oliasoft.atlassian.net/browse/OW-10398))
142
- - Fix bug in default scales when all data points similar values ([OW-4327](https://oliasoft.atlassian.net/browse/OW-4327))
143
-
144
- ## 2.5.27
145
-
146
- - Add guard to useEffect in line-chart
147
-
148
- ## 2.5.26
149
-
150
- - Add guard to getLineChartAxis method
151
-
152
- ## 2.5.25
153
-
154
- - Fix axis ranges updating when new chart data and ranges is passed
155
-
156
- ## 2.5.24
157
-
158
- - Add performance test case
159
-
160
- ## 2.5.23
161
-
162
- - Patch minor regression in axis limits introduced in 2.5.22
163
-
164
- ## 2.5.22
165
-
166
- - Improve UX and input validation for axes range inputs ([OW-10305](https://oliasoft.atlassian.net/browse/OW-10305))
167
-
168
- ## 2.5.21
169
-
170
- - Revert changes from `2.5.12` / [OW-10320](https://oliasoft.atlassian.net/browse/OW-10320)
171
- - Changing thousands separators broke decimal separators in some locales
172
- - Resolves [OW-10320](https://oliasoft.atlassian.net/browse/OW-10320)
173
-
174
- ## 2.5.20
175
-
176
- - Minor refactor (code cleanup)
177
-
178
- ## 2.5.19
179
-
180
- - Hide irregular major axis ticks ([OW-10088](https://oliasoft.atlassian.net/browse/OW-10088))
181
-
182
- ## 2.5.18
183
-
184
- - Fixed minor gridlines when last major tick does not reach axis bounds ([OW-10296](https://oliasoft.atlassian.net/browse/OW-10296))
185
-
186
- ## 2.5.17
187
-
188
- - Added some (realistic) test case stories from our app
189
-
190
- ## 2.5.16
191
-
192
- - Remove test artefacts from published package
193
-
194
- ## 2.5.15
195
-
196
- - Changed GUI library version to `^3.1`
197
-
198
- ## 2.5.14
199
-
200
- - Sync axis labels in chart Controls with props
201
-
202
- ## 2.5.13
203
-
204
- - fixed custom range inputs reset, multi-axis range placeholder values missing
205
-
206
- ## 2.5.12
207
-
208
- - change thousand separators in axis label from comma to space
209
-
210
- ## 2.5.11
211
-
212
- - Allow headerComponent and chart title to coexist
213
-
214
- ## 2.5.10
215
-
216
- - Fix zoom / pan bug at < 0.1 scale on charts
217
-
218
- ## 2.5.9
219
-
220
- - Fix validation for two and more decimal places in charts settings
221
-
222
- ## 2.5.8
223
-
224
- - Disable tooltip animations in `performanceMode`
225
-
226
- ## 2.5.7
227
-
228
- - Allow stretchy headerComponent in controls
229
-
230
- ## 2.5.6
231
-
232
- - Removed resizeDelay, fixed double data labels set position
233
-
234
- ## 2.5.5
235
-
236
- - Removed empty label annotations
237
-
238
- ## 2.5.4
239
-
240
- - Fixed onPointHover event
241
-
242
- ## 2.5.3
243
-
244
- - Fixed datalabels position, set labels position inside chart area
245
-
246
- ## 2.5.2
247
-
248
- - Fix crashes when type a non number into the axis range - add validation in getLinechartAxis method
249
-
250
- ## 2.5.1
251
-
252
- - Added resize delay for performance
253
-
254
- ## 2.5.0
255
-
256
- - Separate controls for points/lines, axes options, legend, download
257
- - Standard control for table
258
- - Box zoom
259
-
260
- ## 2.4.6
261
-
262
- - Fix Multiple X Axes example in LineChart
263
-
264
- ## 2.4.5
265
-
266
- - Fix zooming issue from OW-9960
267
-
268
- ## 2.4.4
269
-
270
- - Updated GUI Library version
271
-
272
- ## 2.4.3
273
-
274
- - Fix crashes when type a non-number into the axis range OW-9924
275
-
276
- ## 2.4.2
277
-
278
- - Square aspect ratio charts can fill height/width
279
-
280
- ## 2.4.1
281
-
282
- - Remove dependency on http-server (moved to dev dependencies)
283
-
284
- ## 2.4.0
285
-
286
- - Switch package manager from NPM to Yarn
287
-
288
- ## 2.3.4
289
-
290
- - RollBack changes regarding OW-4327
291
-
292
- ## 2.3.3
293
-
294
- - restrict suggestedMin/Max by X axe OW-4327
295
-
296
- ## 2.3.2
297
-
298
- - added default values for axis ticks (suggestedMin/Max) OW-4327
299
-
300
- ## 2.3.0
301
-
302
- - Text annotations in line chart
303
-
304
- ## 2.2.1
305
-
306
- - Support for dark mode
307
-
308
- ## 2.2.0
309
-
310
- - first publish of release notes
@@ -1 +0,0 @@
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>
@@ -1 +0,0 @@
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>
@@ -1 +0,0 @@
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>
@@ -1 +0,0 @@
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>
@@ -1,209 +0,0 @@
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
- };