@oliasoft-open-source/charts-library 2.1.0 → 2.1.2
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/.storybook/main.js +18 -22
- package/.storybook/preview.js +37 -0
- package/.storybook/storybook.less +8 -0
- package/package.json +2 -1
- package/src/components/bar-chart/bar-chart-prop-types.js +7 -0
- package/src/components/bar-chart/bar-chart.jsx +7 -2
- package/src/components/bar-chart/{basic.stories.jsx → bar-chart.stories.jsx} +108 -371
- package/src/components/line-chart/Controls/Controls.jsx +2 -0
- package/src/components/line-chart/Controls/Layer.jsx +52 -49
- package/src/components/line-chart/line-chart-prop-types.js +10 -0
- package/src/components/line-chart/line-chart.jsx +91 -10
- package/src/components/line-chart/line-chart.module.less +6 -0
- package/src/components/line-chart/line-chart.stories.jsx +393 -0
- package/src/components/line-chart/state/line-chart-reducer.js +26 -15
- package/src/components/pie-chart/pie-chart.stories.jsx +234 -0
- package/src/components/scatter-chart/{scatter.stories.jsx → scatter-chart.stories.jsx} +25 -79
- package/src/helpers/chart-consts.js +2 -0
- package/src/helpers/chart-interface.ts +9 -0
- package/src/helpers/chart-utils.js +24 -4
- package/src/helpers/get-custom-legend-plugin-example.js +81 -0
- package/src/components/bar-chart/charts.stories.jsx +0 -119
- package/src/components/line-chart/basic.stories.jsx +0 -735
- package/src/components/line-chart/charts.stories.jsx +0 -264
- package/src/components/line-chart/stories/shapes/cubes.stories.jsx +0 -326
- package/src/components/line-chart/stories/shapes/pyramid.stories.jsx +0 -189
- package/src/components/line-chart/stories/shapes/round.stories.jsx +0 -339
- package/src/components/line-chart/stories/shapes/triangle.stories.jsx +0 -166
- package/src/components/pie-chart/basic.stories.jsx +0 -390
- package/src/components/pie-chart/charts.stories.jsx +0 -66
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BarChart } from './bar-chart';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const style = {
|
|
6
|
-
height: '1000px',
|
|
7
|
-
width: '1000px',
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const darkmodeStyle = {
|
|
11
|
-
backgroundColor: '#232628',
|
|
12
|
-
};
|
|
3
|
+
import { getCustomLegendPlugin } from '../../helpers/get-custom-legend-plugin-example';
|
|
13
4
|
|
|
14
5
|
const labels1 = ['label 1', 'label 2', 'label 3'];
|
|
15
6
|
const dataset1_1a = { label: 'data1', data: [3, 8, 7] };
|
|
@@ -26,87 +17,6 @@ const dataset1_3c = { label: 'data3', data: [5, 0, 4], stack: 2 };
|
|
|
26
17
|
|
|
27
18
|
const annotationDataset = { label: 'data', data: [42, 57, 64] };
|
|
28
19
|
|
|
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
20
|
const datasetNoDataLabels = {
|
|
111
21
|
label: 'data',
|
|
112
22
|
data: [210, 333, 248],
|
|
@@ -172,13 +82,6 @@ const groupedStacked = {
|
|
|
172
82
|
},
|
|
173
83
|
};
|
|
174
84
|
|
|
175
|
-
const vertical = {
|
|
176
|
-
data: {
|
|
177
|
-
labels: labels1,
|
|
178
|
-
datasets: [dataset1_1a],
|
|
179
|
-
},
|
|
180
|
-
options: { title: 'vertical' },
|
|
181
|
-
};
|
|
182
85
|
const reversed = {
|
|
183
86
|
data: {
|
|
184
87
|
labels: labels1,
|
|
@@ -236,27 +139,6 @@ const axesWithLabels = {
|
|
|
236
139
|
},
|
|
237
140
|
},
|
|
238
141
|
};
|
|
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
142
|
|
|
261
143
|
const axisPosition = {
|
|
262
144
|
data: {
|
|
@@ -334,18 +216,6 @@ const logartihmicChart = {
|
|
|
334
216
|
},
|
|
335
217
|
};
|
|
336
218
|
|
|
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
219
|
const dataLabelsNumberChart = {
|
|
350
220
|
data: {
|
|
351
221
|
labels: labels1,
|
|
@@ -359,47 +229,6 @@ const dataLabelsNumberChart = {
|
|
|
359
229
|
},
|
|
360
230
|
};
|
|
361
231
|
|
|
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
232
|
const horizontalAnnotationChart = {
|
|
404
233
|
data: {
|
|
405
234
|
labels: labels1,
|
|
@@ -492,37 +321,6 @@ const controlAnnotationChart = {
|
|
|
492
321
|
},
|
|
493
322
|
};
|
|
494
323
|
|
|
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
324
|
const darkMode = {
|
|
527
325
|
data: {
|
|
528
326
|
labels: labels1,
|
|
@@ -555,56 +353,6 @@ const darkMode = {
|
|
|
555
353
|
},
|
|
556
354
|
};
|
|
557
355
|
|
|
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
356
|
const legendRight = {
|
|
609
357
|
data: {
|
|
610
358
|
labels: labels1,
|
|
@@ -618,19 +366,6 @@ const legendRight = {
|
|
|
618
366
|
},
|
|
619
367
|
};
|
|
620
368
|
|
|
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
369
|
const animatedChart = {
|
|
635
370
|
data: {
|
|
636
371
|
labels: labels1,
|
|
@@ -642,111 +377,113 @@ const animatedChart = {
|
|
|
642
377
|
};
|
|
643
378
|
|
|
644
379
|
export default {
|
|
645
|
-
title: '
|
|
380
|
+
title: 'BarChart',
|
|
646
381
|
component: BarChart,
|
|
382
|
+
args: {
|
|
383
|
+
chart: singleChart,
|
|
384
|
+
},
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
const Template = (args) => {
|
|
388
|
+
return (
|
|
389
|
+
<BarChart
|
|
390
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
391
|
+
{...args}
|
|
392
|
+
/>
|
|
393
|
+
);
|
|
647
394
|
};
|
|
648
395
|
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
);
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
export const
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
export const
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
export const Datalabels = ()
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
export const
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
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
|
-
);
|
|
396
|
+
const customLegendContainerID = 'custom-legend-container';
|
|
397
|
+
|
|
398
|
+
const TemplateWithCustomLegendContainer = (args) => {
|
|
399
|
+
return (
|
|
400
|
+
<>
|
|
401
|
+
<BarChart
|
|
402
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
403
|
+
{...args}
|
|
404
|
+
/>
|
|
405
|
+
<div id={customLegendContainerID}></div>
|
|
406
|
+
</>
|
|
407
|
+
);
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
export const Default = Template.bind({});
|
|
411
|
+
|
|
412
|
+
export const MultipleSets = Template.bind({});
|
|
413
|
+
MultipleSets.args = { chart: multipleBarData };
|
|
414
|
+
|
|
415
|
+
export const Stacked = Template.bind({});
|
|
416
|
+
Stacked.args = { chart: stakedBarData };
|
|
417
|
+
|
|
418
|
+
export const StackedGrouped = Template.bind({});
|
|
419
|
+
StackedGrouped.args = { chart: groupedStacked };
|
|
420
|
+
|
|
421
|
+
export const MultipleYAxes = Template.bind({});
|
|
422
|
+
MultipleYAxes.args = { chart: multipleAxisData };
|
|
423
|
+
|
|
424
|
+
export const Horizontal = Template.bind({});
|
|
425
|
+
Horizontal.args = { chart: horizontal };
|
|
426
|
+
|
|
427
|
+
export const Reversed = Template.bind({});
|
|
428
|
+
Reversed.args = { chart: reversed };
|
|
429
|
+
|
|
430
|
+
export const HorizontalReversed = Template.bind({});
|
|
431
|
+
HorizontalReversed.args = { chart: horizontalReversed };
|
|
432
|
+
|
|
433
|
+
export const AxesLabels = Template.bind({});
|
|
434
|
+
AxesLabels.args = { chart: axesWithLabels };
|
|
435
|
+
|
|
436
|
+
export const AxesPositions = Template.bind({});
|
|
437
|
+
AxesPositions.args = { chart: axisPosition };
|
|
438
|
+
|
|
439
|
+
export const NonZeroStart = Template.bind({});
|
|
440
|
+
NonZeroStart.args = { chart: notBeginAtZero };
|
|
441
|
+
|
|
442
|
+
export const CustomRange = Template.bind({});
|
|
443
|
+
CustomRange.args = { chart: suggestedRange };
|
|
444
|
+
|
|
445
|
+
export const CustomStepSize = Template.bind({});
|
|
446
|
+
CustomStepSize.args = { chart: stepSizeChart };
|
|
447
|
+
|
|
448
|
+
export const LogarithmicScale = Template.bind({});
|
|
449
|
+
LogarithmicScale.args = { chart: logartihmicChart };
|
|
450
|
+
|
|
451
|
+
export const Datalabels = Template.bind({});
|
|
452
|
+
Datalabels.args = { chart: dataLabelsNumberChart };
|
|
453
|
+
|
|
454
|
+
export const LegendOnRight = Template.bind({});
|
|
455
|
+
LegendOnRight.args = { chart: legendRight };
|
|
456
|
+
|
|
457
|
+
export const AnnotationYAxis = Template.bind({});
|
|
458
|
+
AnnotationYAxis.args = { chart: horizontalAnnotationChart };
|
|
459
|
+
|
|
460
|
+
export const AnnotationXAxis = Template.bind({});
|
|
461
|
+
AnnotationXAxis.args = { chart: verticalAnnotationChart };
|
|
462
|
+
|
|
463
|
+
export const AnnotationDiagonal = Template.bind({});
|
|
464
|
+
AnnotationDiagonal.args = { chart: diagonalAnnotationChart };
|
|
465
|
+
|
|
466
|
+
export const AnnotationsInLegend = Template.bind({});
|
|
467
|
+
AnnotationsInLegend.args = { chart: controlAnnotationChart };
|
|
468
|
+
|
|
469
|
+
export const Animated = Template.bind({});
|
|
470
|
+
Animated.args = { chart: animatedChart };
|
|
471
|
+
|
|
472
|
+
export const DarkMode = Template.bind({});
|
|
473
|
+
DarkMode.args = { chart: darkMode };
|
|
474
|
+
|
|
475
|
+
export const CustomLegend = TemplateWithCustomLegendContainer.bind({});
|
|
476
|
+
CustomLegend.args = {
|
|
477
|
+
chart: {
|
|
478
|
+
...singleChart,
|
|
479
|
+
options: {
|
|
480
|
+
title: 'Custom HTML legend',
|
|
481
|
+
legend: {
|
|
482
|
+
customLegend: {
|
|
483
|
+
customLegendPlugin: getCustomLegendPlugin(customLegendContainerID),
|
|
484
|
+
customLegendContainerID,
|
|
485
|
+
},
|
|
486
|
+
},
|
|
487
|
+
},
|
|
488
|
+
},
|
|
489
|
+
};
|
|
@@ -4,6 +4,7 @@ import { Popover, Button } from '@oliasoft-open-source/react-ui-library';
|
|
|
4
4
|
import { Layer } from './Layer';
|
|
5
5
|
|
|
6
6
|
export const Controls = ({
|
|
7
|
+
scalesMaxMin,
|
|
7
8
|
zoomEnabled,
|
|
8
9
|
onToggleZoom,
|
|
9
10
|
panEnabled,
|
|
@@ -28,6 +29,7 @@ export const Controls = ({
|
|
|
28
29
|
overflowContainer
|
|
29
30
|
content={
|
|
30
31
|
<Layer
|
|
32
|
+
scalesMaxMin={scalesMaxMin}
|
|
31
33
|
zoomEnabled={zoomEnabled}
|
|
32
34
|
onToggleZoom={onToggleZoom}
|
|
33
35
|
panEnabled={panEnabled}
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
import styles from './Controls.module.less';
|
|
17
17
|
|
|
18
18
|
export const Layer = ({
|
|
19
|
+
scalesMaxMin,
|
|
19
20
|
zoomEnabled,
|
|
20
21
|
onToggleZoom,
|
|
21
22
|
panEnabled,
|
|
@@ -92,60 +93,62 @@ export const Layer = ({
|
|
|
92
93
|
)}
|
|
93
94
|
<p>
|
|
94
95
|
<strong>Change axis: </strong>
|
|
95
|
-
<span>hold
|
|
96
|
+
<span>hold shift key</span>
|
|
96
97
|
</p>
|
|
97
98
|
</div>
|
|
98
99
|
<Spacer height={10} />
|
|
99
100
|
</>
|
|
100
101
|
)}
|
|
101
|
-
{axes.map((axis, i) =>
|
|
102
|
-
|
|
103
|
-
<
|
|
104
|
-
<
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
102
|
+
{axes.map((axis, i) => {
|
|
103
|
+
return (
|
|
104
|
+
<Field key={i} label={axis.label || ''}>
|
|
105
|
+
<InputGroup small>
|
|
106
|
+
<Input
|
|
107
|
+
name="min"
|
|
108
|
+
value={axis.min.inputValue || scalesMaxMin[axis?.id]?.min}
|
|
109
|
+
error={
|
|
110
|
+
!axis.min.valid
|
|
111
|
+
? 'WARNING' //t(InputWarningType.MustBeNumericAndLessThanMax)
|
|
112
|
+
: undefined
|
|
113
|
+
}
|
|
114
|
+
size={5}
|
|
115
|
+
width="100%"
|
|
116
|
+
onChange={(evt) =>
|
|
117
|
+
onSetAxisValue({
|
|
118
|
+
name: evt.target.name,
|
|
119
|
+
value: evt.target.value,
|
|
120
|
+
id: axis.id,
|
|
121
|
+
})
|
|
122
|
+
}
|
|
123
|
+
disabled={zoomEnabled || panEnabled}
|
|
124
|
+
/>
|
|
125
|
+
<InputGroupAddon>
|
|
126
|
+
To
|
|
127
|
+
{/*t(translations.to)*/}
|
|
128
|
+
</InputGroupAddon>
|
|
129
|
+
<Input
|
|
130
|
+
name="max"
|
|
131
|
+
value={axis.max.inputValue || scalesMaxMin[axis?.id].max}
|
|
132
|
+
error={
|
|
133
|
+
!axis.max.valid
|
|
134
|
+
? 'Warning' //t(InputWarningType.MustBeNumericAndGreaterThanMin)
|
|
135
|
+
: undefined
|
|
136
|
+
}
|
|
137
|
+
size={5}
|
|
138
|
+
width="100%"
|
|
139
|
+
onChange={(evt) =>
|
|
140
|
+
onSetAxisValue({
|
|
141
|
+
name: evt.target.name,
|
|
142
|
+
value: evt.target.value,
|
|
143
|
+
id: axis.id,
|
|
144
|
+
})
|
|
145
|
+
}
|
|
146
|
+
disabled={zoomEnabled || panEnabled}
|
|
147
|
+
/>
|
|
148
|
+
</InputGroup>
|
|
149
|
+
</Field>
|
|
150
|
+
);
|
|
151
|
+
})}
|
|
149
152
|
<Field>
|
|
150
153
|
<Button
|
|
151
154
|
small
|