@aquera/nile-visualization 2.9.30 → 2.9.32
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 +14 -0
- package/dist/src/index.d.ts +7 -8
- package/dist/src/index.js +2 -3
- package/dist/src/internal/base/forecastable-chart.d.ts +59 -0
- package/dist/src/internal/base/forecastable-chart.js +149 -0
- package/dist/src/internal/{nile-chart-base.d.ts → base/nile-chart-base.d.ts} +1 -1
- package/dist/src/internal/{nile-chart-base.js → base/nile-chart-base.js} +1 -1
- package/dist/src/internal/echarts/echarts-provider.d.ts +28 -0
- package/dist/src/internal/echarts/echarts-provider.js +59 -0
- package/dist/src/internal/echarts/echarts-theme.d.ts +23 -0
- package/dist/src/internal/echarts/echarts-theme.js +91 -0
- package/dist/src/internal/echarts/index.d.ts +8 -0
- package/dist/src/internal/echarts/index.js +8 -0
- package/dist/src/internal/echarts/translate-config.d.ts +41 -0
- package/dist/src/internal/echarts/translate-config.js +460 -0
- package/dist/src/internal/types/aq-config.type.d.ts +2 -0
- package/dist/src/internal/types/chart-area-config.type.d.ts +4 -2
- package/dist/src/internal/types/chart-area-spline-config.type.d.ts +4 -2
- package/dist/src/internal/types/chart-column-config.type.d.ts +3 -2
- package/dist/src/internal/types/chart-line-config.type.d.ts +3 -2
- package/dist/src/internal/types/chart-spline-config.type.d.ts +3 -2
- package/dist/src/internal/types/index.d.ts +0 -1
- package/dist/src/internal/types/primitive-chart-config.type.d.ts +1 -2
- package/dist/src/internal/{chart-adapters.d.ts → utils/chart-adapters.d.ts} +1 -1
- package/dist/src/internal/{chart-adapters.js → utils/chart-adapters.js} +15 -3
- package/dist/src/internal/utils/chart-forecast.d.ts +126 -0
- package/dist/src/internal/utils/chart-forecast.js +297 -0
- package/dist/src/internal/{dashboard-adapters.d.ts → utils/dashboard-adapters.d.ts} +1 -1
- package/dist/src/internal/{utils.js → utils/deep-merge.js} +1 -1
- package/dist/src/internal/{resolve-widget-kind.d.ts → utils/resolve-widget-kind.d.ts} +1 -1
- package/dist/src/internal/utils/separated-chart-config.d.ts +13 -0
- package/dist/src/internal/utils/separated-chart-config.js +30 -0
- package/dist/src/nile-ai-panel/nile-ai-panel.d.ts +1 -1
- package/dist/src/nile-ai-panel/nile-ai-panel.js +1 -1
- package/dist/src/nile-ai-sender/nile-ai-sender.d.ts +1 -1
- package/dist/src/nile-ai-sender/nile-ai-sender.js +1 -1
- package/dist/src/nile-anomaly-chart/nile-anomaly-chart.d.ts +1 -1
- package/dist/src/nile-anomaly-chart/nile-anomaly-chart.js +4 -4
- package/dist/src/nile-area-chart/nile-area-chart.d.ts +7 -6
- package/dist/src/nile-area-chart/nile-area-chart.js +37 -24
- package/dist/src/nile-area-negative-chart/nile-area-negative-chart.d.ts +1 -1
- package/dist/src/nile-area-negative-chart/nile-area-negative-chart.js +5 -5
- package/dist/src/nile-area-range-chart/nile-area-range-chart.d.ts +1 -1
- package/dist/src/nile-area-range-chart/nile-area-range-chart.js +5 -5
- package/dist/src/nile-area-spline-chart/nile-area-spline-chart.d.ts +10 -4
- package/dist/src/nile-area-spline-chart/nile-area-spline-chart.js +38 -27
- package/dist/src/nile-bar-chart/nile-bar-chart.d.ts +3 -3
- package/dist/src/nile-bar-chart/nile-bar-chart.js +4 -4
- package/dist/src/nile-bellcurve-chart/nile-bellcurve-chart.d.ts +3 -2
- package/dist/src/nile-bellcurve-chart/nile-bellcurve-chart.js +5 -5
- package/dist/src/nile-boxplot-chart/nile-boxplot-chart.d.ts +3 -2
- package/dist/src/nile-boxplot-chart/nile-boxplot-chart.js +5 -5
- package/dist/src/nile-bubble-chart/nile-bubble-chart.d.ts +3 -3
- package/dist/src/nile-bubble-chart/nile-bubble-chart.js +4 -4
- package/dist/src/nile-chart/index.d.ts +2 -2
- package/dist/src/nile-chart/index.js +1 -1
- package/dist/src/nile-chart/nile-chart-config.d.ts +23 -32
- package/dist/src/nile-chart/nile-chart.css.js +6 -1
- package/dist/src/nile-chart/nile-chart.d.ts +15 -8
- package/dist/src/nile-chart/nile-chart.js +128 -61
- package/dist/src/nile-chart/nile-chart.smoke.test.d.ts +1 -0
- package/dist/src/nile-chart/nile-chart.smoke.test.js +87 -0
- package/dist/src/nile-chart-list/nile-chart-list.d.ts +1 -1
- package/dist/src/nile-chart-list/nile-chart-list.js +1 -1
- package/dist/src/nile-chart-message/nile-chart-message.d.ts +1 -1
- package/dist/src/nile-chart-message/nile-chart-message.js +1 -1
- package/dist/src/nile-cluster-chart/nile-cluster-chart.d.ts +3 -2
- package/dist/src/nile-cluster-chart/nile-cluster-chart.js +5 -5
- package/dist/src/nile-column-chart/nile-column-chart.d.ts +13 -6
- package/dist/src/nile-column-chart/nile-column-chart.js +43 -24
- package/dist/src/nile-column-drilldown-chart/nile-column-drilldown-chart.d.ts +1 -1
- package/dist/src/nile-column-drilldown-chart/nile-column-drilldown-chart.js +5 -5
- package/dist/src/nile-column-pyramid-chart/nile-column-pyramid-chart.d.ts +1 -1
- package/dist/src/nile-column-pyramid-chart/nile-column-pyramid-chart.js +5 -5
- package/dist/src/nile-column-range-chart/nile-column-range-chart.d.ts +1 -1
- package/dist/src/nile-column-range-chart/nile-column-range-chart.js +5 -5
- package/dist/src/nile-dashboard-builder/nile-dashboard-builder.d.ts +1 -1
- package/dist/src/nile-dashboard-builder/nile-dashboard-builder.js +2 -2
- package/dist/src/nile-dashboard-viewer/nile-dashboard-viewer.d.ts +1 -1
- package/dist/src/nile-dashboard-viewer/nile-dashboard-viewer.js +1 -1
- package/dist/src/nile-donut-chart/nile-donut-chart.d.ts +3 -3
- package/dist/src/nile-donut-chart/nile-donut-chart.js +4 -4
- package/dist/src/nile-dumbbell-chart/nile-dumbbell-chart.d.ts +1 -1
- package/dist/src/nile-dumbbell-chart/nile-dumbbell-chart.js +5 -5
- package/dist/src/nile-dumbbell-lower-chart/nile-dumbbell-lower-chart.d.ts +1 -1
- package/dist/src/nile-dumbbell-lower-chart/nile-dumbbell-lower-chart.js +5 -5
- package/dist/src/nile-dumbbell-upper-chart/nile-dumbbell-upper-chart.d.ts +1 -1
- package/dist/src/nile-dumbbell-upper-chart/nile-dumbbell-upper-chart.js +5 -5
- package/dist/src/nile-euler-chart/nile-euler-chart.d.ts +1 -1
- package/dist/src/nile-euler-chart/nile-euler-chart.js +5 -5
- package/dist/src/nile-executive-summary/nile-executive-summary.d.ts +1 -1
- package/dist/src/nile-executive-summary/nile-executive-summary.js +1 -1
- package/dist/src/nile-fan-chart/nile-fan-chart.d.ts +1 -1
- package/dist/src/nile-fan-chart/nile-fan-chart.js +5 -5
- package/dist/src/nile-filter-chart/nile-filter-chart.d.ts +1 -1
- package/dist/src/nile-filter-chart/nile-filter-chart.js +1 -1
- package/dist/src/nile-flame-chart/nile-flame-chart.d.ts +1 -1
- package/dist/src/nile-flame-chart/nile-flame-chart.js +5 -5
- package/dist/src/nile-funnel-chart/nile-funnel-chart.d.ts +1 -1
- package/dist/src/nile-funnel-chart/nile-funnel-chart.js +5 -5
- package/dist/src/nile-gauge-chart/nile-gauge-chart.d.ts +1 -1
- package/dist/src/nile-gauge-chart/nile-gauge-chart.js +4 -4
- package/dist/src/nile-heatmap-chart/nile-heatmap-chart.d.ts +3 -2
- package/dist/src/nile-heatmap-chart/nile-heatmap-chart.js +5 -5
- package/dist/src/nile-histogram-chart/nile-histogram-chart.d.ts +3 -2
- package/dist/src/nile-histogram-chart/nile-histogram-chart.js +5 -5
- package/dist/src/nile-inverted-area-chart/nile-inverted-area-chart.d.ts +1 -1
- package/dist/src/nile-inverted-area-chart/nile-inverted-area-chart.js +5 -5
- package/dist/src/nile-kpi-chart/nile-kpi-chart.css.js +41 -0
- package/dist/src/nile-kpi-chart/nile-kpi-chart.d.ts +31 -1
- package/dist/src/nile-kpi-chart/nile-kpi-chart.js +73 -3
- package/dist/src/nile-line-chart/nile-line-chart.d.ts +12 -6
- package/dist/src/nile-line-chart/nile-line-chart.js +44 -24
- package/dist/src/nile-line-column-chart/nile-line-column-chart.d.ts +1 -1
- package/dist/src/nile-line-column-chart/nile-line-column-chart.js +5 -5
- package/dist/src/nile-lollipop-chart/nile-lollipop-chart.d.ts +1 -1
- package/dist/src/nile-lollipop-chart/nile-lollipop-chart.js +5 -5
- package/dist/src/nile-map-chart/nile-map-chart.d.ts +2 -2
- package/dist/src/nile-map-chart/nile-map-chart.js +4 -4
- package/dist/src/nile-master-detail-chart/nile-master-detail-chart.d.ts +1 -1
- package/dist/src/nile-master-detail-chart/nile-master-detail-chart.js +5 -5
- package/dist/src/nile-organization-chart/nile-organization-chart.d.ts +1 -1
- package/dist/src/nile-organization-chart/nile-organization-chart.js +5 -5
- package/dist/src/nile-pie-chart/nile-pie-chart.d.ts +1 -1
- package/dist/src/nile-pie-chart/nile-pie-chart.js +4 -4
- package/dist/src/nile-polygon-chart/nile-polygon-chart.d.ts +1 -1
- package/dist/src/nile-polygon-chart/nile-polygon-chart.js +5 -5
- package/dist/src/nile-radar-chart/nile-radar-chart.d.ts +3 -3
- package/dist/src/nile-radar-chart/nile-radar-chart.js +4 -4
- package/dist/src/nile-radial-bar-chart/nile-radial-bar-chart.d.ts +3 -2
- package/dist/src/nile-radial-bar-chart/nile-radial-bar-chart.js +5 -5
- package/dist/src/nile-scatter-chart/nile-scatter-chart.d.ts +3 -3
- package/dist/src/nile-scatter-chart/nile-scatter-chart.js +4 -4
- package/dist/src/nile-spiderweb-chart/nile-spiderweb-chart.d.ts +3 -2
- package/dist/src/nile-spiderweb-chart/nile-spiderweb-chart.js +5 -5
- package/dist/src/nile-spline-chart/nile-spline-chart.d.ts +8 -6
- package/dist/src/nile-spline-chart/nile-spline-chart.js +36 -24
- package/dist/src/nile-stacked-chart/nile-stacked-chart.d.ts +3 -2
- package/dist/src/nile-stacked-chart/nile-stacked-chart.js +5 -5
- package/dist/src/nile-timeline-chart/nile-timeline-chart.d.ts +1 -1
- package/dist/src/nile-timeline-chart/nile-timeline-chart.js +5 -5
- package/dist/src/nile-trendline-chart/nile-trendline-chart.d.ts +1 -1
- package/dist/src/nile-trendline-chart/nile-trendline-chart.js +4 -4
- package/dist/src/nile-variable-pie-chart/nile-variable-pie-chart.d.ts +3 -2
- package/dist/src/nile-variable-pie-chart/nile-variable-pie-chart.js +5 -5
- package/dist/src/nile-vector-chart/nile-vector-chart.d.ts +1 -1
- package/dist/src/nile-vector-chart/nile-vector-chart.js +5 -5
- package/dist/src/nile-waterfall-chart/nile-waterfall-chart.d.ts +3 -3
- package/dist/src/nile-waterfall-chart/nile-waterfall-chart.js +4 -4
- package/dist/src/nile-widget-viewer/nile-widget-viewer.css.js +6 -2
- package/dist/src/nile-widget-viewer/nile-widget-viewer.d.ts +1 -1
- package/dist/src/nile-widget-viewer/nile-widget-viewer.js +2 -2
- package/dist/src/nile-xrange-chart/nile-xrange-chart.d.ts +3 -2
- package/dist/src/nile-xrange-chart/nile-xrange-chart.js +5 -5
- package/package.json +10 -6
- package/dist/src/internal/separated-chart-config.d.ts +0 -5
- package/dist/src/internal/separated-chart-config.js +0 -16
- package/dist/src/internal/types/chart-forecast-config.type.d.ts +0 -35
- package/dist/src/internal/types/chart-forecast-config.type.js +0 -2
- package/dist/src/nile-forecast-chart/index.d.ts +0 -2
- package/dist/src/nile-forecast-chart/index.js +0 -2
- package/dist/src/nile-forecast-chart/nile-forecast-chart.css.d.ts +0 -1
- package/dist/src/nile-forecast-chart/nile-forecast-chart.css.js +0 -46
- package/dist/src/nile-forecast-chart/nile-forecast-chart.d.ts +0 -90
- package/dist/src/nile-forecast-chart/nile-forecast-chart.js +0 -551
- /package/dist/src/internal/{nile-element.d.ts → base/nile-element.d.ts} +0 -0
- /package/dist/src/internal/{nile-element.js → base/nile-element.js} +0 -0
- /package/dist/src/internal/{chart-events.d.ts → utils/chart-events.d.ts} +0 -0
- /package/dist/src/internal/{chart-events.js → utils/chart-events.js} +0 -0
- /package/dist/src/internal/{chart-runtime.d.ts → utils/chart-runtime.d.ts} +0 -0
- /package/dist/src/internal/{chart-runtime.js → utils/chart-runtime.js} +0 -0
- /package/dist/src/internal/{dashboard-adapters.js → utils/dashboard-adapters.js} +0 -0
- /package/dist/src/internal/{utils.d.ts → utils/deep-merge.d.ts} +0 -0
- /package/dist/src/internal/{highcharts-provider.d.ts → utils/highcharts-provider.d.ts} +0 -0
- /package/dist/src/internal/{highcharts-provider.js → utils/highcharts-provider.js} +0 -0
- /package/dist/src/internal/{resolve-widget-kind.js → utils/resolve-widget-kind.js} +0 -0
- /package/dist/src/internal/{responsive-defaults.d.ts → utils/responsive-defaults.d.ts} +0 -0
- /package/dist/src/internal/{responsive-defaults.js → utils/responsive-defaults.js} +0 -0
package/README.md
CHANGED
|
@@ -36,6 +36,20 @@ 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.32 (September 10, 2026)
|
|
40
|
+
- Nile Chart: Added the `noBorder` config option — set `noBorder: true` on the chart config (root or `aq`) to remove the `border-bottom` divider under the card header, so the header and the plot read as one surface. Header padding, titles and actions are untouched; it composes with `noPadding` and has no effect when the header is hidden via `noHeader`. Reflected as the `no-border` attribute, so `<nile-chart no-border>` and `el.noBorder = true` work too, and the config is kept in sync both ways — assigning a config that omits `noBorder` clears it again, the same as `noHeader` / `noPadding`. Example at `examples/no-border.html` (UIF-1352)
|
|
41
|
+
|
|
42
|
+
#### Version 2.9.31 (August 3, 2026)
|
|
43
|
+
- Nile Charts: **Forecasting moved off the dedicated chart type and onto the ordinary ones.** `<nile-line-chart>`, `<nile-spline-chart>`, `<nile-area-chart>`, `<nile-area-spline-chart>` and `<nile-column-chart>` (and the matching `<nile-chart type="line" | "spline" | "area" | "areaSpline" | "column">`) each take `enableForecasting`, a `projection` config, and series shaped `{ actual, projected, interval }` — all five delegate to one shared util, `internal/chart-forecast.ts`, so the boundary marker, the dashed span, the tinted region and the confidence band are derived identically. Everything is index based: `actual` lines up with the leading `categories` and `projected` continues from where it stops. `projection` carries `start`, `color`, `dashStyle`, `showNowLine`, `nowLabel`, `nowLineColor`, `bandLabel`, `bandColor` and an `interval` block (`name`, `color`, `opacity`, `level`, `label`); per-series `forecastColor`, `forecastDashStyle`, `intervalName`, `intervalColor`, `intervalOpacity`, `intervalLevel` and `intervalLabel` override it. Confidence bands render as an `arearange` pinned to the boundary so the cone opens out of the last measured point, appended after the real series and painted underneath by `zIndex` (so a `chart.update()` that drops a band can't leak its `lineWidth: 0` onto the line), non-interactive with its bounds reaching the tooltip through a `pointFormatter` (`80% CI: 491 – 499`). Columns get no band and no dash — `projection.color` is their only cue, and their whole split (marker, plot band and zone) sits half a category later, since Highcharts assigns a discrete point at exactly the zone value to the next zone and would otherwise recolor the last measured column. `nile-chart-click` now reports `forecast: boolean` on these five charts, and `xAxisTitle` was added to all of them. Turning `enableForecasting` off plots `actual` only — the projection is dropped, not folded into the line — and clears the overlay with it. Gaining or losing a projection animates in both directions: `chart.update()` is passed `FORECAST_UPDATE_ANIMATION`, and because Highcharts morphs a graph path only when the point count is unchanged, the exit runs in two phases (`animateForecastExit`) — the projected values are first pinned to the boundary so the line folds back and the confidence cone closes, then the measured-only series replaces it. A series can take `axis: 'secondary'` to sit on an opposite y-axis (`secondaryAxisTitle`, `secondaryAxisMin`), which is only emitted when some series asks for it, and per-series `type` mixes shapes in one chart — a `column` series inside a `spline` chart keeps column behaviour. Documented in `src/internal/chart-forecast.md`; demo at `demo/forecast.html`, and a migration reference in the same doc (UIF-1316)
|
|
44
|
+
- Nile Forecast Chart: **Removed** `<nile-forecast-chart>`, `<nile-chart type="forecast">`, the `./nile-forecast-chart` package subpath, and the `NileForecastChartConfig` / `ChartForecastConfigType` / `ForecastSeriesData` / `ForecastPoint` types. Use `enableForecasting` on the chart type you actually want; the exported forecast types are now `ForecastSeriesInput`, `ForecastIntervalRange`, `ForecastIntervalConfig`, `ForecastProjectionConfig` and `ForecastConfigFields`. The datetime-axis form is gone — label your categories instead. Converting a forecast `column` config to `bar`, `stacked` or `pie` flattens the projection into the series, since those types can't draw one (UIF-1316)
|
|
45
|
+
|
|
46
|
+
- Nile KPI Chart: Added a projected-value line under the number — `forecastValue` with `forecastLabel` renders as `✦ ~1,058 in 6 mo`, accent-colored and sparkle-marked so a projection can't be mistaken for an actual. It is formatted with the tile's own `valueFormat` / `numberSystem` and carries its `prefix` / `suffix`, so `2.8%` projects as `~3.1%`; `forecastApprox` (default `true`) controls the `~` and `forecastColor` / `--nile-kpi-forecast-color` the accent. `forecastValue: null` (the default) renders nothing, so tiles without a projection are unchanged, and the aria label speaks the unabbreviated number. Exposed as `part="forecast"` and reachable through `<nile-chart type="kpi">`. The sparkline itself is deliberately not forecast-capable — at 48px with a hidden axis there is no room for a boundary marker or confidence band, and the KPI hand-rolls its own sparkline tooltip (UIF-1316)
|
|
47
|
+
- Nile Chart: The forecast boundary label now renders as a dark pill inside the plot instead of loose grey axis text, which was easy to miss and easy to read as an axis tick; it uses `useHTML` (plot-line labels are SVG text with no background box) and sets `pointer-events: none` so it never steals a hover from the series beneath it (UIF-1316)
|
|
48
|
+
|
|
49
|
+
- Nile Charts: A primitive `<nile-*-chart>` now accepts the flat `config` shape that `<nile-chart>` takes, not just the separated `{ chart, aq }` form. Previously the flat form rendered nothing at all and reported nothing — `applyConfig` read `cfg.chart`, got `undefined` and returned — so a config copied from a `<nile-chart>` example silently produced an empty chart. A flat config is unmistakable (`type`/`data` at the top level, no `chart` key), so `normalizeChartConfig` treats it as the chart slice and lifts `chartTitle` / `chartSubtitle` into `aq`. Wired into `nile-line-chart`, `nile-spline-chart`, `nile-area-chart`, `nile-column-chart` and (via `applySeparatedChartConfig`) `nile-area-spline-chart`. `<nile-chart>` already accepted the separated form, so both element kinds now take both shapes and a config can move between them unchanged; the separated form remains the one to prefer, since it keeps header metadata in `aq` separate from the plot config (UIF-1316)
|
|
50
|
+
|
|
51
|
+
- Nile Widget Viewer: Removed display of kpi-chart as block, so that it doesn't render as broken. (UIF-1310)
|
|
52
|
+
|
|
39
53
|
#### Version 2.9.30 (July 28, 2026)
|
|
40
54
|
- Nile Forecast Chart: Added the `forecast` chart type (`<nile-forecast-chart>`) — a datetime series split into a measured half and a projected half. Pass measured series in `data` and projected series in `forecastData` (paired by series `name`), or put the whole timeline in `data` and mark the split with `forecastStart`; with no projection it renders as an ordinary time-series chart, so a chart can gain its forecast later without re-mounting. The projected half is dashed (`forecastDashStyle`, default `Dot`) or, for `column` series, recolored via `forecastColor`, with a labeled boundary marker (`showNowLine`, `nowLabel`, `nowLineColor`) and an optional tinted region (`forecastBandLabel`, `forecastBandColor`). Series support `type` (`line` | `spline` | `area` | `areaspline` | `column`), a secondary y-axis via `axis: 'secondary'` (`secondaryAxisTitle`, `secondaryAxisMin`), `valueSuffix`, `showMarkers`, `lineWidth`, and `fillOpacity`. Set `timezone` (IANA) to align the datetime axis with the boundary. Emits `nile-chart-ready`, `nile-chart-click` (`{ point, x, value, seriesName, forecast }`) and `nile-chart-selection`; exposes `setForecast()`, `clearForecast()`, and `resetZoom()` (UIF-1316)
|
|
41
55
|
- Nile Chart: Drag-to-zoom on the forecast chart (`zoom`, default `true`) uses the header reset-zoom control rather than Highcharts' in-plot reset button — the chart intercepts the selection, applies the extremes itself, and reports `nile-chart-selection`; the header button now serves both `master-detail` and `forecast` (UIF-1316)
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { NileChartEvents } from './internal/chart-events.js';
|
|
2
|
-
export type { NileChartEventName } from './internal/chart-events.js';
|
|
1
|
+
export { NileChartEvents } from './internal/utils/chart-events.js';
|
|
2
|
+
export type { NileChartEventName } from './internal/utils/chart-events.js';
|
|
3
3
|
export { NileBarChart } from './nile-bar-chart/index.js';
|
|
4
4
|
export type { BarChartSeriesData } from './nile-bar-chart/index.js';
|
|
5
5
|
export { NilePieChart } from './nile-pie-chart/index.js';
|
|
@@ -15,8 +15,8 @@ export { NileChart } from './nile-chart/index.js';
|
|
|
15
15
|
export type { NileChartConfig, NileBarChartConfig, NilePieChartConfig, NileTrendlineChartConfig, NileAnomalyChartConfig, NileLineChartConfig, NileAreaChartConfig, NileColumnChartConfig, NileDonutChartConfig, NileScatterChartConfig, NileBubbleChartConfig, NileSplineChartConfig, NileRadarChartConfig, NileGaugeChartConfig, NileWaterfallChartConfig, NileMapChartConfig, NileMasterDetailChartConfig, NileKpiChartConfig, NileListChartConfig, NileMessageChartConfig, ChartType, SwitchAggregation, NileAiConfig, NileChartMenuConfig, NileChartMenuItem, } from './nile-chart/index.js';
|
|
16
16
|
export { convertConfig, registerAdapter } from './nile-chart/index.js';
|
|
17
17
|
export { nileChartConfig } from './nile-chart/index.js';
|
|
18
|
-
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, ChartMasterDetailConfigType, ChartDumbbellConfigType, ChartDumbbellLowerConfigType, ChartDumbbellUpperConfigType, ChartColumnPyramidConfigType, ChartLollipopConfigType, ChartAreaSplineConfigType, ChartAreaNegativeConfigType, ChartAreaRangeConfigType, ChartColumnRangeConfigType, ChartColumnDrilldownConfigType, ChartRadialBarConfigType, ChartVariablePieConfigType, ChartEulerConfigType, ChartPolygonConfigType, ChartVectorConfigType, ChartXrangeConfigType, ChartFanConfigType,
|
|
19
|
-
export type { SeparatedChartDemoConfig } from './internal/separated-chart-config.js';
|
|
18
|
+
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, ChartMasterDetailConfigType, 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 './nile-chart/index.js';
|
|
19
|
+
export type { SeparatedChartDemoConfig } from './internal/utils/separated-chart-config.js';
|
|
20
20
|
export { NileLineChart } from './nile-line-chart/index.js';
|
|
21
21
|
export type { LineChartSeriesData } from './nile-line-chart/index.js';
|
|
22
22
|
export { NileAreaChart } from './nile-area-chart/index.js';
|
|
@@ -71,8 +71,7 @@ export { NileXrangeChart } from './nile-xrange-chart/index.js';
|
|
|
71
71
|
export type { XrangeDataPoint } from './nile-xrange-chart/index.js';
|
|
72
72
|
export { NileFanChart } from './nile-fan-chart/index.js';
|
|
73
73
|
export type { FanLinePoint, FanUncertaintyBand } from './nile-fan-chart/index.js';
|
|
74
|
-
export {
|
|
75
|
-
export type { ForecastSeriesData, ForecastPoint, ForecastSeriesType, ForecastDashStyle } from './nile-forecast-chart/index.js';
|
|
74
|
+
export type { ForecastSeriesInput, ForecastIntervalRange, ForecastIntervalConfig, ForecastProjectionConfig, ForecastConfigFields, ForecastSeriesType, ForecastDashStyle, } from './internal/utils/chart-forecast.js';
|
|
76
75
|
export { NileDonutChart } from './nile-donut-chart/index.js';
|
|
77
76
|
export type { DonutChartSeriesData } from './nile-donut-chart/index.js';
|
|
78
77
|
export { NileScatterChart } from './nile-scatter-chart/index.js';
|
|
@@ -105,7 +104,7 @@ export { NileFilterChart } from './nile-filter-chart/index.js';
|
|
|
105
104
|
export type { FilterChartSeparatedPayload, FilterControl, FilterOption, FilterChartConfig, } from './nile-filter-chart/nile-filter-chart.js';
|
|
106
105
|
export { NileMapChart } from './nile-map-chart/index.js';
|
|
107
106
|
export type { MapChartDataPoint } from './nile-map-chart/index.js';
|
|
108
|
-
export type { ChartExtremes, SetExtremesOptions, MapBounds, } from './internal/chart-runtime.js';
|
|
107
|
+
export type { ChartExtremes, SetExtremesOptions, MapBounds, } from './internal/utils/chart-runtime.js';
|
|
109
108
|
export { NileAiSender } from './nile-ai-sender/index.js';
|
|
110
109
|
export { NileAiPanel } from './nile-ai-panel/index.js';
|
|
111
110
|
export { NileWidgetViewer } from './nile-widget-viewer/index.js';
|
|
@@ -113,7 +112,7 @@ export type { NileWidgetConfig, NileWidgetChartConfig, NileWidgetKpiConfig, Widg
|
|
|
113
112
|
export { NileDashboardViewer } from './nile-dashboard-viewer/index.js';
|
|
114
113
|
export type { NileDashboardConfig } from './nile-dashboard-viewer/index.js';
|
|
115
114
|
export { NileDashboardBuilder } from './nile-dashboard-builder/index.js';
|
|
116
|
-
export { fromApiDashboardResponse } from './internal/dashboard-adapters.js';
|
|
115
|
+
export { fromApiDashboardResponse } from './internal/utils/dashboard-adapters.js';
|
|
117
116
|
export { NileExecutiveSummary } from './nile-executive-summary/index.js';
|
|
118
117
|
export type { NileExecutiveSummaryConfig } from './nile-executive-summary/index.js';
|
|
119
118
|
export { NileChartList } from './nile-chart-list/index.js';
|
package/dist/src/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// console.log(`[nile-visualization] Build: ${__NILE_BUILD_DATE__}`);
|
|
3
3
|
// /* eslint-enable no-console */
|
|
4
4
|
// Names of all Highcharts-derived events forwarded as `nile-*` CustomEvents on charts.
|
|
5
|
-
export { NileChartEvents } from './internal/chart-events.js';
|
|
5
|
+
export { NileChartEvents } from './internal/utils/chart-events.js';
|
|
6
6
|
export { NileBarChart } from './nile-bar-chart/index.js';
|
|
7
7
|
export { NilePieChart } from './nile-pie-chart/index.js';
|
|
8
8
|
export { NileTrendlineChart } from './nile-trendline-chart/index.js';
|
|
@@ -39,7 +39,6 @@ export { NilePolygonChart } from './nile-polygon-chart/index.js';
|
|
|
39
39
|
export { NileVectorChart } from './nile-vector-chart/index.js';
|
|
40
40
|
export { NileXrangeChart } from './nile-xrange-chart/index.js';
|
|
41
41
|
export { NileFanChart } from './nile-fan-chart/index.js';
|
|
42
|
-
export { NileForecastChart } from './nile-forecast-chart/index.js';
|
|
43
42
|
export { NileDonutChart } from './nile-donut-chart/index.js';
|
|
44
43
|
export { NileScatterChart } from './nile-scatter-chart/index.js';
|
|
45
44
|
export { NileBubbleChart } from './nile-bubble-chart/index.js';
|
|
@@ -61,7 +60,7 @@ export { NileAiPanel } from './nile-ai-panel/index.js';
|
|
|
61
60
|
export { NileWidgetViewer } from './nile-widget-viewer/index.js';
|
|
62
61
|
export { NileDashboardViewer } from './nile-dashboard-viewer/index.js';
|
|
63
62
|
export { NileDashboardBuilder } from './nile-dashboard-builder/index.js';
|
|
64
|
-
export { fromApiDashboardResponse } from './internal/dashboard-adapters.js';
|
|
63
|
+
export { fromApiDashboardResponse } from './internal/utils/dashboard-adapters.js';
|
|
65
64
|
export { NileExecutiveSummary } from './nile-executive-summary/index.js';
|
|
66
65
|
export { NileChartList } from './nile-chart-list/index.js';
|
|
67
66
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type Highcharts from 'highcharts';
|
|
2
|
+
import type { PropertyValues } from 'lit';
|
|
3
|
+
import NileChartBase from './nile-chart-base.js';
|
|
4
|
+
import { NO_FORECAST, type ForecastConfigFields, type ForecastProjectionConfig, type ForecastResult, type ForecastSeriesInput, type ForecastSeriesType } from '../utils/chart-forecast.js';
|
|
5
|
+
/**
|
|
6
|
+
* Base class for the five category-axis charts that can carry a projection
|
|
7
|
+
* (`line`, `spline`, `area`, `areaSpline`, `column`) — owns the shared
|
|
8
|
+
* property wiring around `chart-forecast.ts`'s derivation.
|
|
9
|
+
*/
|
|
10
|
+
export default class NileForecastableChart extends NileChartBase {
|
|
11
|
+
protected chartSeriesType: ForecastSeriesType;
|
|
12
|
+
enableForecasting: boolean;
|
|
13
|
+
/** How the projected half is drawn. See `ForecastProjectionConfig`. */
|
|
14
|
+
projection: ForecastProjectionConfig | null;
|
|
15
|
+
/** Forecast input — line width for every series that doesn't set its own. Unused for `column`. */
|
|
16
|
+
lineWidth: number | null;
|
|
17
|
+
/** Forecast input — show point markers. Default `false`. Unused for `column`. */
|
|
18
|
+
showMarkers: boolean;
|
|
19
|
+
/** Forecast input — tooltip value suffix for every series that doesn't set its own. */
|
|
20
|
+
valueSuffix: string;
|
|
21
|
+
/** Forecast input — area fill opacity. Only read by `area` / `areaSpline`. */
|
|
22
|
+
fillOpacity: number | null;
|
|
23
|
+
/** Title for the x-axis. Not forecast-specific — applied either way. */
|
|
24
|
+
xAxisTitle: string;
|
|
25
|
+
/**
|
|
26
|
+
* Title for the opposite y-axis. Only rendered when some series sets
|
|
27
|
+
* `axis: 'secondary'` — there is no second axis to title otherwise.
|
|
28
|
+
*/
|
|
29
|
+
secondaryAxisTitle: string;
|
|
30
|
+
/** Floor for the secondary axis. `null` lets Highcharts pick it from the data. */
|
|
31
|
+
secondaryAxisMin: number | null;
|
|
32
|
+
/** The property names a subclass must watch in `updated()`. Spread into its list. */
|
|
33
|
+
protected static readonly FORECASTABLE_PROPS: readonly string[];
|
|
34
|
+
/** Pending phase 2 of the forecast exit animation; see `animateForecastExit`. */
|
|
35
|
+
private forecastExitTimer;
|
|
36
|
+
protected get forecastData(): ForecastSeriesInput[];
|
|
37
|
+
protected get forecastCategories(): string[];
|
|
38
|
+
/** Copies the forecast fields off a `{ chart }` config slice. */
|
|
39
|
+
protected applyForecastableConfig(c: ForecastConfigFields): void;
|
|
40
|
+
/**
|
|
41
|
+
* The forecast overlay for the current state, or the empty overlay.
|
|
42
|
+
*
|
|
43
|
+
* Always returns something: the empty arrays are what clear a previous
|
|
44
|
+
* overlay, since `chart.update()` leaves an omitted key in place.
|
|
45
|
+
*
|
|
46
|
+
* @param retract build the collapsed frame — phase 1 of the exit animation.
|
|
47
|
+
*/
|
|
48
|
+
protected forecastOverlay(retract?: boolean): ForecastResult | typeof NO_FORECAST & {
|
|
49
|
+
series?: undefined;
|
|
50
|
+
};
|
|
51
|
+
protected forecastSeries(overlay: {
|
|
52
|
+
series?: Highcharts.SeriesOptionsType[];
|
|
53
|
+
}): Highcharts.SeriesOptionsType[];
|
|
54
|
+
protected forecastYAxis(primary: Highcharts.YAxisOptions, hasSecondaryAxis: boolean): Highcharts.YAxisOptions | Highcharts.YAxisOptions[];
|
|
55
|
+
/** True when the clicked x sits past the boundary. For `nile-chart-click`. */
|
|
56
|
+
protected isForecastPoint(x: unknown, boundary: number): boolean;
|
|
57
|
+
protected updateChart(chart: Highcharts.Chart, changedProperties: PropertyValues, build: (retract?: boolean) => Highcharts.Options): void;
|
|
58
|
+
disconnectedCallback(): void;
|
|
59
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
|
+
import NileChartBase from './nile-chart-base.js';
|
|
4
|
+
import { animateForecastExit, applyForecastConfig, buildForecast, FORECAST_UPDATE_ANIMATION, FORECAST_WATCHED_PROPS, hasForecastSeries, NO_FORECAST, plainForecastSeries, } from '../utils/chart-forecast.js';
|
|
5
|
+
/**
|
|
6
|
+
* Base class for the five category-axis charts that can carry a projection
|
|
7
|
+
* (`line`, `spline`, `area`, `areaSpline`, `column`) — owns the shared
|
|
8
|
+
* property wiring around `chart-forecast.ts`'s derivation.
|
|
9
|
+
*/
|
|
10
|
+
class NileForecastableChart extends NileChartBase {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.chartSeriesType = 'line';
|
|
14
|
+
this.enableForecasting = false;
|
|
15
|
+
/** How the projected half is drawn. See `ForecastProjectionConfig`. */
|
|
16
|
+
this.projection = null;
|
|
17
|
+
/** Forecast input — line width for every series that doesn't set its own. Unused for `column`. */
|
|
18
|
+
this.lineWidth = null;
|
|
19
|
+
/** Forecast input — show point markers. Default `false`. Unused for `column`. */
|
|
20
|
+
this.showMarkers = false;
|
|
21
|
+
/** Forecast input — tooltip value suffix for every series that doesn't set its own. */
|
|
22
|
+
this.valueSuffix = '';
|
|
23
|
+
/** Forecast input — area fill opacity. Only read by `area` / `areaSpline`. */
|
|
24
|
+
this.fillOpacity = null;
|
|
25
|
+
/** Title for the x-axis. Not forecast-specific — applied either way. */
|
|
26
|
+
this.xAxisTitle = '';
|
|
27
|
+
/**
|
|
28
|
+
* Title for the opposite y-axis. Only rendered when some series sets
|
|
29
|
+
* `axis: 'secondary'` — there is no second axis to title otherwise.
|
|
30
|
+
*/
|
|
31
|
+
this.secondaryAxisTitle = '';
|
|
32
|
+
/** Floor for the secondary axis. `null` lets Highcharts pick it from the data. */
|
|
33
|
+
this.secondaryAxisMin = null;
|
|
34
|
+
/** Pending phase 2 of the forecast exit animation; see `animateForecastExit`. */
|
|
35
|
+
this.forecastExitTimer = 0;
|
|
36
|
+
}
|
|
37
|
+
get forecastData() {
|
|
38
|
+
return this.data ?? [];
|
|
39
|
+
}
|
|
40
|
+
get forecastCategories() {
|
|
41
|
+
return this.categories ?? [];
|
|
42
|
+
}
|
|
43
|
+
/** Copies the forecast fields off a `{ chart }` config slice. */
|
|
44
|
+
applyForecastableConfig(c) {
|
|
45
|
+
applyForecastConfig(this, c);
|
|
46
|
+
const fill = c.fillOpacity;
|
|
47
|
+
if (fill !== undefined)
|
|
48
|
+
this.fillOpacity = fill;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The forecast overlay for the current state, or the empty overlay.
|
|
52
|
+
*
|
|
53
|
+
* Always returns something: the empty arrays are what clear a previous
|
|
54
|
+
* overlay, since `chart.update()` leaves an omitted key in place.
|
|
55
|
+
*
|
|
56
|
+
* @param retract build the collapsed frame — phase 1 of the exit animation.
|
|
57
|
+
*/
|
|
58
|
+
forecastOverlay(retract = false) {
|
|
59
|
+
if (!(this.enableForecasting || retract) || !hasForecastSeries(this.forecastData)) {
|
|
60
|
+
// A secondary axis is a per-series display concern, not tied to whether
|
|
61
|
+
// the projection overlay itself is drawing — so it survives here too.
|
|
62
|
+
return {
|
|
63
|
+
...NO_FORECAST,
|
|
64
|
+
hasSecondaryAxis: this.forecastData.some(s => s.axis === 'secondary'),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
return buildForecast({
|
|
68
|
+
seriesType: this.chartSeriesType,
|
|
69
|
+
data: this.forecastData,
|
|
70
|
+
categories: this.forecastCategories,
|
|
71
|
+
projection: this.projection,
|
|
72
|
+
...(this.lineWidth !== null ? { lineWidth: this.lineWidth } : {}),
|
|
73
|
+
...(this.fillOpacity !== null ? { fillOpacity: this.fillOpacity } : {}),
|
|
74
|
+
showMarkers: this.showMarkers,
|
|
75
|
+
valueSuffix: this.valueSuffix,
|
|
76
|
+
retract,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
forecastSeries(overlay) {
|
|
80
|
+
return overlay.series
|
|
81
|
+
?? plainForecastSeries(this.chartSeriesType, this.forecastData, {
|
|
82
|
+
showMarkers: this.showMarkers,
|
|
83
|
+
...(this.lineWidth !== null ? { lineWidth: this.lineWidth } : {}),
|
|
84
|
+
...(this.fillOpacity !== null ? { fillOpacity: this.fillOpacity } : {}),
|
|
85
|
+
valueSuffix: this.valueSuffix,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
forecastYAxis(primary, hasSecondaryAxis) {
|
|
89
|
+
if (!hasSecondaryAxis)
|
|
90
|
+
return primary;
|
|
91
|
+
return [
|
|
92
|
+
primary,
|
|
93
|
+
{
|
|
94
|
+
title: { text: this.secondaryAxisTitle || undefined },
|
|
95
|
+
opposite: true,
|
|
96
|
+
// No second gridline set — two overlaid grids read as noise.
|
|
97
|
+
gridLineWidth: 0,
|
|
98
|
+
...(this.secondaryAxisMin !== null ? { min: this.secondaryAxisMin } : {}),
|
|
99
|
+
},
|
|
100
|
+
];
|
|
101
|
+
}
|
|
102
|
+
/** True when the clicked x sits past the boundary. For `nile-chart-click`. */
|
|
103
|
+
isForecastPoint(x, boundary) {
|
|
104
|
+
return typeof x === 'number' && boundary >= 0 && x > boundary;
|
|
105
|
+
}
|
|
106
|
+
updateChart(chart, changedProperties, build) {
|
|
107
|
+
if (changedProperties.get('enableForecasting') === true && !this.enableForecasting) {
|
|
108
|
+
this.forecastExitTimer = animateForecastExit(chart, { retracted: build(true), settled: build() }, this.forecastExitTimer);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
clearTimeout(this.forecastExitTimer);
|
|
112
|
+
chart.update(build(), true, true, FORECAST_UPDATE_ANIMATION);
|
|
113
|
+
}
|
|
114
|
+
disconnectedCallback() {
|
|
115
|
+
super.disconnectedCallback();
|
|
116
|
+
clearTimeout(this.forecastExitTimer);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/** The property names a subclass must watch in `updated()`. Spread into its list. */
|
|
120
|
+
NileForecastableChart.FORECASTABLE_PROPS = Object.freeze(['fillOpacity', ...FORECAST_WATCHED_PROPS]);
|
|
121
|
+
export default NileForecastableChart;
|
|
122
|
+
__decorate([
|
|
123
|
+
property({ type: Boolean, attribute: 'enable-forecasting' })
|
|
124
|
+
], NileForecastableChart.prototype, "enableForecasting", void 0);
|
|
125
|
+
__decorate([
|
|
126
|
+
property({ type: Object })
|
|
127
|
+
], NileForecastableChart.prototype, "projection", void 0);
|
|
128
|
+
__decorate([
|
|
129
|
+
property({ type: Number, attribute: 'line-width' })
|
|
130
|
+
], NileForecastableChart.prototype, "lineWidth", void 0);
|
|
131
|
+
__decorate([
|
|
132
|
+
property({ type: Boolean, attribute: 'show-markers' })
|
|
133
|
+
], NileForecastableChart.prototype, "showMarkers", void 0);
|
|
134
|
+
__decorate([
|
|
135
|
+
property({ type: String, attribute: 'value-suffix' })
|
|
136
|
+
], NileForecastableChart.prototype, "valueSuffix", void 0);
|
|
137
|
+
__decorate([
|
|
138
|
+
property({ type: Number, attribute: 'fill-opacity' })
|
|
139
|
+
], NileForecastableChart.prototype, "fillOpacity", void 0);
|
|
140
|
+
__decorate([
|
|
141
|
+
property({ type: String, attribute: 'x-axis-title' })
|
|
142
|
+
], NileForecastableChart.prototype, "xAxisTitle", void 0);
|
|
143
|
+
__decorate([
|
|
144
|
+
property({ type: String, attribute: 'secondary-axis-title' })
|
|
145
|
+
], NileForecastableChart.prototype, "secondaryAxisTitle", void 0);
|
|
146
|
+
__decorate([
|
|
147
|
+
property({ type: Number, attribute: 'secondary-axis-min' })
|
|
148
|
+
], NileForecastableChart.prototype, "secondaryAxisMin", void 0);
|
|
149
|
+
//# sourceMappingURL=forecastable-chart.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type Highcharts from 'highcharts';
|
|
2
2
|
import NileElement from './nile-element.js';
|
|
3
|
-
import { type ChartExtremes, type SetExtremesOptions } from '
|
|
3
|
+
import { type ChartExtremes, type SetExtremesOptions } from '../utils/chart-runtime.js';
|
|
4
4
|
/**
|
|
5
5
|
* Shared base for the individual chart components. Extends {@link NileElement}
|
|
6
6
|
* (so `emit()` and its defaults are unchanged) and adds a small, additive
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import NileElement from './nile-element.js';
|
|
2
|
-
import { getAxisExtremes, setAxisExtremes, } from '
|
|
2
|
+
import { getAxisExtremes, setAxisExtremes, } from '../utils/chart-runtime.js';
|
|
3
3
|
/**
|
|
4
4
|
* Shared base for the individual chart components. Extends {@link NileElement}
|
|
5
5
|
* (so `emit()` and its defaults are unchanged) and adds a small, additive
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ECharts provider — the engine-swap twin of highcharts-provider.ts.
|
|
3
|
+
* SCAFFOLD (2026-08-11, unwired): nothing imports this yet; see
|
|
4
|
+
* ECHARTS-MIGRATION.md at the package root for the wiring steps.
|
|
5
|
+
*
|
|
6
|
+
* - npm users: their bundler resolves `import('echarts')` from node_modules
|
|
7
|
+
* (add `echarts` to this package's dependencies when wiring).
|
|
8
|
+
* - CDN users: the dynamic import fails (bare specifier), falls back to
|
|
9
|
+
* `window.echarts`. Consumer must load ECharts via <script> before
|
|
10
|
+
* nile-visualization.
|
|
11
|
+
*
|
|
12
|
+
* ECharts needs no per-chart-type module loading — one bundle covers every
|
|
13
|
+
* series type the migration uses (the 200-line module ladder in
|
|
14
|
+
* highcharts-provider.ts has no equivalent here; that's part of the win).
|
|
15
|
+
*/
|
|
16
|
+
export type EChartsStatic = any;
|
|
17
|
+
/**
|
|
18
|
+
* Returns a promise resolving to the ECharts namespace with the `nile`
|
|
19
|
+
* theme registered. Initialization runs once and is shared by all callers —
|
|
20
|
+
* the exact contract of getHighcharts().
|
|
21
|
+
*/
|
|
22
|
+
export declare function getECharts(): Promise<EChartsStatic>;
|
|
23
|
+
/**
|
|
24
|
+
* Re-register the theme (call after a light/dark toggle so token values are
|
|
25
|
+
* re-read) and return the namespace. Charts must be re-initialized with
|
|
26
|
+
* echarts.init(el, 'nile') to pick the refreshed theme up.
|
|
27
|
+
*/
|
|
28
|
+
export declare function refreshNileEchartsTheme(): Promise<EChartsStatic>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ECharts provider — the engine-swap twin of highcharts-provider.ts.
|
|
3
|
+
* SCAFFOLD (2026-08-11, unwired): nothing imports this yet; see
|
|
4
|
+
* ECHARTS-MIGRATION.md at the package root for the wiring steps.
|
|
5
|
+
*
|
|
6
|
+
* - npm users: their bundler resolves `import('echarts')` from node_modules
|
|
7
|
+
* (add `echarts` to this package's dependencies when wiring).
|
|
8
|
+
* - CDN users: the dynamic import fails (bare specifier), falls back to
|
|
9
|
+
* `window.echarts`. Consumer must load ECharts via <script> before
|
|
10
|
+
* nile-visualization.
|
|
11
|
+
*
|
|
12
|
+
* ECharts needs no per-chart-type module loading — one bundle covers every
|
|
13
|
+
* series type the migration uses (the 200-line module ladder in
|
|
14
|
+
* highcharts-provider.ts has no equivalent here; that's part of the win).
|
|
15
|
+
*/
|
|
16
|
+
let _echarts;
|
|
17
|
+
let _initPromise = null;
|
|
18
|
+
async function init() {
|
|
19
|
+
if (_echarts)
|
|
20
|
+
return _echarts;
|
|
21
|
+
try {
|
|
22
|
+
// Literal import — echarts is a real dependency since NILE-005 wiring.
|
|
23
|
+
const mod = await import('echarts');
|
|
24
|
+
_echarts = mod.default || mod;
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
_echarts = globalThis.echarts;
|
|
28
|
+
}
|
|
29
|
+
if (!_echarts) {
|
|
30
|
+
throw new Error('ECharts is required for engine="echarts". Either install it via npm ' +
|
|
31
|
+
'(`npm i echarts`) or load it globally via <script> before nile-visualization.');
|
|
32
|
+
}
|
|
33
|
+
const { registerNileEchartsTheme } = await import('./echarts-theme.js');
|
|
34
|
+
registerNileEchartsTheme(_echarts);
|
|
35
|
+
return _echarts;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Returns a promise resolving to the ECharts namespace with the `nile`
|
|
39
|
+
* theme registered. Initialization runs once and is shared by all callers —
|
|
40
|
+
* the exact contract of getHighcharts().
|
|
41
|
+
*/
|
|
42
|
+
export function getECharts() {
|
|
43
|
+
if (!_initPromise) {
|
|
44
|
+
_initPromise = init();
|
|
45
|
+
}
|
|
46
|
+
return _initPromise;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Re-register the theme (call after a light/dark toggle so token values are
|
|
50
|
+
* re-read) and return the namespace. Charts must be re-initialized with
|
|
51
|
+
* echarts.init(el, 'nile') to pick the refreshed theme up.
|
|
52
|
+
*/
|
|
53
|
+
export async function refreshNileEchartsTheme() {
|
|
54
|
+
const e = await getECharts();
|
|
55
|
+
const { registerNileEchartsTheme } = await import('./echarts-theme.js');
|
|
56
|
+
registerNileEchartsTheme(e);
|
|
57
|
+
return e;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=echarts-provider.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Nile ECharts theme — token-driven at runtime, the web-component twin of
|
|
3
|
+
* Cascade's echarts-cascade-theme.js. SCAFFOLD (2026-08-11, unwired).
|
|
4
|
+
*
|
|
5
|
+
* Reads the design tokens from the document at registration time, so the
|
|
6
|
+
* same code themes correctly in light and dark and under either token
|
|
7
|
+
* prefix (--ng-* NxtGen, --nile-* enterprise). Re-register + re-init after
|
|
8
|
+
* a theme toggle (refreshNileEchartsTheme in the provider).
|
|
9
|
+
*
|
|
10
|
+
* Rules baked in (Cascade chart contract, docs/charts-map.md):
|
|
11
|
+
* - series colors come from the palette IN ORDER — never per-series colors
|
|
12
|
+
* - 8th+ series folds to the "other" gray (enforced in translate-config)
|
|
13
|
+
* - one y-axis; axis/grid ink stays on border/text tokens
|
|
14
|
+
*/
|
|
15
|
+
export declare function buildNileEchartsTheme(): Record<string, any>;
|
|
16
|
+
/** The gray every series beyond the 7th must fold into ("Other"). */
|
|
17
|
+
export declare function nileVizOther(): string;
|
|
18
|
+
/** Categorical slot n (1-based) of the viz palette. */
|
|
19
|
+
export declare function nileViz(n: number): string;
|
|
20
|
+
/** The reserved status-bad token (negative regions, error series). */
|
|
21
|
+
export declare function nileBad(): string;
|
|
22
|
+
/** Register (or re-register) the runtime-valued theme as `nile`. */
|
|
23
|
+
export declare function registerNileEchartsTheme(echarts: any): void;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Nile ECharts theme — token-driven at runtime, the web-component twin of
|
|
3
|
+
* Cascade's echarts-cascade-theme.js. SCAFFOLD (2026-08-11, unwired).
|
|
4
|
+
*
|
|
5
|
+
* Reads the design tokens from the document at registration time, so the
|
|
6
|
+
* same code themes correctly in light and dark and under either token
|
|
7
|
+
* prefix (--ng-* NxtGen, --nile-* enterprise). Re-register + re-init after
|
|
8
|
+
* a theme toggle (refreshNileEchartsTheme in the provider).
|
|
9
|
+
*
|
|
10
|
+
* Rules baked in (Cascade chart contract, docs/charts-map.md):
|
|
11
|
+
* - series colors come from the palette IN ORDER — never per-series colors
|
|
12
|
+
* - 8th+ series folds to the "other" gray (enforced in translate-config)
|
|
13
|
+
* - one y-axis; axis/grid ink stays on border/text tokens
|
|
14
|
+
*/
|
|
15
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
16
|
+
function cssVar(names, fallback) {
|
|
17
|
+
const cs = getComputedStyle(document.documentElement);
|
|
18
|
+
for (const n of names) {
|
|
19
|
+
const v = cs.getPropertyValue(n).trim();
|
|
20
|
+
if (v)
|
|
21
|
+
return v;
|
|
22
|
+
}
|
|
23
|
+
return fallback;
|
|
24
|
+
}
|
|
25
|
+
export function buildNileEchartsTheme() {
|
|
26
|
+
const viz = [];
|
|
27
|
+
for (let i = 1; i <= 7; i++) {
|
|
28
|
+
viz.push(cssVar([`--ng-viz-${i}`, `--nile-viz-${i}`], '#2970FF'));
|
|
29
|
+
}
|
|
30
|
+
const text = cssVar(['--ng-text', '--ng-colors-text-primary-900', '--nile-colors-text-primary-900'], '#101828');
|
|
31
|
+
const text2 = cssVar(['--ng-text-2', '--ng-colors-text-tertiary-600', '--nile-colors-text-tertiary-600'], '#475467');
|
|
32
|
+
const border = cssVar(['--ng-border', '--ng-colors-border-secondary', '--nile-colors-border-secondary'], '#EAECF0');
|
|
33
|
+
const surface = cssVar(['--ng-surface', '--ng-colors-bg-primary', '--nile-colors-bg-primary'], '#FFFFFF');
|
|
34
|
+
const font = cssVar(['--ng-font', '--ng-font-family-body', '--nile-font-family-body'], 'system-ui, sans-serif');
|
|
35
|
+
const axis = {
|
|
36
|
+
axisLine: { lineStyle: { color: border } },
|
|
37
|
+
axisTick: { show: false },
|
|
38
|
+
axisLabel: { color: text2, fontFamily: font, fontSize: 11.5 },
|
|
39
|
+
splitLine: { lineStyle: { color: border, opacity: 0.6 } },
|
|
40
|
+
nameTextStyle: { color: text2, fontFamily: font },
|
|
41
|
+
};
|
|
42
|
+
return {
|
|
43
|
+
color: viz,
|
|
44
|
+
backgroundColor: 'transparent',
|
|
45
|
+
textStyle: { color: text, fontFamily: font },
|
|
46
|
+
title: {
|
|
47
|
+
textStyle: { color: text, fontFamily: font, fontSize: 14, fontWeight: 650 },
|
|
48
|
+
subtextStyle: { color: text2, fontFamily: font, fontSize: 12 },
|
|
49
|
+
},
|
|
50
|
+
legend: {
|
|
51
|
+
textStyle: { color: text2, fontFamily: font, fontSize: 11.5 },
|
|
52
|
+
icon: 'circle', itemWidth: 8, itemHeight: 8,
|
|
53
|
+
},
|
|
54
|
+
tooltip: {
|
|
55
|
+
backgroundColor: surface,
|
|
56
|
+
borderColor: border,
|
|
57
|
+
textStyle: { color: text, fontFamily: font, fontSize: 12 },
|
|
58
|
+
extraCssText: 'border-radius:8px;box-shadow:0 4px 12px rgba(0,0,0,.12);',
|
|
59
|
+
},
|
|
60
|
+
categoryAxis: axis,
|
|
61
|
+
valueAxis: axis,
|
|
62
|
+
logAxis: axis,
|
|
63
|
+
timeAxis: axis,
|
|
64
|
+
line: { symbolSize: 5, lineStyle: { width: 2 } },
|
|
65
|
+
bar: { itemStyle: { borderRadius: [3, 3, 0, 0] } },
|
|
66
|
+
pie: { itemStyle: { borderColor: surface, borderWidth: 2 } },
|
|
67
|
+
radar: { axisName: { color: text2, fontFamily: font } },
|
|
68
|
+
gauge: {
|
|
69
|
+
axisLine: { lineStyle: { color: [[1, border]] } },
|
|
70
|
+
title: { color: text2, fontFamily: font },
|
|
71
|
+
detail: { color: text, fontFamily: font },
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/** The gray every series beyond the 7th must fold into ("Other"). */
|
|
76
|
+
export function nileVizOther() {
|
|
77
|
+
return cssVar(['--ng-viz-other', '--nile-viz-other'], '#98A2B3');
|
|
78
|
+
}
|
|
79
|
+
/** Categorical slot n (1-based) of the viz palette. */
|
|
80
|
+
export function nileViz(n) {
|
|
81
|
+
return cssVar([`--ng-viz-${n}`, `--nile-viz-${n}`], '#2970FF');
|
|
82
|
+
}
|
|
83
|
+
/** The reserved status-bad token (negative regions, error series). */
|
|
84
|
+
export function nileBad() {
|
|
85
|
+
return cssVar(['--ng-bad', '--ng-colors-fg-error-primary', '--nile-colors-fg-error-primary'], '#D92D20');
|
|
86
|
+
}
|
|
87
|
+
/** Register (or re-register) the runtime-valued theme as `nile`. */
|
|
88
|
+
export function registerNileEchartsTheme(echarts) {
|
|
89
|
+
echarts.registerTheme('nile', buildNileEchartsTheme());
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=echarts-theme.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ECharts engine for nile-chart — SCAFFOLD (2026-08-11, unwired).
|
|
3
|
+
* Wiring steps + wave plan: ECHARTS-MIGRATION.md at the package root.
|
|
4
|
+
*/
|
|
5
|
+
export { getECharts, refreshNileEchartsTheme } from './echarts-provider.js';
|
|
6
|
+
export { buildNileEchartsTheme, registerNileEchartsTheme, nileVizOther } from './echarts-theme.js';
|
|
7
|
+
export { translateToECharts, EngineNotMigratedError, ECHARTS_MIGRATED_TYPES, } from './translate-config.js';
|
|
8
|
+
export type { MinimalNileChartConfig } from './translate-config.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ECharts engine for nile-chart — SCAFFOLD (2026-08-11, unwired).
|
|
3
|
+
* Wiring steps + wave plan: ECHARTS-MIGRATION.md at the package root.
|
|
4
|
+
*/
|
|
5
|
+
export { getECharts, refreshNileEchartsTheme } from './echarts-provider.js';
|
|
6
|
+
export { buildNileEchartsTheme, registerNileEchartsTheme, nileVizOther } from './echarts-theme.js';
|
|
7
|
+
export { translateToECharts, EngineNotMigratedError, ECHARTS_MIGRATED_TYPES, } from './translate-config.js';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* nile-chart config → ECharts option translator.
|
|
3
|
+
* Waves 1 (native) + 2 (config, 2026-08-12) — 33 chart types total; see
|
|
4
|
+
* docs/charts-map.md, i.e. every type with a direct ECharts series
|
|
5
|
+
* equivalent. Config/custom waves extend TRANSLATORS below; see
|
|
6
|
+
* ECHARTS-MIGRATION.md for the wave plan.
|
|
7
|
+
*
|
|
8
|
+
* Deliberately structural about input types (a minimal shape, not the full
|
|
9
|
+
* NileChartConfig union) so this file compiles while unwired; when wiring,
|
|
10
|
+
* tighten the signature to the real union from nile-chart-config.ts.
|
|
11
|
+
*
|
|
12
|
+
* Contract enforced here, regardless of what the config asks for:
|
|
13
|
+
* - ONE value axis (dual axis is banned; line-column with two scales must
|
|
14
|
+
* become two charts)
|
|
15
|
+
* - series colors come from the theme; per-series color inputs are IGNORED
|
|
16
|
+
* - an 8th+ series folds into a single "Other" series (nileVizOther gray)
|
|
17
|
+
* - legend on for ≥2 series; tooltip always
|
|
18
|
+
*/
|
|
19
|
+
export interface MinimalNileChartConfig {
|
|
20
|
+
type: string;
|
|
21
|
+
data?: any;
|
|
22
|
+
categories?: string[];
|
|
23
|
+
chartTitle?: string;
|
|
24
|
+
chartSubtitle?: string;
|
|
25
|
+
yAxisTitle?: string;
|
|
26
|
+
xAxisTitle?: string;
|
|
27
|
+
seriesName?: string;
|
|
28
|
+
legend?: {
|
|
29
|
+
enabled?: boolean;
|
|
30
|
+
[k: string]: any;
|
|
31
|
+
};
|
|
32
|
+
[k: string]: any;
|
|
33
|
+
}
|
|
34
|
+
export declare class EngineNotMigratedError extends Error {
|
|
35
|
+
constructor(type: string);
|
|
36
|
+
}
|
|
37
|
+
export type FieldSemantic = 'Price' | 'Percent' | 'Ratio' | 'Count' | 'Duration' | 'Bytes';
|
|
38
|
+
export declare function semanticFormatter(sem: FieldSemantic, currency?: string): (v: any) => string;
|
|
39
|
+
/** Types wave 1 covers — everything else throws EngineNotMigratedError. */
|
|
40
|
+
export declare const ECHARTS_MIGRATED_TYPES: string[];
|
|
41
|
+
export declare function translateToECharts(cfg: MinimalNileChartConfig): Record<string, any>;
|