@aquera/nile-visualization 2.9.42 → 2.9.44
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 +7 -0
- package/dist/src/index.d.ts +1 -1
- package/dist/src/internal/echarts/translate-config.js +42 -2
- package/dist/src/internal/types/chart-master-detail-config.type.d.ts +7 -2
- package/dist/src/internal/utils/lite-tooltip.d.ts +5 -0
- package/dist/src/internal/utils/lite-tooltip.js +18 -0
- package/dist/src/nile-chart/nile-chart-config.d.ts +7 -2
- package/dist/src/nile-chart/nile-chart-empty.js +13 -3
- package/dist/src/nile-chart/nile-chart.css.js +12 -0
- package/dist/src/nile-chart/nile-chart.d.ts +29 -5
- package/dist/src/nile-chart/nile-chart.js +193 -69
- package/dist/src/nile-kpi-chart/nile-kpi-chart.js +10 -6
- package/dist/src/nile-master-detail-chart/index.d.ts +1 -1
- package/dist/src/nile-master-detail-chart/nile-master-detail-chart.d.ts +24 -1
- package/dist/src/nile-master-detail-chart/nile-master-detail-chart.js +92 -38
- package/dist/src/nile-master-detail-chart/nile-master-detail-chart.test.d.ts +2 -0
- package/dist/src/nile-master-detail-chart/nile-master-detail-chart.test.js +262 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,6 +36,13 @@ 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.44 (November 18, 2026)
|
|
40
|
+
- Nile Charts: Long x-axis labels no longer rotate and shrink the plot. `xAxisLabelMode` (`truncate` by default, or `wrap`), `xAxisLabelMaxWidth` (default 80) and `xAxisLabelRotation` control how they fit, and a clipped label shows its full name in a tooltip (UIF-1426)
|
|
41
|
+
- Nile Charts: Lite tooltips in the charts are capped at `--ng-width-64` (256px) wide and 250px tall and scroll beyond that; the chart header title and subtitle tooltips now use `nile-lite-tooltip`, so they need `@aquera/nile-elements` loaded on the page (UIF-1426)
|
|
42
|
+
|
|
43
|
+
#### Version 2.9.43 (November 18, 2026)
|
|
44
|
+
- Nile Chart: The master-detail chart now takes several series and can stack them. Set `series` (`{ name, data, color? }[]`, replaces `data` when non-empty) and `stacking` (`normal` or `percent`) on `type: 'master-detail'` or `<nile-master-detail-chart>`; both panes stack, the detail pane shows a legend and a shared tooltip for 2+ series, and dragging the master selection now zooms every series instead of only the first. Single-series charts are unchanged (UIF-1425)
|
|
45
|
+
|
|
39
46
|
#### Version 2.9.42 (November 18, 2026)
|
|
40
47
|
- Nile KPI Chart: Compact titles now wrap onto up to 3 lines with or without header controls, and the new `title-overflow` property (`ellipsis` default, or `break`) controls how an oversized word is handled; a tooltip with the full title shows only when it is truncated. Other variants are unchanged. Also fixes the white strip beside the compact sparkline in a scaled wrapper and the sparkline tooltip width and edge clamping (UIF-1424)
|
|
41
48
|
- Nile Charts: Fixed the clipped bottom border of the "No data" empty-state badge (UIF-1424)
|
package/dist/src/index.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export type { BoxplotBox, BoxplotSeriesData } from './nile-boxplot-chart/index.j
|
|
|
40
40
|
export { NileTimelineChart } from './nile-timeline-chart/index.js';
|
|
41
41
|
export type { TimelineEvent } from './nile-timeline-chart/index.js';
|
|
42
42
|
export { NileMasterDetailChart } from './nile-master-detail-chart/index.js';
|
|
43
|
-
export type { MasterDetailPoint, MasterDetailSeriesType } from './nile-master-detail-chart/index.js';
|
|
43
|
+
export type { MasterDetailPoint, MasterDetailSeries, MasterDetailSeriesType, MasterDetailStacking } from './nile-master-detail-chart/index.js';
|
|
44
44
|
export { NileDumbbellChart } from './nile-dumbbell-chart/index.js';
|
|
45
45
|
export type { DumbbellPoint } from './nile-dumbbell-chart/index.js';
|
|
46
46
|
export { NileDumbbellLowerChart } from './nile-dumbbell-lower-chart/index.js';
|
|
@@ -325,8 +325,48 @@ const WAVE2_TRANSLATORS = {
|
|
|
325
325
|
return o;
|
|
326
326
|
},
|
|
327
327
|
'master-detail': (c) => {
|
|
328
|
-
const
|
|
329
|
-
|
|
328
|
+
const zoom = { dataZoom: [{ type: 'slider', height: 22, bottom: 4 }, { type: 'inside' }] };
|
|
329
|
+
if (!(Array.isArray(c.series) && c.series.length)) {
|
|
330
|
+
const o = cartesian(c, 'line');
|
|
331
|
+
return { ...o, ...zoom, grid: { ...o.grid, bottom: 58 } };
|
|
332
|
+
}
|
|
333
|
+
// Multi-series form: { name, data: { x, y }[], color? }[] on a time/value x-axis,
|
|
334
|
+
// stacked when `stacking` is set. ECharts has no percent stacking, so percent
|
|
335
|
+
// mode normalises each x to the share of its column total first.
|
|
336
|
+
const stacking = c.stacking === 'normal' || c.stacking === 'percent' ? c.stacking : undefined;
|
|
337
|
+
const area = !['line', 'spline', 'column', 'bar'].includes(c.detailType ?? 'area');
|
|
338
|
+
const bar = c.detailType === 'column' || c.detailType === 'bar';
|
|
339
|
+
const totals = new Map();
|
|
340
|
+
if (stacking === 'percent') {
|
|
341
|
+
for (const s of c.series)
|
|
342
|
+
for (const p of s.data ?? [])
|
|
343
|
+
totals.set(p.x, (totals.get(p.x) ?? 0) + (Number(p.y) || 0));
|
|
344
|
+
}
|
|
345
|
+
const value = (p) => {
|
|
346
|
+
if (stacking !== 'percent')
|
|
347
|
+
return p.y;
|
|
348
|
+
const total = totals.get(p.x) ?? 0;
|
|
349
|
+
return total === 0 ? 0 : ((Number(p.y) || 0) / total) * 100;
|
|
350
|
+
};
|
|
351
|
+
const series = c.series.map((s) => ({
|
|
352
|
+
name: s.name,
|
|
353
|
+
type: bar ? 'bar' : 'line',
|
|
354
|
+
smooth: c.detailType === 'spline' || c.detailType === 'areaspline' || undefined,
|
|
355
|
+
showSymbol: false,
|
|
356
|
+
...(area && !bar ? { areaStyle: {} } : {}),
|
|
357
|
+
...(stacking ? { stack: 'total' } : {}),
|
|
358
|
+
...(s.color ? { itemStyle: { color: s.color }, lineStyle: { color: s.color } } : {}),
|
|
359
|
+
data: (s.data ?? []).map((p) => [p.x, value(p)]),
|
|
360
|
+
}));
|
|
361
|
+
const b = base(c, series.length);
|
|
362
|
+
return {
|
|
363
|
+
...b,
|
|
364
|
+
...zoom,
|
|
365
|
+
grid: { ...b.grid, bottom: 58 },
|
|
366
|
+
xAxis: { type: (c.xAxisType ?? 'datetime') === 'datetime' ? 'time' : 'value' },
|
|
367
|
+
yAxis: { type: 'value', name: c.yAxisTitle, ...(stacking === 'percent' ? { max: 100 } : {}) },
|
|
368
|
+
series,
|
|
369
|
+
};
|
|
330
370
|
},
|
|
331
371
|
'line-column': (c) => {
|
|
332
372
|
// ONE value axis (dual axis is banned) — series carry their own form
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import type { Options } from 'highcharts';
|
|
2
|
-
import type { MasterDetailPoint, MasterDetailSeriesType, MasterDetailXAxisType } from '../../nile-master-detail-chart/nile-master-detail-chart.js';
|
|
2
|
+
import type { MasterDetailPoint, MasterDetailSeries, MasterDetailSeriesType, MasterDetailStacking, MasterDetailXAxisType } from '../../nile-master-detail-chart/nile-master-detail-chart.js';
|
|
3
3
|
export interface ChartMasterDetailConfigType {
|
|
4
4
|
type: 'master-detail';
|
|
5
|
-
|
|
5
|
+
/** Single-series shorthand. Optional when `series` is given. */
|
|
6
|
+
data?: MasterDetailPoint[];
|
|
7
|
+
/** Several named series; when non-empty it replaces `data` / `seriesName` / `seriesColor`. */
|
|
8
|
+
series?: MasterDetailSeries[];
|
|
9
|
+
/** Stack the series on both panes. */
|
|
10
|
+
stacking?: MasterDetailStacking;
|
|
6
11
|
seriesName?: string;
|
|
7
12
|
seriesColor?: string;
|
|
8
13
|
detailType?: MasterDetailSeriesType;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Default size limits for every nile-lite-tooltip the charts render. */
|
|
2
|
+
export declare const LITE_TOOLTIP_MAX_WIDTH = "var(--ng-width-64)";
|
|
3
|
+
export declare const LITE_TOOLTIP_MAX_HEIGHT = 250;
|
|
4
|
+
/** `nile-show` handler: keeps the whole tooltip box within the limits and scrolls any overflow. */
|
|
5
|
+
export declare function limitLiteTooltipHeight(e: Event): void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Default size limits for every nile-lite-tooltip the charts render. */
|
|
2
|
+
export const LITE_TOOLTIP_MAX_WIDTH = 'var(--ng-width-64)';
|
|
3
|
+
export const LITE_TOOLTIP_MAX_HEIGHT = 250;
|
|
4
|
+
/** `nile-show` handler: keeps the whole tooltip box within the limits and scrolls any overflow. */
|
|
5
|
+
export function limitLiteTooltipHeight(e) {
|
|
6
|
+
const popper = e.detail?.instance?.popper;
|
|
7
|
+
const box = popper?.querySelector('.tippy-box');
|
|
8
|
+
const content = popper?.querySelector('.tippy-content');
|
|
9
|
+
if (!box || !content)
|
|
10
|
+
return;
|
|
11
|
+
box.style.boxSizing = 'border-box';
|
|
12
|
+
box.style.maxHeight = `${LITE_TOOLTIP_MAX_HEIGHT}px`;
|
|
13
|
+
box.style.display = 'flex';
|
|
14
|
+
box.style.flexDirection = 'column';
|
|
15
|
+
content.style.minHeight = '0';
|
|
16
|
+
content.style.overflowY = 'auto';
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=lite-tooltip.js.map
|
|
@@ -28,7 +28,7 @@ import type { HistogramSamples } from '../nile-histogram-chart/nile-histogram-ch
|
|
|
28
28
|
import type { BellcurveSamples } from '../nile-bellcurve-chart/nile-bellcurve-chart.js';
|
|
29
29
|
import type { BoxplotSeriesData } from '../nile-boxplot-chart/nile-boxplot-chart.js';
|
|
30
30
|
import type { TimelineEvent } from '../nile-timeline-chart/nile-timeline-chart.js';
|
|
31
|
-
import type { MasterDetailPoint } from '../nile-master-detail-chart/nile-master-detail-chart.js';
|
|
31
|
+
import type { MasterDetailPoint, MasterDetailSeries, MasterDetailStacking } from '../nile-master-detail-chart/nile-master-detail-chart.js';
|
|
32
32
|
import type { DumbbellPoint } from '../nile-dumbbell-chart/nile-dumbbell-chart.js';
|
|
33
33
|
import type { FanLinePoint, FanUncertaintyBand } from '../nile-fan-chart/nile-fan-chart.js';
|
|
34
34
|
import type { FunnelDataPoint } from '../nile-funnel-chart/nile-funnel-chart.js';
|
|
@@ -410,7 +410,12 @@ export interface NileTimelineChartConfig extends NileChartConfigBase {
|
|
|
410
410
|
}
|
|
411
411
|
export interface NileMasterDetailChartConfig extends NileChartConfigBase {
|
|
412
412
|
type: 'master-detail';
|
|
413
|
-
|
|
413
|
+
/** Single-series shorthand. Optional when `series` is given. */
|
|
414
|
+
data?: MasterDetailPoint[];
|
|
415
|
+
/** Several named series; when non-empty it replaces `data` / `seriesName` / `seriesColor`. */
|
|
416
|
+
series?: MasterDetailSeries[];
|
|
417
|
+
/** Stack the series on both panes: `normal` or `percent`. */
|
|
418
|
+
stacking?: MasterDetailStacking;
|
|
414
419
|
seriesName?: string;
|
|
415
420
|
seriesColor?: string;
|
|
416
421
|
detailType?: string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { html, nothing } from 'lit';
|
|
2
2
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
3
3
|
import { renderChartGhost } from './nile-chart-skeleton.js';
|
|
4
|
+
import { LITE_TOOLTIP_MAX_WIDTH, limitLiteTooltipHeight } from '../internal/utils/lite-tooltip.js';
|
|
4
5
|
/** Default empty state for `<nile-chart>`: detection (`isChartEmpty`) and markup (`renderChartEmptyState`). */
|
|
5
6
|
export const EMPTY_STATE_TITLE = 'No data';
|
|
6
7
|
export const EMPTY_STATE_DESCRIPTION = 'There is nothing to show for this chart yet. Data will appear here once it is available.';
|
|
7
8
|
// Tooltip width cap; longer text wraps. The tooltip mounts on <body>, where :root tokens resolve.
|
|
8
|
-
const TOOLTIP_MAX_WIDTH = 'var(--ng-width-64)';
|
|
9
9
|
// Types whose `data` is `[{ name, data: [...] }]`.
|
|
10
10
|
const SERIES_TYPES = new Set([
|
|
11
11
|
'bar', 'line', 'area', 'column', 'spline', 'scatter', 'bubble', 'radar',
|
|
@@ -150,6 +150,16 @@ export function isChartEmpty(config) {
|
|
|
150
150
|
return false;
|
|
151
151
|
return isFanEmpty(cfg.lineData, cfg.bands);
|
|
152
152
|
}
|
|
153
|
+
if (type === 'master-detail' && Array.isArray(cfg.series) && cfg.series.length > 0) {
|
|
154
|
+
// Multi-series form: `series` is the dataset ({ name, data: { x, y }[] }[]), so
|
|
155
|
+
// it is empty only when no series has a plottable point.
|
|
156
|
+
const hasPoint = cfg.series.some((s) => Array.isArray(s?.data) && (s.data).some(isPlottablePoint));
|
|
157
|
+
if (hasPoint)
|
|
158
|
+
return false;
|
|
159
|
+
const optSeries = cfg.options?.series;
|
|
160
|
+
if (!(Array.isArray(optSeries) && optSeries.length > 0))
|
|
161
|
+
return true;
|
|
162
|
+
}
|
|
153
163
|
const isKnown = SERIES_TYPES.has(type) || VALUE_POINT_TYPES.has(type) || LIST_ONLY_TYPES.has(type)
|
|
154
164
|
|| NUMERIC_LIST_TYPES.has(type);
|
|
155
165
|
if (!isKnown)
|
|
@@ -197,12 +207,12 @@ export function renderChartEmptyState(opts = {}) {
|
|
|
197
207
|
: html `<div class="nile-chart-empty__ghost" part="empty-ghost" aria-hidden="true">
|
|
198
208
|
<slot name="empty-ghost">${renderChartGhost(opts.type)}</slot>
|
|
199
209
|
</div>`}
|
|
200
|
-
<nile-lite-tooltip class="nile-chart-empty__tip nile-chart-empty__tip--title" placement="top" .maxWidth=${
|
|
210
|
+
<nile-lite-tooltip class="nile-chart-empty__tip nile-chart-empty__tip--title" placement="top" .maxWidth=${LITE_TOOLTIP_MAX_WIDTH} @nile-show=${limitLiteTooltipHeight} disabled>
|
|
201
211
|
<div class="nile-chart-empty__title" part="empty-title">
|
|
202
212
|
<span class="nile-chart-empty__badge" part="empty-badge"><slot name="empty-title">${EMPTY_STATE_TITLE}</slot></span>
|
|
203
213
|
</div>
|
|
204
214
|
</nile-lite-tooltip>
|
|
205
|
-
<nile-lite-tooltip class="nile-chart-empty__tip nile-chart-empty__tip--description" placement="top" .maxWidth=${
|
|
215
|
+
<nile-lite-tooltip class="nile-chart-empty__tip nile-chart-empty__tip--description" placement="top" .maxWidth=${LITE_TOOLTIP_MAX_WIDTH} @nile-show=${limitLiteTooltipHeight} disabled>
|
|
206
216
|
<div class="nile-chart-empty__description" part="empty-description">
|
|
207
217
|
<slot name="empty-description">${EMPTY_STATE_DESCRIPTION}</slot>
|
|
208
218
|
</div>
|
|
@@ -196,6 +196,18 @@ export const styles = css `
|
|
|
196
196
|
flex: 0 1 auto;
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
+
/* <nile-lite-tooltip> wrappers around the header title / subtitle; they must not break the ellipsis. */
|
|
200
|
+
.nile-chart-header-tip {
|
|
201
|
+
display: block;
|
|
202
|
+
width: 100%;
|
|
203
|
+
min-width: 0;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.nile-chart-header-title-row .nile-chart-header-tip {
|
|
207
|
+
width: auto;
|
|
208
|
+
flex: 0 1 auto;
|
|
209
|
+
}
|
|
210
|
+
|
|
199
211
|
.nile-chart-header-info-tip {
|
|
200
212
|
display: inline-flex;
|
|
201
213
|
align-items: center;
|
|
@@ -85,7 +85,8 @@ import '../nile-ai-panel/index.js';
|
|
|
85
85
|
*/
|
|
86
86
|
export declare class NileChart extends NileElement {
|
|
87
87
|
static styles: CSSResultGroup;
|
|
88
|
-
|
|
88
|
+
/** The nile-lite-tooltip shown for a clipped x-axis label. */
|
|
89
|
+
private _axisTipEl;
|
|
89
90
|
private _headerResizeObs;
|
|
90
91
|
/** Full chart configuration. Accepts flat NileChartConfig or separated { chart, aq } input. */
|
|
91
92
|
config: NileChartConfig | NileChartConfigInputType | null;
|
|
@@ -129,6 +130,12 @@ export declare class NileChart extends NileElement {
|
|
|
129
130
|
* Usage: `<nile-chart chart-type="pie" />` plus `config.chart` with series data only.
|
|
130
131
|
*/
|
|
131
132
|
chartTypeAttr: string;
|
|
133
|
+
/** Long x-axis labels: `truncate` (ellipsis) or `wrap`, at `xAxisLabelMaxWidth`. */
|
|
134
|
+
xAxisLabelMode: 'truncate' | 'wrap';
|
|
135
|
+
/** Max width in px of an x-axis label before it truncates or wraps. */
|
|
136
|
+
xAxisLabelMaxWidth: number;
|
|
137
|
+
/** Rotation in degrees of x-axis labels (e.g. `-45`); `0` keeps them flat. */
|
|
138
|
+
xAxisLabelRotation: number;
|
|
132
139
|
/** Summary/insight text — shown as the AI panel's opening message when the chat is opened. */
|
|
133
140
|
summary: string;
|
|
134
141
|
aiBorder: boolean;
|
|
@@ -253,13 +260,30 @@ export declare class NileChart extends NileElement {
|
|
|
253
260
|
private _renderMenuItem;
|
|
254
261
|
private renderActionsMenu;
|
|
255
262
|
private renderAiTrigger;
|
|
256
|
-
private _showHeaderTip;
|
|
257
|
-
private _hideHeaderTip;
|
|
258
|
-
private _onViewportMove;
|
|
259
263
|
/** Info icon beside the header title. Tooltip, focus and ARIA live on the wrapper, not the glyph. */
|
|
260
264
|
private renderHeaderInfo;
|
|
261
|
-
|
|
265
|
+
/** The x-axis label span in the event's composed path, if any. */
|
|
266
|
+
private _axisLabelFrom;
|
|
267
|
+
/** Finds an unrotated label by pointer coordinates, since some browsers report the wrong event target. */
|
|
268
|
+
private _axisLabelAt;
|
|
269
|
+
/** The x-axis label the tooltip belongs to. */
|
|
270
|
+
private _axisLabelActive;
|
|
271
|
+
/** Shows the full name for a clipped label; uses mousemove because some browsers never fire mouseover here. */
|
|
272
|
+
private _onAxisLabelMove;
|
|
273
|
+
private _showAxisLabelTip;
|
|
274
|
+
private _axisTipHideTimer;
|
|
275
|
+
private _cancelAxisTipHide;
|
|
276
|
+
/** Brief grace period so crossing the gap between two labels doesn't close and reopen the tooltip. */
|
|
277
|
+
private _scheduleAxisTipHide;
|
|
278
|
+
/** Drop the current label tooltip: instantly, or after letting it fade out. */
|
|
279
|
+
private _removeAxisTip;
|
|
280
|
+
private _hideAxisLabelTip;
|
|
281
|
+
private _onAxisViewportMove;
|
|
282
|
+
private _onAxisLabelOut;
|
|
283
|
+
private _onAxisLabelLeave;
|
|
262
284
|
private _syncHeaderTruncationA11y;
|
|
285
|
+
/** Header title or subtitle, wrapped in a lite tooltip that only enables once the text is clipped. */
|
|
286
|
+
private renderHeaderText;
|
|
263
287
|
private renderHeader;
|
|
264
288
|
private renderAiPanel;
|
|
265
289
|
private _echart;
|