@nova-ui/charts 13.0.6-4382 → 13.0.7-4420

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.
@@ -5410,7 +5410,9 @@ class Scale {
5410
5410
  constructor(id) {
5411
5411
  this.domainCalculator = getAutomaticDomain;
5412
5412
  this.formatters = {};
5413
+ this.isTimeseriesScale = false;
5413
5414
  this.isReversed = false;
5415
+ this._fixDomainValues = [];
5414
5416
  this.id = id || UtilityService.uuid();
5415
5417
  this._d3Scale = this.createD3Scale();
5416
5418
  }
@@ -5418,6 +5420,17 @@ class Scale {
5418
5420
  get d3Scale() {
5419
5421
  return this._d3Scale;
5420
5422
  }
5423
+ get fixDomainValues() {
5424
+ return this._fixDomainValues;
5425
+ }
5426
+ /** See {@link IScale#setFixDomainValues} */
5427
+ setFixDomainValues(values) {
5428
+ if (values.length > 1) {
5429
+ this.domain([values[0], values[values.length - 1]]);
5430
+ this.isDomainFixed = true;
5431
+ }
5432
+ this._fixDomainValues = values;
5433
+ }
5421
5434
  range(range) {
5422
5435
  if (range) {
5423
5436
  this._d3Scale.range(this.isReversed ? range.reverse() : range);
@@ -5675,6 +5688,16 @@ class InteractionLabelPlugin extends ChartPlugin {
5675
5688
  .getStream(INTERACTION_VALUES_EVENT)
5676
5689
  .pipe(takeUntil(this.destroy$))
5677
5690
  .subscribe((event) => {
5691
+ if (event.data.values?.y) {
5692
+ const chartGrid = this.chart.getGrid();
5693
+ const eventYAxisIds = Object.keys(event.data.values.y);
5694
+ const chartLeftYAxis = chartGrid.scales.y.list[0];
5695
+ // shows label only for a chart that is currently being hovered
5696
+ if (chartLeftYAxis.isTimeseriesScale &&
5697
+ !eventYAxisIds.includes(chartLeftYAxis.id)) {
5698
+ return;
5699
+ }
5700
+ }
5678
5701
  this.lastInteractionValuesPayload = event.data;
5679
5702
  if (this.isChartInView) {
5680
5703
  this.handleLabelUpdate();
@@ -6228,6 +6251,8 @@ class Grid {
6228
6251
  x2: this.config().dimension.width() +
6229
6252
  Grid.TICK_DIMENSION_CORRECTION,
6230
6253
  y2: this.config().dimension.height() - borderMidpoint,
6254
+ class: this._config.borders.bottom.className ||
6255
+ Grid.DEFAULT_BORDER_CLASS_NAME,
6231
6256
  })
6232
6257
  .classed("hidden", !this._config.borders.bottom?.visible);
6233
6258
  }
@@ -6506,11 +6531,14 @@ class XYGrid extends Grid {
6506
6531
  /** @ignore */
6507
6532
  drawTicks(config, axis, scale, axisGenerator) {
6508
6533
  if (config.visible) {
6509
- const bottomLabelAxis = axisGenerator(scale.d3Scale)
6534
+ const labelAxis = axisGenerator(scale.d3Scale)
6510
6535
  .ticks(config.approximateTicks)
6511
- .tickSize(0)
6512
- .tickFormat(scale.formatters["tick"]);
6513
- axis.labelGroup.call(bottomLabelAxis);
6536
+ .tickSize(0);
6537
+ if (scale.fixDomainValues?.length) {
6538
+ labelAxis.tickValues(scale.fixDomainValues);
6539
+ }
6540
+ labelAxis.tickFormat(scale.formatters["tick"]);
6541
+ axis.labelGroup.call(labelAxis);
6514
6542
  let tickAxis;
6515
6543
  if (scale instanceof BandScale) {
6516
6544
  tickAxis = axisGenerator(scale.copyToLinear().d3Scale)
@@ -6519,9 +6547,11 @@ class XYGrid extends Grid {
6519
6547
  .tickFormat(() => "");
6520
6548
  }
6521
6549
  else {
6522
- tickAxis = axisGenerator(scale.d3Scale)
6523
- .tickSize(config.tickSize)
6524
- .tickFormat(() => "");
6550
+ tickAxis = axisGenerator(scale.d3Scale).tickSize(config.tickSize);
6551
+ if (scale.fixDomainValues?.length) {
6552
+ tickAxis.tickValues(scale.fixDomainValues);
6553
+ }
6554
+ tickAxis.tickFormat(() => "");
6525
6555
  tickAxis.ticks(config.approximateTicks);
6526
6556
  }
6527
6557
  axis.tickGroup.call(tickAxis);
@@ -6537,10 +6567,11 @@ class XYGrid extends Grid {
6537
6567
  const modifyZeroLines = (gridGroupSelection) => gridGroupSelection
6538
6568
  .selectAll(".tick line")
6539
6569
  .classed("nui-zero-line", (d) => d === 0);
6540
- const leftGridLines = axisGenerator(scale.d3Scale)
6541
- .tickSize(size)
6542
- .tickFormat(() => "")
6543
- .ticks(config.approximateTicks);
6570
+ const leftGridLines = axisGenerator(scale.d3Scale).tickSize(size);
6571
+ if (scale.fixDomainValues?.length) {
6572
+ leftGridLines.tickValues(scale.fixDomainValues);
6573
+ }
6574
+ leftGridLines.tickFormat(() => "").ticks(config.approximateTicks);
6544
6575
  if (config.gridTicks) {
6545
6576
  const gridSelection = axis.tickGroup.call(leftGridLines);
6546
6577
  modifyZeroLines(gridSelection);