@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.
@@ -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
- return [...seriesY.values(), ...seriesZ.values()];
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
  };
@@ -86,16 +86,16 @@ const getIcon = (type, icon) => {
86
86
  case 'line':
87
87
  return icon
88
88
  ? {
89
- ...defaultLineIcon,
90
- ...icon,
91
- }
89
+ ...defaultLineIcon,
90
+ ...icon,
91
+ }
92
92
  : defaultLineIcon;
93
93
  default:
94
94
  return icon
95
95
  ? {
96
- ...defaultIcon,
97
- ...icon,
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
@@ -19,5 +19,5 @@
19
19
  "types": ["src/types"]
20
20
  },
21
21
  "include": ["src"],
22
- "exclude": ["node_modules", "**/*.spec.ts"],
23
- }
22
+ "exclude": ["node_modules", "**/*.spec.ts"]
23
+ }