@aquera/nile-visualization 2.9.27 → 2.9.29
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 +5 -0
- package/dist/src/index.js +4 -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/dashboard-adapters.d.ts +4 -0
- package/dist/src/internal/dashboard-adapters.js +9 -3
- package/dist/src/internal/highcharts-provider.js +3 -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/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 +2 -0
- package/dist/src/internal/types/index.js +1 -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/nile-chart-config.d.ts +2 -2
- package/dist/src/nile-chart/nile-chart.css.js +7 -1
- package/dist/src/nile-chart/nile-chart.d.ts +59 -0
- package/dist/src/nile-chart/nile-chart.js +176 -3
- 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/gridstack-css.d.ts +1 -0
- package/dist/src/nile-dashboard-builder/gridstack-css.js +6 -0
- package/dist/src/nile-dashboard-builder/index.d.ts +1 -0
- package/dist/src/nile-dashboard-builder/index.js +2 -0
- package/dist/src/nile-dashboard-builder/nile-dashboard-builder.css.d.ts +1 -0
- package/dist/src/nile-dashboard-builder/nile-dashboard-builder.css.js +96 -0
- package/dist/src/nile-dashboard-builder/nile-dashboard-builder.d.ts +177 -0
- package/dist/src/nile-dashboard-builder/nile-dashboard-builder.js +499 -0
- 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-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-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 +7 -6
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import NileElement from './nile-element.js';
|
|
2
|
+
import { getAxisExtremes, setAxisExtremes, } from './chart-runtime.js';
|
|
3
|
+
/**
|
|
4
|
+
* Shared base for the individual chart components. Extends {@link NileElement}
|
|
5
|
+
* (so `emit()` and its defaults are unchanged) and adds a small, additive
|
|
6
|
+
* runtime surface every chart can inherit:
|
|
7
|
+
*
|
|
8
|
+
* - `chart` getter — the live `Highcharts.Chart`, or `null` until ready.
|
|
9
|
+
* - `whenReady()` — a promise that resolves once the chart exists.
|
|
10
|
+
* - `getExtremes()` / `setExtremes()` — axis range read/write for cross-panel sync.
|
|
11
|
+
*
|
|
12
|
+
* Subclasses assign `this._chart` where they used to assign their private
|
|
13
|
+
* `chart` field, call `this._notifyChartReady()` right after, and
|
|
14
|
+
* `this._clearChart()` when destroying. Nothing else about their lifecycle
|
|
15
|
+
* changes.
|
|
16
|
+
*/
|
|
17
|
+
export default class NileChartBase extends NileElement {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
/** The underlying Highcharts instance. Managed by subclasses via the hooks below. */
|
|
21
|
+
this._chart = null;
|
|
22
|
+
this._readyResolvers = [];
|
|
23
|
+
}
|
|
24
|
+
/** The underlying `Highcharts.Chart` instance, or `null` until the chart is ready. */
|
|
25
|
+
get chart() {
|
|
26
|
+
return this._chart;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Resolves with the `Highcharts.Chart` instance. Resolves immediately if the
|
|
30
|
+
* chart already exists, otherwise on the next time it becomes ready.
|
|
31
|
+
*/
|
|
32
|
+
whenReady() {
|
|
33
|
+
if (this._chart)
|
|
34
|
+
return Promise.resolve(this._chart);
|
|
35
|
+
return new Promise((resolve) => {
|
|
36
|
+
this._readyResolvers.push(resolve);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
/** Subclasses call this right after assigning `this._chart`. */
|
|
40
|
+
_notifyChartReady() {
|
|
41
|
+
const chart = this._chart;
|
|
42
|
+
if (!chart)
|
|
43
|
+
return;
|
|
44
|
+
const resolvers = this._readyResolvers;
|
|
45
|
+
this._readyResolvers = [];
|
|
46
|
+
resolvers.forEach((resolve) => resolve(chart));
|
|
47
|
+
}
|
|
48
|
+
/** Subclasses call this after destroying the chart, so stale instances aren't handed out. */
|
|
49
|
+
_clearChart() {
|
|
50
|
+
this._chart = null;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Read the current extremes of an axis (default: primary x-axis). Returns
|
|
54
|
+
* `null` when the chart isn't ready or the axis doesn't exist.
|
|
55
|
+
*/
|
|
56
|
+
getExtremes(axis = 0, dimension = 'x') {
|
|
57
|
+
return getAxisExtremes(this._chart, axis, dimension);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Set the extremes (zoom/pan range) of an axis. Safe no-op if the chart isn't
|
|
61
|
+
* ready or the axis doesn't exist. Pass `null` to reset a bound to the data edge.
|
|
62
|
+
*/
|
|
63
|
+
setExtremes(min, max, opts = {}) {
|
|
64
|
+
setAxisExtremes(this._chart, min, max, opts);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=nile-chart-base.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { NileWidgetConfig } from './types/widget-config.type.js';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves whether a widget renders as a chart or a KPI tile.
|
|
4
|
+
*
|
|
5
|
+
* Uses the explicit `type` discriminator when present (back-compat); otherwise
|
|
6
|
+
* infers it from the widget's `nileConfig.chart.type` — `'kpi'` yields a KPI
|
|
7
|
+
* tile, anything else (bar, pie, line, …) yields a chart. This lets hosts omit
|
|
8
|
+
* the redundant top-level `type` and let the chart config drive the kind.
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolveWidgetKind(config: NileWidgetConfig): 'chart' | 'kpi';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves whether a widget renders as a chart or a KPI tile.
|
|
3
|
+
*
|
|
4
|
+
* Uses the explicit `type` discriminator when present (back-compat); otherwise
|
|
5
|
+
* infers it from the widget's `nileConfig.chart.type` — `'kpi'` yields a KPI
|
|
6
|
+
* tile, anything else (bar, pie, line, …) yields a chart. This lets hosts omit
|
|
7
|
+
* the redundant top-level `type` and let the chart config drive the kind.
|
|
8
|
+
*/
|
|
9
|
+
export function resolveWidgetKind(config) {
|
|
10
|
+
if (config.type)
|
|
11
|
+
return config.type;
|
|
12
|
+
const chartType = config.nileConfig?.chart
|
|
13
|
+
?.type;
|
|
14
|
+
return chartType === 'kpi' ? 'kpi' : 'chart';
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=resolve-widget-kind.js.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in, type-aware default `responsive.rules` for every Nile chart.
|
|
3
|
+
*
|
|
4
|
+
* These make every chart responsive out of the box — no rules to hand-write.
|
|
5
|
+
* Each individual chart element (`<nile-bar-chart>`, `<nile-pie-chart>`, …)
|
|
6
|
+
* injects the set matching its own type as the last step of its `buildOptions()`
|
|
7
|
+
* via {@link withResponsiveDefaults}, and MERGES any rules the consumer passes
|
|
8
|
+
* on top (theirs win at matching breakpoints). `<nile-chart>` does not compute
|
|
9
|
+
* rules itself: it forwards the consumer's `responsive` value down through
|
|
10
|
+
* `options` to the element it renders, so both entry points behave identically
|
|
11
|
+
* and the element that knows its own axis shape is the one choosing the rules.
|
|
12
|
+
*
|
|
13
|
+
* The rule sets mirror the idiomatic Highcharts patterns: circular charts
|
|
14
|
+
* (pie/donut) collapse their legend as space runs out; cartesian charts move
|
|
15
|
+
* the legend below the plot, then drop the y-axis title / rotate x-labels, then
|
|
16
|
+
* strip to essentials. They only ever touch legend/axis/dataLabels, so they are
|
|
17
|
+
* harmless no-ops on a chart that happens to lack one of those.
|
|
18
|
+
*/
|
|
19
|
+
import type { Options } from 'highcharts';
|
|
20
|
+
/** A single Highcharts responsive rule. */
|
|
21
|
+
export interface ResponsiveRule {
|
|
22
|
+
condition: {
|
|
23
|
+
maxWidth?: number;
|
|
24
|
+
minWidth?: number;
|
|
25
|
+
maxHeight?: number;
|
|
26
|
+
minHeight?: number;
|
|
27
|
+
};
|
|
28
|
+
chartOptions: Record<string, unknown>;
|
|
29
|
+
}
|
|
30
|
+
export declare function withResponsiveDefaults(options: Options, type: string, disabled?: boolean): Options;
|
|
31
|
+
/** Default responsive rules for a chart type (empty for non-adaptive types). */
|
|
32
|
+
export declare function defaultResponsiveRules(type?: string | null): ResponsiveRule[];
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Disables data labels for small sizes. Charts turn data labels ON via the
|
|
3
|
+
* TYPE-SPECIFIC `plotOptions.<type>` key (e.g. `plotOptions.waterfall`,
|
|
4
|
+
* `plotOptions.variablepie`), which is more specific than `plotOptions.series`
|
|
5
|
+
* and wins the merge — so a single `series` override doesn't turn them off. We
|
|
6
|
+
* set every series type that can carry data labels, so the override lands
|
|
7
|
+
* regardless of which key the chart used. (Excludes gauge/organization, which
|
|
8
|
+
* are handled by their own rule sets and must KEEP their labels.)
|
|
9
|
+
*/
|
|
10
|
+
const DATA_LABELS_OFF = Object.fromEntries([
|
|
11
|
+
'series', 'line', 'spline', 'column', 'bar', 'area', 'areaspline',
|
|
12
|
+
'arearange', 'columnrange', 'columnpyramid', 'pie', 'variablepie',
|
|
13
|
+
'funnel', 'pyramid', 'waterfall', 'lollipop', 'dumbbell', 'scatter',
|
|
14
|
+
'bubble', 'boxplot', 'heatmap', 'timeline', 'histogram', 'bellcurve',
|
|
15
|
+
'xrange',
|
|
16
|
+
].map(type => [type, { dataLabels: { enabled: false } }]));
|
|
17
|
+
/** pie / donut / variablePie / funnel / euler — keep the shape legible, shed
|
|
18
|
+
* the leader-line labels then the legend. Data labels are disabled at the
|
|
19
|
+
* `series` level so it applies to every circular type (pie, variablepie,
|
|
20
|
+
* funnel…), not just the `pie` series. */
|
|
21
|
+
const CIRCULAR_RULES = [
|
|
22
|
+
{
|
|
23
|
+
// ≤ 480px — drop leader-line labels, move the legend below the wheel.
|
|
24
|
+
condition: { maxWidth: 480 },
|
|
25
|
+
chartOptions: {
|
|
26
|
+
legend: { align: 'center', verticalAlign: 'bottom', layout: 'horizontal' },
|
|
27
|
+
plotOptions: DATA_LABELS_OFF,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
// Too narrow / too short for a legend without it paging — hide it; the
|
|
31
|
+
// tooltip still names each slice.
|
|
32
|
+
{ condition: { maxWidth: 340 }, chartOptions: { legend: { enabled: false } } },
|
|
33
|
+
{ condition: { maxHeight: 240 }, chartOptions: { legend: { enabled: false } } },
|
|
34
|
+
];
|
|
35
|
+
/** column / bar / line / area / … — reclaim space as the plot narrows. */
|
|
36
|
+
const CARTESIAN_RULES = [
|
|
37
|
+
{
|
|
38
|
+
// ≤ 420px — move the legend below the plot, drop the y-axis title.
|
|
39
|
+
condition: { maxWidth: 420 },
|
|
40
|
+
chartOptions: {
|
|
41
|
+
legend: { align: 'center', verticalAlign: 'bottom', layout: 'horizontal' },
|
|
42
|
+
yAxis: { title: { text: null } },
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
// ≤ 340px — the CHART is the priority: hide the legend, the x/y axis tick
|
|
47
|
+
// labels + titles, and data labels so the plot fills the space instead of
|
|
48
|
+
// being crowded out by axis/label text.
|
|
49
|
+
condition: { maxWidth: 340 },
|
|
50
|
+
chartOptions: {
|
|
51
|
+
legend: { enabled: false },
|
|
52
|
+
xAxis: { labels: { enabled: false }, title: { text: null } },
|
|
53
|
+
yAxis: { labels: { enabled: false }, title: { text: null } },
|
|
54
|
+
plotOptions: DATA_LABELS_OFF,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
// Short — same priority for vertical space: shed axis labels + legend.
|
|
59
|
+
condition: { maxHeight: 220 },
|
|
60
|
+
chartOptions: {
|
|
61
|
+
legend: { enabled: false },
|
|
62
|
+
xAxis: { labels: { enabled: false } },
|
|
63
|
+
yAxis: { labels: { enabled: false } },
|
|
64
|
+
plotOptions: DATA_LABELS_OFF,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
];
|
|
68
|
+
/** gauge — radial scale. Shed the scale tick labels + legend when small so they
|
|
69
|
+
* don't overlap the value in the middle. Keep the value label (don't touch
|
|
70
|
+
* dataLabels). radialBar is NOT here: it has category spokes (xAxis labels), so
|
|
71
|
+
* it uses the cartesian rules that hide x/y labels too. */
|
|
72
|
+
const RADIAL_RULES = [
|
|
73
|
+
{
|
|
74
|
+
condition: { maxWidth: 340 },
|
|
75
|
+
chartOptions: { legend: { enabled: false }, yAxis: { labels: { enabled: false } } },
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
condition: { maxHeight: 220 },
|
|
79
|
+
chartOptions: { legend: { enabled: false }, yAxis: { labels: { enabled: false } } },
|
|
80
|
+
},
|
|
81
|
+
];
|
|
82
|
+
/**
|
|
83
|
+
* Multi-axis charts bind a series to a second x/y axis (line-column's dual
|
|
84
|
+
* y-axis, flame's second x/y axis). The cartesian rules inject `xAxis`/`yAxis`
|
|
85
|
+
* as single OBJECTS, which collapse the chart's axis ARRAY and drop the axis-1
|
|
86
|
+
* series — so these types need axis overrides in ARRAY form, one entry per axis
|
|
87
|
+
* the chart actually declares. An array SHORTER than the chart's axis list is
|
|
88
|
+
* safe (Highcharts matches by index and leaves the rest alone); an array LONGER
|
|
89
|
+
* than it would create a phantom axis, which is why the shapes below are
|
|
90
|
+
* per-type rather than shared.
|
|
91
|
+
*
|
|
92
|
+
* Without this, a dual-axis chart keeps BOTH y-axis titles plus both tick-label
|
|
93
|
+
* columns at every size, and on a small card that chrome crowds the plot down to
|
|
94
|
+
* a third of the width. `AXIS_CHROME_OFF(n)` sheds the titles and tick labels for
|
|
95
|
+
* `n` axes, matching what the cartesian rules do for single-axis charts.
|
|
96
|
+
*/
|
|
97
|
+
const AXIS_CHROME_OFF = (count) => Array.from({ length: count }, () => ({ labels: { enabled: false }, title: { text: null } }));
|
|
98
|
+
/** Titles only — the first step, taken before we drop the tick labels. */
|
|
99
|
+
const AXIS_TITLES_OFF = (count) => Array.from({ length: count }, () => ({ title: { text: null } }));
|
|
100
|
+
/**
|
|
101
|
+
* Build the rule set for a multi-axis type. `xAxes`/`yAxes` are how many axes
|
|
102
|
+
* that chart type declares, so the injected arrays line up index-for-index.
|
|
103
|
+
*/
|
|
104
|
+
const multiAxisRules = (xAxes, yAxes) => [
|
|
105
|
+
{
|
|
106
|
+
// ≤ 420px — legend below the plot, and drop the axis TITLES (the rotated
|
|
107
|
+
// "Avg. order value ($)" text is the single biggest space thief here).
|
|
108
|
+
condition: { maxWidth: 420 },
|
|
109
|
+
chartOptions: {
|
|
110
|
+
legend: { align: 'center', verticalAlign: 'bottom', layout: 'horizontal' },
|
|
111
|
+
yAxis: AXIS_TITLES_OFF(yAxes),
|
|
112
|
+
xAxis: AXIS_TITLES_OFF(xAxes),
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
// ≤ 340px — the plot is the priority: legend, data labels, and every axis's
|
|
117
|
+
// tick labels go, exactly as the cartesian rules do for a single axis.
|
|
118
|
+
condition: { maxWidth: 340 },
|
|
119
|
+
chartOptions: {
|
|
120
|
+
legend: { enabled: false },
|
|
121
|
+
plotOptions: DATA_LABELS_OFF,
|
|
122
|
+
yAxis: AXIS_CHROME_OFF(yAxes),
|
|
123
|
+
xAxis: AXIS_CHROME_OFF(xAxes),
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
// Short — same priority for vertical space.
|
|
128
|
+
condition: { maxHeight: 220 },
|
|
129
|
+
chartOptions: {
|
|
130
|
+
legend: { enabled: false },
|
|
131
|
+
plotOptions: DATA_LABELS_OFF,
|
|
132
|
+
yAxis: AXIS_CHROME_OFF(yAxes),
|
|
133
|
+
xAxis: AXIS_CHROME_OFF(xAxes),
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
];
|
|
137
|
+
/** `line-column` — one shared x-axis, two y-axes (column left, line right). */
|
|
138
|
+
const LINE_COLUMN_RULES = multiAxisRules(1, 2);
|
|
139
|
+
/** `flame` — two x-axes (index 0 hidden) and two y-axes. */
|
|
140
|
+
const FLAME_RULES = multiAxisRules(2, 2);
|
|
141
|
+
/**
|
|
142
|
+
* `histogram` / `bellcurve` — a single x and y axis, but declared in ARRAY form
|
|
143
|
+
* (the derived series needs an axis list to bind to). Only the shape matters
|
|
144
|
+
* here, not the count: an object-form override would be assigned onto the array
|
|
145
|
+
* instead of into `[0]`, so the axis rules would silently do nothing.
|
|
146
|
+
*/
|
|
147
|
+
const SINGLE_AXIS_ARRAY_RULES = multiAxisRules(1, 1);
|
|
148
|
+
/** map — drop the zoom controls + legend when small; keep the shapes. */
|
|
149
|
+
const MAP_RULES = [
|
|
150
|
+
{
|
|
151
|
+
condition: { maxWidth: 420 },
|
|
152
|
+
chartOptions: { legend: { enabled: false }, mapNavigation: { enabled: false } },
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
condition: { maxHeight: 240 },
|
|
156
|
+
chartOptions: { legend: { enabled: false }, mapNavigation: { enabled: false } },
|
|
157
|
+
},
|
|
158
|
+
];
|
|
159
|
+
/**
|
|
160
|
+
* organization — node labels ARE the content, so shed the legend and shrink the
|
|
161
|
+
* node label font as space runs out, but never hide the labels (that would blank
|
|
162
|
+
* the tree).
|
|
163
|
+
*
|
|
164
|
+
* Font size alone is not enough: the node BOXES are what collide. Highcharts
|
|
165
|
+
* sizes them from `nodeWidth` (the box's cross-axis extent — height on the usual
|
|
166
|
+
* `inverted` org chart), `nodePadding` (gap between siblings) and `hangingIndent`
|
|
167
|
+
* (offset for `layout: 'hanging'` children). Those are fixed pixel defaults
|
|
168
|
+
* (50 / 10 / 20), so on a short card four levels of boxes need more room than
|
|
169
|
+
* exists and Highcharts overlaps them into an unreadable pile. Scaling the three
|
|
170
|
+
* down alongside the font keeps the hierarchy legible.
|
|
171
|
+
*
|
|
172
|
+
* These live in `responsive.rules` rather than in a `render` handler because
|
|
173
|
+
* changing node geometry requires a redraw — Highcharts applies rule
|
|
174
|
+
* `chartOptions` through its own update path, so there's no render loop.
|
|
175
|
+
*
|
|
176
|
+
* The font size belongs here too, not in a post-render `.css()` pass: Highcharts
|
|
177
|
+
* lays the node box out around the label's measured text, so the size has to be
|
|
178
|
+
* known BEFORE layout. Restyling the finished SVG label leaves the box sized for
|
|
179
|
+
* the old text and the label overflows it.
|
|
180
|
+
*/
|
|
181
|
+
const ORG_COMPACT = {
|
|
182
|
+
legend: { enabled: false },
|
|
183
|
+
plotOptions: {
|
|
184
|
+
organization: {
|
|
185
|
+
nodeWidth: 24,
|
|
186
|
+
nodePadding: 4,
|
|
187
|
+
hangingIndent: 8,
|
|
188
|
+
borderRadius: 2,
|
|
189
|
+
// Name only — a compact box has room for one line, not name + title.
|
|
190
|
+
dataLabels: { nodeFormat: '{point.name}', style: { fontSize: '9px' } },
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
};
|
|
194
|
+
const ORG_RULES = [
|
|
195
|
+
{ condition: { maxWidth: 420 }, chartOptions: { legend: { enabled: false } } },
|
|
196
|
+
{ condition: { maxWidth: 340 }, chartOptions: ORG_COMPACT },
|
|
197
|
+
{ condition: { maxHeight: 260 }, chartOptions: ORG_COMPACT },
|
|
198
|
+
];
|
|
199
|
+
const CIRCULAR_TYPES = new Set(['pie', 'donut', 'variablepie', 'funnel', 'euler']);
|
|
200
|
+
const RADIAL_TYPES = new Set(['gauge']);
|
|
201
|
+
/**
|
|
202
|
+
* Types that declare their axes as ARRAYS — either because a series binds to a
|
|
203
|
+
* second axis (line-column's dual y-axis, flame's second x/y axis) or because a
|
|
204
|
+
* derived series needs an axis list (histogram, bellcurve). The axis-OBJECT
|
|
205
|
+
* overrides used by the cartesian rules don't reach an array's entries, so each
|
|
206
|
+
* maps to a rule set whose axis overrides are arrays sized to that type's own
|
|
207
|
+
* axis count.
|
|
208
|
+
*/
|
|
209
|
+
const MULTI_AXIS_RULES_BY_TYPE = {
|
|
210
|
+
'line-column': LINE_COLUMN_RULES,
|
|
211
|
+
flame: FLAME_RULES,
|
|
212
|
+
histogram: SINGLE_AXIS_ARRAY_RULES,
|
|
213
|
+
bellcurve: SINGLE_AXIS_ARRAY_RULES,
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* Genuinely non-adaptive types — not Highcharts plots (KPI tile, data grid, and
|
|
217
|
+
* the message/list/filter widgets). Everything else gets a rule set; the
|
|
218
|
+
* CARTESIAN default covers axis + polar charts (radar/spiderweb, heatmap,
|
|
219
|
+
* polygon, vector, xrange, timeline, boxplot, master-detail, …) by shedding the
|
|
220
|
+
* legend, axis tick labels, and data labels so the plot itself stays legible.
|
|
221
|
+
*/
|
|
222
|
+
const NON_ADAPTIVE_TYPES = new Set(['kpi', 'grid', 'filter', 'message', 'list']);
|
|
223
|
+
export function withResponsiveDefaults(options, type, disabled = false) {
|
|
224
|
+
const { responsive, ...rest } = options;
|
|
225
|
+
// `responsive: false` is the opt-out sentinel — strip it either way so it
|
|
226
|
+
// never reaches Highcharts, which expects an object under this key.
|
|
227
|
+
if (disabled || responsive === false)
|
|
228
|
+
return rest;
|
|
229
|
+
const userObj = responsive && typeof responsive === 'object' ? responsive : null;
|
|
230
|
+
const userRules = Array.isArray(userObj?.['rules']) ? userObj['rules'] : [];
|
|
231
|
+
const rules = [...defaultResponsiveRules(type), ...userRules];
|
|
232
|
+
if (!rules.length)
|
|
233
|
+
return rest;
|
|
234
|
+
return { ...rest, responsive: { ...(userObj ?? {}), rules } };
|
|
235
|
+
}
|
|
236
|
+
/** Default responsive rules for a chart type (empty for non-adaptive types). */
|
|
237
|
+
export function defaultResponsiveRules(type) {
|
|
238
|
+
if (!type)
|
|
239
|
+
return CARTESIAN_RULES;
|
|
240
|
+
const t = String(type).toLowerCase();
|
|
241
|
+
if (NON_ADAPTIVE_TYPES.has(t))
|
|
242
|
+
return [];
|
|
243
|
+
if (MULTI_AXIS_RULES_BY_TYPE[t])
|
|
244
|
+
return MULTI_AXIS_RULES_BY_TYPE[t];
|
|
245
|
+
if (RADIAL_TYPES.has(t))
|
|
246
|
+
return RADIAL_RULES;
|
|
247
|
+
if (CIRCULAR_TYPES.has(t))
|
|
248
|
+
return CIRCULAR_RULES;
|
|
249
|
+
if (t === 'map')
|
|
250
|
+
return MAP_RULES;
|
|
251
|
+
if (t === 'organization')
|
|
252
|
+
return ORG_RULES;
|
|
253
|
+
return CARTESIAN_RULES;
|
|
254
|
+
}
|
|
255
|
+
//# sourceMappingURL=responsive-defaults.js.map
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* First-class passthrough for the most-used top-level Highcharts option groups.
|
|
3
|
+
*
|
|
4
|
+
* Every field here maps 1:1 to the identically-named Highcharts top-level option
|
|
5
|
+
* and is deep-merged into EVERY `<nile-chart>` type. That means you can write
|
|
6
|
+
* `responsive` / `tooltip` / `xAxis` at the top level of a chart config instead
|
|
7
|
+
* of nesting them inside `options`:
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* chart.config = {
|
|
11
|
+
* type: 'column',
|
|
12
|
+
* data,
|
|
13
|
+
* // ↓ first-class, applies to every chart type
|
|
14
|
+
* responsive: {
|
|
15
|
+
* rules: [{ condition: { maxWidth: 500 },
|
|
16
|
+
* chartOptions: { legend: { align: 'center', verticalAlign: 'bottom' } } }],
|
|
17
|
+
* },
|
|
18
|
+
* tooltip: { shared: true, valuePrefix: '₹' },
|
|
19
|
+
* yAxis: { min: 0, gridLineDashStyle: 'Dash' },
|
|
20
|
+
* };
|
|
21
|
+
*
|
|
22
|
+
* Anything NOT surfaced here is still fully available through the raw `options`
|
|
23
|
+
* field, which accepts the complete Highcharts `Options` object — so 100% of the
|
|
24
|
+
* Highcharts API remains reachable.
|
|
25
|
+
*
|
|
26
|
+
* Precedence (later wins): `options` → these passthrough fields → the
|
|
27
|
+
* dedicated Nile wrappers (`legend`, `chartSpacing`, `colorPalette`). So a field
|
|
28
|
+
* set here overrides the same key in `options`, and is itself overridden by the
|
|
29
|
+
* matching Nile wrapper where they overlap.
|
|
30
|
+
*
|
|
31
|
+
* Typed via indexed access on Highcharts' `Options` so each field automatically
|
|
32
|
+
* picks up the real Highcharts type once the package's types are present.
|
|
33
|
+
*/
|
|
34
|
+
import type { Options } from 'highcharts';
|
|
35
|
+
/** The top-level Highcharts option keys surfaced as first-class `<nile-chart>` fields. */
|
|
36
|
+
export declare const HIGHCHARTS_PASSTHROUGH_KEYS: readonly ["responsive", "tooltip", "xAxis", "yAxis", "zAxis", "colorAxis", "plotOptions", "pane", "zooming", "annotations", "accessibility", "credits", "time", "boost", "navigation", "caption", "drilldown", "lang", "noData", "chart"];
|
|
37
|
+
export interface HighchartsPassthroughConfig {
|
|
38
|
+
responsive?: Options['responsive'] | false;
|
|
39
|
+
/** Tooltip options — shared/split tooltips, formatting, value prefix/suffix, borders, etc. */
|
|
40
|
+
tooltip?: Options['tooltip'];
|
|
41
|
+
/** X axis (or array of X axes) — titles, min/max, categories, gridlines, plot lines/bands. */
|
|
42
|
+
xAxis?: Options['xAxis'];
|
|
43
|
+
/** Y axis (or array of Y axes). */
|
|
44
|
+
yAxis?: Options['yAxis'];
|
|
45
|
+
/** Z axis — 3D / bubble depth. */
|
|
46
|
+
zAxis?: Options['zAxis'];
|
|
47
|
+
/** Color axis — for heatmaps and color-graded series. */
|
|
48
|
+
colorAxis?: Options['colorAxis'];
|
|
49
|
+
/** Per-series-type defaults — dataLabels, marker, stacking, animation, point events, … */
|
|
50
|
+
plotOptions?: Options['plotOptions'];
|
|
51
|
+
/** Pane options — for gauge, radar, and polar charts. */
|
|
52
|
+
pane?: Options['pane'];
|
|
53
|
+
/** Zooming behaviour — `type`, `mouseWheel`, `pinchType`, `singleTouch`, … */
|
|
54
|
+
zooming?: Options['zooming'];
|
|
55
|
+
/** Annotations — labels, shapes, and callouts anchored to the plot. */
|
|
56
|
+
annotations?: Options['annotations'];
|
|
57
|
+
/** Accessibility options — a11y descriptions, keyboard navigation, screen-reader support. */
|
|
58
|
+
accessibility?: Options['accessibility'];
|
|
59
|
+
/** Credits label shown in the lower-right corner. */
|
|
60
|
+
credits?: Options['credits'];
|
|
61
|
+
/** Time options — timezone, `useUTC`, custom time functions. */
|
|
62
|
+
time?: Options['time'];
|
|
63
|
+
/** Boost module options for large datasets (GPU rendering thresholds). */
|
|
64
|
+
boost?: Options['boost'];
|
|
65
|
+
/** Navigation options shared by the exporting context menu and annotations. */
|
|
66
|
+
navigation?: Options['navigation'];
|
|
67
|
+
/** Caption rendered below the plot area. */
|
|
68
|
+
caption?: Options['caption'];
|
|
69
|
+
/** Drilldown configuration — series/point drilldown. */
|
|
70
|
+
drilldown?: Options['drilldown'];
|
|
71
|
+
/** Language / localization strings (`lang`). */
|
|
72
|
+
lang?: Options['lang'];
|
|
73
|
+
/** "No data to display" message options. */
|
|
74
|
+
noData?: Options['noData'];
|
|
75
|
+
/**
|
|
76
|
+
* Low-level Highcharts `chart` options — `inverted`, `polar`, `backgroundColor`,
|
|
77
|
+
* `events`, `zoomType`, etc. (Prefer `chartSpacing` for spacing.)
|
|
78
|
+
*/
|
|
79
|
+
chart?: Options['chart'];
|
|
80
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** The top-level Highcharts option keys surfaced as first-class `<nile-chart>` fields. */
|
|
2
|
+
export const HIGHCHARTS_PASSTHROUGH_KEYS = [
|
|
3
|
+
'responsive',
|
|
4
|
+
'tooltip',
|
|
5
|
+
'xAxis',
|
|
6
|
+
'yAxis',
|
|
7
|
+
'zAxis',
|
|
8
|
+
'colorAxis',
|
|
9
|
+
'plotOptions',
|
|
10
|
+
'pane',
|
|
11
|
+
'zooming',
|
|
12
|
+
'annotations',
|
|
13
|
+
'accessibility',
|
|
14
|
+
'credits',
|
|
15
|
+
'time',
|
|
16
|
+
'boost',
|
|
17
|
+
'navigation',
|
|
18
|
+
'caption',
|
|
19
|
+
'drilldown',
|
|
20
|
+
'lang',
|
|
21
|
+
'noData',
|
|
22
|
+
'chart',
|
|
23
|
+
];
|
|
24
|
+
//# sourceMappingURL=highcharts-passthrough.type.js.map
|
|
@@ -52,6 +52,8 @@ export type { PrimitiveChartConfigType } from './primitive-chart-config.type.js'
|
|
|
52
52
|
export type { SeparatedChartConfigInputType } from './separated-chart-config-input.type.js';
|
|
53
53
|
export type { AllChartConfigType } from './all-chart-config.type.js';
|
|
54
54
|
export type { CSSObject, LegendConfig, LegendNavigationConfig, LegendTitleConfig, LegendAccessibilityConfig, ChartSpacingConfig, } from './legend-config.type.js';
|
|
55
|
+
export type { HighchartsPassthroughConfig } from './highcharts-passthrough.type.js';
|
|
56
|
+
export { HIGHCHARTS_PASSTHROUGH_KEYS } from './highcharts-passthrough.type.js';
|
|
55
57
|
export type { ChartConfigType } from './chart-config.type.js';
|
|
56
58
|
export type { NileChartConfigInputType } from './nile-chart-config-input.type.js';
|
|
57
59
|
export type { ChartAiPanelPayload, ChartAiSenderPayload, NileAiPanelConfigInputType, NileAiSenderConfigInputType, } from './nile-ai-widgets-config-input.type.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export { HIGHCHARTS_PASSTHROUGH_KEYS } from './highcharts-passthrough.type.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -5,7 +5,11 @@ import type { WidgetLayout } from './widget-layout.type.js';
|
|
|
5
5
|
export interface NileWidgetChartConfig {
|
|
6
6
|
id?: string;
|
|
7
7
|
title?: string;
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Optional widget kind. When omitted, it is inferred from `nileConfig.chart.type`
|
|
10
|
+
* (`'kpi'` → KPI, anything else → chart) via `resolveWidgetKind`.
|
|
11
|
+
*/
|
|
12
|
+
type?: 'chart';
|
|
9
13
|
layout: WidgetLayout;
|
|
10
14
|
/** Full nile chart config: `{ chart: ChartConfigType, aq?: AqConfigType }`. */
|
|
11
15
|
nileConfig: NileChartConfigInputType;
|
|
@@ -14,10 +18,17 @@ export interface NileWidgetChartConfig {
|
|
|
14
18
|
export interface NileWidgetKpiConfig {
|
|
15
19
|
id?: string;
|
|
16
20
|
title?: string;
|
|
17
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Optional widget kind. When omitted, it is inferred from `nileConfig.chart.type`
|
|
23
|
+
* (`'kpi'` → KPI, anything else → chart) via `resolveWidgetKind`.
|
|
24
|
+
*/
|
|
25
|
+
type?: 'kpi';
|
|
18
26
|
layout: WidgetLayout;
|
|
19
27
|
/** Full nile KPI config: `{ chart: ChartKpiSeparatedPayload, aq?: AqConfigType }`. */
|
|
20
28
|
nileConfig: NileKpiConfigInputType;
|
|
21
29
|
}
|
|
22
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* All widget configs. `type` is optional — when absent, the widget kind is
|
|
32
|
+
* inferred from `nileConfig.chart.type` (see `resolveWidgetKind`).
|
|
33
|
+
*/
|
|
23
34
|
export type NileWidgetConfig = NileWidgetChartConfig | NileWidgetKpiConfig;
|
|
@@ -36,6 +36,8 @@ export declare class NileAnomalyChart extends NileElement {
|
|
|
36
36
|
anomaly: AnomalyConfig;
|
|
37
37
|
/** Deep-merge override object for full Highcharts options. */
|
|
38
38
|
options: Highcharts.Options;
|
|
39
|
+
/** Opts out of the built-in responsive rules — the chart still reflows, it just keeps its full legend/axis chrome at every size. */
|
|
40
|
+
noResponsive: boolean;
|
|
39
41
|
/** Whether to show a loading indicator instead of the chart. */
|
|
40
42
|
loading: boolean;
|
|
41
43
|
/** CSS height for the chart container. */
|
|
@@ -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-anomaly-chart.css.js';
|
|
8
9
|
let NileAnomalyChart = class NileAnomalyChart extends NileElement {
|
|
9
10
|
constructor() {
|
|
@@ -25,6 +26,8 @@ let NileAnomalyChart = class NileAnomalyChart extends NileElement {
|
|
|
25
26
|
this.anomaly = {};
|
|
26
27
|
/** Deep-merge override object for full Highcharts options. */
|
|
27
28
|
this.options = {};
|
|
29
|
+
/** Opts out of the built-in responsive rules — the chart still reflows, it just keeps its full legend/axis chrome at every size. */
|
|
30
|
+
this.noResponsive = false;
|
|
28
31
|
/** Whether to show a loading indicator instead of the chart. */
|
|
29
32
|
this.loading = false;
|
|
30
33
|
/** CSS height for the chart container. */
|
|
@@ -312,7 +315,8 @@ let NileAnomalyChart = class NileAnomalyChart extends NileElement {
|
|
|
312
315
|
enabled: false,
|
|
313
316
|
},
|
|
314
317
|
};
|
|
315
|
-
|
|
318
|
+
const merged = deepMerge(defaults, this.options);
|
|
319
|
+
return withResponsiveDefaults(merged, 'anomaly', this.noResponsive);
|
|
316
320
|
}
|
|
317
321
|
async initChart() {
|
|
318
322
|
if (this.loading || !this.chartContainer)
|
|
@@ -360,6 +364,9 @@ __decorate([
|
|
|
360
364
|
__decorate([
|
|
361
365
|
property({ type: Object })
|
|
362
366
|
], NileAnomalyChart.prototype, "options", void 0);
|
|
367
|
+
__decorate([
|
|
368
|
+
property({ type: Boolean, attribute: 'no-responsive' })
|
|
369
|
+
], NileAnomalyChart.prototype, "noResponsive", void 0);
|
|
363
370
|
__decorate([
|
|
364
371
|
property({ type: Boolean, reflect: true })
|
|
365
372
|
], NileAnomalyChart.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-area-chart.css.js';
|
|
8
9
|
let NileAreaChart = class NileAreaChart extends NileElement {
|
|
9
10
|
constructor() {
|
|
@@ -18,6 +19,7 @@ let NileAreaChart = class NileAreaChart 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 = '';
|
|
@@ -158,7 +160,7 @@ let NileAreaChart = class NileAreaChart extends NileElement {
|
|
|
158
160
|
}
|
|
159
161
|
buildOptions() {
|
|
160
162
|
const self = this;
|
|
161
|
-
|
|
163
|
+
const merged = deepMerge({
|
|
162
164
|
chart: { type: 'area', ...(this.height ? { height: this.height } : {}) },
|
|
163
165
|
title: { text: this.chartTitle || undefined },
|
|
164
166
|
subtitle: { text: this.chartSubtitle || undefined },
|
|
@@ -173,6 +175,7 @@ let NileAreaChart = class NileAreaChart extends NileElement {
|
|
|
173
175
|
legend: (() => { const { show, ...rest } = this.legend ?? {}; return { enabled: show ?? this.showLegend, ...rest }; })(),
|
|
174
176
|
credits: { enabled: false },
|
|
175
177
|
}, this.options);
|
|
178
|
+
return withResponsiveDefaults(merged, 'area', this.noResponsive);
|
|
176
179
|
}
|
|
177
180
|
async initChart() {
|
|
178
181
|
if (this.loading || !this.chartContainer)
|
|
@@ -214,6 +217,9 @@ __decorate([
|
|
|
214
217
|
__decorate([
|
|
215
218
|
property({ type: Object })
|
|
216
219
|
], NileAreaChart.prototype, "options", void 0);
|
|
220
|
+
__decorate([
|
|
221
|
+
property({ type: Boolean, attribute: 'no-responsive' })
|
|
222
|
+
], NileAreaChart.prototype, "noResponsive", void 0);
|
|
217
223
|
__decorate([
|
|
218
224
|
property({ type: Boolean, reflect: true })
|
|
219
225
|
], NileAreaChart.prototype, "loading", void 0);
|