@easyv/charts 1.2.14 → 1.3.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/lib/components/Background.js +11 -1
- package/lib/components/Band.js +8 -8
- package/lib/components/CartesianChart.js +5 -1
- package/lib/components/Chart.js +2 -1
- package/lib/components/Label.js +11 -12
- package/lib/components/StackData.js +2 -4
- package/lib/components/StereoBar.js +14 -14
- package/lib/hooks/useExtentData.js +4 -2
- package/lib/hooks/useStackData.js +6 -5
- package/lib/utils/index.js +68 -41
- package/package.json +3 -2
- package/src/components/Background.tsx +21 -4
- package/src/components/Band.tsx +10 -14
- package/src/components/CartesianChart.js +33 -22
- package/src/components/Chart.js +1 -1
- package/src/components/Label.js +59 -40
- package/src/components/StackData.js +2 -6
- package/src/components/StereoBar.tsx +304 -308
- package/src/hooks/useExtentData.js +4 -3
- package/src/hooks/useStackData.js +5 -4
- package/src/utils/index.js +32 -8
- package/tsconfig.json +2 -2
|
@@ -59,9 +59,6 @@ const setStackData = (data, series, stacks) => {
|
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
|
|
63
|
-
currentSeries.bandLength =
|
|
64
|
-
currentSeries.type === 'band' ? stacks.filter((item) => item.type == 'band').length : 1;
|
|
65
62
|
}
|
|
66
63
|
});
|
|
67
64
|
dataMap.clear();
|
|
@@ -94,7 +91,11 @@ export default ({ data, series }) => {
|
|
|
94
91
|
resetStackData(seriesZ);
|
|
95
92
|
setStackData(dataY, seriesY, stacks);
|
|
96
93
|
setStackData(dataZ, seriesZ, stacks);
|
|
97
|
-
|
|
94
|
+
|
|
95
|
+
return {
|
|
96
|
+
bandLength: stacks.filter((item) => item.type == 'band').length,
|
|
97
|
+
series: [...seriesY.values(), ...seriesZ.values()],
|
|
98
|
+
};
|
|
98
99
|
}, [_data, _series]);
|
|
99
100
|
return tmp;
|
|
100
101
|
};
|
package/src/utils/index.js
CHANGED
|
@@ -86,16 +86,16 @@ const getIcon = (type, icon) => {
|
|
|
86
86
|
case 'line':
|
|
87
87
|
return icon
|
|
88
88
|
? {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
...defaultLineIcon,
|
|
90
|
+
...icon,
|
|
91
|
+
}
|
|
92
92
|
: defaultLineIcon;
|
|
93
93
|
default:
|
|
94
94
|
return icon
|
|
95
95
|
? {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
...defaultIcon,
|
|
97
|
+
...icon,
|
|
98
|
+
}
|
|
99
99
|
: defaultIcon;
|
|
100
100
|
}
|
|
101
101
|
};
|
|
@@ -490,6 +490,30 @@ const getBandSeriesStepAndWidth = ({ width, paddingInner, bandLength }) => {
|
|
|
490
490
|
seriesWidth,
|
|
491
491
|
};
|
|
492
492
|
};
|
|
493
|
+
|
|
494
|
+
const getSeriesInfo = ({
|
|
495
|
+
step,
|
|
496
|
+
bandLength = 1,
|
|
497
|
+
paddingInner = 0,
|
|
498
|
+
paddingOuter = 0,
|
|
499
|
+
}) => {
|
|
500
|
+
if (bandLength == 0)
|
|
501
|
+
return {
|
|
502
|
+
seriesWidth: step,
|
|
503
|
+
seriesStep: step,
|
|
504
|
+
seriesStart: 0,
|
|
505
|
+
width: step,
|
|
506
|
+
};
|
|
507
|
+
const _step =
|
|
508
|
+
step / (bandLength + paddingOuter * 2 + paddingInner * (bandLength - 1));
|
|
509
|
+
return {
|
|
510
|
+
seriesWidth: _step,
|
|
511
|
+
seriesStep: (1 + paddingInner) * _step,
|
|
512
|
+
seriesStart: paddingOuter * _step,
|
|
513
|
+
width: step - paddingOuter * 2 * _step,
|
|
514
|
+
};
|
|
515
|
+
};
|
|
516
|
+
|
|
493
517
|
const isValidHttpUrl = (string) => {
|
|
494
518
|
let url;
|
|
495
519
|
|
|
@@ -663,7 +687,6 @@ const getDataWithPercent = (data = [], precision = 0) => {
|
|
|
663
687
|
return tmp;
|
|
664
688
|
};
|
|
665
689
|
|
|
666
|
-
|
|
667
690
|
const excludeTypes = ['array', 'object', 'group', 'modal', 'colors'];
|
|
668
691
|
const reduceConfig = (config = []) => {
|
|
669
692
|
if (!Array.isArray(config)) {
|
|
@@ -679,7 +702,7 @@ const reduceConfig = (config = []) => {
|
|
|
679
702
|
: reduceConfig(config[i]._value);
|
|
680
703
|
}
|
|
681
704
|
return output;
|
|
682
|
-
}
|
|
705
|
+
};
|
|
683
706
|
|
|
684
707
|
export {
|
|
685
708
|
dateFormat,
|
|
@@ -711,4 +734,5 @@ export {
|
|
|
711
734
|
sortPie,
|
|
712
735
|
getDataWithPercent,
|
|
713
736
|
reduceConfig,
|
|
737
|
+
getSeriesInfo,
|
|
714
738
|
};
|
package/tsconfig.json
CHANGED