@aquera/nile-visualization 2.9.28 → 2.9.30
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 +8 -0
- package/dist/src/index.d.ts +6 -1
- package/dist/src/index.js +3 -0
- package/dist/src/internal/chart-events.d.ts +92 -0
- package/dist/src/internal/chart-events.js +291 -0
- package/dist/src/internal/chart-runtime.d.ts +41 -0
- package/dist/src/internal/chart-runtime.js +30 -0
- package/dist/src/internal/highcharts-provider.js +2 -0
- package/dist/src/internal/nile-chart-base.d.ts +43 -0
- package/dist/src/internal/nile-chart-base.js +67 -0
- package/dist/src/internal/resolve-widget-kind.d.ts +10 -0
- package/dist/src/internal/resolve-widget-kind.js +16 -0
- package/dist/src/internal/responsive-defaults.d.ts +32 -0
- package/dist/src/internal/responsive-defaults.js +255 -0
- package/dist/src/internal/types/chart-forecast-config.type.d.ts +35 -0
- package/dist/src/internal/types/chart-forecast-config.type.js +2 -0
- package/dist/src/internal/types/highcharts-passthrough.type.d.ts +80 -0
- package/dist/src/internal/types/highcharts-passthrough.type.js +24 -0
- package/dist/src/internal/types/index.d.ts +3 -0
- package/dist/src/internal/types/index.js +1 -1
- package/dist/src/internal/types/primitive-chart-config.type.d.ts +2 -1
- package/dist/src/internal/types/widget-config.type.d.ts +14 -3
- package/dist/src/nile-anomaly-chart/nile-anomaly-chart.d.ts +2 -0
- package/dist/src/nile-anomaly-chart/nile-anomaly-chart.js +8 -1
- package/dist/src/nile-area-chart/nile-area-chart.d.ts +1 -0
- package/dist/src/nile-area-chart/nile-area-chart.js +7 -1
- package/dist/src/nile-area-negative-chart/nile-area-negative-chart.d.ts +1 -0
- package/dist/src/nile-area-negative-chart/nile-area-negative-chart.js +7 -1
- package/dist/src/nile-area-range-chart/nile-area-range-chart.d.ts +1 -0
- package/dist/src/nile-area-range-chart/nile-area-range-chart.js +7 -1
- package/dist/src/nile-area-spline-chart/nile-area-spline-chart.d.ts +1 -0
- package/dist/src/nile-area-spline-chart/nile-area-spline-chart.js +7 -1
- package/dist/src/nile-bar-chart/nile-bar-chart.d.ts +2 -0
- package/dist/src/nile-bar-chart/nile-bar-chart.js +8 -1
- package/dist/src/nile-bellcurve-chart/nile-bellcurve-chart.d.ts +1 -0
- package/dist/src/nile-bellcurve-chart/nile-bellcurve-chart.js +7 -1
- package/dist/src/nile-boxplot-chart/nile-boxplot-chart.d.ts +1 -0
- package/dist/src/nile-boxplot-chart/nile-boxplot-chart.js +7 -1
- package/dist/src/nile-bubble-chart/nile-bubble-chart.d.ts +1 -0
- package/dist/src/nile-bubble-chart/nile-bubble-chart.js +7 -1
- package/dist/src/nile-chart/index.d.ts +1 -1
- package/dist/src/nile-chart/nile-chart-config.d.ts +22 -83
- package/dist/src/nile-chart/nile-chart-skeleton.js +1 -1
- package/dist/src/nile-chart/nile-chart.css.js +3 -1
- package/dist/src/nile-chart/nile-chart.d.ts +68 -0
- package/dist/src/nile-chart/nile-chart.js +244 -7
- package/dist/src/nile-cluster-chart/nile-cluster-chart.d.ts +1 -0
- package/dist/src/nile-cluster-chart/nile-cluster-chart.js +7 -1
- package/dist/src/nile-column-chart/nile-column-chart.d.ts +1 -0
- package/dist/src/nile-column-chart/nile-column-chart.js +7 -1
- package/dist/src/nile-column-drilldown-chart/nile-column-drilldown-chart.d.ts +1 -0
- package/dist/src/nile-column-drilldown-chart/nile-column-drilldown-chart.js +8 -1
- package/dist/src/nile-column-pyramid-chart/nile-column-pyramid-chart.d.ts +1 -0
- package/dist/src/nile-column-pyramid-chart/nile-column-pyramid-chart.js +7 -1
- package/dist/src/nile-column-range-chart/nile-column-range-chart.d.ts +1 -0
- package/dist/src/nile-column-range-chart/nile-column-range-chart.js +7 -1
- package/dist/src/nile-dashboard-builder/nile-dashboard-builder.css.js +24 -8
- package/dist/src/nile-dashboard-builder/nile-dashboard-builder.d.ts +111 -0
- package/dist/src/nile-dashboard-builder/nile-dashboard-builder.js +188 -6
- package/dist/src/nile-donut-chart/nile-donut-chart.d.ts +1 -0
- package/dist/src/nile-donut-chart/nile-donut-chart.js +7 -1
- package/dist/src/nile-dumbbell-chart/nile-dumbbell-chart.d.ts +1 -0
- package/dist/src/nile-dumbbell-chart/nile-dumbbell-chart.js +7 -1
- package/dist/src/nile-dumbbell-lower-chart/nile-dumbbell-lower-chart.d.ts +1 -0
- package/dist/src/nile-dumbbell-lower-chart/nile-dumbbell-lower-chart.js +7 -1
- package/dist/src/nile-dumbbell-upper-chart/nile-dumbbell-upper-chart.d.ts +1 -0
- package/dist/src/nile-dumbbell-upper-chart/nile-dumbbell-upper-chart.js +7 -1
- package/dist/src/nile-euler-chart/nile-euler-chart.d.ts +1 -0
- package/dist/src/nile-euler-chart/nile-euler-chart.js +7 -1
- package/dist/src/nile-fan-chart/nile-fan-chart.d.ts +1 -0
- package/dist/src/nile-fan-chart/nile-fan-chart.js +7 -1
- package/dist/src/nile-filter-chart/nile-filter-chart.d.ts +2 -0
- package/dist/src/nile-filter-chart/nile-filter-chart.js +14 -0
- package/dist/src/nile-filter-chart/utils/prompt.js +31 -6
- package/dist/src/nile-filter-chart/utils/types.d.ts +2 -0
- package/dist/src/nile-flame-chart/nile-flame-chart.d.ts +1 -0
- package/dist/src/nile-flame-chart/nile-flame-chart.js +7 -1
- package/dist/src/nile-forecast-chart/index.d.ts +2 -0
- package/dist/src/nile-forecast-chart/index.js +2 -0
- package/dist/src/nile-forecast-chart/nile-forecast-chart.css.d.ts +1 -0
- package/dist/src/nile-forecast-chart/nile-forecast-chart.css.js +46 -0
- package/dist/src/nile-forecast-chart/nile-forecast-chart.d.ts +90 -0
- package/dist/src/nile-forecast-chart/nile-forecast-chart.js +551 -0
- package/dist/src/nile-funnel-chart/nile-funnel-chart.d.ts +1 -0
- package/dist/src/nile-funnel-chart/nile-funnel-chart.js +7 -1
- package/dist/src/nile-gauge-chart/nile-gauge-chart.d.ts +20 -0
- package/dist/src/nile-gauge-chart/nile-gauge-chart.js +80 -4
- package/dist/src/nile-heatmap-chart/nile-heatmap-chart.d.ts +1 -0
- package/dist/src/nile-heatmap-chart/nile-heatmap-chart.js +7 -1
- package/dist/src/nile-histogram-chart/nile-histogram-chart.d.ts +1 -0
- package/dist/src/nile-histogram-chart/nile-histogram-chart.js +7 -1
- package/dist/src/nile-inverted-area-chart/nile-inverted-area-chart.d.ts +1 -0
- package/dist/src/nile-inverted-area-chart/nile-inverted-area-chart.js +7 -1
- package/dist/src/nile-line-chart/nile-line-chart.d.ts +1 -0
- package/dist/src/nile-line-chart/nile-line-chart.js +7 -1
- package/dist/src/nile-line-column-chart/nile-line-column-chart.d.ts +1 -0
- package/dist/src/nile-line-column-chart/nile-line-column-chart.js +7 -1
- package/dist/src/nile-lollipop-chart/nile-lollipop-chart.d.ts +1 -0
- package/dist/src/nile-lollipop-chart/nile-lollipop-chart.js +7 -1
- package/dist/src/nile-map-chart/nile-map-chart.d.ts +23 -3
- package/dist/src/nile-map-chart/nile-map-chart.js +52 -12
- package/dist/src/nile-master-detail-chart/nile-master-detail-chart.css.js +13 -1
- package/dist/src/nile-master-detail-chart/nile-master-detail-chart.d.ts +1 -0
- package/dist/src/nile-master-detail-chart/nile-master-detail-chart.js +48 -4
- package/dist/src/nile-organization-chart/nile-organization-chart.d.ts +1 -0
- package/dist/src/nile-organization-chart/nile-organization-chart.js +7 -1
- package/dist/src/nile-pie-chart/nile-pie-chart.d.ts +2 -0
- package/dist/src/nile-pie-chart/nile-pie-chart.js +8 -1
- package/dist/src/nile-polygon-chart/nile-polygon-chart.d.ts +1 -0
- package/dist/src/nile-polygon-chart/nile-polygon-chart.js +7 -1
- package/dist/src/nile-radar-chart/nile-radar-chart.d.ts +1 -0
- package/dist/src/nile-radar-chart/nile-radar-chart.js +7 -1
- package/dist/src/nile-radial-bar-chart/nile-radial-bar-chart.d.ts +1 -0
- package/dist/src/nile-radial-bar-chart/nile-radial-bar-chart.js +7 -1
- package/dist/src/nile-scatter-chart/nile-scatter-chart.d.ts +1 -0
- package/dist/src/nile-scatter-chart/nile-scatter-chart.js +7 -1
- package/dist/src/nile-spiderweb-chart/nile-spiderweb-chart.d.ts +1 -0
- package/dist/src/nile-spiderweb-chart/nile-spiderweb-chart.js +7 -1
- package/dist/src/nile-spline-chart/nile-spline-chart.d.ts +1 -0
- package/dist/src/nile-spline-chart/nile-spline-chart.js +7 -1
- package/dist/src/nile-stacked-chart/nile-stacked-chart.d.ts +1 -0
- package/dist/src/nile-stacked-chart/nile-stacked-chart.js +7 -1
- package/dist/src/nile-timeline-chart/nile-timeline-chart.d.ts +1 -0
- package/dist/src/nile-timeline-chart/nile-timeline-chart.js +7 -1
- package/dist/src/nile-trendline-chart/nile-trendline-chart.d.ts +2 -0
- package/dist/src/nile-trendline-chart/nile-trendline-chart.js +8 -1
- package/dist/src/nile-variable-pie-chart/nile-variable-pie-chart.d.ts +1 -0
- package/dist/src/nile-variable-pie-chart/nile-variable-pie-chart.js +7 -1
- package/dist/src/nile-vector-chart/nile-vector-chart.d.ts +1 -0
- package/dist/src/nile-vector-chart/nile-vector-chart.js +7 -1
- package/dist/src/nile-waterfall-chart/nile-waterfall-chart.d.ts +1 -0
- package/dist/src/nile-waterfall-chart/nile-waterfall-chart.js +7 -1
- package/dist/src/nile-widget-viewer/nile-widget-viewer.js +6 -6
- package/dist/src/nile-xrange-chart/nile-xrange-chart.d.ts +1 -0
- package/dist/src/nile-xrange-chart/nile-xrange-chart.js +7 -1
- package/package.json +2 -1
|
@@ -2,6 +2,7 @@ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
|
2
2
|
import NileElement from '../internal/nile-element.js';
|
|
3
3
|
import type { NileChartConfig, NileChartMenuConfig } from './nile-chart-config.js';
|
|
4
4
|
import type { NileChartConfigInputType } from '../internal/types/index.js';
|
|
5
|
+
import { type ChartExtremes, type SetExtremesOptions } from '../internal/chart-runtime.js';
|
|
5
6
|
import '../nile-bar-chart/index.js';
|
|
6
7
|
import '../nile-pie-chart/index.js';
|
|
7
8
|
import '../nile-trendline-chart/index.js';
|
|
@@ -28,6 +29,7 @@ import '../nile-dumbbell-chart/index.js';
|
|
|
28
29
|
import '../nile-dumbbell-lower-chart/index.js';
|
|
29
30
|
import '../nile-dumbbell-upper-chart/index.js';
|
|
30
31
|
import '../nile-fan-chart/index.js';
|
|
32
|
+
import '../nile-forecast-chart/index.js';
|
|
31
33
|
import '../nile-funnel-chart/index.js';
|
|
32
34
|
import '../nile-organization-chart/index.js';
|
|
33
35
|
import '../nile-line-column-chart/index.js';
|
|
@@ -102,6 +104,19 @@ export declare class NileChart extends NileElement {
|
|
|
102
104
|
noHeader: boolean;
|
|
103
105
|
noPadding: boolean;
|
|
104
106
|
appearance: string | null;
|
|
107
|
+
/**
|
|
108
|
+
* Opt-in double-tap-to-minimize gesture. Double-tap the header to hide it —
|
|
109
|
+
* the plot expands to fill the freed space; double-tap the chart again to
|
|
110
|
+
* bring the header back. Off by default.
|
|
111
|
+
*/
|
|
112
|
+
minimizeOnDoubleTap: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Minimized state — header hidden and body padding removed so the plot fills
|
|
115
|
+
* the card. Reflected as the `minimized` attribute; set it directly to control
|
|
116
|
+
* minimize programmatically, or let the double-tap gesture toggle it when
|
|
117
|
+
* `minimizeOnDoubleTap` is on. Emits `nile-chart-minimize` on every change.
|
|
118
|
+
*/
|
|
119
|
+
minimized: boolean;
|
|
105
120
|
/**
|
|
106
121
|
* When set, fills `chart.type` if the config omits it (same values as `chart.type`, e.g. `stacked`, `pie`).
|
|
107
122
|
* Usage: `<nile-chart chart-type="pie" />` plus `config.chart` with series data only.
|
|
@@ -130,17 +145,41 @@ export declare class NileChart extends NileElement {
|
|
|
130
145
|
private hasHeaderActionsSlot;
|
|
131
146
|
private aiPanel;
|
|
132
147
|
private masterDetailChart;
|
|
148
|
+
private forecastChart;
|
|
133
149
|
/** True while the inner master-detail chart is zoomed — drives the header
|
|
134
150
|
* "Reset zoom" button. Reflected from the chart's `nile-master-detail-zoom`. */
|
|
135
151
|
private masterZoomed;
|
|
136
152
|
private onMasterZoom;
|
|
153
|
+
/** True while the inner forecast chart is zoomed — drives the same header
|
|
154
|
+
* "Reset zoom" button. Reflected from the chart's `nile-forecast-zoom`. */
|
|
155
|
+
private forecastZoomed;
|
|
156
|
+
private onForecastZoom;
|
|
157
|
+
/** Reset-zoom lives in the header for every chart type that supports zoom. */
|
|
158
|
+
private get showResetZoom();
|
|
159
|
+
private resetActiveZoom;
|
|
137
160
|
private get effectiveSummary();
|
|
138
161
|
/** AI panel shows when ai.enabled is true OR when a summary is provided. */
|
|
139
162
|
private get aiEnabled();
|
|
140
163
|
private handleOutsideClick;
|
|
164
|
+
private _readyResolvers;
|
|
165
|
+
private _extremesDisposers;
|
|
141
166
|
private handleChartReady;
|
|
167
|
+
/**
|
|
168
|
+
* Re-emit Highcharts' `afterSetExtremes` (fired on zoom/pan/navigator) as the
|
|
169
|
+
* `nile-extremes-change` Nile event, so consumers can sync a shared range
|
|
170
|
+
* across panels. Uses `Highcharts.addEvent`, which stacks on top of any
|
|
171
|
+
* handler the consumer already set — it never overrides existing behavior.
|
|
172
|
+
*/
|
|
173
|
+
private _wireExtremesEvents;
|
|
174
|
+
private _teardownExtremesEvents;
|
|
142
175
|
connectedCallback(): void;
|
|
143
176
|
disconnectedCallback(): void;
|
|
177
|
+
/**
|
|
178
|
+
* Double-tap gesture (opt-in via `minimizeOnDoubleTap`): toggle the minimized
|
|
179
|
+
* state. When the header is showing, only a double-tap ON the header
|
|
180
|
+
* minimizes; when it's hidden, a double-tap anywhere restores it.
|
|
181
|
+
*/
|
|
182
|
+
private _onDoubleTap;
|
|
144
183
|
private mergeChartTypeFromAttr;
|
|
145
184
|
/** Resolve { chart, aq } input to flat NileChartConfig. */
|
|
146
185
|
private resolveConfig;
|
|
@@ -150,6 +189,35 @@ export declare class NileChart extends NileElement {
|
|
|
150
189
|
private toggleChat;
|
|
151
190
|
/** Push an AI response into the chat panel. Call this from your AI handler. */
|
|
152
191
|
addAiResponse(text: string): void;
|
|
192
|
+
/**
|
|
193
|
+
* The underlying `Highcharts.Chart` instance for the currently rendered chart,
|
|
194
|
+
* or `null` until it's ready. Use this to reach any native Highcharts API
|
|
195
|
+
* (`series.setData`, `mapView.fitToBounds`, etc.). Read-only.
|
|
196
|
+
*/
|
|
197
|
+
get chart(): any;
|
|
198
|
+
/**
|
|
199
|
+
* Resolves with the `Highcharts.Chart` instance once it's ready (immediately if
|
|
200
|
+
* it already exists). On a chart-type switch a new instance is created; this
|
|
201
|
+
* resolves with the current-or-next instance.
|
|
202
|
+
*/
|
|
203
|
+
whenReady(): Promise<any>;
|
|
204
|
+
/**
|
|
205
|
+
* Read the current extremes of an axis (default: primary x-axis). Returns
|
|
206
|
+
* `null` when the chart isn't ready or the axis doesn't exist (e.g. pie/gauge).
|
|
207
|
+
*/
|
|
208
|
+
getExtremes(axis?: number, dimension?: 'x' | 'y'): ChartExtremes | null;
|
|
209
|
+
/**
|
|
210
|
+
* Set the extremes (zoom/pan range) of an axis — useful for syncing a shared
|
|
211
|
+
* range across panels in response to `nile-extremes-change`. Safe no-op if the
|
|
212
|
+
* chart isn't ready or the axis doesn't exist. Pass `null` to reset a bound.
|
|
213
|
+
*/
|
|
214
|
+
setExtremes(min: number | null, max: number | null, opts?: SetExtremesOptions): void;
|
|
215
|
+
/**
|
|
216
|
+
* Force the chart to re-read inherited styles/CSS variables and redraw. Call
|
|
217
|
+
* this after your app toggles light/dark theme. Safe no-op until the chart is
|
|
218
|
+
* ready.
|
|
219
|
+
*/
|
|
220
|
+
refreshTheme(): void;
|
|
153
221
|
private handleAiSend;
|
|
154
222
|
private switchType;
|
|
155
223
|
private get headerTitle();
|
|
@@ -4,11 +4,13 @@ import { customElement, property, query, state } from 'lit/decorators.js';
|
|
|
4
4
|
import { html, nothing } from 'lit';
|
|
5
5
|
import NileElement from '../internal/nile-element.js';
|
|
6
6
|
import { styles, tooltipCss, injectGlobalChartMenuOverrides } from './nile-chart.css.js';
|
|
7
|
+
import { HIGHCHARTS_PASSTHROUGH_KEYS } from '../internal/types/index.js';
|
|
7
8
|
import { nileChartConfig } from './nile-chart-config-builder.js';
|
|
8
9
|
import { renderChartSkeleton } from './nile-chart-skeleton.js';
|
|
9
10
|
import { convertConfig } from '../internal/chart-adapters.js';
|
|
10
11
|
import { deepMerge } from '../internal/utils.js';
|
|
11
12
|
import { initNileChartExporting, getHighcharts } from '../internal/highcharts-provider.js';
|
|
13
|
+
import { getAxisExtremes, setAxisExtremes, } from '../internal/chart-runtime.js';
|
|
12
14
|
import { resolveColorPaletteColors } from '../internal/color-palettes/index.js';
|
|
13
15
|
initNileChartExporting();
|
|
14
16
|
import '../nile-bar-chart/index.js';
|
|
@@ -37,6 +39,7 @@ import '../nile-dumbbell-chart/index.js';
|
|
|
37
39
|
import '../nile-dumbbell-lower-chart/index.js';
|
|
38
40
|
import '../nile-dumbbell-upper-chart/index.js';
|
|
39
41
|
import '../nile-fan-chart/index.js';
|
|
42
|
+
import '../nile-forecast-chart/index.js';
|
|
40
43
|
import '../nile-funnel-chart/index.js';
|
|
41
44
|
import '../nile-organization-chart/index.js';
|
|
42
45
|
import '../nile-line-column-chart/index.js';
|
|
@@ -62,6 +65,7 @@ import '../nile-filter-chart/index.js';
|
|
|
62
65
|
import '../nile-chart-message/nile-chart-message.js';
|
|
63
66
|
import '../nile-chart-list/nile-chart-list.js';
|
|
64
67
|
import '../nile-ai-panel/index.js';
|
|
68
|
+
import { FORECAST_NOW_LINE_COLOR } from '../nile-forecast-chart/nile-forecast-chart.js';
|
|
65
69
|
const CORE_CHART_LABELS = {
|
|
66
70
|
bar: 'Bar',
|
|
67
71
|
pie: 'Pie',
|
|
@@ -179,6 +183,19 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
179
183
|
this.noHeader = false;
|
|
180
184
|
this.noPadding = false;
|
|
181
185
|
this.appearance = null;
|
|
186
|
+
/**
|
|
187
|
+
* Opt-in double-tap-to-minimize gesture. Double-tap the header to hide it —
|
|
188
|
+
* the plot expands to fill the freed space; double-tap the chart again to
|
|
189
|
+
* bring the header back. Off by default.
|
|
190
|
+
*/
|
|
191
|
+
this.minimizeOnDoubleTap = false;
|
|
192
|
+
/**
|
|
193
|
+
* Minimized state — header hidden and body padding removed so the plot fills
|
|
194
|
+
* the card. Reflected as the `minimized` attribute; set it directly to control
|
|
195
|
+
* minimize programmatically, or let the double-tap gesture toggle it when
|
|
196
|
+
* `minimizeOnDoubleTap` is on. Emits `nile-chart-minimize` on every change.
|
|
197
|
+
*/
|
|
198
|
+
this.minimized = false;
|
|
182
199
|
/**
|
|
183
200
|
* When set, fills `chart.type` if the config omits it (same values as `chart.type`, e.g. `stacked`, `pie`).
|
|
184
201
|
* Usage: `<nile-chart chart-type="pie" />` plus `config.chart` with series data only.
|
|
@@ -208,6 +225,9 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
208
225
|
/** True while the inner master-detail chart is zoomed — drives the header
|
|
209
226
|
* "Reset zoom" button. Reflected from the chart's `nile-master-detail-zoom`. */
|
|
210
227
|
this.masterZoomed = false;
|
|
228
|
+
/** True while the inner forecast chart is zoomed — drives the same header
|
|
229
|
+
* "Reset zoom" button. Reflected from the chart's `nile-forecast-zoom`. */
|
|
230
|
+
this.forecastZoomed = false;
|
|
211
231
|
this.handleOutsideClick = (e) => {
|
|
212
232
|
const path = e.composedPath();
|
|
213
233
|
if (!path.includes(this)) {
|
|
@@ -223,8 +243,40 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
223
243
|
}
|
|
224
244
|
}
|
|
225
245
|
};
|
|
246
|
+
this._readyResolvers = [];
|
|
247
|
+
this._extremesDisposers = [];
|
|
226
248
|
this.handleChartReady = (e) => {
|
|
227
249
|
this._hcChart = e.detail?.chart ?? null;
|
|
250
|
+
if (this._hcChart) {
|
|
251
|
+
const resolvers = this._readyResolvers;
|
|
252
|
+
this._readyResolvers = [];
|
|
253
|
+
resolvers.forEach((resolve) => resolve(this._hcChart));
|
|
254
|
+
void this._wireExtremesEvents();
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
/**
|
|
258
|
+
* Double-tap gesture (opt-in via `minimizeOnDoubleTap`): toggle the minimized
|
|
259
|
+
* state. When the header is showing, only a double-tap ON the header
|
|
260
|
+
* minimizes; when it's hidden, a double-tap anywhere restores it.
|
|
261
|
+
*/
|
|
262
|
+
this._onDoubleTap = (event) => {
|
|
263
|
+
if (!this.minimizeOnDoubleTap)
|
|
264
|
+
return;
|
|
265
|
+
if (this.minimized) {
|
|
266
|
+
this.minimized = false; // header is gone — any double-tap restores it
|
|
267
|
+
this.emit('nile-chart-minimize', { minimized: false });
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
const onHeader = event.composedPath().some(el => {
|
|
271
|
+
if (!(el instanceof Element))
|
|
272
|
+
return false;
|
|
273
|
+
const part = el.getAttribute?.('part') || '';
|
|
274
|
+
return el.classList?.contains('nile-chart-header') || part.split(/\s+/).includes('header');
|
|
275
|
+
});
|
|
276
|
+
if (onHeader) {
|
|
277
|
+
this.minimized = true;
|
|
278
|
+
this.emit('nile-chart-minimize', { minimized: true });
|
|
279
|
+
}
|
|
228
280
|
};
|
|
229
281
|
this.resolvedConfig = null;
|
|
230
282
|
// Reveal the full text when a title/subtitle is truncated. Accepts any Event
|
|
@@ -240,6 +292,22 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
240
292
|
onMasterZoom(e) {
|
|
241
293
|
this.masterZoomed = !!e.detail?.zoomed;
|
|
242
294
|
}
|
|
295
|
+
onForecastZoom(e) {
|
|
296
|
+
this.forecastZoomed = !!e.detail?.zoomed;
|
|
297
|
+
}
|
|
298
|
+
/** Reset-zoom lives in the header for every chart type that supports zoom. */
|
|
299
|
+
get showResetZoom() {
|
|
300
|
+
const type = this.activeType ?? this.resolvedConfig?.type;
|
|
301
|
+
return (this.masterZoomed && type === 'master-detail')
|
|
302
|
+
|| (this.forecastZoomed && type === 'forecast');
|
|
303
|
+
}
|
|
304
|
+
resetActiveZoom() {
|
|
305
|
+
const type = this.activeType ?? this.resolvedConfig?.type;
|
|
306
|
+
if (type === 'master-detail')
|
|
307
|
+
this.masterDetailChart?.resetZoom();
|
|
308
|
+
else if (type === 'forecast')
|
|
309
|
+
this.forecastChart?.resetZoom();
|
|
310
|
+
}
|
|
243
311
|
get effectiveSummary() {
|
|
244
312
|
return this.resolvedConfig?.summary ?? this.summary;
|
|
245
313
|
}
|
|
@@ -247,6 +315,51 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
247
315
|
get aiEnabled() {
|
|
248
316
|
return this.resolvedConfig?.ai?.enabled === true || !!this.effectiveSummary;
|
|
249
317
|
}
|
|
318
|
+
/**
|
|
319
|
+
* Re-emit Highcharts' `afterSetExtremes` (fired on zoom/pan/navigator) as the
|
|
320
|
+
* `nile-extremes-change` Nile event, so consumers can sync a shared range
|
|
321
|
+
* across panels. Uses `Highcharts.addEvent`, which stacks on top of any
|
|
322
|
+
* handler the consumer already set — it never overrides existing behavior.
|
|
323
|
+
*/
|
|
324
|
+
async _wireExtremesEvents() {
|
|
325
|
+
this._teardownExtremesEvents();
|
|
326
|
+
const chart = this._hcChart;
|
|
327
|
+
if (!chart?.xAxis?.length)
|
|
328
|
+
return;
|
|
329
|
+
const HC = await getHighcharts();
|
|
330
|
+
const addEvent = HC?.addEvent;
|
|
331
|
+
if (typeof addEvent !== 'function')
|
|
332
|
+
return;
|
|
333
|
+
// Chart may have been swapped out while awaiting; bail if so.
|
|
334
|
+
if (this._hcChart !== chart)
|
|
335
|
+
return;
|
|
336
|
+
chart.xAxis.forEach((axis, index) => {
|
|
337
|
+
const dispose = addEvent(axis, 'afterSetExtremes', (ev) => {
|
|
338
|
+
this.emit('nile-extremes-change', {
|
|
339
|
+
min: ev.min,
|
|
340
|
+
max: ev.max,
|
|
341
|
+
dataMin: ev.dataMin,
|
|
342
|
+
dataMax: ev.dataMax,
|
|
343
|
+
axis: index,
|
|
344
|
+
dimension: 'x',
|
|
345
|
+
trigger: ev.trigger ?? 'api',
|
|
346
|
+
});
|
|
347
|
+
});
|
|
348
|
+
if (typeof dispose === 'function')
|
|
349
|
+
this._extremesDisposers.push(dispose);
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
_teardownExtremesEvents() {
|
|
353
|
+
this._extremesDisposers.forEach((dispose) => {
|
|
354
|
+
try {
|
|
355
|
+
dispose();
|
|
356
|
+
}
|
|
357
|
+
catch {
|
|
358
|
+
/* axis already destroyed */
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
this._extremesDisposers = [];
|
|
362
|
+
}
|
|
250
363
|
connectedCallback() {
|
|
251
364
|
super.connectedCallback();
|
|
252
365
|
ensureHeaderTooltipStyles();
|
|
@@ -258,6 +371,7 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
258
371
|
this._headerTipEl = tip;
|
|
259
372
|
document.addEventListener('click', this.handleOutsideClick);
|
|
260
373
|
this.addEventListener('nile-chart-ready', this.handleChartReady);
|
|
374
|
+
this.addEventListener('dblclick', this._onDoubleTap);
|
|
261
375
|
initNileChartExporting();
|
|
262
376
|
// Pick up config set before element upgrade (e.g. Angular ngAfterViewInit)
|
|
263
377
|
if (this.config && !this.resolvedConfig) {
|
|
@@ -270,10 +384,13 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
270
384
|
super.disconnectedCallback();
|
|
271
385
|
document.removeEventListener('click', this.handleOutsideClick);
|
|
272
386
|
this.removeEventListener('nile-chart-ready', this.handleChartReady);
|
|
387
|
+
this.removeEventListener('dblclick', this._onDoubleTap);
|
|
273
388
|
this._headerTipEl?.remove();
|
|
274
389
|
this._headerTipEl = null;
|
|
275
390
|
this._headerResizeObs?.disconnect();
|
|
276
391
|
this._headerResizeObs = null;
|
|
392
|
+
this._teardownExtremesEvents();
|
|
393
|
+
this._readyResolvers = [];
|
|
277
394
|
}
|
|
278
395
|
mergeChartTypeFromAttr(chart) {
|
|
279
396
|
const t = this.chartTypeAttr?.trim();
|
|
@@ -300,8 +417,11 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
300
417
|
// appearance="minimal" on filter charts implies a header-less compact layout.
|
|
301
418
|
const minimalFilter = resolved.type === 'filter' && resolved.appearance === 'minimal';
|
|
302
419
|
const cfgNoHeader = resolved.noHeader === true || minimalFilter;
|
|
303
|
-
|
|
304
|
-
|
|
420
|
+
// Keep noHeader in sync with the config both ways (like noPadding below) —
|
|
421
|
+
// a one-way latch here would leave the header hidden after the config
|
|
422
|
+
// clears noHeader again.
|
|
423
|
+
if (this.noHeader !== cfgNoHeader)
|
|
424
|
+
this.noHeader = cfgNoHeader;
|
|
305
425
|
if (this.noPadding !== (resolved.noPadding === true))
|
|
306
426
|
this.noPadding = resolved.noPadding === true;
|
|
307
427
|
if (resolved.appearance && this.appearance !== resolved.appearance)
|
|
@@ -336,6 +456,52 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
336
456
|
this.aiPanel.addAssistantMessage(text);
|
|
337
457
|
}
|
|
338
458
|
}
|
|
459
|
+
/**
|
|
460
|
+
* The underlying `Highcharts.Chart` instance for the currently rendered chart,
|
|
461
|
+
* or `null` until it's ready. Use this to reach any native Highcharts API
|
|
462
|
+
* (`series.setData`, `mapView.fitToBounds`, etc.). Read-only.
|
|
463
|
+
*/
|
|
464
|
+
get chart() {
|
|
465
|
+
return this._hcChart;
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Resolves with the `Highcharts.Chart` instance once it's ready (immediately if
|
|
469
|
+
* it already exists). On a chart-type switch a new instance is created; this
|
|
470
|
+
* resolves with the current-or-next instance.
|
|
471
|
+
*/
|
|
472
|
+
whenReady() {
|
|
473
|
+
if (this._hcChart)
|
|
474
|
+
return Promise.resolve(this._hcChart);
|
|
475
|
+
return new Promise((resolve) => {
|
|
476
|
+
this._readyResolvers.push(resolve);
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Read the current extremes of an axis (default: primary x-axis). Returns
|
|
481
|
+
* `null` when the chart isn't ready or the axis doesn't exist (e.g. pie/gauge).
|
|
482
|
+
*/
|
|
483
|
+
getExtremes(axis = 0, dimension = 'x') {
|
|
484
|
+
return getAxisExtremes(this._hcChart, axis, dimension);
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Set the extremes (zoom/pan range) of an axis — useful for syncing a shared
|
|
488
|
+
* range across panels in response to `nile-extremes-change`. Safe no-op if the
|
|
489
|
+
* chart isn't ready or the axis doesn't exist. Pass `null` to reset a bound.
|
|
490
|
+
*/
|
|
491
|
+
setExtremes(min, max, opts = {}) {
|
|
492
|
+
setAxisExtremes(this._hcChart, min, max, opts);
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Force the chart to re-read inherited styles/CSS variables and redraw. Call
|
|
496
|
+
* this after your app toggles light/dark theme. Safe no-op until the chart is
|
|
497
|
+
* ready.
|
|
498
|
+
*/
|
|
499
|
+
refreshTheme() {
|
|
500
|
+
const chart = this._hcChart;
|
|
501
|
+
if (!chart?.update)
|
|
502
|
+
return;
|
|
503
|
+
chart.update({}, true, false);
|
|
504
|
+
}
|
|
339
505
|
handleAiSend(e) {
|
|
340
506
|
e.stopPropagation();
|
|
341
507
|
this.emit('nile-chart-ai-send', {
|
|
@@ -350,8 +516,10 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
350
516
|
const converted = convertConfig(this.resolvedConfig, toType);
|
|
351
517
|
this.activeType = toType;
|
|
352
518
|
this.activeConfig = converted;
|
|
353
|
-
// Leaving master-detail drops any active zoom
|
|
519
|
+
// Leaving master-detail or forecast drops any active zoom, and with it the
|
|
520
|
+
// header reset button.
|
|
354
521
|
this.masterZoomed = false;
|
|
522
|
+
this.forecastZoomed = false;
|
|
355
523
|
this.closeMenu();
|
|
356
524
|
this.emit('nile-chart-type-change', {
|
|
357
525
|
fromType,
|
|
@@ -428,6 +596,8 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
428
596
|
return false;
|
|
429
597
|
}
|
|
430
598
|
shouldShowHeader() {
|
|
599
|
+
if (this.minimized)
|
|
600
|
+
return false;
|
|
431
601
|
if (this.noHeader)
|
|
432
602
|
return false;
|
|
433
603
|
if (this.resolvedConfig?.noHeader === true)
|
|
@@ -443,7 +613,7 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
443
613
|
this.lightDomHasSlot('header') ||
|
|
444
614
|
this.lightDomHasSlot('header-actions') ||
|
|
445
615
|
hasBuiltinActions ||
|
|
446
|
-
this.
|
|
616
|
+
this.showResetZoom);
|
|
447
617
|
}
|
|
448
618
|
buildExportingOptions() {
|
|
449
619
|
return { exporting: { enabled: true, buttons: { contextButton: { enabled: false } } } };
|
|
@@ -637,14 +807,14 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
637
807
|
</div>
|
|
638
808
|
<div class="nile-chart-header-actions" part="header-actions">
|
|
639
809
|
<slot name="header-actions" @slotchange=${this.onHeaderActionsSlotChange}></slot>
|
|
640
|
-
${this.
|
|
810
|
+
${this.showResetZoom
|
|
641
811
|
? html `<nile-tooltip content="Reset zoom" placement="top" part="reset-zoom-tooltip">
|
|
642
812
|
<button
|
|
643
813
|
type="button"
|
|
644
814
|
class="nile-chart-menu-trigger nile-chart-reset-zoom"
|
|
645
815
|
part="reset-zoom"
|
|
646
816
|
aria-label="Reset zoom"
|
|
647
|
-
@click=${() => this.
|
|
817
|
+
@click=${() => this.resetActiveZoom()}
|
|
648
818
|
>
|
|
649
819
|
<nile-glyph name="refresh" size="16" part="reset-zoom-glyph"></nile-glyph>
|
|
650
820
|
</button>
|
|
@@ -704,13 +874,33 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
704
874
|
if (Object.keys(chart).length)
|
|
705
875
|
spacingOptions.chart = chart;
|
|
706
876
|
}
|
|
877
|
+
// First-class Highcharts passthrough fields (responsive, tooltip, xAxis,
|
|
878
|
+
// yAxis, plotOptions, …). Each maps 1:1 to the identically-named top-level
|
|
879
|
+
// Highcharts option and applies to every chart type. Only include keys the
|
|
880
|
+
// caller actually set, so we never inject `undefined` into the merge.
|
|
881
|
+
const passthroughOptions = {};
|
|
882
|
+
for (const key of HIGHCHARTS_PASSTHROUGH_KEYS) {
|
|
883
|
+
const value = config[key];
|
|
884
|
+
if (value !== undefined)
|
|
885
|
+
passthroughOptions[key] = value;
|
|
886
|
+
}
|
|
887
|
+
// Responsiveness is built in, but the RULES belong to the chart element we
|
|
888
|
+
// render, not to us: it knows its own axis shape, so it picks the matching
|
|
889
|
+
// default set (see responsive-defaults). We just forward the consumer's
|
|
890
|
+
// `responsive` value verbatim through `options` — the passthrough loop above
|
|
891
|
+
// already copied it. An object's `rules` are appended to the element's
|
|
892
|
+
// defaults (so they win at matching breakpoints), and `responsive: false`
|
|
893
|
+
// reaches the element as the opt-out sentinel it strips before Highcharts
|
|
894
|
+
// ever sees it. Nothing to do here.
|
|
707
895
|
const cfgData = config.data;
|
|
708
896
|
const dataCount = Array.isArray(cfgData) ? cfgData.length : undefined;
|
|
709
897
|
const hasExplicitColors = Array.isArray(config.options?.colors);
|
|
710
898
|
const paletteCfg = config.colorPalette ?? (hasExplicitColors ? undefined : { theme: 'default' });
|
|
711
899
|
const paletteColors = resolveColorPaletteColors(paletteCfg, dataCount);
|
|
712
900
|
const paletteOptions = paletteColors ? { colors: paletteColors } : {};
|
|
713
|
-
|
|
901
|
+
// Precedence (later wins): raw options → passthrough fields → legend →
|
|
902
|
+
// spacing → palette → title suppression → exporting.
|
|
903
|
+
const mergedOptions = deepMerge(deepMerge(deepMerge(deepMerge(deepMerge(deepMerge(config.options ?? {}, passthroughOptions), legendOptions), spacingOptions), paletteOptions), noTitle), this.buildExportingOptions());
|
|
714
904
|
switch (config.type) {
|
|
715
905
|
case 'bar':
|
|
716
906
|
return html `<nile-bar-chart
|
|
@@ -1339,6 +1529,41 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
1339
1529
|
.loadingFontFamily=${config.loadingFontFamily ?? ''}
|
|
1340
1530
|
.loadingBg=${config.loadingBg ?? ''}
|
|
1341
1531
|
></nile-fan-chart>`;
|
|
1532
|
+
case 'forecast':
|
|
1533
|
+
return html `<nile-forecast-chart
|
|
1534
|
+
.data=${config.data}
|
|
1535
|
+
.forecastData=${config.forecastData ?? []}
|
|
1536
|
+
.height=${this.hasAttribute('fit') ? null : (config.height ?? '100%')}
|
|
1537
|
+
.forecastStart=${config.forecastStart ?? null}
|
|
1538
|
+
.forecastDashStyle=${config.forecastDashStyle ?? 'Dot'}
|
|
1539
|
+
.zoom=${config.zoom ?? true}
|
|
1540
|
+
@nile-forecast-zoom=${(e) => this.onForecastZoom(e)}
|
|
1541
|
+
.showNowLine=${config.showNowLine ?? true}
|
|
1542
|
+
.nowLabel=${config.nowLabel ?? 'Now'}
|
|
1543
|
+
.nowLineColor=${config.nowLineColor ?? FORECAST_NOW_LINE_COLOR}
|
|
1544
|
+
.forecastBandLabel=${config.forecastBandLabel ?? ''}
|
|
1545
|
+
.forecastBandColor=${config.forecastBandColor ?? ''}
|
|
1546
|
+
.xAxisTitle=${config.xAxisTitle ?? ''}
|
|
1547
|
+
.yAxisTitle=${config.yAxisTitle ?? ''}
|
|
1548
|
+
.secondaryAxisTitle=${config.secondaryAxisTitle ?? ''}
|
|
1549
|
+
.secondaryAxisMin=${config.secondaryAxisMin ?? null}
|
|
1550
|
+
.timezone=${config.timezone ?? ''}
|
|
1551
|
+
.showLegend=${config.legend?.show ?? true}
|
|
1552
|
+
.legend=${config.legend ?? null}
|
|
1553
|
+
.options=${mergedOptions}
|
|
1554
|
+
.loading=${config.loading ?? false}
|
|
1555
|
+
.chartBg=${config.chartBg ?? ''}
|
|
1556
|
+
.chartBorderRadius=${config.chartBorderRadius ?? ''}
|
|
1557
|
+
.chartBorder=${config.chartBorder ?? ''}
|
|
1558
|
+
.chartShadow=${config.chartShadow ?? ''}
|
|
1559
|
+
.chartPadding=${config.chartPadding ?? ''}
|
|
1560
|
+
.chartMinHeight=${config.chartMinHeight ?? ''}
|
|
1561
|
+
.loadingText=${config.loadingText ?? 'Loading...'}
|
|
1562
|
+
.loadingColor=${config.loadingColor ?? ''}
|
|
1563
|
+
.loadingFontSize=${config.loadingFontSize ?? ''}
|
|
1564
|
+
.loadingFontFamily=${config.loadingFontFamily ?? ''}
|
|
1565
|
+
.loadingBg=${config.loadingBg ?? ''}
|
|
1566
|
+
></nile-forecast-chart>`;
|
|
1342
1567
|
case 'funnel':
|
|
1343
1568
|
return html `<nile-funnel-chart
|
|
1344
1569
|
.data=${config.data}
|
|
@@ -2003,6 +2228,12 @@ __decorate([
|
|
|
2003
2228
|
__decorate([
|
|
2004
2229
|
property({ type: String, reflect: true })
|
|
2005
2230
|
], NileChart.prototype, "appearance", void 0);
|
|
2231
|
+
__decorate([
|
|
2232
|
+
property({ type: Boolean, reflect: true, attribute: 'minimize-on-double-tap' })
|
|
2233
|
+
], NileChart.prototype, "minimizeOnDoubleTap", void 0);
|
|
2234
|
+
__decorate([
|
|
2235
|
+
property({ type: Boolean, reflect: true })
|
|
2236
|
+
], NileChart.prototype, "minimized", void 0);
|
|
2006
2237
|
__decorate([
|
|
2007
2238
|
property({ type: String, attribute: 'chart-type' })
|
|
2008
2239
|
], NileChart.prototype, "chartTypeAttr", void 0);
|
|
@@ -2039,9 +2270,15 @@ __decorate([
|
|
|
2039
2270
|
__decorate([
|
|
2040
2271
|
query('nile-master-detail-chart')
|
|
2041
2272
|
], NileChart.prototype, "masterDetailChart", void 0);
|
|
2273
|
+
__decorate([
|
|
2274
|
+
query('nile-forecast-chart')
|
|
2275
|
+
], NileChart.prototype, "forecastChart", void 0);
|
|
2042
2276
|
__decorate([
|
|
2043
2277
|
state()
|
|
2044
2278
|
], NileChart.prototype, "masterZoomed", void 0);
|
|
2279
|
+
__decorate([
|
|
2280
|
+
state()
|
|
2281
|
+
], NileChart.prototype, "forecastZoomed", void 0);
|
|
2045
2282
|
NileChart = NileChart_1 = __decorate([
|
|
2046
2283
|
customElement('nile-chart')
|
|
2047
2284
|
], NileChart);
|
|
@@ -5,6 +5,7 @@ import { getHighcharts } from '../internal/highcharts-provider.js';
|
|
|
5
5
|
import NileElement from '../internal/nile-element.js';
|
|
6
6
|
import { applySeparatedChartConfig } from '../internal/separated-chart-config.js';
|
|
7
7
|
import { deepMerge } from '../internal/utils.js';
|
|
8
|
+
import { withResponsiveDefaults } from '../internal/responsive-defaults.js';
|
|
8
9
|
import { styles } from './nile-cluster-chart.css.js';
|
|
9
10
|
let NileClusterChart = class NileClusterChart extends NileElement {
|
|
10
11
|
constructor() {
|
|
@@ -19,6 +20,7 @@ let NileClusterChart = class NileClusterChart extends NileElement {
|
|
|
19
20
|
this.data = [];
|
|
20
21
|
this.categories = [];
|
|
21
22
|
this.options = {};
|
|
23
|
+
this.noResponsive = false;
|
|
22
24
|
this.loading = false;
|
|
23
25
|
this.height = '400px';
|
|
24
26
|
this.yAxisTitle = '';
|
|
@@ -127,7 +129,7 @@ let NileClusterChart = class NileClusterChart extends NileElement {
|
|
|
127
129
|
}
|
|
128
130
|
buildOptions() {
|
|
129
131
|
const self = this;
|
|
130
|
-
|
|
132
|
+
const merged = deepMerge({
|
|
131
133
|
chart: { type: 'column', ...(this.height ? { height: this.height } : {}) },
|
|
132
134
|
title: { text: this.chartTitle || undefined },
|
|
133
135
|
subtitle: { text: this.chartSubtitle || undefined },
|
|
@@ -168,6 +170,7 @@ let NileClusterChart = class NileClusterChart extends NileElement {
|
|
|
168
170
|
})),
|
|
169
171
|
credits: { enabled: false },
|
|
170
172
|
}, this.options);
|
|
173
|
+
return withResponsiveDefaults(merged, 'cluster', this.noResponsive);
|
|
171
174
|
}
|
|
172
175
|
async initChart() {
|
|
173
176
|
if (this.loading || !this.chartContainer)
|
|
@@ -212,6 +215,9 @@ __decorate([
|
|
|
212
215
|
__decorate([
|
|
213
216
|
property({ type: Object })
|
|
214
217
|
], NileClusterChart.prototype, "options", void 0);
|
|
218
|
+
__decorate([
|
|
219
|
+
property({ type: Boolean, attribute: 'no-responsive' })
|
|
220
|
+
], NileClusterChart.prototype, "noResponsive", void 0);
|
|
215
221
|
__decorate([
|
|
216
222
|
property({ type: Boolean, reflect: true })
|
|
217
223
|
], NileClusterChart.prototype, "loading", void 0);
|
|
@@ -4,6 +4,7 @@ import { html } from 'lit';
|
|
|
4
4
|
import { getHighcharts } from '../internal/highcharts-provider.js';
|
|
5
5
|
import NileElement from '../internal/nile-element.js';
|
|
6
6
|
import { deepMerge } from '../internal/utils.js';
|
|
7
|
+
import { withResponsiveDefaults } from '../internal/responsive-defaults.js';
|
|
7
8
|
import { styles } from './nile-column-chart.css.js';
|
|
8
9
|
let NileColumnChart = class NileColumnChart extends NileElement {
|
|
9
10
|
constructor() {
|
|
@@ -18,6 +19,7 @@ let NileColumnChart = class NileColumnChart extends NileElement {
|
|
|
18
19
|
this.data = [];
|
|
19
20
|
this.categories = [];
|
|
20
21
|
this.options = {};
|
|
22
|
+
this.noResponsive = false;
|
|
21
23
|
this.loading = false;
|
|
22
24
|
this.height = '400px';
|
|
23
25
|
this.yAxisTitle = '';
|
|
@@ -155,7 +157,7 @@ let NileColumnChart = class NileColumnChart extends NileElement {
|
|
|
155
157
|
}
|
|
156
158
|
buildOptions() {
|
|
157
159
|
const self = this;
|
|
158
|
-
|
|
160
|
+
const merged = deepMerge({
|
|
159
161
|
chart: { type: 'column', ...(this.height ? { height: this.height } : {}) },
|
|
160
162
|
title: { text: this.chartTitle || undefined },
|
|
161
163
|
subtitle: { text: this.chartSubtitle || undefined },
|
|
@@ -170,6 +172,7 @@ let NileColumnChart = class NileColumnChart extends NileElement {
|
|
|
170
172
|
legend: (() => { const { show, ...rest } = this.legend ?? {}; return { enabled: show ?? this.showLegend, ...rest }; })(),
|
|
171
173
|
credits: { enabled: false },
|
|
172
174
|
}, this.options);
|
|
175
|
+
return withResponsiveDefaults(merged, 'column', this.noResponsive);
|
|
173
176
|
}
|
|
174
177
|
async initChart() {
|
|
175
178
|
if (this.loading || !this.chartContainer)
|
|
@@ -211,6 +214,9 @@ __decorate([
|
|
|
211
214
|
__decorate([
|
|
212
215
|
property({ type: Object })
|
|
213
216
|
], NileColumnChart.prototype, "options", void 0);
|
|
217
|
+
__decorate([
|
|
218
|
+
property({ type: Boolean, attribute: 'no-responsive' })
|
|
219
|
+
], NileColumnChart.prototype, "noResponsive", void 0);
|
|
214
220
|
__decorate([
|
|
215
221
|
property({ type: Boolean, reflect: true })
|
|
216
222
|
], NileColumnChart.prototype, "loading", void 0);
|