@tetacom/svg-charts 1.7.21 → 1.7.22

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.
@@ -750,29 +750,33 @@ class ScaleService {
750
750
  .set(ScaleType.pow, d3.scalePow)
751
751
  .set(ScaleType.sqrt, d3.scaleSqrt)
752
752
  .set(ScaleType.band, d3.scaleBand);
753
- this.scales = combineLatest([this.chartService.size, this.chartService.config, this.zoomService.zoomed]).pipe(map((data) => {
754
- const [size, config, zoom] = data;
753
+ this.scales = combineLatest([this.chartService.size, this.chartService.config, this.zoomService.zoomed]).pipe(map(([size, config, zoom]) => {
754
+ config = { ...config };
755
+ config.xAxis = config.xAxis.map((_) => ({ ..._ }));
756
+ config.yAxis = config.yAxis.map((_) => ({ ..._ }));
755
757
  const xAxisMap = new Map();
756
758
  const yAxisMap = new Map();
757
- config.yAxis.map((axis, index) => {
758
- if (axis.visible &&
759
+ config.yAxis.forEach((axis, index) => {
760
+ const newAxis = Axis.createAxis(AxisOrientation.y, config, index);
761
+ if (newAxis.options.visible &&
759
762
  config.series.some((serie) => serie.yAxisIndex === index && serie.enabled && serie.data?.length > 0)) {
760
- axis.visible = true;
763
+ newAxis.options.visible = true;
761
764
  }
762
765
  else {
763
- axis.visible = false;
766
+ newAxis.options.visible = false;
764
767
  }
765
- yAxisMap.set(index, Axis.createAxis(AxisOrientation.y, config, index));
768
+ yAxisMap.set(index, newAxis);
766
769
  });
767
- config.xAxis.map((axis, index) => {
768
- if (axis.visible &&
770
+ config.xAxis.forEach((axis, index) => {
771
+ const newAxis = Axis.createAxis(AxisOrientation.x, config, index);
772
+ if (newAxis.options.visible &&
769
773
  config.series.some((serie) => serie.xAxisIndex === index && serie.enabled && serie.data?.length > 0)) {
770
- axis.visible = true;
774
+ newAxis.options.visible = true;
771
775
  }
772
776
  else {
773
- axis.visible = false;
777
+ newAxis.options.visible = false;
774
778
  }
775
- xAxisMap.set(index, Axis.createAxis(AxisOrientation.x, config, index));
779
+ xAxisMap.set(index, newAxis);
776
780
  });
777
781
  // Generate x scales
778
782
  const left = Array.from(yAxisMap.values())