@nova-ui/charts 12.0.18 → 12.0.20

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.
@@ -5608,7 +5608,9 @@
5608
5608
  function Scale(id) {
5609
5609
  this.domainCalculator = getAutomaticDomain;
5610
5610
  this.formatters = {};
5611
+ this.isTimeseriesScale = false;
5611
5612
  this.isReversed = false;
5613
+ this._fixDomainValues = [];
5612
5614
  this.id = id || UtilityService.uuid();
5613
5615
  this._d3Scale = this.createD3Scale();
5614
5616
  }
@@ -5620,6 +5622,21 @@
5620
5622
  enumerable: false,
5621
5623
  configurable: true
5622
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
+ };
5623
5640
  Scale.prototype.range = function (range) {
5624
5641
  if (range) {
5625
5642
  this._d3Scale.range(this.isReversed ? range.reverse() : range);
@@ -5888,6 +5905,17 @@
5888
5905
  .getStream(INTERACTION_VALUES_EVENT)
5889
5906
  .pipe(operators.takeUntil(this.destroy$))
5890
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
+ }
5891
5919
  _this.lastInteractionValuesPayload = event.data;
5892
5920
  if (_this.isChartInView) {
5893
5921
  _this.handleLabelUpdate();
@@ -6456,6 +6484,8 @@
6456
6484
  x2: this.config().dimension.width() +
6457
6485
  Grid.TICK_DIMENSION_CORRECTION,
6458
6486
  y2: this.config().dimension.height() - borderMidpoint,
6487
+ class: this._config.borders.bottom.className ||
6488
+ Grid.DEFAULT_BORDER_CLASS_NAME,
6459
6489
  })
6460
6490
  .classed("hidden", !((_a = this._config.borders.bottom) === null || _a === void 0 ? void 0 : _a.visible));
6461
6491
  };
@@ -6782,12 +6812,16 @@
6782
6812
  };
6783
6813
  /** @ignore */
6784
6814
  XYGrid.prototype.drawTicks = function (config, axis, scale, axisGenerator) {
6815
+ var _a, _b;
6785
6816
  if (config.visible) {
6786
- var bottomLabelAxis = axisGenerator(scale.d3Scale)
6817
+ var labelAxis = axisGenerator(scale.d3Scale)
6787
6818
  .ticks(config.approximateTicks)
6788
- .tickSize(0)
6789
- .tickFormat(scale.formatters["tick"]);
6790
- 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);
6791
6825
  var tickAxis = void 0;
6792
6826
  if (scale instanceof BandScale) {
6793
6827
  tickAxis = axisGenerator(scale.copyToLinear().d3Scale)
@@ -6796,9 +6830,11 @@
6796
6830
  .tickFormat(function () { return ""; });
6797
6831
  }
6798
6832
  else {
6799
- tickAxis = axisGenerator(scale.d3Scale)
6800
- .tickSize(config.tickSize)
6801
- .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 ""; });
6802
6838
  tickAxis.ticks(config.approximateTicks);
6803
6839
  }
6804
6840
  axis.tickGroup.call(tickAxis);
@@ -6811,13 +6847,15 @@
6811
6847
  };
6812
6848
  /** @ignore */
6813
6849
  XYGrid.prototype.drawGrids = function (config, axis, axisGenerator, scale, size) {
6850
+ var _a;
6814
6851
  var modifyZeroLines = function (gridGroupSelection) { return gridGroupSelection
6815
6852
  .selectAll(".tick line")
6816
6853
  .classed("nui-zero-line", function (d) { return d === 0; }); };
6817
- var leftGridLines = axisGenerator(scale.d3Scale)
6818
- .tickSize(size)
6819
- .tickFormat(function () { return ""; })
6820
- .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);
6821
6859
  if (config.gridTicks) {
6822
6860
  var gridSelection = axis.tickGroup.call(leftGridLines);
6823
6861
  modifyZeroLines(gridSelection);