@bizy/core 21.5.5 → 21.5.7

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,17 @@ 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
+ const index = this.#getRandomFourDigitsNumber();
10404
+ this.#chartGroups.set(lineYAxis.group, index);
10405
+ axisIndex = index;
10406
+ }
10407
+ }
10395
10408
  yAxis.push({
10396
10409
  type: yAxisType,
10397
10410
  name: lineYAxis?.name,
@@ -10439,6 +10452,17 @@ class BizyBarLineChartComponent {
10439
10452
  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
10453
  const offset = show && thereIsOtherVisibleXAxis && typeof lineXAxis.offset !== 'undefined' ? lineXAxis.offset : show && thereIsOtherVisibleXAxis ? X_AXIS_OFFSET : 0;
10441
10454
  const color = _line.getXAxisColor() ? _line.getXAxisColor() : xAxisType === BIZY_BAR_LINE_CHART_AXIS_TYPE.DEPENDENT && _line.getColor() ? _line.getColor() : defaultXAxisColor;
10455
+ if (lineXAxis.group && xAxisType === BIZY_BAR_LINE_CHART_AXIS_TYPE.DEPENDENT) {
10456
+ const _axisIndex = this.#chartGroups.get(lineXAxis.group);
10457
+ if (_axisIndex) {
10458
+ axisIndex = _axisIndex;
10459
+ }
10460
+ else {
10461
+ const index = this.#getRandomFourDigitsNumber();
10462
+ this.#chartGroups.set(lineXAxis.group, index);
10463
+ axisIndex = index;
10464
+ }
10465
+ }
10442
10466
  xAxis.push({
10443
10467
  type: xAxisType,
10444
10468
  name: lineXAxis?.name,
@@ -10477,16 +10501,17 @@ class BizyBarLineChartComponent {
10477
10501
  }
10478
10502
  }
10479
10503
  }
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;
10504
+ if (axisIndex !== _i) {
10505
+ const _name = this.#chartNames.find(_name => _name === _line.name);
10506
+ if (_name) {
10507
+ const index = series.findIndex(_s => _s.name === _name);
10508
+ if (index !== -1) {
10509
+ axisIndex = index;
10510
+ }
10511
+ }
10512
+ else {
10513
+ this.#chartNames.push(_line.name);
10486
10514
  }
10487
- }
10488
- else {
10489
- this.#chartNames.push(_line.name);
10490
10515
  }
10491
10516
  series.push({
10492
10517
  type: BIZY_BAR_LINE_CHART_TYPE.LINE,
@@ -10506,6 +10531,7 @@ class BizyBarLineChartComponent {
10506
10531
  legends.add(_line.name);
10507
10532
  });
10508
10533
  this.barCharts.forEach((_bar, _i) => {
10534
+ let axisIndex = _i + this.lineCharts.length;
10509
10535
  const barXAxis = _bar.xAxis;
10510
10536
  const barYAxis = _bar.yAxis;
10511
10537
  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 +10545,17 @@ class BizyBarLineChartComponent {
10519
10545
  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
10546
  const offset = show && thereIsOtherVisibleYAxis && typeof barYAxis.offset !== 'undefined' ? barYAxis.offset : show && thereIsOtherVisibleYAxis ? Y_AXIS_OFFSET : 0;
10521
10547
  const color = _bar.getYAxisColor() ? _bar.getYAxisColor() : yAxisType === BIZY_BAR_LINE_CHART_AXIS_TYPE.DEPENDENT && _bar.getColor() ? _bar.getColor() : defaultYAxisColor;
10548
+ if (barYAxis.group && yAxisType === BIZY_BAR_LINE_CHART_AXIS_TYPE.DEPENDENT) {
10549
+ const _axisIndex = this.#chartGroups.get(barYAxis.group);
10550
+ if (_axisIndex) {
10551
+ axisIndex = _axisIndex;
10552
+ }
10553
+ else {
10554
+ const index = this.#getRandomFourDigitsNumber();
10555
+ this.#chartGroups.set(barYAxis.group, index);
10556
+ axisIndex = index;
10557
+ }
10558
+ }
10522
10559
  yAxis.push({
10523
10560
  type: yAxisType,
10524
10561
  name: barYAxis?.name,
@@ -10567,6 +10604,17 @@ class BizyBarLineChartComponent {
10567
10604
  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
10605
  const offset = show && thereIsOtherVisibleXAxis && typeof barXAxis.offset !== 'undefined' ? barXAxis.offset : show && thereIsOtherVisibleXAxis ? X_AXIS_OFFSET : 0;
10569
10606
  const color = _bar.getXAxisColor() ? _bar.getXAxisColor() : xAxisType === BIZY_BAR_LINE_CHART_AXIS_TYPE.DEPENDENT && _bar.getColor() ? _bar.getColor() : defaultXAxisColor;
10607
+ if (barXAxis.group && xAxisType === BIZY_BAR_LINE_CHART_AXIS_TYPE.DEPENDENT) {
10608
+ const _axisIndex = this.#chartGroups.get(barXAxis.group);
10609
+ if (_axisIndex) {
10610
+ axisIndex = _axisIndex;
10611
+ }
10612
+ else {
10613
+ const index = this.#getRandomFourDigitsNumber();
10614
+ this.#chartGroups.set(barXAxis.group, index);
10615
+ axisIndex = index;
10616
+ }
10617
+ }
10570
10618
  xAxis.push({
10571
10619
  type: xAxisType,
10572
10620
  name: barXAxis?.name,
@@ -10606,29 +10654,30 @@ class BizyBarLineChartComponent {
10606
10654
  }
10607
10655
  }
10608
10656
  }
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;
10657
+ if (axisIndex !== _i + this.lineCharts.length) {
10658
+ if (_bar.stack) {
10659
+ const _stack = this.#chartStacks.find(_stack => _stack === _bar.stack);
10660
+ if (_stack) {
10661
+ const index = series.findIndex(_s => _s.stack === _stack);
10662
+ if (index !== -1) {
10663
+ axisIndex = yAxisType === BIZY_BAR_LINE_CHART_AXIS_TYPE.DEPENDENT ? series[index].yAxisIndex : series[index].xAxisIndex;
10664
+ }
10616
10665
  }
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;
10666
+ else {
10667
+ this.#chartStacks.push(_bar.stack);
10628
10668
  }
10629
10669
  }
10630
10670
  else {
10631
- this.#chartNames.push(_bar.name);
10671
+ const _name = this.#chartNames.find(_name => _name === _bar.name);
10672
+ if (_name) {
10673
+ const index = series.findIndex(_s => _s.name === _name);
10674
+ if (index !== -1) {
10675
+ axisIndex = index;
10676
+ }
10677
+ }
10678
+ else {
10679
+ this.#chartNames.push(_bar.name);
10680
+ }
10632
10681
  }
10633
10682
  }
10634
10683
  if (_bar.getMinHeight()) {
@@ -10790,6 +10839,7 @@ class BizyBarLineChartComponent {
10790
10839
  const rootValue = getComputedStyle(document.documentElement).getPropertyValue(cssVariable).trim();
10791
10840
  return rootValue || null;
10792
10841
  };
10842
+ #getRandomFourDigitsNumber = () => Math.floor(1000 + Math.random() * 9000);
10793
10843
  ngOnDestroy() {
10794
10844
  this.#resizeSubscription.unsubscribe();
10795
10845
  this.#barChartsSubscription.unsubscribe();