@oliasoft-open-source/charts-library 2.17.5 → 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 +28 -36
  2. package/index.js +0 -14
  3. package/release-notes.md +0 -305
  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.5",
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
- "@oliasoft-open-source/react-ui-library": "^3.4.2",
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,29 +72,22 @@
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
- "@oliasoft-open-source/react-ui-library": "^3.4.2",
90
+ "@oliasoft-open-source/react-ui-library": "^3.5.6",
99
91
  "@oliasoft-open-source/units": "^2.6.1",
100
92
  "immer": "^9",
101
93
  "prop-types": "^15",
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,305 +0,0 @@
1
- # Charts Library Release Notes
2
-
3
- ## 2.17.5
4
-
5
- - Support disabling `usePointStyle` to show dashed lines in legend ([OW-11786](https://oliasoft.atlassian.net/browse/OW-11786))
6
-
7
- ## 2.17.4
8
-
9
- - Use new `<NumberInput>` component from GUI Library in charts controls, to simplify validation ([OW-11773](https://oliasoft.atlassian.net/browse/OW-11773))
10
-
11
- ## 2.17.3
12
-
13
- - Replace legacy internal implementation of `isEqualWithTolerance` with `isCloseTo` from units package ([OW-11767](https://oliasoft.atlassian.net/browse/OW-11767))
14
-
15
- ## 2.17.2
16
-
17
- - Fix release CI/CD pipeline ([OW-11691](https://oliasoft.atlassian.net/browse/OW-11691))
18
-
19
- ## 2.17.1
20
-
21
- - Added debounce to prevent maximum call stack size exceeded
22
-
23
- ## 2.17.0
24
-
25
- - Added initialize logic, for improve translations
26
-
27
- ## 2.16.0
28
-
29
- - Added common chart area text plugin
30
-
31
- ## 2.15.0
32
- - Added translation, by provider handled([OW-11237](https://oliasoft.atlassian.net/browse/OW-11237))
33
-
34
- ## 2.14.1
35
- - Fix save initAxesRange when dataset changed by parent component([OW-11332](https://oliasoft.atlassian.net/browse/OW-11332))
36
-
37
- ## 2.14.0
38
- - Refactored line chart, for better performance, readable and reduce not needed re-renders
39
-
40
- ## 2.13.5
41
-
42
- - Fixed reset range when subComponent update data, prevent extra re-renders when range have same deep values but different reference
43
-
44
- ## 2.13.4
45
-
46
- - Fixed legend state
47
-
48
- ## 2.13.3
49
-
50
- - Added story for point styling to support ([OW-11107](https://oliasoft.atlassian.net/browse/OW-11107))
51
-
52
- ## 2.13.2
53
-
54
- - Changed default value for zoom to true
55
-
56
- ## 2.13.1
57
-
58
- - Text label for drag options trigger, to make current behaviour more obvious ([OW-11102](https://oliasoft.atlassian.net/browse/OW-11102))
59
-
60
- ## 2.13.0
61
-
62
- - Added feature to save state to localStorage and clean when expired, fixed panEnable(state) bug.
63
-
64
- ## 2.12.0
65
-
66
- - Add unit selector and depth selector to axes options ([OW-9496](https://oliasoft.atlassian.net/browse/OW-9496))
67
-
68
- ## 2.11.3
69
-
70
- - Submit Axes option on keyboard Enter ([OW-10995](https://oliasoft.atlassian.net/browse/OW-10995))
71
-
72
- ## 2.11.2
73
-
74
- - remove number handling functions that were duplicated from units package
75
- ([OW-11062](https://oliasoft.atlassian.net/browse/OW-11062))
76
-
77
- ## 2.11.1
78
-
79
- - updated icon import
80
-
81
- ## 2.11.0
82
-
83
- - added `dragData` feature ([chartjs-plugin-dragdata](https://github.com/chrispahm/chartjs-plugin-dragdata))
84
-
85
- ## 2.10.2
86
-
87
- - remove dead `less-vars-to-js` package ([OW-11017](https://oliasoft.atlassian.net/browse/OW-11017))
88
-
89
- ## 2.10.1
90
-
91
- - Use `peerDependencies` for common versions of shared packages like `units` and `react-ui-library` so reduce double
92
- installs and conflicting versions in parent apps ([OW-10974](https://oliasoft.atlassian.net/browse/OW-10974))
93
-
94
- ## 2.10.0
95
-
96
- - Switch to standard `round()` function from units repo [OW-10972](https://oliasoft.atlassian.net/browse/OW-10972)
97
-
98
- ## 2.9.4
99
-
100
- - Updated version of UI Library
101
-
102
- ## 2.9.3
103
-
104
- - Add @oliasoft-open-source/units package and update pase method in BarChart ([OW-10670](https://oliasoft.atlassian.net/browse/OW-10670))
105
-
106
- ## 2.9.2
107
-
108
- - Fix missing axis scale when in dataset is one point with negative values ([OW-10616](https://oliasoft.atlassian.net/browse/OW-10616))
109
-
110
- ## 2.9.1
111
-
112
- - Fix decimal values in BarChart in tooltips for locales with comma decimal ([OW-10632](https://oliasoft.atlassian.net/browse/OW-10632))
113
-
114
- ## 2.9.0
115
-
116
- - 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))
117
-
118
- ## 2.8.0
119
-
120
- - Simplify dist-tag strategy for beta version releases (to reduce cleanup effort) ([OW-10003](https://oliasoft.atlassian.net/browse/OW-10003))
121
-
122
- ## 2.7.0
123
-
124
- - Add optional CI pipeline that automates publishing of beta releases ([OW-10003](https://oliasoft.atlassian.net/browse/OW-10003))
125
-
126
- ## 2.6.2
127
-
128
- - Fix asis range update correctly ([OW-10534](https://oliasoft.atlassian.net/browse/OW-10534), and [OW-10457](https://oliasoft.atlassian.net/browse/OW-10457))
129
-
130
- ## 2.6.1
131
-
132
- - Added Box and Ellipse annotations ([OW-10519](https://oliasoft.atlassian.net/browse/OW-10519))
133
-
134
- ## 2.6.0
135
-
136
- - Add support for optional `autoAxisPadding` prop, which autoscales 5% padding around data ([OW-10398](https://oliasoft.atlassian.net/browse/OW-10398))
137
- - Fix bug in default scales when all data points similar values ([OW-4327](https://oliasoft.atlassian.net/browse/OW-4327))
138
-
139
- ## 2.5.27
140
-
141
- - Add guard to useEffect in line-chart
142
-
143
- ## 2.5.26
144
-
145
- - Add guard to getLineChartAxis method
146
-
147
- ## 2.5.25
148
-
149
- - Fix axis ranges updating when new chart data and ranges is passed
150
-
151
- ## 2.5.24
152
-
153
- - Add performance test case
154
-
155
- ## 2.5.23
156
-
157
- - Patch minor regression in axis limits introduced in 2.5.22
158
-
159
- ## 2.5.22
160
-
161
- - Improve UX and input validation for axes range inputs ([OW-10305](https://oliasoft.atlassian.net/browse/OW-10305))
162
-
163
- ## 2.5.21
164
-
165
- - Revert changes from `2.5.12` / [OW-10320](https://oliasoft.atlassian.net/browse/OW-10320)
166
- - Changing thousands separators broke decimal separators in some locales
167
- - Resolves [OW-10320](https://oliasoft.atlassian.net/browse/OW-10320)
168
-
169
- ## 2.5.20
170
-
171
- - Minor refactor (code cleanup)
172
-
173
- ## 2.5.19
174
-
175
- - Hide irregular major axis ticks ([OW-10088](https://oliasoft.atlassian.net/browse/OW-10088))
176
-
177
- ## 2.5.18
178
-
179
- - Fixed minor gridlines when last major tick does not reach axis bounds ([OW-10296](https://oliasoft.atlassian.net/browse/OW-10296))
180
-
181
- ## 2.5.17
182
-
183
- - Added some (realistic) test case stories from our app
184
-
185
- ## 2.5.16
186
-
187
- - Remove test artefacts from published package
188
-
189
- ## 2.5.15
190
-
191
- - Changed GUI library version to `^3.1`
192
-
193
- ## 2.5.14
194
-
195
- - Sync axis labels in chart Controls with props
196
-
197
- ## 2.5.13
198
-
199
- - fixed custom range inputs reset, multi-axis range placeholder values missing
200
-
201
- ## 2.5.12
202
-
203
- - change thousand separators in axis label from comma to space
204
-
205
- ## 2.5.11
206
-
207
- - Allow headerComponent and chart title to coexist
208
-
209
- ## 2.5.10
210
-
211
- - Fix zoom / pan bug at < 0.1 scale on charts
212
-
213
- ## 2.5.9
214
-
215
- - Fix validation for two and more decimal places in charts settings
216
-
217
- ## 2.5.8
218
-
219
- - Disable tooltip animations in `performanceMode`
220
-
221
- ## 2.5.7
222
-
223
- - Allow stretchy headerComponent in controls
224
-
225
- ## 2.5.6
226
-
227
- - Removed resizeDelay, fixed double data labels set position
228
-
229
- ## 2.5.5
230
-
231
- - Removed empty label annotations
232
-
233
- ## 2.5.4
234
-
235
- - Fixed onPointHover event
236
-
237
- ## 2.5.3
238
-
239
- - Fixed datalabels position, set labels position inside chart area
240
-
241
- ## 2.5.2
242
-
243
- - Fix crashes when type a non number into the axis range - add validation in getLinechartAxis method
244
-
245
- ## 2.5.1
246
-
247
- - Added resize delay for performance
248
-
249
- ## 2.5.0
250
-
251
- - Separate controls for points/lines, axes options, legend, download
252
- - Standard control for table
253
- - Box zoom
254
-
255
- ## 2.4.6
256
-
257
- - Fix Multiple X Axes example in LineChart
258
-
259
- ## 2.4.5
260
-
261
- - Fix zooming issue from OW-9960
262
-
263
- ## 2.4.4
264
-
265
- - Updated GUI Library version
266
-
267
- ## 2.4.3
268
-
269
- - Fix crashes when type a non-number into the axis range OW-9924
270
-
271
- ## 2.4.2
272
-
273
- - Square aspect ratio charts can fill height/width
274
-
275
- ## 2.4.1
276
-
277
- - Remove dependency on http-server (moved to dev dependencies)
278
-
279
- ## 2.4.0
280
-
281
- - Switch package manager from NPM to Yarn
282
-
283
- ## 2.3.4
284
-
285
- - RollBack changes regarding OW-4327
286
-
287
- ## 2.3.3
288
-
289
- - restrict suggestedMin/Max by X axe OW-4327
290
-
291
- ## 2.3.2
292
-
293
- - added default values for axis ticks (suggestedMin/Max) OW-4327
294
-
295
- ## 2.3.0
296
-
297
- - Text annotations in line chart
298
-
299
- ## 2.2.1
300
-
301
- - Support for dark mode
302
-
303
- ## 2.2.0
304
-
305
- - 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
- };