@nova-ui/charts 12.0.17 → 12.0.20-4218

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.
@@ -1088,10 +1088,20 @@
1088
1088
  this.chartComponent = chartComponent;
1089
1089
  this.chartCollectionService = chartCollectionService;
1090
1090
  }
1091
- ChartCollectionIdDirective.prototype.ngAfterViewInit = function () {
1092
- this.chartCollectionService
1093
- .getChartCollection(this.collectionId)
1094
- .addChart(this.chartComponent.chart);
1091
+ ChartCollectionIdDirective.prototype.ngOnChanges = function (changes) {
1092
+ var collectionIdChange = changes.collectionId;
1093
+ if (collectionIdChange) {
1094
+ if (collectionIdChange.previousValue) {
1095
+ this.chartCollectionService
1096
+ .getChartCollection(collectionIdChange.previousValue)
1097
+ .removeChart(this.chartComponent.chart);
1098
+ }
1099
+ if (collectionIdChange.currentValue) {
1100
+ this.chartCollectionService
1101
+ .getChartCollection(collectionIdChange.currentValue)
1102
+ .addChart(this.chartComponent.chart);
1103
+ }
1104
+ }
1095
1105
  };
1096
1106
  return ChartCollectionIdDirective;
1097
1107
  }());
@@ -5598,7 +5608,9 @@
5598
5608
  function Scale(id) {
5599
5609
  this.domainCalculator = getAutomaticDomain;
5600
5610
  this.formatters = {};
5611
+ this.isTimeseriesScale = false;
5601
5612
  this.isReversed = false;
5613
+ this._fixDomainValues = [];
5602
5614
  this.id = id || UtilityService.uuid();
5603
5615
  this._d3Scale = this.createD3Scale();
5604
5616
  }
@@ -5610,6 +5622,21 @@
5610
5622
  enumerable: false,
5611
5623
  configurable: true
5612
5624
  });
5625
+ Object.defineProperty(Scale.prototype, "fixDomainValues", {
5626
+ get: function () {
5627
+ return this._fixDomainValues;
5628
+ },
5629
+ enumerable: false,
5630
+ configurable: true
5631
+ });
5632
+ /** See {@link IScale#setFixDomainValues} */
5633
+ Scale.prototype.setFixDomainValues = function (values) {
5634
+ if (values.length > 1) {
5635
+ this.domain([values[0], values[values.length - 1]]);
5636
+ this.isDomainFixed = true;
5637
+ }
5638
+ this._fixDomainValues = values;
5639
+ };
5613
5640
  Scale.prototype.range = function (range) {
5614
5641
  if (range) {
5615
5642
  this._d3Scale.range(this.isReversed ? range.reverse() : range);
@@ -5878,6 +5905,17 @@
5878
5905
  .getStream(INTERACTION_VALUES_EVENT)
5879
5906
  .pipe(operators.takeUntil(this.destroy$))
5880
5907
  .subscribe(function (event) {
5908
+ var _a;
5909
+ if ((_a = event.data.values) === null || _a === void 0 ? void 0 : _a.y) {
5910
+ var chartGrid = _this.chart.getGrid();
5911
+ var eventYAxisIds = Object.keys(event.data.values.y);
5912
+ var chartLeftYAxis = chartGrid.scales.y.list[0];
5913
+ // shows label only for a chart that is currently being hovered
5914
+ if (chartLeftYAxis.isTimeseriesScale &&
5915
+ !eventYAxisIds.includes(chartLeftYAxis.id)) {
5916
+ return;
5917
+ }
5918
+ }
5881
5919
  _this.lastInteractionValuesPayload = event.data;
5882
5920
  if (_this.isChartInView) {
5883
5921
  _this.handleLabelUpdate();
@@ -6446,6 +6484,8 @@
6446
6484
  x2: this.config().dimension.width() +
6447
6485
  Grid.TICK_DIMENSION_CORRECTION,
6448
6486
  y2: this.config().dimension.height() - borderMidpoint,
6487
+ class: this._config.borders.bottom.className ||
6488
+ Grid.DEFAULT_BORDER_CLASS_NAME,
6449
6489
  })
6450
6490
  .classed("hidden", !((_a = this._config.borders.bottom) === null || _a === void 0 ? void 0 : _a.visible));
6451
6491
  };
@@ -6772,12 +6812,16 @@
6772
6812
  };
6773
6813
  /** @ignore */
6774
6814
  XYGrid.prototype.drawTicks = function (config, axis, scale, axisGenerator) {
6815
+ var _a, _b;
6775
6816
  if (config.visible) {
6776
- var bottomLabelAxis = axisGenerator(scale.d3Scale)
6817
+ var labelAxis = axisGenerator(scale.d3Scale)
6777
6818
  .ticks(config.approximateTicks)
6778
- .tickSize(0)
6779
- .tickFormat(scale.formatters["tick"]);
6780
- axis.labelGroup.call(bottomLabelAxis);
6819
+ .tickSize(0);
6820
+ if ((_a = scale.fixDomainValues) === null || _a === void 0 ? void 0 : _a.length) {
6821
+ labelAxis.tickValues(scale.fixDomainValues);
6822
+ }
6823
+ labelAxis.tickFormat(scale.formatters["tick"]);
6824
+ axis.labelGroup.call(labelAxis);
6781
6825
  var tickAxis = void 0;
6782
6826
  if (scale instanceof BandScale) {
6783
6827
  tickAxis = axisGenerator(scale.copyToLinear().d3Scale)
@@ -6786,9 +6830,11 @@
6786
6830
  .tickFormat(function () { return ""; });
6787
6831
  }
6788
6832
  else {
6789
- tickAxis = axisGenerator(scale.d3Scale)
6790
- .tickSize(config.tickSize)
6791
- .tickFormat(function () { return ""; });
6833
+ tickAxis = axisGenerator(scale.d3Scale).tickSize(config.tickSize);
6834
+ if ((_b = scale.fixDomainValues) === null || _b === void 0 ? void 0 : _b.length) {
6835
+ tickAxis.tickValues(scale.fixDomainValues);
6836
+ }
6837
+ tickAxis.tickFormat(function () { return ""; });
6792
6838
  tickAxis.ticks(config.approximateTicks);
6793
6839
  }
6794
6840
  axis.tickGroup.call(tickAxis);
@@ -6801,13 +6847,15 @@
6801
6847
  };
6802
6848
  /** @ignore */
6803
6849
  XYGrid.prototype.drawGrids = function (config, axis, axisGenerator, scale, size) {
6850
+ var _a;
6804
6851
  var modifyZeroLines = function (gridGroupSelection) { return gridGroupSelection
6805
6852
  .selectAll(".tick line")
6806
6853
  .classed("nui-zero-line", function (d) { return d === 0; }); };
6807
- var leftGridLines = axisGenerator(scale.d3Scale)
6808
- .tickSize(size)
6809
- .tickFormat(function () { return ""; })
6810
- .ticks(config.approximateTicks);
6854
+ var leftGridLines = axisGenerator(scale.d3Scale).tickSize(size);
6855
+ if ((_a = scale.fixDomainValues) === null || _a === void 0 ? void 0 : _a.length) {
6856
+ leftGridLines.tickValues(scale.fixDomainValues);
6857
+ }
6858
+ leftGridLines.tickFormat(function () { return ""; }).ticks(config.approximateTicks);
6811
6859
  if (config.gridTicks) {
6812
6860
  var gridSelection = axis.tickGroup.call(leftGridLines);
6813
6861
  modifyZeroLines(gridSelection);