@oliasoft-open-source/charts-library 2.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 (79) hide show
  1. package/.eslintignore +2 -0
  2. package/.eslintrc.js +129 -0
  3. package/.gitlab-ci.yml +77 -0
  4. package/.husky/pre-commit +4 -0
  5. package/.prettierignore +3 -0
  6. package/.prettierrc +4 -0
  7. package/.storybook/main.js +40 -0
  8. package/LICENSE +21 -0
  9. package/README.md +5 -0
  10. package/babel.config.js +29 -0
  11. package/index.js +9 -0
  12. package/jest.config.js +9 -0
  13. package/package.json +96 -0
  14. package/src/components/bar-chart/bar-chart-prop-types.js +181 -0
  15. package/src/components/bar-chart/bar-chart.interface.ts +83 -0
  16. package/src/components/bar-chart/bar-chart.jsx +247 -0
  17. package/src/components/bar-chart/bar-chart.module.less +56 -0
  18. package/src/components/bar-chart/basic.stories.jsx +752 -0
  19. package/src/components/bar-chart/charts.stories.jsx +119 -0
  20. package/src/components/bar-chart/get-bar-chart-data-labels.js +45 -0
  21. package/src/components/bar-chart/get-bar-chart-scales.js +147 -0
  22. package/src/components/bar-chart/get-bar-chart-tooltips.js +100 -0
  23. package/src/components/line-chart/Controls/Controls.jsx +59 -0
  24. package/src/components/line-chart/Controls/Controls.module.less +21 -0
  25. package/src/components/line-chart/Controls/Layer.jsx +169 -0
  26. package/src/components/line-chart/basic.stories.jsx +735 -0
  27. package/src/components/line-chart/charts.stories.jsx +264 -0
  28. package/src/components/line-chart/get-line-chart-data-labels.js +24 -0
  29. package/src/components/line-chart/get-line-chart-scales.js +131 -0
  30. package/src/components/line-chart/get-line-chart-tooltips.js +91 -0
  31. package/src/components/line-chart/line-chart-consts.js +6 -0
  32. package/src/components/line-chart/line-chart-prop-types.js +187 -0
  33. package/src/components/line-chart/line-chart-utils.js +163 -0
  34. package/src/components/line-chart/line-chart.interface.ts +103 -0
  35. package/src/components/line-chart/line-chart.jsx +423 -0
  36. package/src/components/line-chart/line-chart.minor-gridlines-plugin.js +78 -0
  37. package/src/components/line-chart/line-chart.minor-gridlines-plugin.test.js +34 -0
  38. package/src/components/line-chart/line-chart.module.less +56 -0
  39. package/src/components/line-chart/state/action-types.js +9 -0
  40. package/src/components/line-chart/state/initial-state.js +51 -0
  41. package/src/components/line-chart/state/line-chart-reducer.js +115 -0
  42. package/src/components/line-chart/stories/shapes/cubes.stories.jsx +326 -0
  43. package/src/components/line-chart/stories/shapes/pyramid.stories.jsx +189 -0
  44. package/src/components/line-chart/stories/shapes/round.stories.jsx +339 -0
  45. package/src/components/line-chart/stories/shapes/triangle.stories.jsx +166 -0
  46. package/src/components/pie-chart/basic.stories.jsx +390 -0
  47. package/src/components/pie-chart/charts.stories.jsx +66 -0
  48. package/src/components/pie-chart/pie-chart-prop-types.js +111 -0
  49. package/src/components/pie-chart/pie-chart-utils.js +55 -0
  50. package/src/components/pie-chart/pie-chart.interface.ts +61 -0
  51. package/src/components/pie-chart/pie-chart.jsx +477 -0
  52. package/src/components/pie-chart/pie-chart.module.less +56 -0
  53. package/src/components/scatter-chart/scatter-chart.intefrace.ts +32 -0
  54. package/src/components/scatter-chart/scatter-chart.jsx +13 -0
  55. package/src/components/scatter-chart/scatter.stories.jsx +196 -0
  56. package/src/helpers/chart-consts.js +82 -0
  57. package/src/helpers/chart-interface.ts +54 -0
  58. package/src/helpers/chart-utils.js +178 -0
  59. package/src/helpers/container.jsx +60 -0
  60. package/src/helpers/disabled-context.js +8 -0
  61. package/src/helpers/enums.js +84 -0
  62. package/src/helpers/get-chart-annotation.js +91 -0
  63. package/src/helpers/styles.js +68 -0
  64. package/src/helpers/text.js +6 -0
  65. package/src/style/external.less +4 -0
  66. package/src/style/fonts/lato/Lato-Bold.woff2 +0 -0
  67. package/src/style/fonts/lato/Lato-BoldItalic.woff2 +0 -0
  68. package/src/style/fonts/lato/Lato-Italic.woff2 +0 -0
  69. package/src/style/fonts/lato/Lato-Regular.woff2 +0 -0
  70. package/src/style/fonts.less +27 -0
  71. package/src/style/global.less +43 -0
  72. package/src/style/reset/reset.less +28 -0
  73. package/src/style/shared.less +24 -0
  74. package/src/style/variables.less +91 -0
  75. package/webpack/webpack.common.js +39 -0
  76. package/webpack/webpack.common.rules.js +107 -0
  77. package/webpack/webpack.dev.js +22 -0
  78. package/webpack/webpack.prod.js +23 -0
  79. package/webpack/webpack.resolve.js +22 -0
