@aquera/nile-visualization 2.9.47 → 2.9.48

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.
package/README.md CHANGED
@@ -36,6 +36,9 @@ To run a local development server that serves the basic demo located in `demo/in
36
36
 
37
37
  In this section, you can find the updates for each release of `nile-visualization`. It's a good practice to maintain detailed release notes to help users and developers understand what changes have been made from one version to another and how these changes might affect their projects.
38
38
 
39
+ #### Version 2.9.48 (November 20, 2026)
40
+ - Nile Master-Detail Chart: Optional navigator bar under the master pane (`navigator-controls`): pan, a window slider, zoom in / out and a range caption with an optional `navigator-hint`. `navigator-default-window` (e.g. `0.25`, `7d`) opens zoomed in so the controls are usable on load. Off by default (UIF-1433)
41
+
39
42
  #### Version 2.9.47 (November 20, 2026)
40
43
  - Nile Charts: Reverted the 2.9.44 changes (x-axis label options and lite tooltips, UIF-1426)
41
44
 
@@ -14,6 +14,10 @@ export interface ChartMasterDetailConfigType {
14
14
  masterType?: MasterDetailSeriesType;
15
15
  masterOnly?: boolean;
16
16
  masterCollapsible?: boolean;
17
+ navigatorControls?: boolean;
18
+ navigatorHint?: string;
19
+ /** Opening window with navigator controls: a fraction (`0.25`) or a duration (`7d`, `12h`, `30m`, `2w`). */
20
+ navigatorDefaultWindow?: string;
17
21
  xAxisType?: MasterDetailXAxisType;
18
22
  xAxisMin?: number | null;
19
23
  xAxisMax?: number | null;
@@ -422,6 +422,10 @@ export interface NileMasterDetailChartConfig extends NileChartConfigBase {
422
422
  masterType?: string;
423
423
  masterOnly?: boolean;
424
424
  masterCollapsible?: boolean;
425
+ navigatorControls?: boolean;
426
+ navigatorHint?: string;
427
+ /** Opening window with navigator controls: a fraction (`0.25`) or a duration (`7d`, `12h`, `30m`, `2w`). */
428
+ navigatorDefaultWindow?: string;
425
429
  xAxisType?: 'datetime' | 'linear' | 'logarithmic' | 'category';
426
430
  xAxisMin?: number | null;
427
431
  xAxisMax?: number | null;
@@ -1642,6 +1642,9 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
1642
1642
  .masterType=${config.masterType ?? 'area'}
1643
1643
  .masterOnly=${config.masterOnly ?? false}
1644
1644
  .masterCollapsible=${config.masterCollapsible ?? false}
1645
+ .navigatorControls=${config.navigatorControls ?? false}
1646
+ .navigatorHint=${config.navigatorHint ?? ''}
1647
+ .navigatorDefaultWindow=${config.navigatorDefaultWindow ?? ''}
1645
1648
  .xAxisType=${config.xAxisType ?? 'datetime'}
1646
1649
  .xAxisMin=${config.xAxisMin ?? null}
1647
1650
  .xAxisMax=${config.xAxisMax ?? null}
@@ -98,6 +98,48 @@ export const styles = css `
98
98
  background: var(--nile-colors-dark-200, var(--ng-colors-bg-secondary-hover));
99
99
  }
100
100
 
