@bizy/core 21.5.5 → 21.5.6

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.
@@ -10313,6 +10313,7 @@ class BizyBarLineChartComponent {
10313
10313
  #gridLeft = 0;
10314
10314
  #chartStacks = [];
10315
10315
  #chartNames = [];
10316
+ #chartGroups = new Map();
10316
10317
  ngAfterContentInit() {
10317
10318
  import('echarts').then(echarts => {
10318
10319
  this.#echarts = echarts;
@@ -10379,6 +10380,7 @@ class BizyBarLineChartComponent {
10379
10380
  const defaultYAxisColor = this.#getClosestCssVariable(this.#elementRef.nativeElement, '--bizy-bar-line-chart-y-axis-color');
10380
10381
  const defaultXAxisColor = this.#getClosestCssVariable(this.#elementRef.nativeElement, '--bizy-bar-line-chart-x-axis-color');
10381
10382
  this.lineCharts.forEach((_line, _i) => {
10383
+ let axisIndex = _i;
10382
10384
  const lineXAxis = _line.xAxis;
10383
10385
  const lineYAxis = _line.yAxis;
10384
10386
  const xAxisType = !lineXAxis || typeof lineXAxis.independent === 'undefined' ? BIZY_BAR_LINE_CHART_AXIS_TYPE.INDEPENDENT : lineXAxis?.independent ? BIZY_BAR_LINE_CHART_AXIS_TYPE.INDEPENDENT : BIZY_BAR_LINE_CHART_AXIS_TYPE.DEPENDENT;
@@ -10392,6 +10394,15 @@ class BizyBarLineChartComponent {
10392
10394
  const thereIsOtherVisibleYAxis = (position === BIZY_BAR_LINE_CHART_AXIS_POSITION.LEFT && this.#gridLeft > 0 || position === BIZY_BAR_LINE_CHART_AXIS_POSITION.RIGHT && this.#gridRight > 0);
10393
10395
  const offset = show && thereIsOtherVisibleYAxis && typeof lineYAxis.offset !== 'undefined' ? lineYAxis.offset : show && thereIsOtherVisibleYAxis ? Y_AXIS_OFFSET : 0;
10394
10396
  const color = _line.getYAxisColor() ? _line.getYAxisColor() : yAxisType === BIZY_BAR_LINE_CHART_AXIS_TYPE.DEPENDENT && _line.getColor() ? _line.getColor() : defaultYAxisColor;
10397
+ if (lineYAxis.group && yAxisType === BIZY_BAR_LINE_CHART_AXIS_TYPE.DEPENDENT) {
10398
+ const _axisIndex = this.#chartGroups.get(lineYAxis.group);
10399
+ if (_axisIndex) {
10400
+ axisIndex = _axisIndex;
10401
+ }
10402
+ else {
10403
+ this.#chartGroups.set(lineYAxis.group, this.#getRandomFourDigitsNumber());
10404
+ }
10405
+ }
10395
10406
  yAxis.push({
10396
10407
  type: yAxisType,
10397
10408
  name: lineYAxis?.name,
@@ -10439,6 +10450,15 @@ class BizyBarLineChartComponent {
10439
10450
  const thereIsOtherVisibleXAxis = (position === BIZY_BAR_LINE_CHART_AXIS_POSITION.TOP && this.#gridTop > 0 || position === BIZY_BAR_LINE_CHART_AXIS_POSITION.BOTTOM && this.#gridBottom > 0);
10440
10451
  const offset = show && thereIsOtherVisibleXAxis && typeof lineXAxis.offset !== 'undefined' ? lineXAxis.offset : show && thereIsOtherVisibleXAxis ? X_AXIS_OFFSET : 0;
10441
10452
  const color = _line.getXAxisColor() ? _line.getXAxisColor() : xAxisType === BIZY_BAR_LINE_CHART_AXIS_TYPE.DEPENDENT && _line.getColor() ? _line.getColor() : defaultXAxisColor;
10453
+ if (lineXAxis.group && xAxisType === BIZY_BAR_LINE_CHART_AXIS_TYPE.DEPENDENT) {
10454
+ const _axisIndex = this.#chartGroups.get(lineXAxis.group);
10455
+ if (_axisIndex) {
10456
+ axisIndex = _axisIndex;
10457
+ }
10458
+ else {
10459
+ this.#chartGroups.set(lineXAxis.group, this.#getRandomFourDigitsNumber());
10460
+ }
10461
+ }
10442
10462
  xAxis.push({
10443
10463
  type: xAxisType,
10444
10464
  name: lineXAxis?.name,
@@ -10477,16 +10497,17 @@ class BizyBarLineChartComponent {
10477
10497
  }
10478
10498
  }
10479
10499
  }
10480
- let axisIndex = _i;
10481
- const _name = this.#chartNames.find(_name => _name === _line.name);
10482
- if (_name) {
10483
- const index = series.findIndex(_s => _s.name === _name);
10484
- if (index !== -1) {
10485
- axisIndex = index;
10500
+ if (axisIndex !== _i) {
10501
+ const _name = this.#chartNames.find(_name => _name === _line.name);
10502
+ if (_name) {
10503
+ const index = series.findIndex(_s => _s.name === _name);
10504
+ if (index !== -1) {
10505
+ axisIndex = index;
10506
+ }
10507
+ }
10508
+ else {
10509
+ this.#chartNames.push(_line.name);
10486
10510
  }
10487
- }
10488
- else {
10489
- this.#chartNames.push(_line.name);
10490
10511
  }
10491
10512
  series.push({
10492
10513
  type: BIZY_BAR_LINE_CHART_TYPE.LINE,
@@ -10506,6 +10527,7 @@ class BizyBarLineChartComponent {
10506
10527
  legends.add(_line.name);
10507
10528
  });
10508
10529
  this.barCharts.forEach((_bar, _i) => {
10530
+ let axisIndex = _i + this.lineCharts.length;
10509
10531
  const barXAxis = _bar.xAxis;
10510
10532
  const barYAxis = _bar.yAxis;
10511
10533
  const xAxisType = !barXAxis || typeof barXAxis.independent === 'undefined' ? BIZY_BAR_LINE_CHART_AXIS_TYPE.INDEPENDENT : barXAxis?.independent ? BIZY_BAR_LINE_CHART_AXIS_TYPE.INDEPENDENT : BIZY_BAR_LINE_CHART_AXIS_TYPE.DEPENDENT;
@@ -10519,6 +10541,15 @@ class BizyBarLineChartComponent {
10519
10541
  const thereIsOtherVisibleYAxis = (position === BIZY_BAR_LINE_CHART_AXIS_POSITION.LEFT && this.#gridLeft > 0 || position === BIZY_BAR_LINE_CHART_AXIS_POSITION.RIGHT && this.#gridRight > 0);
10520
10542
  const offset = show && thereIsOtherVisibleYAxis && typeof barYAxis.offset !== 'undefined' ? barYAxis.offset : show && thereIsOtherVisibleYAxis ? Y_AXIS_OFFSET : 0;
10521
10543
  const color = _bar.getYAxisColor() ? _bar.getYAxisColor() : yAxisType === BIZY_BAR_LINE_CHART_AXIS_TYPE.DEPENDENT && _bar.getColor() ? _bar.getColor() : defaultYAxisColor;
10544
+ if (barYAxis.group && yAxisType === BIZY_BAR_LINE_CHART_AXIS_TYPE.DEPENDENT) {
10545
+ const _axisIndex = this.#chartGroups.get(barYAxis.group);
10546
+ if (_axisIndex) {
10547
+ axisIndex = _axisIndex;
10548
+ }
10549
+ else {
10550
+ this.#chartGroups.set(barYAxis.group, this.#getRandomFourDigitsNumber());
10551
+ }
10552
+ }
10522
10553
  yAxis.push({
10523
10554
  type: yAxisType,
10524
10555
  name: barYAxis?.name,
@@ -10567,6 +10598,15 @@ class BizyBarLineChartComponent {
10567
10598
  const thereIsOtherVisibleXAxis = (position === BIZY_BAR_LINE_CHART_AXIS_POSITION.TOP && this.#gridTop > 0 || position === BIZY_BAR_LINE_CHART_AXIS_POSITION.BOTTOM && this.#gridBottom > 0);
10568
10599
  const offset = show && thereIsOtherVisibleXAxis && typeof barXAxis.offset !== 'undefined' ? barXAxis.offset : show && thereIsOtherVisibleXAxis ? X_AXIS_OFFSET : 0;
10569
10600
  const color = _bar.getXAxisColor() ? _bar.getXAxisColor() : xAxisType === BIZY_BAR_LINE_CHART_AXIS_TYPE.DEPENDENT && _bar.getColor() ? _bar.getColor() : defaultXAxisColor;
10601
+ if (barXAxis.group && xAxisType === BIZY_BAR_LINE_CHART_AXIS_TYPE.DEPENDENT) {
10602
+ const _axisIndex = this.#chartGroups.get(barXAxis.group);
10603
+ if (_axisIndex) {
10604
+ axisIndex = _axisIndex;
10605
+ }
10606
+ else {
10607
+ this.#chartGroups.set(barXAxis.group, this.#getRandomFourDigitsNumber());
10608
+ }
10609
+ }
10570
10610
  xAxis.push({
10571
10611
  type: xAxisType,
10572
10612
  name: barXAxis?.name,
@@ -10606,29 +10646,30 @@ class BizyBarLineChartComponent {
10606
10646
  }
10607
10647
  }
10608
10648
  }
10609
- let axisIndex = _i + this.lineCharts.length;
10610
- if (_bar.stack) {
10611
- const _stack = this.#chartStacks.find(_stack => _stack === _bar.stack);
10612
- if (_stack) {
10613
- const index = series.findIndex(_s => _s.stack === _stack);
10614
- if (index !== -1) {
10615
- axisIndex = yAxisType === BIZY_BAR_LINE_CHART_AXIS_TYPE.DEPENDENT ? series[index].yAxisIndex : series[index].xAxisIndex;
10649
+ if (axisIndex !== _i + this.lineCharts.length) {
10650
+ if (_bar.stack) {
10651
+ const _stack = this.#chartStacks.find(_stack => _stack === _bar.stack);
10652
+ if (_stack) {
10653
+ const index = series.findIndex(_s => _s.stack === _stack);
10654
+ if (index !== -1) {
10655
+ axisIndex = yAxisType === BIZY_BAR_LINE_CHART_AXIS_TYPE.DEPENDENT ? series[index].yAxisIndex : series[index].xAxisIndex;
10656
+ }
10616
10657
  }
10617
- }
10618
- else {
10619
- this.#chartStacks.push(_bar.stack);
10620
- }
10621
- }
10622
- else {
10623
- const _name = this.#chartNames.find(_name => _name === _bar.name);
10624
- if (_name) {
10625
- const index = series.findIndex(_s => _s.name === _name);
10626
- if (index !== -1) {
10627
- axisIndex = index;
10658
+ else {
10659
+ this.#chartStacks.push(_bar.stack);
10628
10660
  }
10629
10661
  }
10630
10662
  else {
10631
- this.#chartNames.push(_bar.name);
10663
+ const _name = this.#chartNames.find(_name => _name === _bar.name);
10664
+ if (_name) {
10665
+ const index = series.findIndex(_s => _s.name === _name);
10666
+ if (index !== -1) {
10667
+ axisIndex = index;
10668
+ }
10669
+ }
10670
+ else {
10671
+ this.#chartNames.push(_bar.name);
10672
+ }
10632
10673
  }
10633
10674
  }
10634
10675
  if (_bar.getMinHeight()) {
@@ -10790,6 +10831,7 @@ class BizyBarLineChartComponent {
10790
10831
  const rootValue = getComputedStyle(document.documentElement).getPropertyValue(cssVariable).trim();
10791
10832
  return rootValue || null;
10792
10833
  };
10834
+ #getRandomFourDigitsNumber = () => Math.floor(1000 + Math.random() * 9000);
10793
10835
  ngOnDestroy() {
10794
10836
  this.#resizeSubscription.unsubscribe();
10795
10837
  this.#barChartsSubscription.unsubscribe();