@@ -0,0 +1,78 @@
1
+ const MINOR_TICKS_PER_MAJOR = 10;
2
+
3
+ // Return largest gap between ticks
4
+ // (Tick distance may not be consistent if ranges are custom)
5
+ export const getLargestMajorTickWidth = (majorTickPositions) => {
6
+ return majorTickPositions.reduce((acc, curr, index) => {
7
+ if (index === 0) return acc;
8
+ const gap = Math.abs(curr - majorTickPositions[index - 1]);
9
+ return Math.max(gap, acc);
10
+ }, 0);
11
+ };
12
+
13
+ // Check if position is in visible part of axis scale
14
+ export const isValidPosition = (minorTickPosition, majorTickPositions) => {
15
+ const isAfterStart = minorTickPosition > majorTickPositions[0];
16
+ const isBeforeEnd =
17
+ minorTickPosition < majorTickPositions[majorTickPositions.length - 1];
18
+ const isDuplicate = majorTickPositions.indexOf(minorTickPosition) !== -1;
19
+ return isAfterStart && isBeforeEnd && !isDuplicate;
20
+ };
21
+
22
+ // Generate minor tick positions for a given axis/scale
23
+ // (Uses second tick as starting point in case first tick is an irregular custom value)
24
+ export const getMinorTickPositions = (majorTickPositions) => {
25
+ const sortedMajorTickPositions = majorTickPositions.sort((a, b) => {
26
+ return a - b;
27
+ });
28
+ const minorTickWidth = getLargestMajorTickWidth(majorTickPositions) / 10;
29
+ const startPosition = majorTickPositions[1];
30
+ const numMinorTicks = (majorTickPositions.length - 1) * MINOR_TICKS_PER_MAJOR;
31
+ const positions = [...Array(numMinorTicks)]
32
+ .map((_, index) => {
33
+ const minorTickPosition =
34
+ startPosition + (index - MINOR_TICKS_PER_MAJOR + 1) * minorTickWidth;
35
+ return parseFloat(minorTickPosition.toFixed(1));
36
+ })
37
+ .filter((position) => isValidPosition(position, sortedMajorTickPositions));
38
+ return positions;
39
+ };
40
+
41
+ const drawMinorTicksForScale = (scale) => {
42
+ const { chart, ctx } = scale;
43
+ if (!chart.config._config.options.scales[scale.id].grid.drawOnChartArea)
44
+ return;
45
+ if (chart.config._config.options.indexAxis === scale.axis) return;
46
+ const isHorizontal = scale.axis === 'x';
47
+ const majorTickPositions = scale.ticks.map((_, index) =>
48
+ scale.getPixelForTick(index),
49
+ );
50
+ const minorTickPositions = getMinorTickPositions(majorTickPositions);
51
+ ctx.save();
52
+ ctx.strokeStyle =
53
+ chart.config._config.options.scales[scale.id].grid.color ||
54
+ 'rgba(0,0,0,0.06)';
55
+ ctx.lineWidth = 0.5;
56
+ minorTickPositions.forEach((minorTickPosition) => {
57
+ ctx.beginPath();
58
+ if (isHorizontal) {
59
+ const { top, bottom } = chart.chartArea;
60
+ ctx.moveTo(minorTickPosition, top);
61
+ ctx.lineTo(minorTickPosition, bottom);
62
+ } else {
63
+ const { left, right } = chart.chartArea;
64
+ ctx.moveTo(left, minorTickPosition);
65
+ ctx.lineTo(right, minorTickPosition);
66
+ }
67
+ ctx.stroke();
68
+ });
69
+ ctx.restore();
70
+ };
71
+
72
+ export const chartMinorGridlinesPlugin = {
73
+ id: 'minorGridlines',
74
+ beforeDatasetsDraw: (chart) => {
75
+ const { scales } = chart;
76
+ Object.keys(scales).forEach((id) => drawMinorTicksForScale(scales[id]));
77
+ },
78
+ };
@@ -0,0 +1,34 @@
1
+ import {
2
+ getLargestMajorTickWidth,
3
+ getMinorTickPositions,
4
+ isValidPosition,
5
+ } from './line-chart.minor-gridlines-plugin';
6
+
7
+ describe('chartMinorGridlinesPlugin', () => {
8
+ test('getLargestMajorTickWidth', () => {
9
+ const even = [0, 1, 2, 3];
10
+ const uneven = [0.85, 1, 2, 2.25];
11
+ expect(getLargestMajorTickWidth(even)).toBe(1);
12
+ expect(getLargestMajorTickWidth(uneven)).toBe(1);
13
+ });
14
+ test('isValidPosition', () => {
15
+ const tickPositions = [0, 1, 2, 3];
16
+ const inBounds = 0.1;
17
+ const outOfBounds = 3.1;
18
+ const duplicate = 2;
19
+ expect(isValidPosition(inBounds, tickPositions)).toBe(true);
20
+ expect(isValidPosition(outOfBounds, tickPositions)).toBe(false);
21
+ expect(isValidPosition(duplicate, tickPositions)).toBe(false);
22
+ });
23
+ test('getMinorTickPositions', () => {
24
+ const even = [0, 1, 2, 3];
25
+ const uneven = [0.85, 1, 2, 2.25];
26
+ expect(getMinorTickPositions(even)).toStrictEqual([
27
+ 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6,
28
+ 1.7, 1.8, 1.9, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9,
29
+ ]);
30
+ expect(getMinorTickPositions(uneven)).toStrictEqual([
31
+ 0.9, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.1, 2.2,
32
+ ]);
33
+ });
34
+ });
@@ -0,0 +1,56 @@
1
+ .chart {
2
+ border: 1px solid rgba(255, 255, 255, 0);
3
+ padding-top: 10px;
4
+ position: relative;
5
+
6
+ canvas {
7
+ width: 100% !important; // Fix for resizing bug
8
+ height: 100% !important; // Remove if stretched when maintainAspectRatio=true
9
+ }
10
+
11
+ &.fixedHeight {
12
+ display: flex;
13
+ align-items: flex-start;
14
+ justify-content: flex-start;
15
+ height: auto;
16
+ }
17
+
18
+ &.stretchHeight {
19
+ display: flex;
20
+ align-items: stretch;
21
+ justify-content: stretch;
22
+ height: 100%;
23
+ }
24
+
25
+ &:focus {
26
+ border: 1px solid #85b7d9;
27
+ outline: none; // Remove dotted outline on FF
28
+ }
29
+
30
+ &::-moz-focus-inner {
31
+ border: 0; // Remove dotted outline on FF
32
+ }
33
+ }
34
+
35
+ .zoomForm {
36
+ position: absolute;
37
+ display: flex;
38
+ align-items: center;
39
+ justify-content: center;
40
+ top: 0;
41
+ right: 0;
42
+
43
+ .zoomReset {
44
+ margin-left: 10px;
45
+ }
46
+
47
+ .help {
48
+ margin-left: 5px;
49
+ line-height: 0; // Strip whitespace from icon
50
+ }
51
+ }
52
+
53
+ .autoWeight {
54
+ width: auto;
55
+ height: auto;
56
+ }
@@ -0,0 +1,9 @@
1
+ export const TOGGLE_ZOOM = 'TOGGLE_ZOOM';
2
+ export const TOGGLE_PAN = 'TOGGLE_PAN';
3
+ export const TOGGLE_POINTS = 'TOGGLE_POINTS';
4
+ export const TOGGLE_LINE = 'TOGGLE_LINE';
5
+ export const TOGGLE_LEGEND = 'TOGGLE_LEGEND';
6
+ export const UNSET_AXES_VALUES = 'UNSET_AXES_VALUES';
7
+ export const SET_AXIS_VALUE = 'SET_AXIS_VALUE';
8
+ export const SET_POINTS_ZOOM_DEFAULTS = 'SET_POINTS_ZOOM_DEFAULTS';
9
+ export const TOGGLE_ANNOTATION = 'TOGGLE_ANNOTATION';
@@ -0,0 +1,51 @@
1
+ import { AxisType } from '../../../helpers/enums';
2
+ import { setAnnotations } from '../../../helpers/chart-utils';
3
+
4
+ const initialState = ({
5
+ axes,
6
+ enableZoom,
7
+ enablePan,
8
+ showPoints,
9
+ showLine,
10
+ legendDisplay,
11
+ annotationsData,
12
+ }) => {
13
+ /**
14
+ * getAxis
15
+ * @param {'x'|'y'} axisType
16
+ * @return {{id: string, label: string}[] | []} returns array of objects describing all chart axis or empty array
17
+ */
18
+ const getStateAxesByType = (axisType) => {
19
+ if (axes[axisType].length > 1) {
20
+ return axes[axisType].map((axisObj, index) => {
21
+ return {
22
+ id: `${axisType}${index}`,
23
+ label: axisObj.label,
24
+ };
25
+ });
26
+ } else {
27
+ return [
28
+ {
29
+ id: axisType,
30
+ label: axes[axisType][0].label,
31
+ },
32
+ ];
33
+ }
34
+ };
35
+
36
+ const xStateAxes = getStateAxesByType(AxisType.X);
37
+ const yStateAxes = getStateAxesByType(AxisType.Y);
38
+ const stateAxes = [...xStateAxes, ...yStateAxes];
39
+
40
+ return {
41
+ zoomEnabled: enableZoom,
42
+ panEnabled: true, // TODO: work out why this logic doesn't work, workaround wih dispatch is currently used
43
+ pointsEnabled: showPoints,
44
+ lineEnabled: showLine,
45
+ legendEnabled: legendDisplay !== false,
46
+ axes: stateAxes,
47
+ showAnnotationLineIndex: setAnnotations(annotationsData),
48
+ };
49
+ };
50
+
51
+ export default initialState;
@@ -0,0 +1,115 @@
1
+ import {
2
+ cleanNumStr,
3
+ isGreaterThanMin,
4
+ isLessThanMax,
5
+ toNum,
6
+ validNumber,
7
+ } from '../line-chart-utils';
8
+ import {
9
+ TOGGLE_PAN,
10
+ TOGGLE_ZOOM,
11
+ TOGGLE_POINTS,
12
+ TOGGLE_LINE,
13
+ TOGGLE_LEGEND,
14
+ UNSET_AXES_VALUES,
15
+ SET_AXIS_VALUE,
16
+ SET_POINTS_ZOOM_DEFAULTS,
17
+ TOGGLE_ANNOTATION,
18
+ } from './action-types';
19
+ import { getAxisValue } from '../../../helpers/chart-utils';
20
+
21
+ const unsetAxisValues = (axes) => axes.map(({ min, max, ...axis }) => axis);
22
+
23
+ export const reducer = (state, action) => {
24
+ const newState = { ...state };
25
+ switch (action.type) {
26
+ case TOGGLE_ZOOM: {
27
+ newState.zoomEnabled = !newState.zoomEnabled;
28
+ if (newState.panEnabled) {
29
+ newState.panEnabled = false;
30
+ }
31
+ // TODO: find out if this logic is needed once panning and zomming works properly
32
+ // if (!newState.zoomEnabled) {
33
+ // //reset the axes when enabling zoom (zoom plugin and manual ranges aren't compatible together yet)
34
+ // newState.axes = unsetAxisValues(newState.axes);
35
+ // }
36
+ return newState;
37
+ }
38
+ case TOGGLE_PAN: {
39
+ newState.panEnabled = !newState.panEnabled;
40
+ if (newState.zoomEnabled) {
41
+ newState.zoomEnabled = false;
42
+ }
43
+ // if (!newState.panEnabled) {
44
+ // //reset the axes when enabling pan (zoom plugin and manual ranges aren't compatible together yet)
45
+ // newState.axes = unsetAxisValues(newState.axes);
46
+ // }
47
+ return newState;
48
+ }
49
+ case TOGGLE_POINTS: {
50
+ return {
51
+ ...newState,
52
+ pointsEnabled: !newState.pointsEnabled,
53
+ };
54
+ }
55
+ case TOGGLE_LINE: {
56
+ return {
57
+ ...newState,
58
+ lineEnabled: !newState.lineEnabled,
59
+ };
60
+ }
61
+ case TOGGLE_LEGEND: {
62
+ return {
63
+ ...newState,
64
+ legendEnabled: !newState.legendEnabled,
65
+ };
66
+ }
67
+ case UNSET_AXES_VALUES: {
68
+ return {
69
+ ...newState,
70
+ axes: unsetAxisValues(newState.axes),
71
+ };
72
+ }
73
+ case SET_AXIS_VALUE: {
74
+ const { name, value: nextInputValue, id } = action.payload;
75
+ const nextValue = isNaN(nextInputValue)
76
+ ? cleanNumStr(nextInputValue)
77
+ : toNum(nextInputValue);
78
+ const axis = newState.axes.find((a) => a.id === id);
79
+ axis.min = getAxisValue(name === 'min' ? nextValue : axis.min?.value);
80
+ axis.max = getAxisValue(name === 'max' ? nextValue : axis.max?.value);
81
+ axis.min.valid =
82
+ validNumber(axis.min.inputValue ?? '') &&
83
+ isLessThanMax(axis.min.value, axis.max.value);
84
+ axis.min.displayValue = axis.min.valid ? axis.min.value : undefined;
85
+ axis.max.valid =
86
+ validNumber(axis.max.inputValue ?? '') &&
87
+ isGreaterThanMin(axis.max.value, axis.min.value);
88
+ axis.max.displayValue = axis.max.valid ? axis.max.value : undefined;
89
+ return newState;
90
+ }
91
+ case SET_POINTS_ZOOM_DEFAULTS:
92
+ const { showPoints, enableZoom, enablePan, showLine } = action.payload;
93
+ return {
94
+ ...newState,
95
+ zoomEnabled: enableZoom,
96
+ pointsEnabled: showPoints,
97
+ lineEnabled: showLine,
98
+ panEnabled: enablePan,
99
+ };
100
+ case TOGGLE_ANNOTATION:
101
+ const { annotationIndex } = action.payload;
102
+ const updatedIndexes = newState.showAnnotationLineIndex.includes(
103
+ annotationIndex,
104
+ )
105
+ ? newState.showAnnotationLineIndex.filter((v) => v !== annotationIndex)
106
+ : [...newState.showAnnotationLineIndex, annotationIndex];
107
+ return {
108
+ ...newState,
109
+ showAnnotationLineIndex: updatedIndexes,
110
+ };
111
+ default: {
112
+ return newState;
113
+ }
114
+ }
115
+ };
@@ -0,0 +1,326 @@
1
+ import React from 'react';
2
+ import { LineChart } from '../../line-chart';
3
+ import { Container } from '../../../../helpers/container';
4
+
5
+ const style = {
6
+ height: '1000px',
7
+ width: '1000px',
8
+ };
9
+
10
+ const cubeLines = {
11
+ borderColor: '#011fa3',
12
+ pointBackgroundColor: '#011fa3',
13
+ pointRadius: '0',
14
+ pointHoverRadius: '0',
15
+ pointHitRadius: '0',
16
+ borderWidth: 4,
17
+ data: [
18
+ {
19
+ x: 10,
20
+ y: 30,
21
+ },
22
+ {
23
+ x: 10,
24
+ y: 10,
25
+ },
26
+ {
27
+ x: 30,
28
+ y: 10,
29
+ },
30
+ {
31
+ x: 36,
32
+ y: 17,
33
+ },
34
+ {
35
+ x: 36,
36
+ y: 33,
37
+ },
38
+ {
39
+ x: 20,
40
+ y: 33,
41
+ },
42
+ {
43
+ x: 10,
44
+ y: 30,
45
+ },
46
+ {
47
+ x: 30,
48
+ y: 30,
49
+ },
50
+ {
51
+ x: 30,
52
+ y: 10,
53
+ },
54
+ {
55
+ x: 30,
56
+ y: 30,
57
+ },
58
+ {
59
+ x: 36,
60
+ y: 33,
61
+ },
62
+ ],
63
+ };
64
+
65
+ const cubeDashedLines = {
66
+ borderColor: '#011fa3',
67
+ pointBackgroundColor: '#011fa3',
68
+ pointRadius: '0',
69
+ pointHoverRadius: '0',
70
+ pointHitRadius: '0',
71
+ borderDash: [10, 5],
72
+ borderWidth: 2,
73
+ data: [
74
+ {
75
+ x: 10,
76
+ y: 10,
77
+ },
78
+ {
79
+ x: 20,
80
+ y: 17,
81
+ },
82
+ {
83
+ x: 36,
84
+ y: 17,
85
+ },
86
+ {
87
+ x: 20,
88
+ y: 17,
89
+ },
90
+ {
91
+ x: 20,
92
+ y: 33,
93
+ },
94
+ ],
95
+ };
96
+
97
+ const cubeData = {
98
+ datasets: [cubeLines, cubeDashedLines],
99
+ };
100
+
101
+ export const CubesLineChartExample = () => (
102
+ <Container style={style}>
103
+ <LineChart
104
+ chart={{
105
+ data: cubeData,
106
+ options: {
107
+ title: 'Cube using datasets',
108
+ axes: {
109
+ x: [
110
+ {
111
+ gridLines: {
112
+ drawOnChartArea: false,
113
+ },
114
+ },
115
+ ],
116
+ y: [
117
+ {
118
+ gridLines: {
119
+ drawOnChartArea: false,
120
+ },
121
+ },
122
+ ],
123
+ },
124
+ additionalAxesOptions: {
125
+ range: {
126
+ x: {
127
+ min: 5,
128
+ max: 40,
129
+ },
130
+ y: {
131
+ min: 5,
132
+ max: 40,
133
+ },
134
+ },
135
+ },
136
+ chartStyling: {
137
+ width: 768,
138
+ height: 768,
139
+ },
140
+ legend: {
141
+ display: false,
142
+ },
143
+ },
144
+ }}
145
+ />
146
+ <LineChart
147
+ chart={{
148
+ data: cubeData,
149
+ options: {
150
+ title: 'Cube with perspective lines using annotations',
151
+ axes: {
152
+ x: [
153
+ {
154
+ gridLines: {
155
+ drawOnChartArea: false,
156
+ },
157
+ },
158
+ ],
159
+ y: [
160
+ {
161
+ gridLines: {
162
+ drawOnChartArea: false,
163
+ },
164
+ },
165
+ ],
166
+ },
167
+ additionalAxesOptions: {
168
+ range: {
169
+ x: {
170
+ min: 5,
171
+ max: 40,
172
+ },
173
+ y: {
174
+ min: 5,
175
+ max: 40,
176
+ },
177
+ },
178
+ },
179
+ chartStyling: {
180
+ width: 768,
181
+ height: 768,
182
+ },
183
+ annotations: {
184
+ annotationsData: [
185
+ {
186
+ annotationAxis: 'x',
187
+ value: 55.7,
188
+ endValue: 25.8,
189
+ color: 'rgba(128, 32, 196, 0.5)',
190
+ },
191
+ {
192
+ annotationAxis: 'x',
193
+ value: 52.5,
194
+ endValue: 3,
195
+ color: 'rgba(128, 32, 196, 0.5)',
196
+ },
197
+ {
198
+ annotationAxis: 'x',
199
+ value: 49.3,
200
+ endValue: -19.8,
201
+ color: 'rgba(128, 32, 196, 0.4)',
202
+ },
203
+ {
204
+ annotationAxis: 'x',
205
+ value: 46.1,
206
+ endValue: -42.6,
207
+ color: 'rgba(128, 32, 196, 0.3)',
208
+ },
209
+ {
210
+ annotationAxis: 'x',
211
+ value: 42.9,
212
+ endValue: -65.4,
213
+ color: 'rgba(128, 32, 196, 0.2)',
214
+ },
215
+ {
216
+ annotationAxis: 'x',
217
+ value: 39.7,
218
+ endValue: -88.2,
219
+ color: 'rgba(128, 32, 196, 0.1)',
220
+ },
221
+ {
222
+ annotationAxis: 'x',
223
+ value: 36.5,
224
+ endValue: -111,
225
+ color: 'rgba(128, 32, 196, 0.1)',
226
+ },
227
+ {
228
+ annotationAxis: 'x',
229
+ value: 33.3,
230
+ endValue: -133.8,
231
+ color: 'rgba(128, 32, 196, 0.1)',
232
+ },
233
+ {
234
+ annotationAxis: 'x',
235
+ value: 30.1,
236
+ endValue: -156.6,
237
+ color: 'rgba(128, 32, 196, 0.1)',
238
+ },
239
+ {
240
+ annotationAxis: 'x',
241
+ value: 26.9,
242
+ endValue: -179.4,
243
+ color: 'rgba(128, 32, 196, 0.1)',
244
+ },
245
+ {
246
+ annotationAxis: 'y',
247
+ value: 10,
248
+ color: 'rgba(128, 32, 196, 0.5)',
249
+ },
250
+ {
251
+ annotationAxis: 'y',
252
+ value: 17,
253
+ color: 'rgba(128, 32, 196, 0.5)',
254
+ },
255
+ {
256
+ annotationAxis: 'y',
257
+ value: 23,
258
+ color: 'rgba(128, 32, 196, 0.5)',
259
+ },
260
+ {
261
+ annotationAxis: 'y',
262
+ value: 28,
263
+ color: 'rgba(128, 32, 196, 0.5)',
264
+ },
265
+ {
266
+ annotationAxis: 'y',
267
+ value: 32,
268
+ color: 'rgba(128, 32, 196, 0.4)',
269
+ },
270
+ {
271
+ annotationAxis: 'y',
272
+ value: 35,
273
+ color: 'rgba(128, 32, 196, 0.3)',
274
+ },
275
+ {
276
+ annotationAxis: 'y',
277
+ value: 37,
278
+ color: 'rgba(128, 32, 196, 0.2)',
279
+ },
280
+ {
281
+ annotationAxis: 'y',
282
+ value: 38,
283
+ color: 'rgba(128, 32, 196, 0.1)',
284
+ },
285
+ ],
286
+ },
287
+ legend: {
288
+ display: false,
289
+ },
290
+ },
291
+ }}
292
+ />
293
+ <LineChart
294
+ chart={{
295
+ data: cubeData,
296
+ options: {
297
+ title: 'Cube with gridlines',
298
+ additionalAxesOptions: {
299
+ range: {
300
+ x: {
301
+ min: 5,
302
+ max: 40,
303
+ },
304
+ y: {
305
+ min: 5,
306
+ max: 40,
307
+ },
308
+ },
309
+ },
310
+ chartStyling: {
311
+ width: 768,
312
+ height: 768,
313
+ },
314
+ legend: {
315
+ display: false,
316
+ },
317
+ },
318
+ }}
319
+ />
320
+ </Container>
321
+ );
322
+
323
+ export default {
324
+ title: 'Line Chart - Cube Shape',
325
+ component: CubesLineChartExample,
326
+ };