@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.
- package/.eslintignore +2 -0
- package/.eslintrc.js +129 -0
- package/.gitlab-ci.yml +77 -0
- package/.husky/pre-commit +4 -0
- package/.prettierignore +3 -0
- package/.prettierrc +4 -0
- package/.storybook/main.js +40 -0
- package/LICENSE +21 -0
- package/README.md +5 -0
- package/babel.config.js +29 -0
- package/index.js +9 -0
- package/jest.config.js +9 -0
- package/package.json +96 -0
- package/src/components/bar-chart/bar-chart-prop-types.js +181 -0
- package/src/components/bar-chart/bar-chart.interface.ts +83 -0
- package/src/components/bar-chart/bar-chart.jsx +247 -0
- package/src/components/bar-chart/bar-chart.module.less +56 -0
- package/src/components/bar-chart/basic.stories.jsx +752 -0
- package/src/components/bar-chart/charts.stories.jsx +119 -0
- package/src/components/bar-chart/get-bar-chart-data-labels.js +45 -0
- package/src/components/bar-chart/get-bar-chart-scales.js +147 -0
- package/src/components/bar-chart/get-bar-chart-tooltips.js +100 -0
- package/src/components/line-chart/Controls/Controls.jsx +59 -0
- package/src/components/line-chart/Controls/Controls.module.less +21 -0
- package/src/components/line-chart/Controls/Layer.jsx +169 -0
- package/src/components/line-chart/basic.stories.jsx +735 -0
- package/src/components/line-chart/charts.stories.jsx +264 -0
- package/src/components/line-chart/get-line-chart-data-labels.js +24 -0
- package/src/components/line-chart/get-line-chart-scales.js +131 -0
- package/src/components/line-chart/get-line-chart-tooltips.js +91 -0
- package/src/components/line-chart/line-chart-consts.js +6 -0
- package/src/components/line-chart/line-chart-prop-types.js +187 -0
- package/src/components/line-chart/line-chart-utils.js +163 -0
- package/src/components/line-chart/line-chart.interface.ts +103 -0
- package/src/components/line-chart/line-chart.jsx +423 -0
- package/src/components/line-chart/line-chart.minor-gridlines-plugin.js +78 -0
- package/src/components/line-chart/line-chart.minor-gridlines-plugin.test.js +34 -0
- package/src/components/line-chart/line-chart.module.less +56 -0
- package/src/components/line-chart/state/action-types.js +9 -0
- package/src/components/line-chart/state/initial-state.js +51 -0
- package/src/components/line-chart/state/line-chart-reducer.js +115 -0
- package/src/components/line-chart/stories/shapes/cubes.stories.jsx +326 -0
- package/src/components/line-chart/stories/shapes/pyramid.stories.jsx +189 -0
- package/src/components/line-chart/stories/shapes/round.stories.jsx +339 -0
- package/src/components/line-chart/stories/shapes/triangle.stories.jsx +166 -0
- package/src/components/pie-chart/basic.stories.jsx +390 -0
- package/src/components/pie-chart/charts.stories.jsx +66 -0
- package/src/components/pie-chart/pie-chart-prop-types.js +111 -0
- package/src/components/pie-chart/pie-chart-utils.js +55 -0
- package/src/components/pie-chart/pie-chart.interface.ts +61 -0
- package/src/components/pie-chart/pie-chart.jsx +477 -0
- package/src/components/pie-chart/pie-chart.module.less +56 -0
- package/src/components/scatter-chart/scatter-chart.intefrace.ts +32 -0
- package/src/components/scatter-chart/scatter-chart.jsx +13 -0
- package/src/components/scatter-chart/scatter.stories.jsx +196 -0
- package/src/helpers/chart-consts.js +82 -0
- package/src/helpers/chart-interface.ts +54 -0
- package/src/helpers/chart-utils.js +178 -0
- package/src/helpers/container.jsx +60 -0
- package/src/helpers/disabled-context.js +8 -0
- package/src/helpers/enums.js +84 -0
- package/src/helpers/get-chart-annotation.js +91 -0
- package/src/helpers/styles.js +68 -0
- package/src/helpers/text.js +6 -0
- package/src/style/external.less +4 -0
- package/src/style/fonts/lato/Lato-Bold.woff2 +0 -0
- package/src/style/fonts/lato/Lato-BoldItalic.woff2 +0 -0
- package/src/style/fonts/lato/Lato-Italic.woff2 +0 -0
- package/src/style/fonts/lato/Lato-Regular.woff2 +0 -0
- package/src/style/fonts.less +27 -0
- package/src/style/global.less +43 -0
- package/src/style/reset/reset.less +28 -0
- package/src/style/shared.less +24 -0
- package/src/style/variables.less +91 -0
- package/webpack/webpack.common.js +39 -0
- package/webpack/webpack.common.rules.js +107 -0
- package/webpack/webpack.dev.js +22 -0
- package/webpack/webpack.prod.js +23 -0
- package/webpack/webpack.resolve.js +22 -0
|
@@ -0,0 +1,752 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BarChart } from './bar-chart';
|
|
3
|
+
import { Container } from '../../helpers/container';
|
|
4
|
+
|
|
5
|
+
const style = {
|
|
6
|
+
height: '1000px',
|
|
7
|
+
width: '1000px',
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const darkmodeStyle = {
|
|
11
|
+
backgroundColor: '#232628',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const labels1 = ['label 1', 'label 2', 'label 3'];
|
|
15
|
+
const dataset1_1a = { label: 'data1', data: [3, 8, 7] };
|
|
16
|
+
const dataset1_2a = { label: 'data2', data: [1, 2, 3] };
|
|
17
|
+
const dataset1_3a = { label: 'data3', data: [5, 0, 4] };
|
|
18
|
+
|
|
19
|
+
const dataset1_1b = { label: 'data1', data: [3, 8, 7], yAxisID: 'y1' };
|
|
20
|
+
const dataset1_2b = { label: 'data2', data: [1, 2, 3], yAxisID: 'y2' };
|
|
21
|
+
const dataset1_3b = { label: 'data3', data: [5, 0, 4], yAxisID: 'y2' };
|
|
22
|
+
|
|
23
|
+
const dataset1_1c = { label: 'data1', data: [3, 8, 7], stack: 1 };
|
|
24
|
+
const dataset1_2c = { label: 'data2', data: [1, 2, 3], stack: 1 };
|
|
25
|
+
const dataset1_3c = { label: 'data3', data: [5, 0, 4], stack: 2 };
|
|
26
|
+
|
|
27
|
+
const annotationDataset = { label: 'data', data: [42, 57, 64] };
|
|
28
|
+
|
|
29
|
+
const numericData = {
|
|
30
|
+
label: 'numeric data',
|
|
31
|
+
data: [
|
|
32
|
+
{
|
|
33
|
+
x: 1,
|
|
34
|
+
y: 3,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
x: 2,
|
|
38
|
+
y: 8,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
x: 3,
|
|
42
|
+
y: 7,
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const floatingData = {
|
|
48
|
+
label: 'floating data',
|
|
49
|
+
data: [
|
|
50
|
+
[2, 3],
|
|
51
|
+
[1.2, 8],
|
|
52
|
+
[4, 7],
|
|
53
|
+
],
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const roundedDataset = {
|
|
57
|
+
label: 'rounded data',
|
|
58
|
+
borderRadius: 50,
|
|
59
|
+
data: [42, 57, 64],
|
|
60
|
+
};
|
|
61
|
+
const borderWidthDataset = {
|
|
62
|
+
label: 'rounded data',
|
|
63
|
+
borderWidth: 8,
|
|
64
|
+
data: [42, 57, 64],
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const borderSkippedDataset = {
|
|
68
|
+
label: 'border skipped bottom',
|
|
69
|
+
borderSkipped: 'bottom',
|
|
70
|
+
data: [42, 57, 64],
|
|
71
|
+
backgroundColor: [
|
|
72
|
+
'rgba(255, 99, 132, 0.2)',
|
|
73
|
+
'rgba(255, 159, 64, 0.2)',
|
|
74
|
+
'rgba(255, 205, 86, 0.2)',
|
|
75
|
+
],
|
|
76
|
+
borderColor: ['rgb(255, 99, 132)', 'rgb(255, 159, 64)', 'rgb(255, 205, 86)'],
|
|
77
|
+
};
|
|
78
|
+
const borderSkippedDataset2 = {
|
|
79
|
+
label: 'border skipped top',
|
|
80
|
+
borderSkipped: 'top',
|
|
81
|
+
data: [47, 53, 69],
|
|
82
|
+
backgroundColor: [
|
|
83
|
+
'rgba(99, 132, 255, 0.2)',
|
|
84
|
+
'rgba(159, 64, 255, 0.2)',
|
|
85
|
+
'rgba(205, 86, 255, 0.2)',
|
|
86
|
+
],
|
|
87
|
+
borderColor: ['rgb(99, 132, 255)', 'rgb(159, 64, 255)', 'rgb(205, 86, 255)'],
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const datasetDatalabels = {
|
|
91
|
+
label: 'data',
|
|
92
|
+
data: [
|
|
93
|
+
{
|
|
94
|
+
x: 0,
|
|
95
|
+
y: 210,
|
|
96
|
+
label: 'label',
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
x: 0,
|
|
100
|
+
y: 333,
|
|
101
|
+
label: 'labal',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
x: 0,
|
|
105
|
+
y: 248,
|
|
106
|
+
label: 'lebel',
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
};
|
|
110
|
+
const datasetNoDataLabels = {
|
|
111
|
+
label: 'data',
|
|
112
|
+
data: [210, 333, 248],
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const singleChart = {
|
|
116
|
+
data: {
|
|
117
|
+
labels: labels1,
|
|
118
|
+
datasets: [dataset1_1a],
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const multipleBarData = {
|
|
123
|
+
data: {
|
|
124
|
+
labels: labels1,
|
|
125
|
+
datasets: [dataset1_1a, dataset1_2a, dataset1_3a],
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const stakedBarData = {
|
|
130
|
+
data: {
|
|
131
|
+
labels: labels1,
|
|
132
|
+
datasets: [dataset1_1a, dataset1_2a, dataset1_3a],
|
|
133
|
+
},
|
|
134
|
+
options: {
|
|
135
|
+
title: 'Stacked',
|
|
136
|
+
additionalAxesOptions: {
|
|
137
|
+
stacked: true,
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
const multipleAxisData = {
|
|
143
|
+
data: {
|
|
144
|
+
labels: labels1,
|
|
145
|
+
datasets: [dataset1_1b, dataset1_2b, dataset1_3b],
|
|
146
|
+
},
|
|
147
|
+
options: {
|
|
148
|
+
title: 'Multiple y axes',
|
|
149
|
+
axes: {
|
|
150
|
+
y: [
|
|
151
|
+
{},
|
|
152
|
+
{
|
|
153
|
+
gridLines: {
|
|
154
|
+
drawOnChartArea: false,
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
const groupedStacked = {
|
|
163
|
+
data: {
|
|
164
|
+
labels: labels1,
|
|
165
|
+
datasets: [dataset1_1c, dataset1_2c, dataset1_3c],
|
|
166
|
+
},
|
|
167
|
+
options: {
|
|
168
|
+
title: 'Grouped stacked',
|
|
169
|
+
additionalAxesOptions: {
|
|
170
|
+
stacked: true,
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
const vertical = {
|
|
176
|
+
data: {
|
|
177
|
+
labels: labels1,
|
|
178
|
+
datasets: [dataset1_1a],
|
|
179
|
+
},
|
|
180
|
+
options: { title: 'vertical' },
|
|
181
|
+
};
|
|
182
|
+
const reversed = {
|
|
183
|
+
data: {
|
|
184
|
+
labels: labels1,
|
|
185
|
+
datasets: [dataset1_1a],
|
|
186
|
+
},
|
|
187
|
+
options: {
|
|
188
|
+
title: 'reversed vertical',
|
|
189
|
+
additionalAxesOptions: {
|
|
190
|
+
reverse: true,
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
};
|
|
194
|
+
const horizontal = {
|
|
195
|
+
data: {
|
|
196
|
+
labels: labels1,
|
|
197
|
+
datasets: [dataset1_1a],
|
|
198
|
+
},
|
|
199
|
+
options: {
|
|
200
|
+
title: 'horizontal',
|
|
201
|
+
direction: 'horizontal',
|
|
202
|
+
},
|
|
203
|
+
};
|
|
204
|
+
const horizontalReversed = {
|
|
205
|
+
data: {
|
|
206
|
+
labels: labels1,
|
|
207
|
+
datasets: [dataset1_1a],
|
|
208
|
+
},
|
|
209
|
+
options: {
|
|
210
|
+
title: 'reversed horizontal',
|
|
211
|
+
direction: 'horizontal',
|
|
212
|
+
additionalAxesOptions: {
|
|
213
|
+
reverse: true,
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
const axesWithLabels = {
|
|
219
|
+
data: {
|
|
220
|
+
labels: labels1,
|
|
221
|
+
datasets: [dataset1_1a],
|
|
222
|
+
},
|
|
223
|
+
options: {
|
|
224
|
+
title: 'With axes labels',
|
|
225
|
+
axes: {
|
|
226
|
+
x: [
|
|
227
|
+
{
|
|
228
|
+
label: 'x axis',
|
|
229
|
+
},
|
|
230
|
+
],
|
|
231
|
+
y: [
|
|
232
|
+
{
|
|
233
|
+
label: 'y axis',
|
|
234
|
+
},
|
|
235
|
+
],
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
};
|
|
239
|
+
const axesWithUnits = {
|
|
240
|
+
data: {
|
|
241
|
+
labels: labels1,
|
|
242
|
+
datasets: [dataset1_1a],
|
|
243
|
+
},
|
|
244
|
+
options: {
|
|
245
|
+
title: 'With axes units',
|
|
246
|
+
axes: {
|
|
247
|
+
x: [
|
|
248
|
+
{
|
|
249
|
+
unit: 'day',
|
|
250
|
+
},
|
|
251
|
+
],
|
|
252
|
+
y: [
|
|
253
|
+
{
|
|
254
|
+
unit: 'm',
|
|
255
|
+
},
|
|
256
|
+
],
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
const axisPosition = {
|
|
262
|
+
data: {
|
|
263
|
+
labels: labels1,
|
|
264
|
+
datasets: [dataset1_1a],
|
|
265
|
+
},
|
|
266
|
+
options: {
|
|
267
|
+
title: ['x axis on top', 'y axis on right'],
|
|
268
|
+
axes: {
|
|
269
|
+
x: [
|
|
270
|
+
{
|
|
271
|
+
position: 'top',
|
|
272
|
+
},
|
|
273
|
+
],
|
|
274
|
+
y: [
|
|
275
|
+
{
|
|
276
|
+
position: 'right',
|
|
277
|
+
},
|
|
278
|
+
],
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
const notBeginAtZero = {
|
|
284
|
+
data: {
|
|
285
|
+
labels: labels1,
|
|
286
|
+
datasets: [dataset1_1a],
|
|
287
|
+
},
|
|
288
|
+
options: {
|
|
289
|
+
title: 'Not beginning at zero',
|
|
290
|
+
additionalAxesOptions: {
|
|
291
|
+
beginAtZero: false,
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
const stepSizeChart = {
|
|
297
|
+
data: {
|
|
298
|
+
labels: labels1,
|
|
299
|
+
datasets: [dataset1_1a],
|
|
300
|
+
},
|
|
301
|
+
options: {
|
|
302
|
+
title: 'With step size of 2',
|
|
303
|
+
additionalAxesOptions: {
|
|
304
|
+
stepSize: 2,
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
const suggestedRange = {
|
|
310
|
+
data: {
|
|
311
|
+
labels: labels1,
|
|
312
|
+
datasets: [dataset1_1a],
|
|
313
|
+
},
|
|
314
|
+
options: {
|
|
315
|
+
title: 'With suggested range',
|
|
316
|
+
additionalAxesOptions: {
|
|
317
|
+
beginAtZero: false,
|
|
318
|
+
suggestedMin: 2,
|
|
319
|
+
suggestedMax: 12,
|
|
320
|
+
},
|
|
321
|
+
},
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
const logartihmicChart = {
|
|
325
|
+
data: {
|
|
326
|
+
labels: labels1,
|
|
327
|
+
datasets: [dataset1_1a],
|
|
328
|
+
},
|
|
329
|
+
options: {
|
|
330
|
+
title: 'With logarithmic scale',
|
|
331
|
+
additionalAxesOptions: {
|
|
332
|
+
chartScaleType: 'logarithmic',
|
|
333
|
+
},
|
|
334
|
+
},
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
const dataLabelsChart = {
|
|
338
|
+
data: {
|
|
339
|
+
labels: labels1,
|
|
340
|
+
datasets: [datasetDatalabels],
|
|
341
|
+
},
|
|
342
|
+
options: {
|
|
343
|
+
title: 'With custom datalabels',
|
|
344
|
+
graph: {
|
|
345
|
+
showDataLabels: true,
|
|
346
|
+
},
|
|
347
|
+
},
|
|
348
|
+
};
|
|
349
|
+
const dataLabelsNumberChart = {
|
|
350
|
+
data: {
|
|
351
|
+
labels: labels1,
|
|
352
|
+
datasets: [datasetNoDataLabels],
|
|
353
|
+
},
|
|
354
|
+
options: {
|
|
355
|
+
title: 'With value as datalabels',
|
|
356
|
+
graph: {
|
|
357
|
+
showDataLabels: true,
|
|
358
|
+
},
|
|
359
|
+
},
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
const dataLabelsNoBeginAtZero = {
|
|
363
|
+
data: {
|
|
364
|
+
labels: labels1,
|
|
365
|
+
datasets: [datasetDatalabels],
|
|
366
|
+
},
|
|
367
|
+
options: {
|
|
368
|
+
title: 'When not beginning at zero',
|
|
369
|
+
additionalAxesOptions: {
|
|
370
|
+
beginAtZero: false,
|
|
371
|
+
},
|
|
372
|
+
graph: {
|
|
373
|
+
showDataLabels: true,
|
|
374
|
+
},
|
|
375
|
+
},
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
const dataLabelssTooltips = {
|
|
379
|
+
data: {
|
|
380
|
+
labels: labels1,
|
|
381
|
+
datasets: [datasetDatalabels],
|
|
382
|
+
},
|
|
383
|
+
options: {
|
|
384
|
+
title: 'With datalabels in tooltips',
|
|
385
|
+
tooltip: {
|
|
386
|
+
showLabelsInTooltips: true,
|
|
387
|
+
},
|
|
388
|
+
},
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
const minorGridlines = {
|
|
392
|
+
data: {
|
|
393
|
+
labels: labels1,
|
|
394
|
+
datasets: [dataset1_1a],
|
|
395
|
+
},
|
|
396
|
+
options: {
|
|
397
|
+
graph: {
|
|
398
|
+
showMinorGridlines: true,
|
|
399
|
+
},
|
|
400
|
+
},
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
const horizontalAnnotationChart = {
|
|
404
|
+
data: {
|
|
405
|
+
labels: labels1,
|
|
406
|
+
datasets: [annotationDataset],
|
|
407
|
+
},
|
|
408
|
+
options: {
|
|
409
|
+
title: 'Annotation Y Axis',
|
|
410
|
+
annotations: {
|
|
411
|
+
showAnnotations: true,
|
|
412
|
+
annotationsData: [
|
|
413
|
+
{
|
|
414
|
+
annotationAxis: 'y',
|
|
415
|
+
label: 'Horizontal Annotation',
|
|
416
|
+
value: 53,
|
|
417
|
+
color: 'rgba(96, 32, 196, 0.5)',
|
|
418
|
+
},
|
|
419
|
+
],
|
|
420
|
+
},
|
|
421
|
+
},
|
|
422
|
+
};
|
|
423
|
+
const verticalAnnotationChart = {
|
|
424
|
+
data: {
|
|
425
|
+
labels: labels1,
|
|
426
|
+
datasets: [annotationDataset],
|
|
427
|
+
},
|
|
428
|
+
options: {
|
|
429
|
+
title: 'Annotation X Axis',
|
|
430
|
+
annotations: {
|
|
431
|
+
showAnnotations: true,
|
|
432
|
+
annotationsData: [
|
|
433
|
+
{
|
|
434
|
+
annotationAxis: 'x',
|
|
435
|
+
label: 'Vertical Annotation',
|
|
436
|
+
value: 0.5,
|
|
437
|
+
color: 'green',
|
|
438
|
+
},
|
|
439
|
+
],
|
|
440
|
+
},
|
|
441
|
+
},
|
|
442
|
+
};
|
|
443
|
+
|
|
444
|
+
const diagonalAnnotationChart = {
|
|
445
|
+
data: {
|
|
446
|
+
labels: labels1,
|
|
447
|
+
datasets: [annotationDataset],
|
|
448
|
+
},
|
|
449
|
+
options: {
|
|
450
|
+
title: 'Diagonal Annotation',
|
|
451
|
+
annotations: {
|
|
452
|
+
showAnnotations: true,
|
|
453
|
+
annotationsData: [
|
|
454
|
+
{
|
|
455
|
+
annotationAxis: 'y',
|
|
456
|
+
label: 'Diagonal Annotation',
|
|
457
|
+
value: 40,
|
|
458
|
+
endValue: 67,
|
|
459
|
+
color: 'rgba(123, 16, 32, 0.8)',
|
|
460
|
+
},
|
|
461
|
+
],
|
|
462
|
+
},
|
|
463
|
+
},
|
|
464
|
+
};
|
|
465
|
+
|
|
466
|
+
const controlAnnotationChart = {
|
|
467
|
+
data: {
|
|
468
|
+
labels: labels1,
|
|
469
|
+
datasets: [annotationDataset],
|
|
470
|
+
},
|
|
471
|
+
options: {
|
|
472
|
+
title: 'Control annotations in legend',
|
|
473
|
+
annotations: {
|
|
474
|
+
showAnnotations: true,
|
|
475
|
+
controlAnnotation: true,
|
|
476
|
+
annotationsData: [
|
|
477
|
+
{
|
|
478
|
+
annotationAxis: 'y',
|
|
479
|
+
label: 'Diagonal Annotation',
|
|
480
|
+
value: 40,
|
|
481
|
+
endValue: 67,
|
|
482
|
+
color: 'rgba(123, 16, 32, 0.8)',
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
annotationAxis: 'y',
|
|
486
|
+
label: 'Horizontal Annotation',
|
|
487
|
+
value: 53,
|
|
488
|
+
color: 'rgba(96, 32, 196, 0.5)',
|
|
489
|
+
},
|
|
490
|
+
],
|
|
491
|
+
},
|
|
492
|
+
},
|
|
493
|
+
};
|
|
494
|
+
|
|
495
|
+
const lightMode = {
|
|
496
|
+
data: {
|
|
497
|
+
labels: labels1,
|
|
498
|
+
datasets: [dataset1_1a, dataset1_2a, dataset1_3a],
|
|
499
|
+
},
|
|
500
|
+
options: {
|
|
501
|
+
title: 'Light mode',
|
|
502
|
+
axes: {
|
|
503
|
+
x: [
|
|
504
|
+
{
|
|
505
|
+
label: 'X',
|
|
506
|
+
},
|
|
507
|
+
],
|
|
508
|
+
},
|
|
509
|
+
chartStyling: {
|
|
510
|
+
darkMode: false,
|
|
511
|
+
},
|
|
512
|
+
graph: {
|
|
513
|
+
showDataLabels: true,
|
|
514
|
+
showMinorGridlines: true,
|
|
515
|
+
},
|
|
516
|
+
annotations: {
|
|
517
|
+
annotationsData: [
|
|
518
|
+
{
|
|
519
|
+
label: 'Annotation 1',
|
|
520
|
+
value: 6,
|
|
521
|
+
},
|
|
522
|
+
],
|
|
523
|
+
},
|
|
524
|
+
},
|
|
525
|
+
};
|
|
526
|
+
const darkMode = {
|
|
527
|
+
data: {
|
|
528
|
+
labels: labels1,
|
|
529
|
+
datasets: [dataset1_1a, dataset1_2a, dataset1_3a],
|
|
530
|
+
},
|
|
531
|
+
options: {
|
|
532
|
+
title: 'Dark mode',
|
|
533
|
+
axes: {
|
|
534
|
+
x: [
|
|
535
|
+
{
|
|
536
|
+
label: 'X',
|
|
537
|
+
},
|
|
538
|
+
],
|
|
539
|
+
},
|
|
540
|
+
chartStyling: {
|
|
541
|
+
darkMode: true,
|
|
542
|
+
},
|
|
543
|
+
graph: {
|
|
544
|
+
showDataLabels: true,
|
|
545
|
+
showMinorGridlines: true,
|
|
546
|
+
},
|
|
547
|
+
annotations: {
|
|
548
|
+
annotationsData: [
|
|
549
|
+
{
|
|
550
|
+
label: 'Annotation 1',
|
|
551
|
+
value: 6,
|
|
552
|
+
},
|
|
553
|
+
],
|
|
554
|
+
},
|
|
555
|
+
},
|
|
556
|
+
};
|
|
557
|
+
|
|
558
|
+
const borderWidthChart = {
|
|
559
|
+
data: {
|
|
560
|
+
labels: labels1,
|
|
561
|
+
datasets: [borderWidthDataset],
|
|
562
|
+
},
|
|
563
|
+
options: { title: 'Custom border Width' },
|
|
564
|
+
};
|
|
565
|
+
|
|
566
|
+
const roundedBars = {
|
|
567
|
+
data: {
|
|
568
|
+
labels: labels1,
|
|
569
|
+
datasets: [roundedDataset],
|
|
570
|
+
},
|
|
571
|
+
options: { title: 'Rounded borders' },
|
|
572
|
+
};
|
|
573
|
+
|
|
574
|
+
const skippedBorders = {
|
|
575
|
+
data: {
|
|
576
|
+
labels: labels1,
|
|
577
|
+
datasets: [borderSkippedDataset, borderSkippedDataset2],
|
|
578
|
+
},
|
|
579
|
+
options: {
|
|
580
|
+
title: 'Skipped borders',
|
|
581
|
+
direction: 'horizontal',
|
|
582
|
+
},
|
|
583
|
+
};
|
|
584
|
+
|
|
585
|
+
const categoryChart = {
|
|
586
|
+
data: {
|
|
587
|
+
labels: labels1,
|
|
588
|
+
datasets: [dataset1_1a],
|
|
589
|
+
},
|
|
590
|
+
options: { title: 'Category data' },
|
|
591
|
+
};
|
|
592
|
+
|
|
593
|
+
const floatingChart = {
|
|
594
|
+
data: {
|
|
595
|
+
labels: labels1,
|
|
596
|
+
datasets: [floatingData],
|
|
597
|
+
},
|
|
598
|
+
options: { title: 'Floating bars' },
|
|
599
|
+
};
|
|
600
|
+
|
|
601
|
+
const numericChart = {
|
|
602
|
+
data: {
|
|
603
|
+
datasets: [numericData],
|
|
604
|
+
},
|
|
605
|
+
options: { title: 'Numeric data' },
|
|
606
|
+
};
|
|
607
|
+
|
|
608
|
+
const legendRight = {
|
|
609
|
+
data: {
|
|
610
|
+
labels: labels1,
|
|
611
|
+
datasets: [dataset1_1a],
|
|
612
|
+
},
|
|
613
|
+
options: {
|
|
614
|
+
title: 'Legend to the right',
|
|
615
|
+
legend: {
|
|
616
|
+
position: 'right',
|
|
617
|
+
},
|
|
618
|
+
},
|
|
619
|
+
};
|
|
620
|
+
|
|
621
|
+
const legendStart = {
|
|
622
|
+
data: {
|
|
623
|
+
labels: labels1,
|
|
624
|
+
datasets: [dataset1_1a],
|
|
625
|
+
},
|
|
626
|
+
options: {
|
|
627
|
+
title: 'Legend aligned to start',
|
|
628
|
+
legend: {
|
|
629
|
+
align: 'start',
|
|
630
|
+
},
|
|
631
|
+
},
|
|
632
|
+
};
|
|
633
|
+
|
|
634
|
+
const animatedChart = {
|
|
635
|
+
data: {
|
|
636
|
+
labels: labels1,
|
|
637
|
+
datasets: [dataset1_1a],
|
|
638
|
+
},
|
|
639
|
+
options: {
|
|
640
|
+
chartStyling: { performanceMode: false },
|
|
641
|
+
},
|
|
642
|
+
};
|
|
643
|
+
|
|
644
|
+
export default {
|
|
645
|
+
title: 'Bar Chart',
|
|
646
|
+
component: BarChart,
|
|
647
|
+
};
|
|
648
|
+
|
|
649
|
+
export const Default = () => (
|
|
650
|
+
<Container style={style}>
|
|
651
|
+
<BarChart chart={singleChart} />
|
|
652
|
+
</Container>
|
|
653
|
+
);
|
|
654
|
+
|
|
655
|
+
export const MultipleSets = () => (
|
|
656
|
+
<Container style={style}>
|
|
657
|
+
<BarChart chart={multipleBarData} />
|
|
658
|
+
<BarChart chart={stakedBarData} />
|
|
659
|
+
<BarChart chart={multipleAxisData} />
|
|
660
|
+
<BarChart chart={groupedStacked} />
|
|
661
|
+
</Container>
|
|
662
|
+
);
|
|
663
|
+
|
|
664
|
+
export const Orientation = () => (
|
|
665
|
+
<Container style={style}>
|
|
666
|
+
<BarChart chart={vertical} />
|
|
667
|
+
<BarChart chart={horizontal} />
|
|
668
|
+
<BarChart chart={reversed} />
|
|
669
|
+
<BarChart chart={horizontalReversed} />
|
|
670
|
+
</Container>
|
|
671
|
+
);
|
|
672
|
+
|
|
673
|
+
export const InputData = () => (
|
|
674
|
+
<Container style={style}>
|
|
675
|
+
<BarChart chart={categoryChart} />
|
|
676
|
+
<BarChart chart={floatingChart} />
|
|
677
|
+
<BarChart chart={numericChart} />
|
|
678
|
+
</Container>
|
|
679
|
+
);
|
|
680
|
+
|
|
681
|
+
export const AxesData = () => (
|
|
682
|
+
<Container style={style}>
|
|
683
|
+
<BarChart chart={axesWithLabels} />
|
|
684
|
+
<BarChart chart={axesWithUnits} />
|
|
685
|
+
<BarChart chart={axisPosition} />
|
|
686
|
+
</Container>
|
|
687
|
+
);
|
|
688
|
+
|
|
689
|
+
export const AxesOptions = () => (
|
|
690
|
+
<Container style={style}>
|
|
691
|
+
<BarChart chart={notBeginAtZero} />
|
|
692
|
+
<BarChart chart={suggestedRange} />
|
|
693
|
+
<BarChart chart={stepSizeChart} />
|
|
694
|
+
<BarChart chart={logartihmicChart} />
|
|
695
|
+
</Container>
|
|
696
|
+
);
|
|
697
|
+
|
|
698
|
+
export const WithMinorGridlines = () => (
|
|
699
|
+
<Container style={style}>
|
|
700
|
+
<BarChart chart={minorGridlines} />
|
|
701
|
+
</Container>
|
|
702
|
+
);
|
|
703
|
+
|
|
704
|
+
export const Datalabels = () => (
|
|
705
|
+
<Container style={style}>
|
|
706
|
+
<BarChart chart={dataLabelsChart} />
|
|
707
|
+
<BarChart chart={dataLabelsNumberChart} />
|
|
708
|
+
<BarChart chart={dataLabelsNoBeginAtZero} />
|
|
709
|
+
<BarChart chart={dataLabelssTooltips} />
|
|
710
|
+
</Container>
|
|
711
|
+
);
|
|
712
|
+
|
|
713
|
+
export const Legend = () => (
|
|
714
|
+
<Container style={style}>
|
|
715
|
+
<BarChart chart={legendRight} />
|
|
716
|
+
<BarChart chart={legendStart} />
|
|
717
|
+
</Container>
|
|
718
|
+
);
|
|
719
|
+
|
|
720
|
+
export const Annotations = () => (
|
|
721
|
+
<Container style={style}>
|
|
722
|
+
<BarChart chart={horizontalAnnotationChart} />
|
|
723
|
+
<BarChart chart={verticalAnnotationChart} />
|
|
724
|
+
<BarChart chart={diagonalAnnotationChart} />
|
|
725
|
+
<BarChart chart={controlAnnotationChart} />
|
|
726
|
+
</Container>
|
|
727
|
+
);
|
|
728
|
+
|
|
729
|
+
export const Animated = () => (
|
|
730
|
+
<Container style={style}>
|
|
731
|
+
<BarChart chart={animatedChart} />
|
|
732
|
+
</Container>
|
|
733
|
+
);
|
|
734
|
+
|
|
735
|
+
export const DarkMode = () => (
|
|
736
|
+
<Container style={style}>
|
|
737
|
+
<Container>
|
|
738
|
+
<BarChart chart={lightMode} />
|
|
739
|
+
</Container>
|
|
740
|
+
<Container style={darkmodeStyle}>
|
|
741
|
+
<BarChart chart={darkMode} />
|
|
742
|
+
</Container>
|
|
743
|
+
</Container>
|
|
744
|
+
);
|
|
745
|
+
|
|
746
|
+
export const BarStyling = () => (
|
|
747
|
+
<Container style={style}>
|
|
748
|
+
<BarChart chart={borderWidthChart} />
|
|
749
|
+
<BarChart chart={roundedBars} />
|
|
750
|
+
<BarChart chart={skippedBorders} />
|
|
751
|
+
</Container>
|
|
752
|
+
);
|