101
+ .navigator {
102
+ flex: 0 0 auto;
103
+ display: flex;
104
+ flex-direction: column;
105
+ gap: var(--nile-spacing-1, var(--ng-spacing-1, 4px));
106
+ padding-top: var(--nile-spacing-2, var(--ng-spacing-2, 8px));
107
+ }
108
+
109
+ .navigator-controls {
110
+ display: flex;
111
+ flex-wrap: nowrap;
112
+ align-items: center;
113
+ gap: var(--nile-spacing-2, var(--ng-spacing-2, 8px));
114
+ }
115
+
116
+ .navigator-zoom {
117
+ display: inline-flex;
118
+ gap: var(--nile-spacing-1, var(--ng-spacing-1, 4px));
119
+ }
120
+
121
+ .navigator-button::part(base) {
122
+ min-width: var(--nile-height-32px, var(--ng-height-32px, 32px));
123
+ padding-inline: 0;
124
+ justify-content: center;
125
+ }
126
+
127
+ /* half the thumb plus a gap, so the thumb at either end clears the buttons */
128
+ .navigator-slider {
129
+ flex: 1 1 160px;
130
+ min-width: 120px;
131
+ margin-inline: calc(
132
+ var(--nile-spacing-lg, var(--ng-spacing-2xl, 24px)) / 2 + var(--nile-spacing-xs, var(--ng-spacing-xs, 4px))
133
+ );
134
+ --nile-slider-width: 100%;
135
+ }
136
+
137
+ .navigator-caption {
138
+ color: var(--nile-colors-neutral-700, var(--ng-colors-text-secondary-700));
139
+ font-size: var(--nile-type-scale-2, var(--ng-font-size-text-xs));
140
+ }
141
+
142
+
101
143
  .chart-loading {
102
144
  display: flex;
103
145
  align-items: center;
@@ -21,6 +21,21 @@ export declare const MASTER_DETAIL_SERIES_TYPES: readonly ["area", "line", "spli
21
21
  export type MasterDetailSeriesType = (typeof MASTER_DETAIL_SERIES_TYPES)[number];
22
22
  export declare const MASTER_DETAIL_X_AXIS_TYPES: readonly ["datetime", "linear", "logarithmic", "category"];
23
23
  export type MasterDetailXAxisType = (typeof MASTER_DETAIL_X_AXIS_TYPES)[number];
24
+ /**
25
+ * @tag nile-master-detail-chart
26
+ * @summary A detail chart above an overview (master) strip; dragging on the strip zooms the detail.
27
+ *
28
+ * @event nile-chart-ready - Charts are created. `detail: { chart }`
29
+ * @event nile-chart-selection - The visible window changed. `detail: { min, max }`
30
+ * @event nile-master-detail-zoom - Zoomed in or back to the full range. `detail: { zoomed }`
31
+ *
32
+ * @csspart detail-container - The detail chart.
33
+ * @csspart master-container - The master (overview) strip.
34
+ * @csspart master-toggle - The show/hide button for the master strip (`master-collapsible`).
35
+ * @csspart navigator - The control bar under the master strip (`navigator-controls`).
36
+ * @csspart navigator-caption - The range readout in the control bar.
37
+ * @csspart navigator-hint - The hint text after the range readout.
38
+ */
24
39
  export declare class NileMasterDetailChart extends NileElement {
25
40
  static styles: CSSResultGroup;
26
41
  private _hc;
@@ -50,6 +65,17 @@ export declare class NileMasterDetailChart extends NileElement {
50
65
  masterType: MasterDetailSeriesType;
51
66
  masterOnly: boolean;
52
67
  masterCollapsible: boolean;
68
+ navigatorControls: boolean;
69
+ navigatorHint: string;
70
+ /**
71
+ * Opening window when `navigator-controls` is on and no `selection-min` / `selection-max` is set:
72
+ * a fraction of the range (`0.25`) or, on a datetime axis, a duration (`30m`, `12h`, `7d`, `2w`),
73
+ * ending at the latest data. Empty opens on the full range.
74
+ */
75
+ navigatorDefaultWindow: string;
76
+ private _window;
77
+ /** Re-renders only when the control bar is shown, so plain charts skip the extra update. */
78
+ private _trackWindow;
53
79
  height: string;
54
80
  masterHeight: string | number;
55
81
  xAxisType: MasterDetailXAxisType;
@@ -101,11 +127,34 @@ export declare class NileMasterDetailChart extends NileElement {
101
127
  private _zoomWindow;
102
128
  private _masterMinRange;
103
129
  private snapSelection;
130
+ /** Opening window from `navigatorDefaultWindow`, snapped to data points; `null` means use the full range. */
131
+ private _defaultWindow;
104
132
  private defaultSelection;
105
133
  private buildDetailOptions;
106
134
  private buildMasterOptions;
107
135
  resetZoom(): void;
108
136
  private applySelection;
137
+ /** Pan and zoom work on the log scale when the x-axis is logarithmic. */
138
+ private get _isLogX();
139
+ private _toScale;
140
+ private _fromScale;
141
+ /** Index of the data x nearest to `v` on the axis scale; `xs` is sorted. */
142
+ private _nearestIndex;
143
+ /** Clamps `[min, max]` into the data range keeping its width, then snaps both edges to data points. */
144
+ private _snapWindow;
145
+ private _windowIndices;
146
+ private _applyWindow;
147
+ private _setWindow;
148
+ /** Move the window by 25% of its width toward the start (`-1`) or end (`1`), at least one data point. */
149
+ panBy(direction: -1 | 1): void;
150
+ /** Scale the window around its centre: `0.5` zooms in, `2` zooms out; at least one data point per step. */
151
+ zoomBy(factor: number): void;
152
+ private get _navState();
153
+ private _onSliderChange;
154
+ private _formatX;
155
+ /** `title` names the inner button for assistive tech and shows the hover tooltip. */
156
+ private _navButton;
157
+ private _renderNavigator;
109
158
  private initCharts;
110
159
  private destroyCharts;
111
160
  render(): TemplateResult | typeof nothing;
@@ -1,6 +1,7 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { customElement, property, query, state } from 'lit/decorators.js';
3
3
  import { html, nothing } from 'lit';
4
+ import { keyed } from 'lit/directives/keyed.js';
4
5
  import { getHighcharts } from '../internal/utils/highcharts-provider.js';
5
6
  import NileElement from '../internal/base/nile-element.js';
6
7
  import { applySeparatedChartConfig } from '../internal/utils/separated-chart-config.js';
@@ -17,6 +18,21 @@ export const MASTER_DETAIL_SERIES_TYPES = [
17
18
  'bar',
18
19
  ];
19
20
  export const MASTER_DETAIL_X_AXIS_TYPES = ['datetime', 'linear', 'logarithmic', 'category'];
21
+ /**
22
+ * @tag nile-master-detail-chart
23
+ * @summary A detail chart above an overview (master) strip; dragging on the strip zooms the detail.
24
+ *
25
+ * @event nile-chart-ready - Charts are created. `detail: { chart }`
26
+ * @event nile-chart-selection - The visible window changed. `detail: { min, max }`
27
+ * @event nile-master-detail-zoom - Zoomed in or back to the full range. `detail: { zoomed }`
28
+ *
29
+ * @csspart detail-container - The detail chart.
30
+ * @csspart master-container - The master (overview) strip.
31
+ * @csspart master-toggle - The show/hide button for the master strip (`master-collapsible`).
32
+ * @csspart navigator - The control bar under the master strip (`navigator-controls`).
33
+ * @csspart navigator-caption - The range readout in the control bar.
34
+ * @csspart navigator-hint - The hint text after the range readout.
35
+ */
20
36
  let NileMasterDetailChart = class NileMasterDetailChart extends NileElement {
21
37
  constructor() {
22
38
  super(...arguments);
@@ -43,6 +59,15 @@ let NileMasterDetailChart = class NileMasterDetailChart extends NileElement {
43
59
  this.masterType = 'area';
44
60
  this.masterOnly = false;
45
61
  this.masterCollapsible = false;
62
+ this.navigatorControls = false;
63
+ this.navigatorHint = '';
64
+ /**
65
+ * Opening window when `navigator-controls` is on and no `selection-min` / `selection-max` is set:
66
+ * a fraction of the range (`0.25`) or, on a datetime axis, a duration (`30m`, `12h`, `7d`, `2w`),
67
+ * ending at the latest data. Empty opens on the full range.
68
+ */
69
+ this.navigatorDefaultWindow = '';
70
+ this._window = null;
46
71
  this.height = '600px';
47
72
  this.masterHeight = 100;
48
73
  this.xAxisType = 'datetime';
@@ -85,6 +110,12 @@ let NileMasterDetailChart = class NileMasterDetailChart extends NileElement {
85
110
  this.masterChart?.reflow();
86
111
  }
87
112
  }
113
+ /** Re-renders only when the control bar is shown, so plain charts skip the extra update. */
114
+ _trackWindow(min, max) {
115
+ this._window = { min, max };
116
+ if (this.navigatorControls)
117
+ this.requestUpdate();
118
+ }
88
119
  _cssLength(val) {
89
120
  return typeof val === 'number'
90
121
  ? (Number.isFinite(val) ? `${val}px` : '')
@@ -168,6 +199,7 @@ let NileMasterDetailChart = class NileMasterDetailChart extends NileElement {
168
199
  'yAxisMax',
169
200
  'selectionMin',
170
201
  'selectionMax',
202
+ 'navigatorDefaultWindow',
171
203
  'detailTitle',
172
204
  'masterTitle',
173
205
  'maskFill',
@@ -306,8 +338,44 @@ let NileMasterDetailChart = class NileMasterDetailChart extends NileElement {
306
338
  const hi = nearest(max);
307
339
  return { min: Math.min(lo, hi), max: Math.max(lo, hi) };
308
340
  }
341
+ /** Opening window from `navigatorDefaultWindow`, snapped to data points; `null` means use the full range. */
342
+ _defaultWindow() {
343
+ const v = String(this.navigatorDefaultWindow ?? '').trim();
344
+ const xs = this._allXs();
345
+ if (!v || xs.length < 2)
346
+ return null;
347
+ const dataMin = xs[0];
348
+ const dataMax = xs[xs.length - 1];
349
+ let min = null;
350
+ const fraction = Number(v);
351
+ if (Number.isFinite(fraction)) {
352
+ if (fraction > 0 && fraction < 1) {
353
+ const sMin = this._toScale(dataMin);
354
+ const sMax = this._toScale(dataMax);
355
+ min = this._fromScale(sMax - (sMax - sMin) * fraction);
356
+ }
357
+ }
358
+ else {
359
+ const m = /^(\d+(?:\.\d+)?)\s*(m|h|d|w)$/i.exec(v);
360
+ if (m && this.xAxisType === 'datetime') {
361
+ const unit = { m: 6e4, h: 36e5, d: 864e5, w: 6048e5 };
362
+ const width = Number(m[1]) * unit[m[2].toLowerCase()];
363
+ if (width > 0 && width < dataMax - dataMin)
364
+ min = dataMax - width;
365
+ }
366
+ }
367
+ if (min == null)
368
+ return null;
369
+ const w = this._snapWindow(min, dataMax);
370
+ return w ? { min: xs[w.lo], max: xs[w.hi] } : null;
371
+ }
309
372
  defaultSelection() {
310
373
  const { dataMin, dataMax } = this.dataExtremes();
374
+ if (this.navigatorControls && this.selectionMin == null && this.selectionMax == null) {
375
+ const win = this._defaultWindow();
376
+ if (win)
377
+ return win;
378
+ }
311
379
  return {
312
380
  min: this.selectionMin ?? dataMin,
313
381
  max: this.selectionMax ?? dataMax,
@@ -393,6 +461,7 @@ let NileMasterDetailChart = class NileMasterDetailChart extends NileElement {
393
461
  : { min: ext.min, max: ext.max };
394
462
  const win = self._zoomWindow(sel.min, sel.max);
395
463
  self.masterChart?.xAxis[0].setExtremes(win.min, win.max);
464
+ self._trackWindow(sel.min, sel.max);
396
465
  self.setZoomed(true);
397
466
  self.emit('nile-chart-selection', sel);
398
467
  return false;
@@ -466,6 +535,7 @@ let NileMasterDetailChart = class NileMasterDetailChart extends NileElement {
466
535
  if (!this.masterChart)
467
536
  return;
468
537
  const { dataMin, dataMax } = this.dataExtremes();
538
+ this._trackWindow(dataMin, dataMax);
469
539
  if (this.masterOnly) {
470
540
  this.masterChart.xAxis[0].setExtremes(dataMin, dataMax);
471
541
  }
@@ -480,6 +550,7 @@ let NileMasterDetailChart = class NileMasterDetailChart extends NileElement {
480
550
  this.emit('nile-chart-selection', { min: dataMin, max: dataMax });
481
551
  }
482
552
  applySelection(min, max) {
553
+ this._trackWindow(min, max);
483
554
  if (!this.masterChart)
484
555
  return;
485
556
  if (this.masterOnly) {
@@ -505,6 +576,199 @@ let NileMasterDetailChart = class NileMasterDetailChart extends NileElement {
505
576
  if (max < dataMax)
506
577
  xAxis.addPlotBand({ id: 'mask-after', from: max, to: dataMax, color: this.maskFill });
507
578
  }
579
+ /** Pan and zoom work on the log scale when the x-axis is logarithmic. */
580
+ get _isLogX() {
581
+ const xs = this._allXs();
582
+ return this.xAxisType === 'logarithmic' && xs.length > 0 && xs[0] > 0;
583
+ }
584
+ _toScale(v) {
585
+ return this._isLogX ? Math.log10(v) : v;
586
+ }
587
+ _fromScale(v) {
588
+ return this._isLogX ? Math.pow(10, v) : v;
589
+ }
590
+ /** Index of the data x nearest to `v` on the axis scale; `xs` is sorted. */
591
+ _nearestIndex(xs, v) {
592
+ let lo = 0;
593
+ let hi = xs.length - 1;
594
+ while (lo < hi) {
595
+ const mid = (lo + hi) >> 1;
596
+ if (xs[mid] < v)
597
+ lo = mid + 1;
598
+ else
599
+ hi = mid;
600
+ }
601
+ const sv = this._toScale(v);
602
+ if (lo > 0 && Math.abs(this._toScale(xs[lo - 1]) - sv) <= Math.abs(this._toScale(xs[lo]) - sv))
603
+ return lo - 1;
604
+ return lo;
605
+ }
606
+ /** Clamps `[min, max]` into the data range keeping its width, then snaps both edges to data points. */
607
+ _snapWindow(min, max) {
608
+ const xs = this._allXs();
609
+ if (xs.length < 2)
610
+ return null;
611
+ const sMin = this._toScale(xs[0]);
612
+ const sMax = this._toScale(xs[xs.length - 1]);
613
+ let a = this._toScale(min);
614
+ const width = Math.min(Math.max(this._toScale(max) - a, 0), sMax - sMin);
615
+ if (a < sMin)
616
+ a = sMin;
617
+ if (a + width > sMax)
618
+ a = sMax - width;
619
+ let lo = this._nearestIndex(xs, this._fromScale(a));
620
+ let hi = this._nearestIndex(xs, this._fromScale(a + width));
621
+ if (hi <= lo) {
622
+ if (lo < xs.length - 1)
623
+ hi = lo + 1;
624
+ else
625
+ lo = hi - 1;
626
+ }
627
+ return { lo, hi };
628
+ }
629
+ _windowIndices() {
630
+ const xs = this._allXs();
631
+ if (!this._window || xs.length < 2)
632
+ return null;
633
+ return { lo: this._nearestIndex(xs, this._window.min), hi: this._nearestIndex(xs, this._window.max) };
634
+ }
635
+ _applyWindow(lo, hi) {
636
+ const xs = this._allXs();
637
+ const min = xs[lo];
638
+ const max = xs[hi];
639
+ if (this.masterOnly) {
640
+ this._trackWindow(min, max);
641
+ this.masterChart?.xAxis[0].setExtremes(min, max);
642
+ }
643
+ else {
644
+ this.applySelection(min, max);
645
+ }
646
+ this.setZoomed(lo > 0 || hi < xs.length - 1);
647
+ this.emit('nile-chart-selection', { min, max });
648
+ }
649
+ _setWindow(min, max) {
650
+ const w = this._snapWindow(min, max);
651
+ if (w)
652
+ this._applyWindow(w.lo, w.hi);
653
+ }
654
+ /** Move the window by 25% of its width toward the start (`-1`) or end (`1`), at least one data point. */
655
+ panBy(direction) {
656
+ const cur = this._windowIndices();
657
+ if (!cur)
658
+ return;
659
+ const xs = this._allXs();
660
+ const a = this._toScale(xs[cur.lo]);
661
+ const b = this._toScale(xs[cur.hi]);
662
+ const d = (b - a) * 0.25 * direction;
663
+ let w = this._snapWindow(this._fromScale(a + d), this._fromScale(b + d));
664
+ if (w.lo === cur.lo && w.hi === cur.hi && cur.lo + direction >= 0 && cur.hi + direction <= xs.length - 1) {
665
+ w = { lo: cur.lo + direction, hi: cur.hi + direction };
666
+ }
667
+ this._applyWindow(w.lo, w.hi);
668
+ }
669
+ /** Scale the window around its centre: `0.5` zooms in, `2` zooms out; at least one data point per step. */
670
+ zoomBy(factor) {
671
+ const cur = this._windowIndices();
672
+ if (!cur)
673
+ return;
674
+ const xs = this._allXs();
675
+ const a = this._toScale(xs[cur.lo]);
676
+ const b = this._toScale(xs[cur.hi]);
677
+ const c = (a + b) / 2;
678
+ const half = ((b - a) * factor) / 2;
679
+ let w = this._snapWindow(this._fromScale(c - half), this._fromScale(c + half));
680
+ if (w.lo === cur.lo && w.hi === cur.hi) {
681
+ if (factor < 1 && cur.hi - cur.lo > 1)
682
+ w = { lo: cur.hi - cur.lo > 2 ? cur.lo + 1 : cur.lo, hi: cur.hi - 1 };
683
+ else if (factor > 1)
684
+ w = { lo: Math.max(0, cur.lo - 1), hi: Math.min(xs.length - 1, cur.hi + 1) };
685
+ }
686
+ this._applyWindow(w.lo, w.hi);
687
+ }
688
+ get _navState() {
689
+ const xs = this._allXs();
690
+ const last = xs.length - 1;
691
+ const cur = this._windowIndices() ?? { lo: 0, hi: last };
692
+ const sMin = this._toScale(xs[0]);
693
+ const room = this._toScale(xs[last]) - sMin - (this._toScale(xs[cur.hi]) - this._toScale(xs[cur.lo]));
694
+ const atStart = cur.lo <= 0;
695
+ const atEnd = cur.hi >= last;
696
+ return {
697
+ full: atStart && atEnd,
698
+ atStart,
699
+ atEnd,
700
+ atMinWidth: cur.hi - cur.lo <= 1,
701
+ sliderValue: room > 0 ? Math.round(((this._toScale(xs[cur.lo]) - sMin) / room) * 1000) : 0,
702
+ };
703
+ }
704
+ _onSliderChange(event) {
705
+ const cur = this._windowIndices();
706
+ if (!cur)
707
+ return;
708
+ const xs = this._allXs();
709
+ const sMin = this._toScale(xs[0]);
710
+ const width = this._toScale(xs[cur.hi]) - this._toScale(xs[cur.lo]);
711
+ const room = this._toScale(xs[xs.length - 1]) - sMin - width;
712
+ if (room <= 0)
713
+ return;
714
+ const value = Number(event.detail.value) || 0;
715
+ const a = sMin + room * (value / 1000);
716
+ this._setWindow(this._fromScale(a), this._fromScale(a + width));
717
+ }
718
+ _formatX(value) {
719
+ if (this.xAxisType === 'datetime' && this._hc) {
720
+ return this._hc.dateFormat('%Y-%m-%d %H:%M:%S', value);
721
+ }
722
+ if (this.xAxisType === 'category') {
723
+ const axis = (this.detailChart ?? this.masterChart)?.xAxis[0];
724
+ const name = axis?.categories?.[value] ?? axis?.names?.[value];
725
+ if (name != null && name !== '')
726
+ return String(name);
727
+ }
728
+ return String(value);
729
+ }
730
+ /** `title` names the inner button for assistive tech and shows the hover tooltip. */
731
+ _navButton(icon, label, disabled, onClick) {
732
+ return html `<nile-button
733
+ class="navigator-button"
734
+ variant="secondary"
735
+ size="sm"
736
+ aria-label=${label}
737
+ title=${label}
738
+ ?disabled=${disabled}
739
+ @click=${onClick}
740
+ ><nile-glyph name=${icon} method="stroke" size="16"></nile-glyph></nile-button>`;
741
+ }
742
+ _renderNavigator() {
743
+ const nav = this._navState;
744
+ const { dataMin, dataMax } = this.dataExtremes();
745
+ const w = this._window ?? { min: dataMin, max: dataMax };
746
+ const caption = `${this._formatX(w.min)} → ${this._formatX(w.max)}`;
747
+ return html `<div class="navigator" part="navigator" role="toolbar" aria-label="Chart navigation">
748
+ <div class="navigator-controls">
749
+ ${this._navButton('ng-chevron-left', 'Pan back', nav.atStart, () => this.panBy(-1))}
750
+ ${keyed(`${nav.sliderValue}:${nav.full}`, html `<nile-slider
751
+ class="navigator-slider"
752
+ aria-label="Visible range position"
753
+ .minValue=${0}
754
+ .maxValue=${1000}
755
+ .value=${nav.sliderValue}
756
+ ?disabled=${nav.full}
757
+ @nile-change-end=${this._onSliderChange}
758
+ ></nile-slider>`)}
759
+ ${this._navButton('ng-chevron-right', 'Pan forward', nav.atEnd, () => this.panBy(1))}
760
+ <div class="navigator-zoom">
761
+ ${this._navButton('ng-minus', 'Zoom out', nav.full, () => this.zoomBy(2))}
762
+ ${this._navButton('ng-plus', 'Zoom in', nav.atMinWidth, () => this.zoomBy(0.5))}
763
+ </div>
764
+ </div>
765
+ <div class="navigator-caption" part="navigator-caption" aria-live="polite">
766
+ ${caption}${this.navigatorHint
767
+ ? html ` · <span class="navigator-hint" part="navigator-hint">${this.navigatorHint}</span>`
768
+ : nothing}
769
+ </div>
770
+ </div>`;
771
+ }
508
772
  async initCharts() {
509
773
  if (this.loading)
510
774
  return;
@@ -569,6 +833,7 @@ let NileMasterDetailChart = class NileMasterDetailChart extends NileElement {
569
833
  </nile-lite-tooltip>`
570
834
  : null}`}
571
835
  <div class="master-container ${masterHidden ? 'master-container--collapsed' : ''}" part="master-container"></div>
836
+ ${this.navigatorControls && this._allXs().length >= 2 ? this._renderNavigator() : nothing}
572
837
  </div>`;
573
838
  }
574
839
  };
@@ -618,6 +883,15 @@ __decorate([
618
883
  __decorate([
619
884
  property({ type: Boolean, attribute: 'master-collapsible' })
620
885
  ], NileMasterDetailChart.prototype, "masterCollapsible", void 0);
886
+ __decorate([
887
+ property({ type: Boolean, reflect: true, attribute: 'navigator-controls' })
888
+ ], NileMasterDetailChart.prototype, "navigatorControls", void 0);
889
+ __decorate([
890
+ property({ type: String, attribute: 'navigator-hint' })
891
+ ], NileMasterDetailChart.prototype, "navigatorHint", void 0);
892
+ __decorate([
893
+ property({ type: String, attribute: 'navigator-default-window' })
894
+ ], NileMasterDetailChart.prototype, "navigatorDefaultWindow", void 0);
621
895
  __decorate([
622
896
  property({ type: String })
623
897
  ], NileMasterDetailChart.prototype, "height", void 0);
@@ -89,7 +89,24 @@ function makeChart(options) {
89
89
  };
90
90
  return chart;
91
91
  }
92
- const makeFakeHC = () => ({ chart: (_c, options) => makeChart(options), setOptions() { } });
92
+ // Minimal Highcharts.dateFormat stand-in (UTC) so the navigator caption, which
93
+ // formats datetime ranges through `this._hc.dateFormat(...)`, has something to call.
94
+ function fakeDateFormat(format, timestamp) {
95
+ const d = new Date(timestamp);
96
+ const pad = (n) => String(n).padStart(2, '0');
97
+ return format
98
+ .replace(/%Y/g, String(d.getUTCFullYear()))
99
+ .replace(/%m/g, pad(d.getUTCMonth() + 1))
100
+ .replace(/%d/g, pad(d.getUTCDate()))
101
+ .replace(/%H/g, pad(d.getUTCHours()))
102
+ .replace(/%M/g, pad(d.getUTCMinutes()))
103
+ .replace(/%S/g, pad(d.getUTCSeconds()));
104
+ }
105
+ const makeFakeHC = () => ({
106
+ chart: (_c, options) => makeChart(options),
107
+ setOptions() { },
108
+ dateFormat: fakeDateFormat,
109
+ });
93
110
  // --- mount helper (injects the fake before first render) ---------------------
94
111
  const mounted = [];
95
112
  async function mount(props) {
@@ -258,5 +275,335 @@ describe('NileChart → master-detail passthrough', () => {
258
275
  expect(inner.series).to.deep.equal(SERIES);
259
276
  expect(inner.stacking).to.equal('normal');
260
277
  });
278
+ it('27. passes navigatorControls, navigatorHint and navigatorDefaultWindow down to the inner chart', async () => {
279
+ const el = await fixture(html `<nile-chart style="display:block;width:600px;height:400px"></nile-chart>`);
280
+ el.config = {
281
+ chart: { type: 'master-detail', series: SERIES, navigatorControls: true, navigatorHint: 'drag to zoom', navigatorDefaultWindow: '7d' },
282
+ };
283
+ await el.updateComplete;
284
+ await el.updateComplete;
285
+ const inner = el.shadowRoot.querySelector('nile-master-detail-chart');
286
+ expect(inner, 'inner master-detail chart should render').to.exist;
287
+ expect(inner.navigatorControls).to.be.true;
288
+ expect(inner.navigatorHint).to.equal('drag to zoom');
289
+ expect(inner.navigatorDefaultWindow).to.equal('7d');
290
+ });
291
+ });
292
+ // --- navigator controls (spec: nile-master-detail-chart-navigator.md) --------
293
+ //
294
+ // Evenly spaced datetime data: 9 points one day apart, so every window edge the
295
+ // controls produce lands on an exact, predictable timestamp.
296
+ const DAY = 86400000;
297
+ const T0 = Date.UTC(2026, 8, 25, 3, 11, 21); // 2026-09-25 03:11:21 UTC
298
+ const DT_DATA = Array.from({ length: 9 }, (_, i) => ({ x: T0 + i * DAY, y: i }));
299
+ const DT_MIN = T0;
300
+ const DT_MAX = T0 + 8 * DAY; // full span = 8 days = 8 * pointStep
301
+ const DT_SERIES = [
302
+ { name: 'Clean', data: DT_DATA, color: '#0000ff' },
303
+ { name: 'Needs attention', data: DT_DATA.map((p) => ({ x: p.x, y: p.y * 2 })), color: '#ff0000' },
304
+ ];
305
+ const nav = (el) => el;
306
+ const navigatorPart = (el) => el.shadowRoot.querySelector('[part~="navigator"]');
307
+ const captionPart = (el) => el.shadowRoot.querySelector('[part~="navigator-caption"]');
308
+ const btn = (el, label) => el.shadowRoot.querySelector(`[part~="navigator"] [aria-label="${label}"]`);
309
+ const slider = (el) => el.shadowRoot.querySelector('[part~="navigator"] nile-slider');
310
+ // Every control step goes through applySelection / setExtremes and re-emits
311
+ // `nile-chart-selection { min, max }`. Collect them after mount (the init-time
312
+ // emission has already fired by then).
313
+ function selectionSpy(el) {
314
+ const seen = [];
315
+ el.addEventListener('nile-chart-selection', (e) => seen.push(e.detail));
316
+ return seen;
317
+ }
318
+ const fmt = (ts) => fakeDateFormat('%Y-%m-%d %H:%M:%S', ts);
319
+ const isDisabled = (node) => !!node && (node.hasAttribute('disabled') || node.disabled === true);
320
+ describe('NileMasterDetailChart — navigator controls', () => {
321
+ it('28. renders no control bar without navigator-controls', async () => {
322
+ const el = await mount({ series: DT_SERIES });
323
+ expect(navigatorPart(el)).to.be.null;
324
+ });
325
+ it('29. renders the control bar with navigator-controls (master+detail)', async () => {
326
+ const el = await mount({ series: DT_SERIES, navigatorControls: true });
327
+ expect(navigatorPart(el)).to.not.be.null;
328
+ expect(btn(el, 'Pan back')).to.not.be.null;
329
+ expect(btn(el, 'Pan forward')).to.not.be.null;
330
+ expect(btn(el, 'Zoom in')).to.not.be.null;
331
+ expect(btn(el, 'Zoom out')).to.not.be.null;
332
+ expect(slider(el)).to.not.be.null;
333
+ });
334
+ it('30. renders the control bar in master-only mode', async () => {
335
+ const el = await mount({ series: DT_SERIES, navigatorControls: true, masterOnly: true });
336
+ expect(navigatorPart(el)).to.not.be.null;
337
+ });
338
+ it('31. exposes navigator, navigator-caption and navigator-hint parts', async () => {
339
+ const el = await mount({ series: DT_SERIES, navigatorControls: true, navigatorHint: 'blue = clean' });
340
+ expect(navigatorPart(el)).to.not.be.null;
341
+ expect(captionPart(el)).to.not.be.null;
342
+ expect(el.shadowRoot.querySelector('[part~="navigator-hint"]')).to.not.be.null;
343
+ });
344
+ it('32. navigator-controls reflects to the attribute', async () => {
345
+ const el = await mount({ series: DT_SERIES, navigatorControls: true });
346
+ expect(el.hasAttribute('navigator-controls')).to.be.true;
347
+ });
348
+ it('33. at full range pan/zoom-out/slider are disabled, zoom in enabled', async () => {
349
+ const el = await mount({ series: DT_SERIES, navigatorControls: true });
350
+ expect(isDisabled(btn(el, 'Pan back')), 'pan back').to.be.true;
351
+ expect(isDisabled(btn(el, 'Pan forward')), 'pan forward').to.be.true;
352
+ expect(isDisabled(btn(el, 'Zoom out')), 'zoom out').to.be.true;
353
+ expect(isDisabled(slider(el)), 'slider').to.be.true;
354
+ expect(isDisabled(btn(el, 'Zoom in')), 'zoom in').to.be.false;
355
+ });
356
+ it('34. zoom in halves the window around its centre and fires nile-chart-selection', async () => {
357
+ const el = await mount({ series: DT_SERIES, navigatorControls: true });
358
+ const seen = selectionSpy(el);
359
+ nav(el).zoomBy(0.5);
360
+ await el.updateComplete;
361
+ // centre = T0 + 4d, new width = 4d → [T0+2d, T0+6d]
362
+ expect(seen[seen.length - 1]).to.deep.equal({ min: T0 + 2 * DAY, max: T0 + 6 * DAY });
363
+ });
364
+ it('35. the zoom-in button halves the window', async () => {
365
+ const el = await mount({ series: DT_SERIES, navigatorControls: true });
366
+ const seen = selectionSpy(el);
367
+ btn(el, 'Zoom in').click();
368
+ await el.updateComplete;
369
+ expect(seen[seen.length - 1]).to.deep.equal({ min: T0 + 2 * DAY, max: T0 + 6 * DAY });
370
+ });
371
+ it('36. zoom out doubles the window toward the data range', async () => {
372
+ const el = await mount({ series: DT_SERIES, navigatorControls: true });
373
+ nav(el).zoomBy(0.5); // → width 4d [T0+2d, T0+6d]
374
+ await el.updateComplete;
375
+ const seen = selectionSpy(el);
376
+ nav(el).zoomBy(2); // double → width 8d, clamped to full range
377
+ await el.updateComplete;
378
+ expect(seen[seen.length - 1]).to.deep.equal({ min: DT_MIN, max: DT_MAX });
379
+ });
380
+ it('37. zoom out is disabled at full range', async () => {
381
+ const el = await mount({ series: DT_SERIES, navigatorControls: true });
382
+ expect(isDisabled(btn(el, 'Zoom out'))).to.be.true;
383
+ });
384
+ it('38. pan forward moves by 25% of the width and preserves the width', async () => {
385
+ const el = await mount({ series: DT_SERIES, navigatorControls: true });
386
+ nav(el).zoomBy(0.5); // width 4d → [T0+2d, T0+6d]
387
+ await el.updateComplete;
388
+ const seen = selectionSpy(el);
389
+ nav(el).panBy(1); // +25% of 4d = +1d → [T0+3d, T0+7d]
390
+ await el.updateComplete;
391
+ const w = seen[seen.length - 1];
392
+ expect(w).to.deep.equal({ min: T0 + 3 * DAY, max: T0 + 7 * DAY });
393
+ expect(w.max - w.min).to.equal(4 * DAY);
394
+ });
395
+ it('39. pan back moves the window toward the start, same width', async () => {
396
+ const el = await mount({ series: DT_SERIES, navigatorControls: true });
397
+ nav(el).zoomBy(0.5); // [T0+2d, T0+6d]
398
+ await el.updateComplete;
399
+ const seen = selectionSpy(el);
400
+ nav(el).panBy(-1); // -1d → [T0+1d, T0+5d]
401
+ await el.updateComplete;
402
+ expect(seen[seen.length - 1]).to.deep.equal({ min: T0 + 1 * DAY, max: T0 + 5 * DAY });
403
+ });
404
+ it('40. pan forward clamps at the data end, preserving the width', async () => {
405
+ const el = await mount({ series: DT_SERIES, navigatorControls: true });
406
+ nav(el).zoomBy(0.5); // width 4d → [T0+2d, T0+6d]
407
+ await el.updateComplete;
408
+ const seen = selectionSpy(el);
409
+ nav(el).panBy(1); // [T0+3d, T0+7d]
410
+ nav(el).panBy(1); // [T0+4d, T0+8d] (hits end)
411
+ nav(el).panBy(1); // clamped, stays [T0+4d, T0+8d]
412
+ await el.updateComplete;
413
+ const w = seen[seen.length - 1];
414
+ expect(w).to.deep.equal({ min: T0 + 4 * DAY, max: DT_MAX });
415
+ expect(w.max - w.min).to.equal(4 * DAY);
416
+ });
417
+ it('41. pan forward is disabled once the window is at the data end', async () => {
418
+ const el = await mount({ series: DT_SERIES, navigatorControls: true });
419
+ nav(el).zoomBy(0.5);
420
+ nav(el).panBy(1);
421
+ nav(el).panBy(1); // [T0+4d, T0+8d] at end
422
+ await el.updateComplete;
423
+ expect(isDisabled(btn(el, 'Pan forward'))).to.be.true;
424
+ expect(isDisabled(btn(el, 'Pan back'))).to.be.false;
425
+ });
426
+ it('42. zoom in stops at one point step and disables the zoom-in button', async () => {
427
+ const el = await mount({ series: DT_SERIES, navigatorControls: true });
428
+ // 8d → 4d → 2d → 1d (= pointStep)
429
+ nav(el).zoomBy(0.5);
430
+ nav(el).zoomBy(0.5);
431
+ nav(el).zoomBy(0.5);
432
+ await el.updateComplete;
433
+ const atStep = nav(el)._window;
434
+ expect(atStep.max - atStep.min).to.equal(DAY);
435
+ expect(isDisabled(btn(el, 'Zoom in'))).to.be.true;
436
+ // A further zoom-in must not shrink below the point step.
437
+ const seen = selectionSpy(el);
438
+ nav(el).zoomBy(0.5);
439
+ await el.updateComplete;
440
+ const after = nav(el)._window;
441
+ expect(after.max - after.min).to.equal(DAY);
442
+ if (seen.length)
443
+ expect(seen[seen.length - 1].max - seen[seen.length - 1].min).to.equal(DAY);
444
+ });
445
+ it('43. slider change moves the window start while keeping its width', async () => {
446
+ const el = await mount({ series: DT_SERIES, navigatorControls: true });
447
+ nav(el).zoomBy(0.5); // width 4d, slider now enabled
448
+ await el.updateComplete;
449
+ const seen = selectionSpy(el);
450
+ const s = slider(el);
451
+ // 0–1000 positions: 500 → start = dataMin + 0.5 * (span − width) = T0 + 2d
452
+ s.value = 500;
453
+ s.dispatchEvent(new CustomEvent('nile-change-end', { detail: { value: 500 }, bubbles: true, composed: true }));
454
+ await el.updateComplete;
455
+ const w = seen[seen.length - 1];
456
+ expect(w.max - w.min).to.equal(4 * DAY);
457
+ expect(w).to.deep.equal({ min: T0 + 2 * DAY, max: T0 + 6 * DAY });
458
+ });
459
+ it('44. resetZoom restores the full window, caption and controls', async () => {
460
+ const el = await mount({ series: DT_SERIES, navigatorControls: true });
461
+ nav(el).zoomBy(0.5);
462
+ await el.updateComplete;
463
+ const seen = selectionSpy(el);
464
+ el.resetZoom();
465
+ await el.updateComplete;
466
+ expect(seen[seen.length - 1]).to.deep.equal({ min: DT_MIN, max: DT_MAX });
467
+ expect(nav(el)._window).to.deep.equal({ min: DT_MIN, max: DT_MAX });
468
+ // back at full range → zoom out / pan disabled again
469
+ expect(isDisabled(btn(el, 'Zoom out'))).to.be.true;
470
+ expect(captionPart(el).textContent).to.contain(`${fmt(DT_MIN)} → ${fmt(DT_MAX)}`);
471
+ });
472
+ it('45. a master drag selection updates the window and caption', async () => {
473
+ const el = await mount({ series: DT_SERIES, navigatorControls: true });
474
+ host(el).applySelection(T0 + 1 * DAY, T0 + 5 * DAY);
475
+ el._window = { min: T0 + 1 * DAY, max: T0 + 5 * DAY };
476
+ await el.updateComplete;
477
+ expect(captionPart(el).textContent).to.contain(`${fmt(T0 + 1 * DAY)} → ${fmt(T0 + 5 * DAY)}`);
478
+ });
479
+ it('46. caption shows the datetime range on a datetime axis', async () => {
480
+ const el = await mount({ series: DT_SERIES, navigatorControls: true });
481
+ expect(captionPart(el).textContent).to.contain(`${fmt(DT_MIN)} → ${fmt(DT_MAX)}`);
482
+ });
483
+ it('47. caption appends " · hint" when navigator-hint is set', async () => {
484
+ const el = await mount({ series: DT_SERIES, navigatorControls: true, navigatorHint: 'blue = clean' });
485
+ const text = captionPart(el).textContent;
486
+ expect(text).to.contain('·');
487
+ expect(text).to.contain('blue = clean');
488
+ });
489
+ it('48. a control step refilters every detail series in master+detail mode', async () => {
490
+ const el = await mount({ series: DT_SERIES, navigatorControls: true });
491
+ nav(el).zoomBy(0.5); // [T0+2d, T0+6d] → points at 2,3,4,5,6 days = 5 per series
492
+ await el.updateComplete;
493
+ expect(detailSeries(el).map(pointCount)).to.deep.equal([5, 5]);
494
+ });
495
+ });
496
+ describe('NileMasterDetailChart — navigator icon buttons', () => {
497
+ it('56. each button shows only an icon and is named by title and aria-label', async () => {
498
+ const el = await mount({ series: DT_SERIES, navigatorControls: true });
499
+ for (const label of ['Pan back', 'Pan forward', 'Zoom out', 'Zoom in']) {
500
+ const b = btn(el, label);
501
+ expect(b, label).to.not.be.null;
502
+ expect(b.getAttribute('title'), label).to.equal(label);
503
+ expect(b.textContent.trim(), label).to.equal('');
504
+ expect(b.querySelector('nile-glyph'), label).to.not.be.null;
505
+ }
506
+ });
507
+ });
508
+ describe('NileMasterDetailChart — navigator default window', () => {
509
+ it('49. a fraction opens on that share of the range, ending at the latest data', async () => {
510
+ const el = await mount({ series: DT_SERIES, navigatorControls: true, navigatorDefaultWindow: '0.25' });
511
+ expect(nav(el)._window).to.deep.equal({ min: DT_MAX - 2 * DAY, max: DT_MAX });
512
+ });
513
+ it('50. a duration opens on that span on a datetime axis', async () => {
514
+ const el = await mount({ series: DT_SERIES, navigatorControls: true, navigatorDefaultWindow: '3d' });
515
+ expect(nav(el)._window).to.deep.equal({ min: DT_MAX - 3 * DAY, max: DT_MAX });
516
+ });
517
+ it('51. the slider, pan back and zoom out are enabled on load', async () => {
518
+ const el = await mount({ series: DT_SERIES, navigatorControls: true, navigatorDefaultWindow: '0.5' });
519
+ expect(isDisabled(slider(el)), 'slider').to.be.false;
520
+ expect(isDisabled(btn(el, 'Pan back')), 'pan back').to.be.false;
521
+ expect(isDisabled(btn(el, 'Zoom out')), 'zoom out').to.be.false;
522
+ expect(slider(el).value, 'thumb at the end').to.equal(1000);
523
+ });
524
+ it('52. selection-min / selection-max win over the default window', async () => {
525
+ const el = await mount({
526
+ series: DT_SERIES, navigatorControls: true, navigatorDefaultWindow: '0.25',
527
+ selectionMin: T0 + DAY, selectionMax: T0 + 3 * DAY,
528
+ });
529
+ expect(nav(el)._window).to.deep.equal({ min: T0 + DAY, max: T0 + 3 * DAY });
530
+ });
531
+ it('53. is ignored without navigator-controls, and when empty or invalid', async () => {
532
+ for (const props of [
533
+ { navigatorDefaultWindow: '0.25' },
534
+ { navigatorControls: true, navigatorDefaultWindow: '' },
535
+ { navigatorControls: true, navigatorDefaultWindow: 'soon' },
536
+ { navigatorControls: true, navigatorDefaultWindow: '2' },
537
+ { navigatorControls: true, navigatorDefaultWindow: '30d' },
538
+ ]) {
539
+ const el = await mount({ series: DT_SERIES, ...props });
540
+ expect(nav(el)._window, JSON.stringify(props)).to.deep.equal({ min: DT_MIN, max: DT_MAX });
541
+ }
542
+ });
543
+ it('54. a duration is ignored on a non-datetime axis', async () => {
544
+ const el = await mount({ series: DT_SERIES, navigatorControls: true, navigatorDefaultWindow: '3d', xAxisType: 'linear' });
545
+ expect(nav(el)._window).to.deep.equal({ min: DT_MIN, max: DT_MAX });
546
+ });
547
+ it('55. resetZoom returns to the full range', async () => {
548
+ const el = await mount({ series: DT_SERIES, navigatorControls: true, navigatorDefaultWindow: '0.25' });
549
+ el.resetZoom();
550
+ await el.updateComplete;
551
+ expect(nav(el)._window).to.deep.equal({ min: DT_MIN, max: DT_MAX });
552
+ });
553
+ });
554
+ describe('NileMasterDetailChart — navigator snapping, log scale, categories, small data', () => {
555
+ const xsOf = (series) => new Set(series.flatMap((s) => s.data.map((p) => p.x)));
556
+ const EIGHT = [{ name: 'A', data: Array.from({ length: 8 }, (_, i) => ({ x: T0 + i * DAY, y: i })) }];
557
+ it('57. a zoom that lands between points snaps both edges to data points', async () => {
558
+ const el = await mount({ series: EIGHT, navigatorControls: true });
559
+ nav(el).zoomBy(0.5); // centre 3.5d, width 3.5d → 1.75d..5.25d → snaps to 2d..5d
560
+ await el.updateComplete;
561
+ const w = nav(el)._window;
562
+ expect(xsOf(EIGHT).has(w.min) && xsOf(EIGHT).has(w.max), JSON.stringify(w)).to.be.true;
563
+ expect(w).to.deep.equal({ min: T0 + 2 * DAY, max: T0 + 5 * DAY });
564
+ });
565
+ it('58. pan always moves at least one data point', async () => {
566
+ const el = await mount({ series: EIGHT, navigatorControls: true, selectionMin: T0, selectionMax: T0 + DAY });
567
+ nav(el).panBy(1); // 25% of one step would snap back; it moves one point instead
568
+ await el.updateComplete;
569
+ expect(nav(el)._window).to.deep.equal({ min: T0 + DAY, max: T0 + 2 * DAY });
570
+ });
571
+ it('59. a slider position between points snaps to data points', async () => {
572
+ const el = await mount({ series: EIGHT, navigatorControls: true, selectionMin: T0, selectionMax: T0 + 2 * DAY });
573
+ const s = slider(el);
574
+ s.dispatchEvent(new CustomEvent('nile-change-end', { detail: { value: 333 } })); // start ≈ 1.67d → 2d
575
+ await el.updateComplete;
576
+ expect(nav(el)._window).to.deep.equal({ min: T0 + 2 * DAY, max: T0 + 4 * DAY });
577
+ });
578
+ it('60. the default window snaps to data points', async () => {
579
+ const el = await mount({ series: DT_SERIES, navigatorControls: true, navigatorDefaultWindow: '0.3' });
580
+ expect(nav(el)._window).to.deep.equal({ min: DT_MAX - 2 * DAY, max: DT_MAX }); // 2.4d → 2d
581
+ });
582
+ it('61. on a logarithmic axis pan and zoom work on the log scale', async () => {
583
+ const LOG = [{ name: 'A', data: Array.from({ length: 9 }, (_, i) => ({ x: 10 ** i, y: i })) }];
584
+ const el = await mount({ series: LOG, navigatorControls: true, xAxisType: 'logarithmic' });
585
+ nav(el).zoomBy(0.5); // decades 0..8 → 2..6
586
+ await el.updateComplete;
587
+ expect(nav(el)._window).to.deep.equal({ min: 1e2, max: 1e6 });
588
+ nav(el).panBy(1); // 25% of 4 decades = 1 decade
589
+ await el.updateComplete;
590
+ expect(nav(el)._window).to.deep.equal({ min: 1e3, max: 1e7 });
591
+ });
592
+ it('62. on a category axis the caption shows category names', async () => {
593
+ const CAT = [{ name: 'A', data: [0, 1, 2, 3].map((x) => ({ x, y: x })) }];
594
+ const el = await mount({ series: CAT, navigatorControls: true, xAxisType: 'category' });
595
+ host(el).detailChart.xAxis[0].categories = ['Mon', 'Tue', 'Wed', 'Thu'];
596
+ el.requestUpdate();
597
+ await el.updateComplete;
598
+ expect(captionPart(el).textContent).to.contain('Mon → Thu');
599
+ });
600
+ it('63. no control bar with fewer than two distinct x values', async () => {
601
+ for (const data of [[], [{ x: T0, y: 1 }], [{ x: T0, y: 1 }, { x: T0, y: 2 }]]) {
602
+ const el = await mount({ data, navigatorControls: true });
603
+ expect(navigatorPart(el), JSON.stringify(data)).to.be.null;
604
+ }
605
+ const two = await mount({ data: [{ x: T0, y: 1 }, { x: T0 + DAY, y: 2 }], navigatorControls: true });
606
+ expect(navigatorPart(two)).to.not.be.null;
607
+ });
261
608
  });
262
609
  //# sourceMappingURL=nile-master-detail-chart.test.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aquera/nile-visualization",
3
- "version": "2.9.47",
3
+ "version": "2.9.48",
4
4
  "description": "A visualization Library for the Nile Design System",
5
5
  "license": "MIT",
6
6
  "author": "Aquera Inc",