@aquera/nile-visualization 2.9.18 → 2.9.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.
- package/README.md +6 -0
- package/dist/src/internal/color-palettes/color-palettes-data.d.ts +15 -0
- package/dist/src/internal/color-palettes/color-palettes-data.js +111 -0
- package/dist/src/internal/color-palettes/index.d.ts +3 -0
- package/dist/src/internal/color-palettes/index.js +43 -0
- package/dist/src/internal/types/chart-color-palette.type.d.ts +13 -0
- package/dist/src/internal/types/chart-color-palette.type.js +2 -0
- package/dist/src/internal/types/chart-grid-config.type.d.ts +4 -0
- package/dist/src/internal/types/index.d.ts +1 -0
- package/dist/src/nile-chart/index.d.ts +1 -1
- package/dist/src/nile-chart/nile-chart-config.d.ts +7 -0
- package/dist/src/nile-chart/nile-chart.js +15 -1
- package/dist/src/nile-kpi-chart/nile-kpi-chart.css.d.ts +1 -1
- package/dist/src/nile-kpi-chart/nile-kpi-chart.css.js +76 -12
- package/dist/src/nile-kpi-chart/nile-kpi-chart.d.ts +6 -0
- package/dist/src/nile-kpi-chart/nile-kpi-chart.js +78 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,6 +36,12 @@ 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.20 (June 18, 2026)
|
|
40
|
+
- Nile Chart: Added built-in color palettes — set `colorPalette` on the chart config to apply the Nile `default` theme (sizes 15 / 30 / 50) or a `custom` color array. Palettes resolve to `var(--ng-*)` tokens and repeat with an opacity falloff when data points exceed the palette size (UIF-1270)
|
|
41
|
+
|
|
42
|
+
#### Version 2.9.19 (June 16, 2026)
|
|
43
|
+
- Nile Chart: Forwarded the new data-grid pagination sub-properties (`paginationVariant`, `totalItems`, `currentPage`, `pageSize`) through `<nile-chart>` when using `type: 'grid'` (UIF-1265)
|
|
44
|
+
|
|
39
45
|
#### Version 2.9.18 (June 10, 2026)
|
|
40
46
|
- Nile Chart: Exposed the full `<nile-data-grid>` property surface through `<nile-chart>` — every public grid property is forwarded when using `type: 'grid'`(UIF-1260)
|
|
41
47
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ColorPaletteName } from '../types/chart-color-palette.type.js';
|
|
2
|
+
export interface PaletteEntry {
|
|
3
|
+
token: string;
|
|
4
|
+
value: string;
|
|
5
|
+
}
|
|
6
|
+
export interface PaletteTheme {
|
|
7
|
+
id: ColorPaletteName;
|
|
8
|
+
name?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
palettes: Record<string, PaletteEntry[]>;
|
|
11
|
+
}
|
|
12
|
+
export interface PalettesFile {
|
|
13
|
+
themes: PaletteTheme[];
|
|
14
|
+
}
|
|
15
|
+
export declare const palettesData: PalettesFile;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
export const palettesData = {
|
|
2
|
+
"themes": [
|
|
3
|
+
{
|
|
4
|
+
"id": "default",
|
|
5
|
+
"name": "Default",
|
|
6
|
+
"description": "Balanced, brand-led. Blue Dark anchors the sequence; adjacent hues jump family and step for maximum legibility.",
|
|
7
|
+
"palettes": {
|
|
8
|
+
"15": [
|
|
9
|
+
{ "token": "utility-blue-dark-500", "value": "var(--ng-componentcolors-utility-blue-dark-500)" },
|
|
10
|
+
{ "token": "utility-orange-500", "value": "var(--ng-componentcolors-utility-orange-500)" },
|
|
11
|
+
{ "token": "utility-success-500", "value": "var(--ng-componentcolors-utility-success-500)" },
|
|
12
|
+
{ "token": "utility-fuchsia-500", "value": "var(--ng-componentcolors-utility-fuchsia-500)" },
|
|
13
|
+
{ "token": "utility-warning-500", "value": "var(--ng-componentcolors-utility-warning-500)" },
|
|
14
|
+
{ "token": "utility-indigo-500", "value": "var(--ng-componentcolors-utility-indigo-500)" },
|
|
15
|
+
{ "token": "utility-pink-500", "value": "var(--ng-componentcolors-utility-pink-500)" },
|
|
16
|
+
{ "token": "utility-teal-500", "value": "var(--ng-color-teal-500)" },
|
|
17
|
+
{ "token": "utility-rose-500", "value": "var(--ng-color-rose-500)" },
|
|
18
|
+
{ "token": "utility-blue-light-500", "value": "var(--ng-componentcolors-utility-blue-light-500)" },
|
|
19
|
+
{ "token": "utility-yellow-500", "value": "var(--ng-componentcolors-utility-yellow-500)" },
|
|
20
|
+
{ "token": "utility-purple-500", "value": "var(--ng-componentcolors-utility-purple-500)" },
|
|
21
|
+
{ "token": "utility-moss-500", "value": "var(--ng-color-moss-500)" },
|
|
22
|
+
{ "token": "utility-orange-dark-500", "value": "var(--ng-componentcolors-utility-orange-dark-500)" },
|
|
23
|
+
{ "token": "utility-cyan-500", "value": "var(--ng-color-cyan-500)" }
|
|
24
|
+
],
|
|
25
|
+
"30": [
|
|
26
|
+
{ "token": "utility-brand-600", "value": "var(--ng-componentcolors-utility-brand-600)" },
|
|
27
|
+
{ "token": "utility-error-600", "value": "var(--ng-componentcolors-utility-error-600)" },
|
|
28
|
+
{ "token": "utility-warning-600", "value": "var(--ng-componentcolors-utility-warning-600)" },
|
|
29
|
+
{ "token": "utility-success-600", "value": "var(--ng-componentcolors-utility-success-600)" },
|
|
30
|
+
{ "token": "utility-gray-blue-600", "value": "var(--ng-componentcolors-utility-gray-blue-600)" },
|
|
31
|
+
{ "token": "utility-blue-light-600", "value": "var(--ng-componentcolors-utility-blue-light-600)" },
|
|
32
|
+
{ "token": "utility-blue-dark-600", "value": "var(--ng-componentcolors-utility-blue-dark-600)" },
|
|
33
|
+
{ "token": "utility-indigo-600", "value": "var(--ng-componentcolors-utility-indigo-600)" },
|
|
34
|
+
{ "token": "utility-purple-600", "value": "var(--ng-componentcolors-utility-purple-600)" },
|
|
35
|
+
{ "token": "utility-fuchsia-600", "value": "var(--ng-componentcolors-utility-fuchsia-600)" },
|
|
36
|
+
{ "token": "utility-pink-600", "value": "var(--ng-componentcolors-utility-pink-600)" },
|
|
37
|
+
{ "token": "utility-green-600", "value": "var(--ng-componentcolors-utility-green-600)" },
|
|
38
|
+
{ "token": "utility-yellow-600", "value": "var(--ng-componentcolors-utility-yellow-600)" },
|
|
39
|
+
{ "token": "utility-gray-600", "value": "var(--ng-componentcolors-utility-gray-600)" },
|
|
40
|
+
{ "token": "utility-brand-300", "value": "var(--ng-componentcolors-utility-brand-300)" },
|
|
41
|
+
{ "token": "utility-error-300", "value": "var(--ng-componentcolors-utility-error-300)" },
|
|
42
|
+
{ "token": "utility-warning-300", "value": "var(--ng-componentcolors-utility-warning-300)" },
|
|
43
|
+
{ "token": "utility-success-300", "value": "var(--ng-componentcolors-utility-success-300)" },
|
|
44
|
+
{ "token": "utility-gray-blue-300", "value": "var(--ng-componentcolors-utility-gray-blue-300)" },
|
|
45
|
+
{ "token": "utility-blue-light-300", "value": "var(--ng-componentcolors-utility-blue-light-300)" },
|
|
46
|
+
{ "token": "utility-blue-dark-300", "value": "var(--ng-componentcolors-utility-blue-dark-300)" },
|
|
47
|
+
{ "token": "utility-indigo-300", "value": "var(--ng-componentcolors-utility-indigo-300)" },
|
|
48
|
+
{ "token": "utility-purple-300", "value": "var(--ng-componentcolors-utility-purple-300)" },
|
|
49
|
+
{ "token": "utility-fuchsia-300", "value": "var(--ng-componentcolors-utility-fuchsia-300)" },
|
|
50
|
+
{ "token": "utility-pink-300", "value": "var(--ng-componentcolors-utility-pink-300)" },
|
|
51
|
+
{ "token": "utility-green-300", "value": "var(--ng-componentcolors-utility-green-300)" },
|
|
52
|
+
{ "token": "utility-yellow-300", "value": "var(--ng-componentcolors-utility-yellow-300)" },
|
|
53
|
+
{ "token": "utility-gray-300", "value": "var(--ng-componentcolors-utility-gray-300)" }
|
|
54
|
+
],
|
|
55
|
+
"50": [
|
|
56
|
+
{ "token": "utility-brand-600", "value": "var(--ng-componentcolors-utility-brand-600)" },
|
|
57
|
+
{ "token": "utility-error-600", "value": "var(--ng-componentcolors-utility-error-600)" },
|
|
58
|
+
{ "token": "utility-warning-600", "value": "var(--ng-componentcolors-utility-warning-600)" },
|
|
59
|
+
{ "token": "utility-success-600", "value": "var(--ng-componentcolors-utility-success-600)" },
|
|
60
|
+
{ "token": "utility-gray-blue-600", "value": "var(--ng-componentcolors-utility-gray-blue-600)" },
|
|
61
|
+
{ "token": "utility-blue-light-600", "value": "var(--ng-componentcolors-utility-blue-light-600)" },
|
|
62
|
+
{ "token": "utility-blue-600", "value": "var(--ng-componentcolors-utility-blue-600)" },
|
|
63
|
+
{ "token": "utility-blue-dark-600", "value": "var(--ng-componentcolors-utility-blue-dark-600)" },
|
|
64
|
+
{ "token": "utility-indigo-600", "value": "var(--ng-componentcolors-utility-indigo-600)" },
|
|
65
|
+
{ "token": "utility-purple-600", "value": "var(--ng-componentcolors-utility-purple-600)" },
|
|
66
|
+
{ "token": "utility-fuchsia-600", "value": "var(--ng-componentcolors-utility-fuchsia-600)" },
|
|
67
|
+
{ "token": "utility-pink-600", "value": "var(--ng-componentcolors-utility-pink-600)" },
|
|
68
|
+
{ "token": "utility-orange-600", "value": "var(--ng-componentcolors-utility-orange-600)" },
|
|
69
|
+
{ "token": "utility-green-600", "value": "var(--ng-componentcolors-utility-green-600)" },
|
|
70
|
+
{ "token": "utility-yellow-600", "value": "var(--ng-componentcolors-utility-yellow-600)" },
|
|
71
|
+
{ "token": "utility-gray-600", "value": "var(--ng-componentcolors-utility-gray-600)" },
|
|
72
|
+
{ "token": "utility-gray-400", "value": "var(--ng-componentcolors-utility-gray-400)" },
|
|
73
|
+
{ "token": "utility-brand-400", "value": "var(--ng-componentcolors-utility-brand-400)" },
|
|
74
|
+
{ "token": "utility-error-400", "value": "var(--ng-componentcolors-utility-error-400)" },
|
|
75
|
+
{ "token": "utility-warning-400", "value": "var(--ng-componentcolors-utility-warning-400)" },
|
|
76
|
+
{ "token": "utility-success-400", "value": "var(--ng-componentcolors-utility-success-400)" },
|
|
77
|
+
{ "token": "utility-gray-blue-400", "value": "var(--ng-componentcolors-utility-gray-blue-400)" },
|
|
78
|
+
{ "token": "utility-blue-light-400", "value": "var(--ng-componentcolors-utility-blue-light-400)" },
|
|
79
|
+
{ "token": "utility-blue-400", "value": "var(--ng-componentcolors-utility-blue-400)" },
|
|
80
|
+
{ "token": "utility-blue-dark-400", "value": "var(--ng-componentcolors-utility-blue-dark-400)" },
|
|
81
|
+
{ "token": "utility-indigo-400", "value": "var(--ng-componentcolors-utility-indigo-400)" },
|
|
82
|
+
{ "token": "utility-purple-400", "value": "var(--ng-componentcolors-utility-purple-400)" },
|
|
83
|
+
{ "token": "utility-fuchsia-400", "value": "var(--ng-componentcolors-utility-fuchsia-400)" },
|
|
84
|
+
{ "token": "utility-pink-400", "value": "var(--ng-componentcolors-utility-pink-400)" },
|
|
85
|
+
{ "token": "utility-orange-dark-400", "value": "var(--ng-componentcolors-utility-orange-dark-400)" },
|
|
86
|
+
{ "token": "utility-orange-400", "value": "var(--ng-componentcolors-utility-orange-400)" },
|
|
87
|
+
{ "token": "utility-green-400", "value": "var(--ng-componentcolors-utility-green-400)" },
|
|
88
|
+
{ "token": "utility-yellow-400", "value": "var(--ng-componentcolors-utility-yellow-400)" },
|
|
89
|
+
{ "token": "utility-gray-200", "value": "var(--ng-componentcolors-utility-gray-200)" },
|
|
90
|
+
{ "token": "utility-brand-200", "value": "var(--ng-componentcolors-utility-brand-200)" },
|
|
91
|
+
{ "token": "utility-error-200", "value": "var(--ng-componentcolors-utility-error-200)" },
|
|
92
|
+
{ "token": "utility-warning-200", "value": "var(--ng-componentcolors-utility-warning-200)" },
|
|
93
|
+
{ "token": "utility-success-200", "value": "var(--ng-componentcolors-utility-success-200)" },
|
|
94
|
+
{ "token": "utility-gray-blue-200", "value": "var(--ng-componentcolors-utility-gray-blue-200)" },
|
|
95
|
+
{ "token": "utility-blue-light-200", "value": "var(--ng-componentcolors-utility-blue-light-200)" },
|
|
96
|
+
{ "token": "utility-blue-200", "value": "var(--ng-componentcolors-utility-blue-200)" },
|
|
97
|
+
{ "token": "utility-blue-dark-200", "value": "var(--ng-componentcolors-utility-blue-dark-200)" },
|
|
98
|
+
{ "token": "utility-indigo-200", "value": "var(--ng-componentcolors-utility-indigo-200)" },
|
|
99
|
+
{ "token": "utility-purple-200", "value": "var(--ng-componentcolors-utility-purple-200)" },
|
|
100
|
+
{ "token": "utility-fuchsia-200", "value": "var(--ng-componentcolors-utility-fuchsia-200)" },
|
|
101
|
+
{ "token": "utility-pink-200", "value": "var(--ng-componentcolors-utility-pink-200)" },
|
|
102
|
+
{ "token": "utility-orange-dark-200", "value": "var(--ng-componentcolors-utility-orange-dark-200)" },
|
|
103
|
+
{ "token": "utility-orange-200", "value": "var(--ng-componentcolors-utility-orange-200)" },
|
|
104
|
+
{ "token": "utility-green-200", "value": "var(--ng-componentcolors-utility-green-200)" },
|
|
105
|
+
{ "token": "utility-yellow-200", "value": "var(--ng-componentcolors-utility-yellow-200)" }
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
};
|
|
111
|
+
//# sourceMappingURL=color-palettes-data.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ChartColorPaletteConfig } from '../types/chart-color-palette.type.js';
|
|
2
|
+
export declare function resolveColorPaletteColors(cfg: ChartColorPaletteConfig | undefined, count?: number): string[] | undefined;
|
|
3
|
+
export { palettesData } from './color-palettes-data.js';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { palettesData } from './color-palettes-data.js';
|
|
2
|
+
const DEFAULT_THEME = 'default';
|
|
3
|
+
const DEFAULT_SIZE = 30;
|
|
4
|
+
const ALPHA_MAX = 1;
|
|
5
|
+
const ALPHA_MIN = 0.5;
|
|
6
|
+
function withAlpha(color, alpha) {
|
|
7
|
+
return alpha >= 1
|
|
8
|
+
? color
|
|
9
|
+
: `color-mix(in srgb, ${color} ${Math.round(alpha * 100)}%, transparent)`;
|
|
10
|
+
}
|
|
11
|
+
function extendWithAlpha(base, count) {
|
|
12
|
+
const target = count && count > 0 ? count : base.length;
|
|
13
|
+
if (target <= base.length)
|
|
14
|
+
return base.slice(0, target);
|
|
15
|
+
const cycles = Math.ceil(target / base.length);
|
|
16
|
+
const out = [];
|
|
17
|
+
for (let c = 0; c < cycles; c++) {
|
|
18
|
+
const alpha = ALPHA_MAX - ((ALPHA_MAX - ALPHA_MIN) * c) / (cycles - 1);
|
|
19
|
+
for (const color of base)
|
|
20
|
+
out.push(withAlpha(color, alpha));
|
|
21
|
+
}
|
|
22
|
+
return out.slice(0, target);
|
|
23
|
+
}
|
|
24
|
+
export function resolveColorPaletteColors(cfg, count) {
|
|
25
|
+
if (!cfg)
|
|
26
|
+
return undefined;
|
|
27
|
+
if (cfg.theme === 'custom') {
|
|
28
|
+
return cfg.customColors && cfg.customColors.length > 0
|
|
29
|
+
? extendWithAlpha(cfg.customColors, count)
|
|
30
|
+
: undefined;
|
|
31
|
+
}
|
|
32
|
+
const themeName = cfg.theme ?? DEFAULT_THEME;
|
|
33
|
+
const size = cfg.size ?? DEFAULT_SIZE;
|
|
34
|
+
const theme = palettesData.themes.find(t => t.id === themeName);
|
|
35
|
+
if (!theme)
|
|
36
|
+
return undefined;
|
|
37
|
+
const entries = theme.palettes[String(size)];
|
|
38
|
+
if (!entries || entries.length === 0)
|
|
39
|
+
return undefined;
|
|
40
|
+
return extendWithAlpha(entries.map(e => e.value), count);
|
|
41
|
+
}
|
|
42
|
+
export { palettesData } from './color-palettes-data.js';
|
|
43
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Palette theme names. Use 'custom' with `customColors` to supply your own array. */
|
|
2
|
+
export type ColorPaletteName = 'default' | 'custom';
|
|
3
|
+
/** Number of color variants in the palette. Ignored when `theme` is 'custom'. */
|
|
4
|
+
export type ColorPaletteSize = 15 | 30 | 50;
|
|
5
|
+
/** Color palette selection for a chart. */
|
|
6
|
+
export interface ChartColorPaletteConfig {
|
|
7
|
+
/** Palette theme. Default: 'default'. Use 'custom' with `customColors`. */
|
|
8
|
+
theme?: ColorPaletteName;
|
|
9
|
+
/** Number of color variants for built-in palettes. Default: 30. Ignored for 'custom'. */
|
|
10
|
+
size?: ColorPaletteSize;
|
|
11
|
+
/** Custom color array (hex strings). Used only when `theme` is 'custom'. Looped with alpha falloff if series count exceeds array length. */
|
|
12
|
+
customColors?: string[];
|
|
13
|
+
}
|
|
@@ -17,6 +17,10 @@ export interface ChartGridConfigType {
|
|
|
17
17
|
paginationEnabled?: boolean;
|
|
18
18
|
pagination?: PaginationState;
|
|
19
19
|
pageSizeOptions?: number[];
|
|
20
|
+
paginationVariant?: 'fluid' | 'compact' | 'mini';
|
|
21
|
+
totalItems?: number;
|
|
22
|
+
currentPage?: number;
|
|
23
|
+
pageSize?: number;
|
|
20
24
|
virtualized?: boolean;
|
|
21
25
|
estimatedRowHeight?: number;
|
|
22
26
|
overscan?: number;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type { AiConfigType } from './ai-config.type.js';
|
|
2
2
|
export type { SwitchableConfigType } from './switchable-config.type.js';
|
|
3
3
|
export type { AqConfigType } from './aq-config.type.js';
|
|
4
|
+
export type { ChartColorPaletteConfig, ColorPaletteName, ColorPaletteSize, } from './chart-color-palette.type.js';
|
|
4
5
|
export type { ChartBarConfigType } from './chart-bar-config.type.js';
|
|
5
6
|
export type { ChartPieConfigType } from './chart-pie-config.type.js';
|
|
6
7
|
export type { ChartTrendlineConfigType } from './chart-trendline-config.type.js';
|
|
@@ -2,4 +2,4 @@ export { NileChart } from './nile-chart.js';
|
|
|
2
2
|
export type { NileChartConfig, NileBarChartConfig, NilePieChartConfig, NileTrendlineChartConfig, NileAnomalyChartConfig, NileLineChartConfig, NileAreaChartConfig, NileColumnChartConfig, NileDonutChartConfig, NileScatterChartConfig, NileBubbleChartConfig, NileSplineChartConfig, NileRadarChartConfig, NileGaugeChartConfig, NileWaterfallChartConfig, NileKpiChartConfig, NileMapChartConfig, ChartType, SwitchAggregation, NileAiConfig, NileChartMenuConfig, NileChartMenuItem, } from './nile-chart-config.js';
|
|
3
3
|
export { convertConfig, registerAdapter } from '../internal/chart-adapters.js';
|
|
4
4
|
export { nileChartConfig } from './nile-chart-config-builder.js';
|
|
5
|
-
export type { AiConfigType, SwitchableConfigType, AqConfigType, ChartBarConfigType, ChartPieConfigType, ChartTrendlineConfigType, ChartAnomalyConfigType, ChartLineConfigType, ChartAreaConfigType, ChartInvertedAreaConfigType, ChartColumnConfigType, ChartDonutConfigType, ChartScatterConfigType, ChartBubbleConfigType, ChartSplineConfigType, ChartRadarConfigType, ChartGaugeConfigType, ChartWaterfallConfigType, ChartClusterConfigType, ChartStackedConfigType, ChartHistogramConfigType, ChartBellcurveConfigType, ChartBoxplotConfigType, ChartTimelineConfigType, ChartDumbbellConfigType, ChartDumbbellLowerConfigType, ChartDumbbellUpperConfigType, ChartColumnPyramidConfigType, ChartLollipopConfigType, ChartAreaSplineConfigType, ChartAreaNegativeConfigType, ChartAreaRangeConfigType, ChartColumnRangeConfigType, ChartColumnDrilldownConfigType, ChartRadialBarConfigType, ChartVariablePieConfigType, ChartEulerConfigType, ChartPolygonConfigType, ChartVectorConfigType, ChartXrangeConfigType, ChartFanConfigType, ChartFunnelConfigType, ChartOrganizationConfigType, ChartLineColumnConfigType, ChartHeatmapConfigType, ChartFlameConfigType, ChartSpiderwebConfigType, ChartKpiConfigType, ChartKpiPropsType, ChartMapConfigType, PrimitiveChartConfigType, SeparatedChartConfigInputType, AllChartConfigType, ChartConfigType, NileChartConfigInputType, ChartAiPanelPayload, ChartAiSenderPayload, NileAiPanelConfigInputType, NileAiSenderConfigInputType, } from '../internal/types/index.js';
|
|
5
|
+
export type { AiConfigType, SwitchableConfigType, AqConfigType, ChartColorPaletteConfig, ColorPaletteName, ColorPaletteSize, ChartBarConfigType, ChartPieConfigType, ChartTrendlineConfigType, ChartAnomalyConfigType, ChartLineConfigType, ChartAreaConfigType, ChartInvertedAreaConfigType, ChartColumnConfigType, ChartDonutConfigType, ChartScatterConfigType, ChartBubbleConfigType, ChartSplineConfigType, ChartRadarConfigType, ChartGaugeConfigType, ChartWaterfallConfigType, ChartClusterConfigType, ChartStackedConfigType, ChartHistogramConfigType, ChartBellcurveConfigType, ChartBoxplotConfigType, ChartTimelineConfigType, ChartDumbbellConfigType, ChartDumbbellLowerConfigType, ChartDumbbellUpperConfigType, ChartColumnPyramidConfigType, ChartLollipopConfigType, ChartAreaSplineConfigType, ChartAreaNegativeConfigType, ChartAreaRangeConfigType, ChartColumnRangeConfigType, ChartColumnDrilldownConfigType, ChartRadialBarConfigType, ChartVariablePieConfigType, ChartEulerConfigType, ChartPolygonConfigType, ChartVectorConfigType, ChartXrangeConfigType, ChartFanConfigType, ChartFunnelConfigType, ChartOrganizationConfigType, ChartLineColumnConfigType, ChartHeatmapConfigType, ChartFlameConfigType, ChartSpiderwebConfigType, ChartKpiConfigType, ChartKpiPropsType, ChartMapConfigType, PrimitiveChartConfigType, SeparatedChartConfigInputType, AllChartConfigType, ChartConfigType, NileChartConfigInputType, ChartAiPanelPayload, ChartAiSenderPayload, NileAiPanelConfigInputType, NileAiSenderConfigInputType, } from '../internal/types/index.js';
|
|
@@ -46,6 +46,7 @@ import type { PolygonSeriesConfig } from '../nile-polygon-chart/nile-polygon-cha
|
|
|
46
46
|
import type { VectorDataPoint } from '../nile-vector-chart/nile-vector-chart.js';
|
|
47
47
|
import type { XrangeDataPoint } from '../nile-xrange-chart/nile-xrange-chart.js';
|
|
48
48
|
import type { LineColumnSeriesPart } from '../nile-line-column-chart/nile-line-column-chart.js';
|
|
49
|
+
import type { ChartColorPaletteConfig } from '../internal/types/chart-color-palette.type.js';
|
|
49
50
|
export type SwitchAggregation = 'by-category' | 'by-series' | 'flatten';
|
|
50
51
|
/**
|
|
51
52
|
* A built-in menu action (fullscreen, print, or a download).
|
|
@@ -157,6 +158,8 @@ export interface NileChartConfigBase {
|
|
|
157
158
|
menu?: NileChartMenuConfig;
|
|
158
159
|
menuItems?: NileChartMenuItem[];
|
|
159
160
|
legend?: LegendConfig;
|
|
161
|
+
/** Color palette applied to the chart's series. */
|
|
162
|
+
colorPalette?: ChartColorPaletteConfig;
|
|
160
163
|
chartBg?: string;
|
|
161
164
|
chartBorderRadius?: string | number;
|
|
162
165
|
chartBorder?: string;
|
|
@@ -275,6 +278,10 @@ export interface NileGridChartConfig extends NileChartConfigBase {
|
|
|
275
278
|
paginationEnabled?: boolean;
|
|
276
279
|
pagination?: PaginationState;
|
|
277
280
|
pageSizeOptions?: number[];
|
|
281
|
+
paginationVariant?: 'fluid' | 'compact' | 'mini';
|
|
282
|
+
totalItems?: number;
|
|
283
|
+
currentPage?: number;
|
|
284
|
+
pageSize?: number;
|
|
278
285
|
virtualized?: boolean;
|
|
279
286
|
estimatedRowHeight?: number;
|
|
280
287
|
overscan?: number;
|
|
@@ -8,6 +8,7 @@ import { renderChartSkeleton } from './nile-chart-skeleton.js';
|
|
|
8
8
|
import { convertConfig } from '../internal/chart-adapters.js';
|
|
9
9
|
import { deepMerge } from '../internal/utils.js';
|
|
10
10
|
import { initNileChartExporting, getHighcharts } from '../internal/highcharts-provider.js';
|
|
11
|
+
import { resolveColorPaletteColors } from '../internal/color-palettes/index.js';
|
|
11
12
|
// Start loading exporting/offline-exporting/export-data at module import time.
|
|
12
13
|
// `chart.fullscreen` is attached via a `beforeRender` hook installed by the exporting module's
|
|
13
14
|
// compose step, so if a chart is constructed before the module applies, that instance will have
|
|
@@ -604,7 +605,16 @@ let NileChart = class NileChart extends NileElement {
|
|
|
604
605
|
const { show, ...rest } = config.legend;
|
|
605
606
|
legendOptions.legend = { enabled: show ?? true, ...rest };
|
|
606
607
|
}
|
|
607
|
-
const
|
|
608
|
+
const cfgData = config.data;
|
|
609
|
+
const dataCount = Array.isArray(cfgData) ? cfgData.length : undefined;
|
|
610
|
+
// Apply the built-in 'default' palette automatically when no colorPalette is
|
|
611
|
+
// given — so charts use Nile colors out of the box with no config needed. A
|
|
612
|
+
// consumer who supplies their own `options.colors` opts out (not clobbered).
|
|
613
|
+
const hasExplicitColors = Array.isArray(config.options?.colors);
|
|
614
|
+
const paletteCfg = config.colorPalette ?? (hasExplicitColors ? undefined : { theme: 'default' });
|
|
615
|
+
const paletteColors = resolveColorPaletteColors(paletteCfg, dataCount);
|
|
616
|
+
const paletteOptions = paletteColors ? { colors: paletteColors } : {};
|
|
617
|
+
const mergedOptions = deepMerge(deepMerge(deepMerge(deepMerge(config.options ?? {}, legendOptions), paletteOptions), noTitle), this.buildExportingOptions());
|
|
608
618
|
switch (config.type) {
|
|
609
619
|
case 'bar':
|
|
610
620
|
return html `<nile-bar-chart
|
|
@@ -1752,6 +1762,10 @@ let NileChart = class NileChart extends NileElement {
|
|
|
1752
1762
|
.paginationEnabled=${config.paginationEnabled ?? false}
|
|
1753
1763
|
.pagination=${config.pagination ?? DEFAULT_GRID_PAGINATION}
|
|
1754
1764
|
.pageSizeOptions=${config.pageSizeOptions ?? DEFAULT_GRID_PAGE_SIZE_OPTIONS}
|
|
1765
|
+
.paginationVariant=${config.paginationVariant ?? 'fluid'}
|
|
1766
|
+
.totalItems=${config.totalItems ?? null}
|
|
1767
|
+
.currentPage=${config.currentPage ?? null}
|
|
1768
|
+
.pageSize=${config.pageSize ?? null}
|
|
1755
1769
|
.virtualized=${config.virtualized ?? false}
|
|
1756
1770
|
.estimatedRowHeight=${config.estimatedRowHeight ?? 44}
|
|
1757
1771
|
.overscan=${config.overscan ?? 10}
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
* Global tooltip styles — injected once into document.head so the tooltip
|
|
3
3
|
* element on document.body is styled independently of the shadow DOM.
|
|
4
4
|
*/
|
|
5
|
-
export declare const tooltipCss = "\n .nile-kpi-tooltip {\n position: fixed;\n display: none;\n transform: translate(-50%, calc(-100% - 10px));\n background: var(--nile-colors-white-base, var(--ng-colors-bg-primary));\n color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900));\n font-family: var(--nile-font-family-serif, var(--ng-font-family-body));\n font-size: var(--nile-type-scale-2, var(--ng-font-size-text-xs));\n font-weight: var(--nile-font-weight-medium, var(--ng-font-weight-medium));\n line-height: 1.4;\n padding: var(--nile-spacing-xs, var(--ng-spacing-xs)) var(--nile-spacing-md, var(--ng-spacing-md));\n border-radius: var(--nile-radius-radius-xl, var(--ng-radius-sm));\n border: var(--nile-border-width-1, var(--ng-stroke-width-1)) solid var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));\n pointer-events: none;\n white-space:
|
|
5
|
+
export declare const tooltipCss = "\n .nile-kpi-tooltip {\n position: fixed;\n display: none;\n transform: translate(-50%, calc(-100% - 10px));\n background: var(--nile-colors-white-base, var(--ng-colors-bg-primary));\n color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900));\n font-family: var(--nile-font-family-serif, var(--ng-font-family-body));\n font-size: var(--nile-type-scale-2, var(--ng-font-size-text-xs));\n font-weight: var(--nile-font-weight-medium, var(--ng-font-weight-medium));\n line-height: 1.4;\n padding: var(--nile-spacing-xs, var(--ng-spacing-xs)) var(--nile-spacing-md, var(--ng-spacing-md));\n border-radius: var(--nile-radius-radius-xl, var(--ng-radius-sm));\n border: var(--nile-border-width-1, var(--ng-stroke-width-1)) solid var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));\n pointer-events: none;\n white-space: normal;\n max-width: 260px;\n word-break: break-word;\n z-index: 2;\n box-shadow: var(--nile-box-shadow-3, var(--ng-shadow-sm));\n }\n\n .nile-kpi-tooltip::after {\n content: '';\n position: absolute;\n top: 100%;\n left: 50%;\n transform: translateX(-50%);\n border: var(--nile-border-size-5, 5px) solid transparent;\n border-top-color: var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));\n }\n .nile-kpi-marker {\n position: fixed;\n display: none;\n width: 10px;\n height: 10px;\n border-radius: 50%;\n transform: translate(-50%, -50%);\n pointer-events: none;\n z-index: 1;\n }\n";
|
|
6
6
|
export declare const styles: import("lit").CSSResult;
|
|
@@ -18,8 +18,10 @@ export const tooltipCss = `
|
|
|
18
18
|
border-radius: var(--nile-radius-radius-xl, var(--ng-radius-sm));
|
|
19
19
|
border: var(--nile-border-width-1, var(--ng-stroke-width-1)) solid var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));
|
|
20
20
|
pointer-events: none;
|
|
21
|
-
white-space:
|
|
22
|
-
|
|
21
|
+
white-space: normal;
|
|
22
|
+
max-width: 260px;
|
|
23
|
+
word-break: break-word;
|
|
24
|
+
z-index: 2;
|
|
23
25
|
box-shadow: var(--nile-box-shadow-3, var(--ng-shadow-sm));
|
|
24
26
|
}
|
|
25
27
|
|
|
@@ -32,6 +34,16 @@ export const tooltipCss = `
|
|
|
32
34
|
border: var(--nile-border-size-5, 5px) solid transparent;
|
|
33
35
|
border-top-color: var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));
|
|
34
36
|
}
|
|
37
|
+
.nile-kpi-marker {
|
|
38
|
+
position: fixed;
|
|
39
|
+
display: none;
|
|
40
|
+
width: 10px;
|
|
41
|
+
height: 10px;
|
|
42
|
+
border-radius: 50%;
|
|
43
|
+
transform: translate(-50%, -50%);
|
|
44
|
+
pointer-events: none;
|
|
45
|
+
z-index: 1;
|
|
46
|
+
}
|
|
35
47
|
`;
|
|
36
48
|
export const styles = css `
|
|
37
49
|
:host {
|
|
@@ -59,15 +71,18 @@ export const styles = css `
|
|
|
59
71
|
display: flex;
|
|
60
72
|
flex-direction: column;
|
|
61
73
|
width: 100%;
|
|
62
|
-
min-width:
|
|
74
|
+
min-width: 120px;
|
|
63
75
|
position: relative;
|
|
64
76
|
box-sizing: border-box;
|
|
65
77
|
overflow: hidden;
|
|
66
|
-
|
|
67
|
-
container-type: size;
|
|
78
|
+
container-type: inline-size;
|
|
68
79
|
min-height: 120px;
|
|
69
80
|
}
|
|
70
81
|
|
|
82
|
+
:host([size-container]) {
|
|
83
|
+
container-type: size;
|
|
84
|
+
}
|
|
85
|
+
|
|
71
86
|
/* Gauge variant needs more vertical room so the ring renders at a usable size. */
|
|
72
87
|
:host([variant='gauge']) {
|
|
73
88
|
min-height: 200px;
|
|
@@ -83,6 +98,7 @@ export const styles = css `
|
|
|
83
98
|
:host([fit]) {
|
|
84
99
|
height: 100%;
|
|
85
100
|
min-height: 0;
|
|
101
|
+
container-type: size;
|
|
86
102
|
}
|
|
87
103
|
|
|
88
104
|
/* Card / gauge chrome on the host when used alone (inside nile-chart, embed-in-nile-chart skips this). */
|
|
@@ -143,6 +159,7 @@ export const styles = css `
|
|
|
143
159
|
width: 100%;
|
|
144
160
|
max-width: 100%;
|
|
145
161
|
box-sizing: border-box;
|
|
162
|
+
flex-shrink: 0;
|
|
146
163
|
}
|
|
147
164
|
|
|
148
165
|
.kpi-value-row {
|
|
@@ -240,6 +257,7 @@ export const styles = css `
|
|
|
240
257
|
font-size: var(--nile-kpi-description-font-size);
|
|
241
258
|
color: var(--nile-kpi-description-color);
|
|
242
259
|
line-height: 1.5;
|
|
260
|
+
white-space: nowrap;
|
|
243
261
|
overflow: hidden;
|
|
244
262
|
text-overflow: ellipsis;
|
|
245
263
|
min-width: 0;
|
|
@@ -252,7 +270,6 @@ export const styles = css `
|
|
|
252
270
|
width: 100%;
|
|
253
271
|
flex: 1 1 24px;
|
|
254
272
|
min-height: 24px;
|
|
255
|
-
margin-top: var(--nile-spacing-xs, var(--ng-spacing-xs));
|
|
256
273
|
}
|
|
257
274
|
|
|
258
275
|
/* ── Container queries: scale down for narrow cards ── */
|
|
@@ -285,9 +302,7 @@ export const styles = css `
|
|
|
285
302
|
}
|
|
286
303
|
}
|
|
287
304
|
|
|
288
|
-
|
|
289
|
-
the visible order stays value → trend → sparkline. */
|
|
290
|
-
@container (max-width: 180px) {
|
|
305
|
+
@container (max-width: 130px) {
|
|
291
306
|
.kpi-sparkline {
|
|
292
307
|
display: none;
|
|
293
308
|
}
|
|
@@ -372,9 +387,7 @@ export const styles = css `
|
|
|
372
387
|
}
|
|
373
388
|
}
|
|
374
389
|
|
|
375
|
-
|
|
376
|
-
Skip the card-variant gauge here so the gauge ring keeps its vertical room. */
|
|
377
|
-
@container (max-height: 110px) and (min-width: 320px) {
|
|
390
|
+
@container (max-height: 110px) and (min-width: 380px) {
|
|
378
391
|
:host(:not([variant='gauge'])) .kpi {
|
|
379
392
|
flex-direction: row;
|
|
380
393
|
align-items: flex-start;
|
|
@@ -425,6 +438,12 @@ export const styles = css `
|
|
|
425
438
|
}
|
|
426
439
|
}
|
|
427
440
|
|
|
441
|
+
@container (max-width: 379.98px) and (max-height: 90px) {
|
|
442
|
+
:host([has-value][has-sparkline]:not([variant='gauge'])) .kpi-sparkline {
|
|
443
|
+
display: none;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
|
|
428
447
|
/* Constrained both ways — only show the value. */
|
|
429
448
|
|
|
430
449
|
|
|
@@ -443,6 +462,30 @@ export const styles = css `
|
|
|
443
462
|
}
|
|
444
463
|
}
|
|
445
464
|
|
|
465
|
+
@container (max-height: 150px) {
|
|
466
|
+
:host([has-sparkline]:not([variant='gauge'])) .kpi-description {
|
|
467
|
+
display: none;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
@container (max-width: 319.98px) and (max-height: 165px) {
|
|
472
|
+
:host([has-sparkline]:not([variant='gauge'])) .kpi-description {
|
|
473
|
+
display: none;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
@container (max-width: 319.98px) and (max-height: 110px) {
|
|
478
|
+
:host([has-value]) .kpi-label {
|
|
479
|
+
display: none;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
@container (max-height: 110px) {
|
|
484
|
+
:host([has-value][has-sparkline]:not([variant='gauge'])) .kpi-label {
|
|
485
|
+
display: none;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
|
|
446
489
|
/* ── Gauge variant ── */
|
|
447
490
|
|
|
448
491
|
.kpi--gauge {
|
|
@@ -481,7 +524,28 @@ export const styles = css `
|
|
|
481
524
|
}
|
|
482
525
|
|
|
483
526
|
.kpi--gauge .kpi-trend {
|
|
527
|
+
display: block;
|
|
528
|
+
width: 100%;
|
|
529
|
+
box-sizing: border-box;
|
|
484
530
|
margin: 0 auto;
|
|
531
|
+
overflow: hidden;
|
|
532
|
+
text-overflow: ellipsis;
|
|
533
|
+
white-space: nowrap;
|
|
534
|
+
/* Don't grow to fill the leftover height (the base .kpi-trend is flex:1 1 0) —
|
|
535
|
+
keep it to its text height so the gauge ring takes the space instead. */
|
|
536
|
+
flex: 0 0 auto;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
.kpi--gauge .kpi-trend-arrow {
|
|
540
|
+
display: inline-block;
|
|
541
|
+
vertical-align: middle;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
.kpi--gauge .kpi-trend-value,
|
|
545
|
+
.kpi--gauge .kpi-trend-label {
|
|
546
|
+
display: inline;
|
|
547
|
+
overflow: visible;
|
|
548
|
+
text-overflow: clip;
|
|
485
549
|
}
|
|
486
550
|
|
|
487
551
|
.kpi--gauge .kpi-description {
|
|
@@ -132,8 +132,12 @@ export declare class NileKpiChart extends NileElement {
|
|
|
132
132
|
private sparklineChart;
|
|
133
133
|
private gaugeChart;
|
|
134
134
|
private resizeObserver;
|
|
135
|
+
/** Latched once the fit safety-net has fallen back to inline-size (see _reconcileFit). */
|
|
136
|
+
private _fitInlineFallback;
|
|
135
137
|
/** Tooltip element on document.body — outside shadow DOM, never clipped. */
|
|
136
138
|
private _tipEl;
|
|
139
|
+
/** Hover marker on document.body — so the bubble isn't clipped by the card edge. */
|
|
140
|
+
private _markerEl;
|
|
137
141
|
private sparklineContainer;
|
|
138
142
|
private gaugeContainer;
|
|
139
143
|
private gaugeSlot;
|
|
@@ -250,6 +254,7 @@ export declare class NileKpiChart extends NileElement {
|
|
|
250
254
|
embedInNileChart: boolean;
|
|
251
255
|
private _createTipEl;
|
|
252
256
|
private _showTip;
|
|
257
|
+
private _showMarker;
|
|
253
258
|
private _hideTip;
|
|
254
259
|
private _syncCssVars;
|
|
255
260
|
private formatCssLength;
|
|
@@ -272,6 +277,7 @@ export declare class NileKpiChart extends NileElement {
|
|
|
272
277
|
private _syncGaugeNow;
|
|
273
278
|
private syncGaugeChartSize;
|
|
274
279
|
private syncSparklineChartSize;
|
|
280
|
+
private _reconcileFit;
|
|
275
281
|
private setupResizeObserver;
|
|
276
282
|
private _onSparklineMouseMove;
|
|
277
283
|
private _onSparklineMouseLeave;
|
|
@@ -22,8 +22,12 @@ let NileKpiChart = class NileKpiChart extends NileElement {
|
|
|
22
22
|
this.sparklineChart = null;
|
|
23
23
|
this.gaugeChart = null;
|
|
24
24
|
this.resizeObserver = null;
|
|
25
|
+
/** Latched once the fit safety-net has fallen back to inline-size (see _reconcileFit). */
|
|
26
|
+
this._fitInlineFallback = false;
|
|
25
27
|
/** Tooltip element on document.body — outside shadow DOM, never clipped. */
|
|
26
28
|
this._tipEl = null;
|
|
29
|
+
/** Hover marker on document.body — so the bubble isn't clipped by the card edge. */
|
|
30
|
+
this._markerEl = null;
|
|
27
31
|
/** Full configuration: `{ chart, aq }` (same convention as other Nile charts). */
|
|
28
32
|
this.config = null;
|
|
29
33
|
/** Display variant: default (flat), card (bordered container), gauge (Highcharts solid gauge). */
|
|
@@ -156,12 +160,15 @@ let NileKpiChart = class NileKpiChart extends NileElement {
|
|
|
156
160
|
if (!series?.points?.length)
|
|
157
161
|
return;
|
|
158
162
|
const rect = this.sparklineContainer.getBoundingClientRect();
|
|
159
|
-
const
|
|
160
|
-
|
|
163
|
+
const inverted = !!chart.inverted;
|
|
164
|
+
const xAxis = series.xAxis;
|
|
165
|
+
const yAxis = series.yAxis;
|
|
166
|
+
const mouseAlongCat = inverted ? e.clientY - rect.top : e.clientX - rect.left;
|
|
161
167
|
let nearest = series.points[0];
|
|
162
168
|
let minDist = Infinity;
|
|
163
169
|
for (const p of series.points) {
|
|
164
|
-
const
|
|
170
|
+
const catPix = xAxis.toPixels(p.x ?? 0, false);
|
|
171
|
+
const dist = Math.abs(catPix - mouseAlongCat);
|
|
165
172
|
if (dist < minDist) {
|
|
166
173
|
minDist = dist;
|
|
167
174
|
nearest = p;
|
|
@@ -169,9 +176,15 @@ let NileKpiChart = class NileKpiChart extends NileElement {
|
|
|
169
176
|
}
|
|
170
177
|
const scale = this.inferSparklineTooltipScale();
|
|
171
178
|
const text = this.getTooltipContent((nearest.y ?? 0) * scale);
|
|
172
|
-
const
|
|
173
|
-
const
|
|
179
|
+
const catScreen = xAxis.toPixels(nearest.x ?? 0, false);
|
|
180
|
+
const valScreen = yAxis.toPixels(nearest.y ?? 0, false);
|
|
181
|
+
const tipX = rect.left + (inverted ? valScreen : catScreen);
|
|
182
|
+
const tipY = rect.top + (inverted ? catScreen : valScreen);
|
|
174
183
|
this._showTip(text, tipX, tipY);
|
|
184
|
+
const isBarLike = this.sparklineType === 'bar' || this.sparklineType === 'column';
|
|
185
|
+
if (!isBarLike) {
|
|
186
|
+
this._showMarker(tipX, tipY, this.sparklineColor || '#005EA6');
|
|
187
|
+
}
|
|
175
188
|
};
|
|
176
189
|
this._onSparklineMouseLeave = () => {
|
|
177
190
|
this._hideTip();
|
|
@@ -234,6 +247,10 @@ let NileKpiChart = class NileKpiChart extends NileElement {
|
|
|
234
247
|
el.className = 'nile-kpi-tooltip';
|
|
235
248
|
document.body.appendChild(el);
|
|
236
249
|
this._tipEl = el;
|
|
250
|
+
const marker = document.createElement('div');
|
|
251
|
+
marker.className = 'nile-kpi-marker';
|
|
252
|
+
document.body.appendChild(marker);
|
|
253
|
+
this._markerEl = marker;
|
|
237
254
|
}
|
|
238
255
|
_showTip(text, x, y) {
|
|
239
256
|
if (!this._tipEl || !this.tooltipEnabled)
|
|
@@ -243,9 +260,20 @@ let NileKpiChart = class NileKpiChart extends NileElement {
|
|
|
243
260
|
this._tipEl.style.top = `${y}px`;
|
|
244
261
|
this._tipEl.style.display = 'block';
|
|
245
262
|
}
|
|
263
|
+
_showMarker(x, y, color) {
|
|
264
|
+
if (!this._markerEl || !this.tooltipEnabled)
|
|
265
|
+
return;
|
|
266
|
+
this._markerEl.style.left = `${x}px`;
|
|
267
|
+
this._markerEl.style.top = `${y}px`;
|
|
268
|
+
this._markerEl.style.backgroundColor = color;
|
|
269
|
+
this._markerEl.style.boxShadow = `0 0 0 4px ${color}33`;
|
|
270
|
+
this._markerEl.style.display = 'block';
|
|
271
|
+
}
|
|
246
272
|
_hideTip() {
|
|
247
273
|
if (this._tipEl)
|
|
248
274
|
this._tipEl.style.display = 'none';
|
|
275
|
+
if (this._markerEl)
|
|
276
|
+
this._markerEl.style.display = 'none';
|
|
249
277
|
}
|
|
250
278
|
// ── CSS custom property sync ─────────────────────────────────────────────
|
|
251
279
|
_syncCssVars() {
|
|
@@ -577,13 +605,15 @@ let NileKpiChart = class NileKpiChart extends NileElement {
|
|
|
577
605
|
const h = this.formatCssLength(c.height);
|
|
578
606
|
if (h) {
|
|
579
607
|
this.style.minHeight = h;
|
|
580
|
-
this.style.
|
|
608
|
+
this.style.height = h;
|
|
581
609
|
this.style.removeProperty('max-height');
|
|
610
|
+
this.setAttribute('size-container', '');
|
|
582
611
|
}
|
|
583
612
|
else {
|
|
584
613
|
this.style.removeProperty('min-height');
|
|
585
614
|
this.style.removeProperty('height');
|
|
586
615
|
this.style.removeProperty('max-height');
|
|
616
|
+
this.removeAttribute('size-container');
|
|
587
617
|
}
|
|
588
618
|
}
|
|
589
619
|
}
|
|
@@ -608,6 +638,8 @@ let NileKpiChart = class NileKpiChart extends NileElement {
|
|
|
608
638
|
this._hideTip();
|
|
609
639
|
this._tipEl?.remove();
|
|
610
640
|
this._tipEl = null;
|
|
641
|
+
this._markerEl?.remove();
|
|
642
|
+
this._markerEl = null;
|
|
611
643
|
this.destroyCharts();
|
|
612
644
|
this.resizeObserver?.disconnect();
|
|
613
645
|
this.resizeObserver = null;
|
|
@@ -617,8 +649,12 @@ let NileKpiChart = class NileKpiChart extends NileElement {
|
|
|
617
649
|
this.initSparkline();
|
|
618
650
|
this.initGauge();
|
|
619
651
|
this.setupResizeObserver();
|
|
652
|
+
requestAnimationFrame(() => this._reconcileFit());
|
|
620
653
|
}
|
|
621
654
|
updated(changedProperties) {
|
|
655
|
+
const hasValue = this.value !== '' && this.value !== null && this.value !== undefined;
|
|
656
|
+
this.toggleAttribute('has-value', hasValue);
|
|
657
|
+
this.toggleAttribute('has-sparkline', this.sparkline.length > 0);
|
|
622
658
|
if (changedProperties.has('config') && this.config) {
|
|
623
659
|
this.applyConfig(this.config);
|
|
624
660
|
return;
|
|
@@ -714,8 +750,27 @@ let NileKpiChart = class NileKpiChart extends NileElement {
|
|
|
714
750
|
this.sparklineContainer.addEventListener('mousemove', this._onSparklineMouseMove);
|
|
715
751
|
this.sparklineContainer.addEventListener('mouseleave', this._onSparklineMouseLeave);
|
|
716
752
|
}
|
|
753
|
+
_reconcileFit() {
|
|
754
|
+
if (!this.hasAttribute('fit')) {
|
|
755
|
+
if (this._fitInlineFallback) {
|
|
756
|
+
this.style.removeProperty('container-type');
|
|
757
|
+
this._fitInlineFallback = false;
|
|
758
|
+
}
|
|
759
|
+
return;
|
|
760
|
+
}
|
|
761
|
+
if (this._fitInlineFallback)
|
|
762
|
+
return; // already content-sizing
|
|
763
|
+
if (this.offsetParent === null)
|
|
764
|
+
return; // in a hidden subtree — not a real collapse
|
|
765
|
+
if (this.getBoundingClientRect().height < 1) {
|
|
766
|
+
// Collapsed: the parent gave no definite height. Content-size instead.
|
|
767
|
+
this.style.containerType = 'inline-size';
|
|
768
|
+
this._fitInlineFallback = true;
|
|
769
|
+
}
|
|
770
|
+
}
|
|
717
771
|
setupResizeObserver() {
|
|
718
772
|
this.resizeObserver = new ResizeObserver(() => {
|
|
773
|
+
this._reconcileFit();
|
|
719
774
|
this.syncSparklineChartSize();
|
|
720
775
|
this.syncGaugeChartSize();
|
|
721
776
|
});
|
|
@@ -763,6 +818,18 @@ let NileKpiChart = class NileKpiChart extends NileElement {
|
|
|
763
818
|
const isAreaLike = seriesType === 'area' || seriesType === 'areaspline';
|
|
764
819
|
const isBarLike = seriesType === 'column' || seriesType === 'bar';
|
|
765
820
|
const isScatter = seriesType === 'scatter';
|
|
821
|
+
const tightAxis = !isBarLike && !isScatter;
|
|
822
|
+
const nums = this.sparkline.filter(n => typeof n === 'number' && Number.isFinite(n));
|
|
823
|
+
let yAxisOptions = { visible: false };
|
|
824
|
+
let areaThreshold = null;
|
|
825
|
+
if (tightAxis && nums.length) {
|
|
826
|
+
const dMin = Math.min(...nums);
|
|
827
|
+
const dMax = Math.max(...nums);
|
|
828
|
+
const span = dMax - dMin;
|
|
829
|
+
const pad = span > 0 ? span * 0.15 : (Math.abs(dMax) * 0.1 || 1);
|
|
830
|
+
yAxisOptions = { visible: false, min: dMin - pad, max: dMax + pad, startOnTick: false, endOnTick: false };
|
|
831
|
+
areaThreshold = dMin - pad; // area fills from the line down to the plot bottom
|
|
832
|
+
}
|
|
766
833
|
const fillColor = isAreaLike
|
|
767
834
|
? {
|
|
768
835
|
fillColor: {
|
|
@@ -780,7 +847,7 @@ let NileKpiChart = class NileKpiChart extends NileElement {
|
|
|
780
847
|
borderWidth: 0,
|
|
781
848
|
pointPadding: 0.05,
|
|
782
849
|
groupPadding: 0.05,
|
|
783
|
-
states: { hover: { enabled:
|
|
850
|
+
states: { hover: { enabled: true, brightness: 0.15 } },
|
|
784
851
|
}
|
|
785
852
|
: isScatter
|
|
786
853
|
? {
|
|
@@ -789,19 +856,20 @@ let NileKpiChart = class NileKpiChart extends NileElement {
|
|
|
789
856
|
states: { hover: { enabled: false } },
|
|
790
857
|
}
|
|
791
858
|
: {
|
|
792
|
-
marker: { enabled: this.sparklineMarkers },
|
|
859
|
+
marker: { enabled: this.sparklineMarkers, states: { hover: { enabled: false } } },
|
|
793
860
|
lineWidth,
|
|
794
861
|
lineColor: brandColor,
|
|
795
862
|
color: brandColor,
|
|
796
863
|
...fillColor,
|
|
797
|
-
|
|
864
|
+
...(isAreaLike && areaThreshold !== null ? { threshold: areaThreshold } : {}),
|
|
865
|
+
states: { hover: { lineWidth, halo: null } },
|
|
798
866
|
};
|
|
799
867
|
const defaults = {
|
|
800
868
|
chart: { type: seriesType, height: this.sparklineHeight, margin: [2, 0, 2, 0], backgroundColor: 'transparent' },
|
|
801
869
|
title: { text: undefined },
|
|
802
870
|
subtitle: { text: undefined },
|
|
803
871
|
xAxis: { visible: false },
|
|
804
|
-
yAxis:
|
|
872
|
+
yAxis: yAxisOptions,
|
|
805
873
|
legend: { enabled: false },
|
|
806
874
|
tooltip: { enabled: false },
|
|
807
875
|
plotOptions: {
|