@aquera/nile-visualization 0.1.0 → 0.2.0
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/dist/src/index.d.ts +27 -2
- package/dist/src/index.js +15 -0
- package/dist/src/internal/highcharts-provider.js +45 -0
- package/dist/src/internal/separated-chart-config.d.ts +5 -0
- package/dist/src/internal/separated-chart-config.js +16 -0
- package/dist/src/internal/types/ai-config.type.d.ts +9 -0
- package/dist/src/internal/types/ai-config.type.js +2 -0
- package/dist/src/internal/types/all-chart-config.type.d.ts +8 -0
- package/dist/src/internal/types/all-chart-config.type.js +2 -0
- package/dist/src/internal/types/aq-config.type.d.ts +13 -0
- package/dist/src/internal/types/aq-config.type.js +2 -0
- package/dist/src/internal/types/chart-anomaly-config.type.d.ts +13 -0
- package/dist/src/internal/types/chart-anomaly-config.type.js +2 -0
- package/dist/src/internal/types/chart-area-config.type.d.ts +13 -0
- package/dist/src/internal/types/chart-area-config.type.js +2 -0
- package/dist/src/internal/types/chart-bar-config.type.d.ts +12 -0
- package/dist/src/internal/types/chart-bar-config.type.js +2 -0
- package/dist/src/internal/types/chart-bellcurve-config.type.d.ts +19 -0
- package/dist/src/internal/types/chart-bellcurve-config.type.js +2 -0
- package/dist/src/internal/types/chart-boxplot-config.type.d.ts +15 -0
- package/dist/src/internal/types/chart-boxplot-config.type.js +2 -0
- package/dist/src/internal/types/chart-bubble-config.type.d.ts +12 -0
- package/dist/src/internal/types/chart-bubble-config.type.js +2 -0
- package/dist/src/internal/types/chart-cluster-config.type.d.ts +15 -0
- package/dist/src/internal/types/chart-cluster-config.type.js +2 -0
- package/dist/src/internal/types/chart-column-config.type.d.ts +12 -0
- package/dist/src/internal/types/chart-column-config.type.js +2 -0
- package/dist/src/internal/types/chart-config.type.d.ts +16 -0
- package/dist/src/internal/types/chart-config.type.js +2 -0
- package/dist/src/internal/types/chart-donut-config.type.d.ts +14 -0
- package/dist/src/internal/types/chart-donut-config.type.js +2 -0
- package/dist/src/internal/types/chart-dumbbell-config.type.d.ts +16 -0
- package/dist/src/internal/types/chart-dumbbell-config.type.js +2 -0
- package/dist/src/internal/types/chart-fan-config.type.d.ts +17 -0
- package/dist/src/internal/types/chart-fan-config.type.js +2 -0
- package/dist/src/internal/types/chart-flame-config.type.d.ts +14 -0
- package/dist/src/internal/types/chart-flame-config.type.js +2 -0
- package/dist/src/internal/types/chart-funnel-config.type.d.ts +12 -0
- package/dist/src/internal/types/chart-funnel-config.type.js +2 -0
- package/dist/src/internal/types/chart-gauge-config.type.d.ts +14 -0
- package/dist/src/internal/types/chart-gauge-config.type.js +2 -0
- package/dist/src/internal/types/chart-histogram-config.type.d.ts +19 -0
- package/dist/src/internal/types/chart-histogram-config.type.js +2 -0
- package/dist/src/internal/types/chart-kpi-config.type.d.ts +21 -0
- package/dist/src/internal/types/chart-kpi-config.type.js +2 -0
- package/dist/src/internal/types/chart-line-config.type.d.ts +12 -0
- package/dist/src/internal/types/chart-line-config.type.js +2 -0
- package/dist/src/internal/types/chart-pie-config.type.d.ts +13 -0
- package/dist/src/internal/types/chart-pie-config.type.js +2 -0
- package/dist/src/internal/types/chart-radar-config.type.d.ts +12 -0
- package/dist/src/internal/types/chart-radar-config.type.js +2 -0
- package/dist/src/internal/types/chart-scatter-config.type.d.ts +12 -0
- package/dist/src/internal/types/chart-scatter-config.type.js +2 -0
- package/dist/src/internal/types/chart-spiderweb-config.type.d.ts +12 -0
- package/dist/src/internal/types/chart-spiderweb-config.type.js +2 -0
- package/dist/src/internal/types/chart-spline-config.type.d.ts +12 -0
- package/dist/src/internal/types/chart-spline-config.type.js +2 -0
- package/dist/src/internal/types/chart-stacked-config.type.d.ts +15 -0
- package/dist/src/internal/types/chart-stacked-config.type.js +2 -0
- package/dist/src/internal/types/chart-timeline-config.type.d.ts +15 -0
- package/dist/src/internal/types/chart-timeline-config.type.js +2 -0
- package/dist/src/internal/types/chart-trendline-config.type.d.ts +13 -0
- package/dist/src/internal/types/chart-trendline-config.type.js +2 -0
- package/dist/src/internal/types/chart-waterfall-config.type.d.ts +11 -0
- package/dist/src/internal/types/chart-waterfall-config.type.js +2 -0
- package/dist/src/internal/types/index.d.ts +35 -0
- package/dist/src/internal/types/index.js +2 -0
- package/dist/src/internal/types/nile-ai-widgets-config-input.type.d.ts +23 -0
- package/dist/src/internal/types/nile-ai-widgets-config-input.type.js +2 -0
- package/dist/src/internal/types/nile-chart-config-input.type.d.ts +7 -0
- package/dist/src/internal/types/nile-chart-config-input.type.js +2 -0
- package/dist/src/internal/types/primitive-chart-config.type.d.ts +16 -0
- package/dist/src/internal/types/primitive-chart-config.type.js +2 -0
- package/dist/src/internal/types/separated-chart-config-input.type.d.ts +7 -0
- package/dist/src/internal/types/separated-chart-config-input.type.js +2 -0
- package/dist/src/internal/types/switchable-config.type.d.ts +8 -0
- package/dist/src/internal/types/switchable-config.type.js +2 -0
- package/dist/src/nile-ai-panel/index.d.ts +1 -0
- package/dist/src/nile-ai-panel/nile-ai-panel.d.ts +8 -1
- package/dist/src/nile-ai-panel/nile-ai-panel.js +34 -0
- package/dist/src/nile-ai-sender/index.d.ts +1 -0
- package/dist/src/nile-ai-sender/nile-ai-sender.d.ts +8 -1
- package/dist/src/nile-ai-sender/nile-ai-sender.js +30 -0
- package/dist/src/nile-anomaly-chart/nile-anomaly-chart.d.ts +6 -0
- package/dist/src/nile-anomaly-chart/nile-anomaly-chart.js +41 -0
- package/dist/src/nile-area-chart/nile-area-chart.d.ts +6 -0
- package/dist/src/nile-area-chart/nile-area-chart.js +41 -0
- package/dist/src/nile-bar-chart/nile-bar-chart.d.ts +6 -0
- package/dist/src/nile-bar-chart/nile-bar-chart.js +40 -1
- package/dist/src/nile-bellcurve-chart/index.d.ts +2 -0
- package/dist/src/nile-bellcurve-chart/index.js +2 -0
- package/dist/src/nile-bellcurve-chart/nile-bellcurve-chart.css.d.ts +1 -0
- package/dist/src/nile-bellcurve-chart/nile-bellcurve-chart.css.js +28 -0
- package/dist/src/nile-bellcurve-chart/nile-bellcurve-chart.d.ts +49 -0
- package/dist/src/nile-bellcurve-chart/nile-bellcurve-chart.js +258 -0
- package/dist/src/nile-boxplot-chart/index.d.ts +2 -0
- package/dist/src/nile-boxplot-chart/index.js +2 -0
- package/dist/src/nile-boxplot-chart/nile-boxplot-chart.css.d.ts +1 -0
- package/dist/src/nile-boxplot-chart/nile-boxplot-chart.css.js +28 -0
- package/dist/src/nile-boxplot-chart/nile-boxplot-chart.d.ts +58 -0
- package/dist/src/nile-boxplot-chart/nile-boxplot-chart.js +235 -0
- package/dist/src/nile-bubble-chart/nile-bubble-chart.d.ts +6 -0
- package/dist/src/nile-bubble-chart/nile-bubble-chart.js +39 -0
- package/dist/src/nile-chart/index.d.ts +3 -1
- package/dist/src/nile-chart/index.js +1 -0
- package/dist/src/nile-chart/nile-chart-config-builder.d.ts +4 -0
- package/dist/src/nile-chart/nile-chart-config-builder.js +13 -0
- package/dist/src/nile-chart/nile-chart-config.d.ts +76 -2
- package/dist/src/nile-chart/nile-chart.d.ts +16 -2
- package/dist/src/nile-chart/nile-chart.js +144 -14
- package/dist/src/nile-cluster-chart/index.d.ts +2 -0
- package/dist/src/nile-cluster-chart/index.js +2 -0
- package/dist/src/nile-cluster-chart/nile-cluster-chart.css.d.ts +1 -0
- package/dist/src/nile-cluster-chart/nile-cluster-chart.css.js +28 -0
- package/dist/src/nile-cluster-chart/nile-cluster-chart.d.ts +46 -0
- package/dist/src/nile-cluster-chart/nile-cluster-chart.js +196 -0
- package/dist/src/nile-column-chart/nile-column-chart.d.ts +6 -0
- package/dist/src/nile-column-chart/nile-column-chart.js +39 -0
- package/dist/src/nile-donut-chart/nile-donut-chart.d.ts +6 -0
- package/dist/src/nile-donut-chart/nile-donut-chart.js +43 -0
- package/dist/src/nile-dumbbell-chart/index.d.ts +2 -0
- package/dist/src/nile-dumbbell-chart/index.js +2 -0
- package/dist/src/nile-dumbbell-chart/nile-dumbbell-chart.css.d.ts +1 -0
- package/dist/src/nile-dumbbell-chart/nile-dumbbell-chart.css.js +28 -0
- package/dist/src/nile-dumbbell-chart/nile-dumbbell-chart.d.ts +50 -0
- package/dist/src/nile-dumbbell-chart/nile-dumbbell-chart.js +217 -0
- package/dist/src/nile-fan-chart/index.d.ts +2 -0
- package/dist/src/nile-fan-chart/index.js +2 -0
- package/dist/src/nile-fan-chart/nile-fan-chart.css.d.ts +1 -0
- package/dist/src/nile-fan-chart/nile-fan-chart.css.js +28 -0
- package/dist/src/nile-fan-chart/nile-fan-chart.d.ts +65 -0
- package/dist/src/nile-fan-chart/nile-fan-chart.js +257 -0
- package/dist/src/nile-flame-chart/index.d.ts +2 -0
- package/dist/src/nile-flame-chart/index.js +2 -0
- package/dist/src/nile-flame-chart/nile-flame-chart.css.d.ts +1 -0
- package/dist/src/nile-flame-chart/nile-flame-chart.css.js +28 -0
- package/dist/src/nile-flame-chart/nile-flame-chart.d.ts +60 -0
- package/dist/src/nile-flame-chart/nile-flame-chart.js +311 -0
- package/dist/src/nile-funnel-chart/index.d.ts +2 -0
- package/dist/src/nile-funnel-chart/index.js +2 -0
- package/dist/src/nile-funnel-chart/nile-funnel-chart.css.d.ts +1 -0
- package/dist/src/nile-funnel-chart/nile-funnel-chart.css.js +28 -0
- package/dist/src/nile-funnel-chart/nile-funnel-chart.d.ts +42 -0
- package/dist/src/nile-funnel-chart/nile-funnel-chart.js +189 -0
- package/dist/src/nile-gauge-chart/nile-gauge-chart.d.ts +6 -0
- package/dist/src/nile-gauge-chart/nile-gauge-chart.js +43 -0
- package/dist/src/nile-histogram-chart/index.d.ts +2 -0
- package/dist/src/nile-histogram-chart/index.js +2 -0
- package/dist/src/nile-histogram-chart/nile-histogram-chart.css.d.ts +1 -0
- package/dist/src/nile-histogram-chart/nile-histogram-chart.css.js +28 -0
- package/dist/src/nile-histogram-chart/nile-histogram-chart.d.ts +53 -0
- package/dist/src/nile-histogram-chart/nile-histogram-chart.js +263 -0
- package/dist/src/nile-kpi-chart/index.d.ts +1 -1
- package/dist/src/nile-kpi-chart/nile-kpi-chart.d.ts +32 -0
- package/dist/src/nile-kpi-chart/nile-kpi-chart.js +60 -0
- package/dist/src/nile-line-chart/nile-line-chart.d.ts +6 -0
- package/dist/src/nile-line-chart/nile-line-chart.js +39 -0
- package/dist/src/nile-pie-chart/nile-pie-chart.d.ts +6 -0
- package/dist/src/nile-pie-chart/nile-pie-chart.js +41 -0
- package/dist/src/nile-radar-chart/nile-radar-chart.d.ts +6 -0
- package/dist/src/nile-radar-chart/nile-radar-chart.js +39 -0
- package/dist/src/nile-scatter-chart/nile-scatter-chart.d.ts +6 -0
- package/dist/src/nile-scatter-chart/nile-scatter-chart.js +39 -0
- package/dist/src/nile-spiderweb-chart/index.d.ts +2 -0
- package/dist/src/nile-spiderweb-chart/index.js +2 -0
- package/dist/src/nile-spiderweb-chart/nile-spiderweb-chart.css.d.ts +1 -0
- package/dist/src/nile-spiderweb-chart/nile-spiderweb-chart.css.js +28 -0
- package/dist/src/nile-spiderweb-chart/nile-spiderweb-chart.d.ts +46 -0
- package/dist/src/nile-spiderweb-chart/nile-spiderweb-chart.js +191 -0
- package/dist/src/nile-spline-chart/nile-spline-chart.d.ts +6 -0
- package/dist/src/nile-spline-chart/nile-spline-chart.js +39 -0
- package/dist/src/nile-stacked-chart/index.d.ts +2 -0
- package/dist/src/nile-stacked-chart/index.js +2 -0
- package/dist/src/nile-stacked-chart/nile-stacked-chart.css.d.ts +1 -0
- package/dist/src/nile-stacked-chart/nile-stacked-chart.css.js +28 -0
- package/dist/src/nile-stacked-chart/nile-stacked-chart.d.ts +47 -0
- package/dist/src/nile-stacked-chart/nile-stacked-chart.js +216 -0
- package/dist/src/nile-timeline-chart/index.d.ts +2 -0
- package/dist/src/nile-timeline-chart/index.js +2 -0
- package/dist/src/nile-timeline-chart/nile-timeline-chart.css.d.ts +1 -0
- package/dist/src/nile-timeline-chart/nile-timeline-chart.css.js +28 -0
- package/dist/src/nile-timeline-chart/nile-timeline-chart.d.ts +58 -0
- package/dist/src/nile-timeline-chart/nile-timeline-chart.js +239 -0
- package/dist/src/nile-trendline-chart/nile-trendline-chart.d.ts +6 -0
- package/dist/src/nile-trendline-chart/nile-trendline-chart.js +41 -0
- package/dist/src/nile-waterfall-chart/nile-waterfall-chart.d.ts +6 -0
- package/dist/src/nile-waterfall-chart/nile-waterfall-chart.js +37 -0
- package/package.json +12 -1
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
3
|
+
import { html } from 'lit';
|
|
4
|
+
import { getHighcharts } from '../internal/highcharts-provider.js';
|
|
5
|
+
import NileElement from '../internal/nile-element.js';
|
|
6
|
+
import { applySeparatedChartConfig } from '../internal/separated-chart-config.js';
|
|
7
|
+
import { deepMerge } from '../internal/utils.js';
|
|
8
|
+
import { styles } from './nile-histogram-chart.css.js';
|
|
9
|
+
/** Stable id linking the hidden source series to the histogram series. */
|
|
10
|
+
const HISTOGRAM_BASE_ID = 'nile-histogram-base';
|
|
11
|
+
let NileHistogramChart = class NileHistogramChart extends NileElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this._hc = null;
|
|
15
|
+
this.chart = null;
|
|
16
|
+
this.resizeObserver = null;
|
|
17
|
+
/** Full chart configuration. Accepts separated `{ chart, aq }` input. */
|
|
18
|
+
this.config = null;
|
|
19
|
+
this.chartTitle = '';
|
|
20
|
+
this.chartSubtitle = '';
|
|
21
|
+
/** Raw numeric observations; each value is binned into the histogram. */
|
|
22
|
+
this.data = [];
|
|
23
|
+
this.options = {};
|
|
24
|
+
this.loading = false;
|
|
25
|
+
this.height = '400px';
|
|
26
|
+
this.xAxisTitle = '';
|
|
27
|
+
this.yAxisTitle = '';
|
|
28
|
+
this.histogramSeriesName = '';
|
|
29
|
+
this.sourceSeriesName = '';
|
|
30
|
+
/** Bar fill color for the histogram series. */
|
|
31
|
+
this.histogramColor = '#3b82f6';
|
|
32
|
+
/**
|
|
33
|
+
* Bin rule: a positive integer, or `square-root` (default), `sturges`, or `rice`.
|
|
34
|
+
* Ignored when `binWidth` is set.
|
|
35
|
+
*/
|
|
36
|
+
this.binsNumber = 'square-root';
|
|
37
|
+
/** Fixed bin width; when > 0, overrides `binsNumber`. */
|
|
38
|
+
this.binWidth = 0;
|
|
39
|
+
this.showLegend = true;
|
|
40
|
+
}
|
|
41
|
+
/** Apply `{ chart, aq }` config to individual properties. */
|
|
42
|
+
applyConfig(cfg) {
|
|
43
|
+
applySeparatedChartConfig(this, cfg);
|
|
44
|
+
}
|
|
45
|
+
connectedCallback() {
|
|
46
|
+
super.connectedCallback();
|
|
47
|
+
if (this.config)
|
|
48
|
+
this.applyConfig(this.config);
|
|
49
|
+
}
|
|
50
|
+
disconnectedCallback() {
|
|
51
|
+
super.disconnectedCallback();
|
|
52
|
+
this.destroyChart();
|
|
53
|
+
this.resizeObserver?.disconnect();
|
|
54
|
+
this.resizeObserver = null;
|
|
55
|
+
}
|
|
56
|
+
firstUpdated() {
|
|
57
|
+
this.initChart();
|
|
58
|
+
this.setupResizeObserver();
|
|
59
|
+
}
|
|
60
|
+
updated(changedProperties) {
|
|
61
|
+
if (changedProperties.has('config') && this.config) {
|
|
62
|
+
this.applyConfig(this.config);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const props = [
|
|
66
|
+
'data',
|
|
67
|
+
'chartTitle',
|
|
68
|
+
'chartSubtitle',
|
|
69
|
+
'options',
|
|
70
|
+
'height',
|
|
71
|
+
'xAxisTitle',
|
|
72
|
+
'yAxisTitle',
|
|
73
|
+
'histogramSeriesName',
|
|
74
|
+
'sourceSeriesName',
|
|
75
|
+
'histogramColor',
|
|
76
|
+
'binsNumber',
|
|
77
|
+
'binWidth',
|
|
78
|
+
'showLegend',
|
|
79
|
+
'loading',
|
|
80
|
+
];
|
|
81
|
+
if (!props.some(p => changedProperties.has(p)))
|
|
82
|
+
return;
|
|
83
|
+
if (this.loading) {
|
|
84
|
+
this.destroyChart();
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (this.chart) {
|
|
88
|
+
this.chart.update(this.buildOptions(), true, true);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
this.initChart();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
setupResizeObserver() {
|
|
95
|
+
if (!this.chartContainer)
|
|
96
|
+
return;
|
|
97
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
98
|
+
this.chart?.reflow();
|
|
99
|
+
});
|
|
100
|
+
this.resizeObserver.observe(this.chartContainer);
|
|
101
|
+
}
|
|
102
|
+
resolveBinsNumber() {
|
|
103
|
+
const raw = (this.binsNumber || 'square-root').trim().toLowerCase();
|
|
104
|
+
if (/^\d+$/.test(raw)) {
|
|
105
|
+
const n = parseInt(raw, 10);
|
|
106
|
+
return n > 0 ? n : 'square-root';
|
|
107
|
+
}
|
|
108
|
+
if (raw === 'sturges' || raw === 'rice' || raw === 'square-root')
|
|
109
|
+
return raw;
|
|
110
|
+
return 'square-root';
|
|
111
|
+
}
|
|
112
|
+
buildOptions() {
|
|
113
|
+
const self = this;
|
|
114
|
+
const bw = this.binWidth > 0 ? this.binWidth : undefined;
|
|
115
|
+
const scatterData = this.data.map(x => [x, 0]);
|
|
116
|
+
return deepMerge({
|
|
117
|
+
chart: { height: this.height },
|
|
118
|
+
title: { text: this.chartTitle || undefined },
|
|
119
|
+
subtitle: { text: this.chartSubtitle || undefined },
|
|
120
|
+
legend: { enabled: this.showLegend },
|
|
121
|
+
xAxis: [
|
|
122
|
+
{
|
|
123
|
+
title: { text: this.xAxisTitle || undefined },
|
|
124
|
+
gridLineWidth: 1,
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
yAxis: [
|
|
128
|
+
{
|
|
129
|
+
title: { text: this.yAxisTitle || 'Count' },
|
|
130
|
+
min: 0,
|
|
131
|
+
gridLineWidth: 1,
|
|
132
|
+
},
|
|
133
|
+
],
|
|
134
|
+
tooltip: {
|
|
135
|
+
headerFormat: '',
|
|
136
|
+
pointFormat: '<span style="color:{point.color}">●</span> <b>{point.x:.1f} – {point.x2:.1f}</b><br/>Count: <b>{point.y}</b>',
|
|
137
|
+
},
|
|
138
|
+
plotOptions: {
|
|
139
|
+
histogram: {
|
|
140
|
+
borderWidth: 0,
|
|
141
|
+
borderRadius: 2,
|
|
142
|
+
color: this.histogramColor,
|
|
143
|
+
cursor: 'pointer',
|
|
144
|
+
point: {
|
|
145
|
+
events: {
|
|
146
|
+
click() {
|
|
147
|
+
self.emit('nile-chart-click', {
|
|
148
|
+
point: this,
|
|
149
|
+
x: this.x,
|
|
150
|
+
x2: this.x2,
|
|
151
|
+
value: this.y,
|
|
152
|
+
seriesName: this.series.name,
|
|
153
|
+
});
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
scatter: {
|
|
159
|
+
marker: { enabled: false, radius: 0 },
|
|
160
|
+
enableMouseTracking: false,
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
series: [
|
|
164
|
+
{
|
|
165
|
+
type: 'scatter',
|
|
166
|
+
id: HISTOGRAM_BASE_ID,
|
|
167
|
+
name: this.sourceSeriesName || 'Observations',
|
|
168
|
+
data: scatterData,
|
|
169
|
+
xAxis: 0,
|
|
170
|
+
yAxis: 0,
|
|
171
|
+
visible: false,
|
|
172
|
+
showInLegend: false,
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
type: 'histogram',
|
|
176
|
+
name: this.histogramSeriesName || 'Distribution',
|
|
177
|
+
baseSeries: HISTOGRAM_BASE_ID,
|
|
178
|
+
xAxis: 0,
|
|
179
|
+
yAxis: 0,
|
|
180
|
+
binsNumber: bw ? undefined : this.resolveBinsNumber(),
|
|
181
|
+
binWidth: bw,
|
|
182
|
+
color: this.histogramColor,
|
|
183
|
+
zIndex: 1,
|
|
184
|
+
},
|
|
185
|
+
],
|
|
186
|
+
credits: { enabled: false },
|
|
187
|
+
}, this.options);
|
|
188
|
+
}
|
|
189
|
+
async initChart() {
|
|
190
|
+
if (this.loading || !this.chartContainer)
|
|
191
|
+
return;
|
|
192
|
+
if (!this._hc)
|
|
193
|
+
this._hc = await getHighcharts();
|
|
194
|
+
this.chart = this._hc.chart(this.chartContainer, this.buildOptions());
|
|
195
|
+
this.emit('nile-chart-ready', { chart: this.chart });
|
|
196
|
+
}
|
|
197
|
+
destroyChart() {
|
|
198
|
+
if (this.chart) {
|
|
199
|
+
this.chart.destroy();
|
|
200
|
+
this.chart = null;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
render() {
|
|
204
|
+
if (this.loading) {
|
|
205
|
+
return html `<div class="chart-loading" style="height:${this.height}">Loading...</div>`;
|
|
206
|
+
}
|
|
207
|
+
return html `<div class="chart-container"></div>`;
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
NileHistogramChart.styles = styles;
|
|
211
|
+
__decorate([
|
|
212
|
+
query('.chart-container')
|
|
213
|
+
], NileHistogramChart.prototype, "chartContainer", void 0);
|
|
214
|
+
__decorate([
|
|
215
|
+
property({ type: Object })
|
|
216
|
+
], NileHistogramChart.prototype, "config", void 0);
|
|
217
|
+
__decorate([
|
|
218
|
+
property({ type: String, attribute: 'chart-title' })
|
|
219
|
+
], NileHistogramChart.prototype, "chartTitle", void 0);
|
|
220
|
+
__decorate([
|
|
221
|
+
property({ type: String, attribute: 'chart-subtitle' })
|
|
222
|
+
], NileHistogramChart.prototype, "chartSubtitle", void 0);
|
|
223
|
+
__decorate([
|
|
224
|
+
property({ type: Array })
|
|
225
|
+
], NileHistogramChart.prototype, "data", void 0);
|
|
226
|
+
__decorate([
|
|
227
|
+
property({ type: Object })
|
|
228
|
+
], NileHistogramChart.prototype, "options", void 0);
|
|
229
|
+
__decorate([
|
|
230
|
+
property({ type: Boolean, reflect: true })
|
|
231
|
+
], NileHistogramChart.prototype, "loading", void 0);
|
|
232
|
+
__decorate([
|
|
233
|
+
property({ type: String })
|
|
234
|
+
], NileHistogramChart.prototype, "height", void 0);
|
|
235
|
+
__decorate([
|
|
236
|
+
property({ type: String, attribute: 'x-axis-title' })
|
|
237
|
+
], NileHistogramChart.prototype, "xAxisTitle", void 0);
|
|
238
|
+
__decorate([
|
|
239
|
+
property({ type: String, attribute: 'y-axis-title' })
|
|
240
|
+
], NileHistogramChart.prototype, "yAxisTitle", void 0);
|
|
241
|
+
__decorate([
|
|
242
|
+
property({ type: String, attribute: 'histogram-name' })
|
|
243
|
+
], NileHistogramChart.prototype, "histogramSeriesName", void 0);
|
|
244
|
+
__decorate([
|
|
245
|
+
property({ type: String, attribute: 'source-name' })
|
|
246
|
+
], NileHistogramChart.prototype, "sourceSeriesName", void 0);
|
|
247
|
+
__decorate([
|
|
248
|
+
property({ type: String, attribute: 'histogram-color' })
|
|
249
|
+
], NileHistogramChart.prototype, "histogramColor", void 0);
|
|
250
|
+
__decorate([
|
|
251
|
+
property({ type: String, attribute: 'bins-number' })
|
|
252
|
+
], NileHistogramChart.prototype, "binsNumber", void 0);
|
|
253
|
+
__decorate([
|
|
254
|
+
property({ type: Number, attribute: 'bin-width' })
|
|
255
|
+
], NileHistogramChart.prototype, "binWidth", void 0);
|
|
256
|
+
__decorate([
|
|
257
|
+
property({ type: Boolean, attribute: 'show-legend' })
|
|
258
|
+
], NileHistogramChart.prototype, "showLegend", void 0);
|
|
259
|
+
NileHistogramChart = __decorate([
|
|
260
|
+
customElement('nile-histogram-chart')
|
|
261
|
+
], NileHistogramChart);
|
|
262
|
+
export { NileHistogramChart };
|
|
263
|
+
//# sourceMappingURL=nile-histogram-chart.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { NileKpiChart } from './nile-kpi-chart.js';
|
|
2
|
-
export type { KpiConfig, TrendDirection, KpiVariant } from './nile-kpi-chart.js';
|
|
2
|
+
export type { ChartKpiSeparatedPayload, KpiConfig, NileKpiConfigInputType, TrendDirection, KpiVariant, } from './nile-kpi-chart.js';
|
|
@@ -1,8 +1,35 @@
|
|
|
1
1
|
import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
2
2
|
import type Highcharts from 'highcharts';
|
|
3
3
|
import NileElement from '../internal/nile-element.js';
|
|
4
|
+
import type { AqConfigType } from '../internal/types/aq-config.type.js';
|
|
4
5
|
export type TrendDirection = 'up' | 'down' | 'neutral';
|
|
5
6
|
export type KpiVariant = 'default' | 'card' | 'gauge';
|
|
7
|
+
/** `chart` slice for `<nile-kpi-chart>.config` (discriminated by `type: 'kpi'`). */
|
|
8
|
+
export interface ChartKpiSeparatedPayload {
|
|
9
|
+
type: 'kpi';
|
|
10
|
+
variant?: KpiVariant;
|
|
11
|
+
label?: string;
|
|
12
|
+
value?: string | number;
|
|
13
|
+
prefix?: string;
|
|
14
|
+
suffix?: string;
|
|
15
|
+
trendValue?: number | null;
|
|
16
|
+
trendDirection?: TrendDirection;
|
|
17
|
+
trendLabel?: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
sparkline?: number[];
|
|
20
|
+
sparklineColor?: string;
|
|
21
|
+
gaugeValue?: number;
|
|
22
|
+
gaugeMin?: number;
|
|
23
|
+
gaugeMax?: number;
|
|
24
|
+
gaugeColor?: string;
|
|
25
|
+
loading?: boolean;
|
|
26
|
+
options?: Highcharts.Options;
|
|
27
|
+
}
|
|
28
|
+
/** Separated `{ chart, aq }` input for `<nile-kpi-chart>`. */
|
|
29
|
+
export interface NileKpiConfigInputType {
|
|
30
|
+
chart: ChartKpiSeparatedPayload;
|
|
31
|
+
aq?: AqConfigType;
|
|
32
|
+
}
|
|
6
33
|
export interface KpiConfig {
|
|
7
34
|
label: string;
|
|
8
35
|
value: number | string;
|
|
@@ -24,6 +51,8 @@ export declare class NileKpiChart extends NileElement {
|
|
|
24
51
|
private resizeObserver;
|
|
25
52
|
private sparklineContainer;
|
|
26
53
|
private gaugeContainer;
|
|
54
|
+
/** Full configuration: `{ chart, aq }` (same convention as other Nile charts). */
|
|
55
|
+
config: NileKpiConfigInputType | null;
|
|
27
56
|
/** Display variant: default (flat), card (bordered container), gauge (Highcharts solid gauge). */
|
|
28
57
|
variant: KpiVariant;
|
|
29
58
|
/** Label displayed above the value. */
|
|
@@ -58,6 +87,9 @@ export declare class NileKpiChart extends NileElement {
|
|
|
58
87
|
loading: boolean;
|
|
59
88
|
/** Highcharts options override for the sparkline or gauge. */
|
|
60
89
|
options: Highcharts.Options;
|
|
90
|
+
/** Apply `{ chart, aq }` to individual properties. */
|
|
91
|
+
private applyConfig;
|
|
92
|
+
connectedCallback(): void;
|
|
61
93
|
disconnectedCallback(): void;
|
|
62
94
|
protected firstUpdated(): void;
|
|
63
95
|
protected updated(changedProperties: PropertyValues): void;
|
|
@@ -11,6 +11,8 @@ let NileKpiChart = class NileKpiChart extends NileElement {
|
|
|
11
11
|
this.sparklineChart = null;
|
|
12
12
|
this.gaugeChart = null;
|
|
13
13
|
this.resizeObserver = null;
|
|
14
|
+
/** Full configuration: `{ chart, aq }` (same convention as other Nile charts). */
|
|
15
|
+
this.config = null;
|
|
14
16
|
/** Display variant: default (flat), card (bordered container), gauge (Highcharts solid gauge). */
|
|
15
17
|
this.variant = 'default';
|
|
16
18
|
/** Label displayed above the value. */
|
|
@@ -46,6 +48,57 @@ let NileKpiChart = class NileKpiChart extends NileElement {
|
|
|
46
48
|
/** Highcharts options override for the sparkline or gauge. */
|
|
47
49
|
this.options = {};
|
|
48
50
|
}
|
|
51
|
+
/** Apply `{ chart, aq }` to individual properties. */
|
|
52
|
+
applyConfig(cfg) {
|
|
53
|
+
const { chart: c, aq } = cfg;
|
|
54
|
+
if (c) {
|
|
55
|
+
if (c.variant !== undefined)
|
|
56
|
+
this.variant = c.variant;
|
|
57
|
+
if (c.label !== undefined)
|
|
58
|
+
this.label = c.label;
|
|
59
|
+
if (c.value !== undefined)
|
|
60
|
+
this.value = c.value;
|
|
61
|
+
if (c.prefix !== undefined)
|
|
62
|
+
this.prefix = c.prefix;
|
|
63
|
+
if (c.suffix !== undefined)
|
|
64
|
+
this.suffix = c.suffix;
|
|
65
|
+
if (c.trendValue !== undefined)
|
|
66
|
+
this.trendValue = c.trendValue;
|
|
67
|
+
if (c.trendDirection !== undefined)
|
|
68
|
+
this.trendDirection = c.trendDirection;
|
|
69
|
+
if (c.trendLabel !== undefined)
|
|
70
|
+
this.trendLabel = c.trendLabel;
|
|
71
|
+
if (c.description !== undefined)
|
|
72
|
+
this.description = c.description;
|
|
73
|
+
if (c.sparkline !== undefined)
|
|
74
|
+
this.sparkline = c.sparkline;
|
|
75
|
+
if (c.sparklineColor !== undefined)
|
|
76
|
+
this.sparklineColor = c.sparklineColor;
|
|
77
|
+
if (c.gaugeValue !== undefined)
|
|
78
|
+
this.gaugeValue = c.gaugeValue;
|
|
79
|
+
if (c.gaugeMin !== undefined)
|
|
80
|
+
this.gaugeMin = c.gaugeMin;
|
|
81
|
+
if (c.gaugeMax !== undefined)
|
|
82
|
+
this.gaugeMax = c.gaugeMax;
|
|
83
|
+
if (c.gaugeColor !== undefined)
|
|
84
|
+
this.gaugeColor = c.gaugeColor;
|
|
85
|
+
if (c.loading !== undefined)
|
|
86
|
+
this.loading = c.loading;
|
|
87
|
+
if (c.options !== undefined)
|
|
88
|
+
this.options = c.options;
|
|
89
|
+
}
|
|
90
|
+
if (aq) {
|
|
91
|
+
if (aq.chartTitle != null)
|
|
92
|
+
this.label = aq.chartTitle;
|
|
93
|
+
if (aq.chartSubtitle != null)
|
|
94
|
+
this.description = aq.chartSubtitle;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
connectedCallback() {
|
|
98
|
+
super.connectedCallback();
|
|
99
|
+
if (this.config)
|
|
100
|
+
this.applyConfig(this.config);
|
|
101
|
+
}
|
|
49
102
|
disconnectedCallback() {
|
|
50
103
|
super.disconnectedCallback();
|
|
51
104
|
this.destroyCharts();
|
|
@@ -58,6 +111,10 @@ let NileKpiChart = class NileKpiChart extends NileElement {
|
|
|
58
111
|
this.setupResizeObserver();
|
|
59
112
|
}
|
|
60
113
|
updated(changedProperties) {
|
|
114
|
+
if (changedProperties.has('config') && this.config) {
|
|
115
|
+
this.applyConfig(this.config);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
61
118
|
const sparklineProps = ['sparkline', 'sparklineColor', 'options'];
|
|
62
119
|
if (sparklineProps.some(p => changedProperties.has(p))) {
|
|
63
120
|
if (this.sparklineChart) {
|
|
@@ -277,6 +334,9 @@ __decorate([
|
|
|
277
334
|
__decorate([
|
|
278
335
|
query('.kpi-gauge-container')
|
|
279
336
|
], NileKpiChart.prototype, "gaugeContainer", void 0);
|
|
337
|
+
__decorate([
|
|
338
|
+
property({ type: Object })
|
|
339
|
+
], NileKpiChart.prototype, "config", void 0);
|
|
280
340
|
__decorate([
|
|
281
341
|
property({ type: String, reflect: true })
|
|
282
342
|
], NileKpiChart.prototype, "variant", void 0);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
2
2
|
import type Highcharts from 'highcharts';
|
|
3
3
|
import NileElement from '../internal/nile-element.js';
|
|
4
|
+
import type { NileChartConfigInputType } from '../internal/types/index.js';
|
|
4
5
|
export interface LineChartSeriesData {
|
|
5
6
|
name: string;
|
|
6
7
|
data: number[];
|
|
@@ -12,6 +13,8 @@ export declare class NileLineChart extends NileElement {
|
|
|
12
13
|
private chart;
|
|
13
14
|
private resizeObserver;
|
|
14
15
|
private chartContainer;
|
|
16
|
+
/** Full chart configuration. Accepts separated { chart, aq } input. */
|
|
17
|
+
config: NileChartConfigInputType | null;
|
|
15
18
|
chartTitle: string;
|
|
16
19
|
chartSubtitle: string;
|
|
17
20
|
data: LineChartSeriesData[];
|
|
@@ -20,6 +23,9 @@ export declare class NileLineChart extends NileElement {
|
|
|
20
23
|
loading: boolean;
|
|
21
24
|
height: string;
|
|
22
25
|
yAxisTitle: string;
|
|
26
|
+
/** Apply { chart, aq } config to individual properties. */
|
|
27
|
+
private applyConfig;
|
|
28
|
+
connectedCallback(): void;
|
|
23
29
|
disconnectedCallback(): void;
|
|
24
30
|
protected firstUpdated(): void;
|
|
25
31
|
protected updated(changedProperties: PropertyValues): void;
|
|
@@ -11,6 +11,8 @@ let NileLineChart = class NileLineChart extends NileElement {
|
|
|
11
11
|
this._hc = null;
|
|
12
12
|
this.chart = null;
|
|
13
13
|
this.resizeObserver = null;
|
|
14
|
+
/** Full chart configuration. Accepts separated { chart, aq } input. */
|
|
15
|
+
this.config = null;
|
|
14
16
|
this.chartTitle = '';
|
|
15
17
|
this.chartSubtitle = '';
|
|
16
18
|
this.data = [];
|
|
@@ -20,6 +22,36 @@ let NileLineChart = class NileLineChart extends NileElement {
|
|
|
20
22
|
this.height = '400px';
|
|
21
23
|
this.yAxisTitle = '';
|
|
22
24
|
}
|
|
25
|
+
/** Apply { chart, aq } config to individual properties. */
|
|
26
|
+
applyConfig(cfg) {
|
|
27
|
+
const { chart: c, aq } = cfg;
|
|
28
|
+
if (c) {
|
|
29
|
+
const line = c;
|
|
30
|
+
if (line.data)
|
|
31
|
+
this.data = line.data;
|
|
32
|
+
if (line.categories)
|
|
33
|
+
this.categories = line.categories;
|
|
34
|
+
if (line.yAxisTitle)
|
|
35
|
+
this.yAxisTitle = line.yAxisTitle;
|
|
36
|
+
if (line.height)
|
|
37
|
+
this.height = line.height;
|
|
38
|
+
if (line.loading !== undefined)
|
|
39
|
+
this.loading = line.loading;
|
|
40
|
+
if (line.options)
|
|
41
|
+
this.options = line.options;
|
|
42
|
+
}
|
|
43
|
+
if (aq) {
|
|
44
|
+
if (aq.chartTitle)
|
|
45
|
+
this.chartTitle = aq.chartTitle;
|
|
46
|
+
if (aq.chartSubtitle)
|
|
47
|
+
this.chartSubtitle = aq.chartSubtitle;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
connectedCallback() {
|
|
51
|
+
super.connectedCallback();
|
|
52
|
+
if (this.config)
|
|
53
|
+
this.applyConfig(this.config);
|
|
54
|
+
}
|
|
23
55
|
disconnectedCallback() {
|
|
24
56
|
super.disconnectedCallback();
|
|
25
57
|
this.destroyChart();
|
|
@@ -28,6 +60,10 @@ let NileLineChart = class NileLineChart extends NileElement {
|
|
|
28
60
|
}
|
|
29
61
|
firstUpdated() { this.initChart(); this.setupResizeObserver(); }
|
|
30
62
|
updated(changedProperties) {
|
|
63
|
+
if (changedProperties.has('config') && this.config) {
|
|
64
|
+
this.applyConfig(this.config);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
31
67
|
const props = ['data', 'categories', 'chartTitle', 'chartSubtitle', 'options', 'height', 'yAxisTitle', 'loading'];
|
|
32
68
|
if (!props.some(p => changedProperties.has(p)))
|
|
33
69
|
return;
|
|
@@ -84,6 +120,9 @@ NileLineChart.styles = styles;
|
|
|
84
120
|
__decorate([
|
|
85
121
|
query('.chart-container')
|
|
86
122
|
], NileLineChart.prototype, "chartContainer", void 0);
|
|
123
|
+
__decorate([
|
|
124
|
+
property({ type: Object })
|
|
125
|
+
], NileLineChart.prototype, "config", void 0);
|
|
87
126
|
__decorate([
|
|
88
127
|
property({ type: String, attribute: 'chart-title' })
|
|
89
128
|
], NileLineChart.prototype, "chartTitle", void 0);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
2
2
|
import type Highcharts from 'highcharts';
|
|
3
3
|
import NileElement from '../internal/nile-element.js';
|
|
4
|
+
import type { NileChartConfigInputType } from '../internal/types/index.js';
|
|
4
5
|
export interface PieChartSeriesData {
|
|
5
6
|
name: string;
|
|
6
7
|
y: number;
|
|
@@ -14,6 +15,8 @@ export declare class NilePieChart extends NileElement {
|
|
|
14
15
|
private chart;
|
|
15
16
|
private resizeObserver;
|
|
16
17
|
private chartContainer;
|
|
18
|
+
/** Full chart configuration. Accepts separated { chart, aq } input. */
|
|
19
|
+
config: NileChartConfigInputType | null;
|
|
17
20
|
/** The chart title displayed above the chart. */
|
|
18
21
|
chartTitle: string;
|
|
19
22
|
/** The subtitle displayed below the title. */
|
|
@@ -32,6 +35,9 @@ export declare class NilePieChart extends NileElement {
|
|
|
32
35
|
showDataLabels: boolean;
|
|
33
36
|
/** Whether to enable the legend. */
|
|
34
37
|
showLegend: boolean;
|
|
38
|
+
/** Apply { chart, aq } config to individual properties. */
|
|
39
|
+
private applyConfig;
|
|
40
|
+
connectedCallback(): void;
|
|
35
41
|
disconnectedCallback(): void;
|
|
36
42
|
protected firstUpdated(): void;
|
|
37
43
|
protected updated(changedProperties: PropertyValues): void;
|
|
@@ -11,6 +11,8 @@ let NilePieChart = class NilePieChart extends NileElement {
|
|
|
11
11
|
this._hc = null;
|
|
12
12
|
this.chart = null;
|
|
13
13
|
this.resizeObserver = null;
|
|
14
|
+
/** Full chart configuration. Accepts separated { chart, aq } input. */
|
|
15
|
+
this.config = null;
|
|
14
16
|
/** The chart title displayed above the chart. */
|
|
15
17
|
this.chartTitle = '';
|
|
16
18
|
/** The subtitle displayed below the title. */
|
|
@@ -30,6 +32,38 @@ let NilePieChart = class NilePieChart extends NileElement {
|
|
|
30
32
|
/** Whether to enable the legend. */
|
|
31
33
|
this.showLegend = true;
|
|
32
34
|
}
|
|
35
|
+
/** Apply { chart, aq } config to individual properties. */
|
|
36
|
+
applyConfig(cfg) {
|
|
37
|
+
const { chart: c, aq } = cfg;
|
|
38
|
+
if (c) {
|
|
39
|
+
const pie = c;
|
|
40
|
+
if (pie.data)
|
|
41
|
+
this.data = pie.data;
|
|
42
|
+
if (pie.seriesName)
|
|
43
|
+
this.seriesName = pie.seriesName;
|
|
44
|
+
if (pie.height)
|
|
45
|
+
this.height = pie.height;
|
|
46
|
+
if (pie.loading !== undefined)
|
|
47
|
+
this.loading = pie.loading;
|
|
48
|
+
if (pie.options)
|
|
49
|
+
this.options = pie.options;
|
|
50
|
+
if (pie.showDataLabels !== undefined)
|
|
51
|
+
this.showDataLabels = pie.showDataLabels;
|
|
52
|
+
if (pie.showLegend !== undefined)
|
|
53
|
+
this.showLegend = pie.showLegend;
|
|
54
|
+
}
|
|
55
|
+
if (aq) {
|
|
56
|
+
if (aq.chartTitle)
|
|
57
|
+
this.chartTitle = aq.chartTitle;
|
|
58
|
+
if (aq.chartSubtitle)
|
|
59
|
+
this.chartSubtitle = aq.chartSubtitle;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
connectedCallback() {
|
|
63
|
+
super.connectedCallback();
|
|
64
|
+
if (this.config)
|
|
65
|
+
this.applyConfig(this.config);
|
|
66
|
+
}
|
|
33
67
|
disconnectedCallback() {
|
|
34
68
|
super.disconnectedCallback();
|
|
35
69
|
this.destroyChart();
|
|
@@ -41,6 +75,10 @@ let NilePieChart = class NilePieChart extends NileElement {
|
|
|
41
75
|
this.setupResizeObserver();
|
|
42
76
|
}
|
|
43
77
|
updated(changedProperties) {
|
|
78
|
+
if (changedProperties.has('config') && this.config) {
|
|
79
|
+
this.applyConfig(this.config);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
44
82
|
const chartProps = [
|
|
45
83
|
'data',
|
|
46
84
|
'chartTitle',
|
|
@@ -163,6 +201,9 @@ NilePieChart.styles = styles;
|
|
|
163
201
|
__decorate([
|
|
164
202
|
query('.chart-container')
|
|
165
203
|
], NilePieChart.prototype, "chartContainer", void 0);
|
|
204
|
+
__decorate([
|
|
205
|
+
property({ type: Object })
|
|
206
|
+
], NilePieChart.prototype, "config", void 0);
|
|
166
207
|
__decorate([
|
|
167
208
|
property({ type: String, attribute: 'chart-title' })
|
|
168
209
|
], NilePieChart.prototype, "chartTitle", void 0);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
2
2
|
import type Highcharts from 'highcharts';
|
|
3
3
|
import NileElement from '../internal/nile-element.js';
|
|
4
|
+
import type { NileChartConfigInputType } from '../internal/types/index.js';
|
|
4
5
|
export interface RadarChartSeriesData {
|
|
5
6
|
name: string;
|
|
6
7
|
data: number[];
|
|
@@ -12,6 +13,8 @@ export declare class NileRadarChart extends NileElement {
|
|
|
12
13
|
private chart;
|
|
13
14
|
private resizeObserver;
|
|
14
15
|
private chartContainer;
|
|
16
|
+
/** Full chart configuration. Accepts separated { chart, aq } input. */
|
|
17
|
+
config: NileChartConfigInputType | null;
|
|
15
18
|
chartTitle: string;
|
|
16
19
|
chartSubtitle: string;
|
|
17
20
|
data: RadarChartSeriesData[];
|
|
@@ -20,6 +23,9 @@ export declare class NileRadarChart extends NileElement {
|
|
|
20
23
|
loading: boolean;
|
|
21
24
|
height: string;
|
|
22
25
|
showArea: boolean;
|
|
26
|
+
/** Apply { chart, aq } config to individual properties. */
|
|
27
|
+
private applyConfig;
|
|
28
|
+
connectedCallback(): void;
|
|
23
29
|
disconnectedCallback(): void;
|
|
24
30
|
protected firstUpdated(): void;
|
|
25
31
|
protected updated(changedProperties: PropertyValues): void;
|
|
@@ -11,6 +11,8 @@ let NileRadarChart = class NileRadarChart extends NileElement {
|
|
|
11
11
|
this._hc = null;
|
|
12
12
|
this.chart = null;
|
|
13
13
|
this.resizeObserver = null;
|
|
14
|
+
/** Full chart configuration. Accepts separated { chart, aq } input. */
|
|
15
|
+
this.config = null;
|
|
14
16
|
this.chartTitle = '';
|
|
15
17
|
this.chartSubtitle = '';
|
|
16
18
|
this.data = [];
|
|
@@ -20,6 +22,36 @@ let NileRadarChart = class NileRadarChart extends NileElement {
|
|
|
20
22
|
this.height = '400px';
|
|
21
23
|
this.showArea = false;
|
|
22
24
|
}
|
|
25
|
+
/** Apply { chart, aq } config to individual properties. */
|
|
26
|
+
applyConfig(cfg) {
|
|
27
|
+
const { chart: c, aq } = cfg;
|
|
28
|
+
if (c) {
|
|
29
|
+
const radar = c;
|
|
30
|
+
if (radar.data)
|
|
31
|
+
this.data = radar.data;
|
|
32
|
+
if (radar.categories)
|
|
33
|
+
this.categories = radar.categories;
|
|
34
|
+
if (radar.height)
|
|
35
|
+
this.height = radar.height;
|
|
36
|
+
if (radar.loading !== undefined)
|
|
37
|
+
this.loading = radar.loading;
|
|
38
|
+
if (radar.options)
|
|
39
|
+
this.options = radar.options;
|
|
40
|
+
if (radar.showArea !== undefined)
|
|
41
|
+
this.showArea = radar.showArea;
|
|
42
|
+
}
|
|
43
|
+
if (aq) {
|
|
44
|
+
if (aq.chartTitle)
|
|
45
|
+
this.chartTitle = aq.chartTitle;
|
|
46
|
+
if (aq.chartSubtitle)
|
|
47
|
+
this.chartSubtitle = aq.chartSubtitle;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
connectedCallback() {
|
|
51
|
+
super.connectedCallback();
|
|
52
|
+
if (this.config)
|
|
53
|
+
this.applyConfig(this.config);
|
|
54
|
+
}
|
|
23
55
|
disconnectedCallback() {
|
|
24
56
|
super.disconnectedCallback();
|
|
25
57
|
this.destroyChart();
|
|
@@ -28,6 +60,10 @@ let NileRadarChart = class NileRadarChart extends NileElement {
|
|
|
28
60
|
}
|
|
29
61
|
firstUpdated() { this.initChart(); this.setupResizeObserver(); }
|
|
30
62
|
updated(changedProperties) {
|
|
63
|
+
if (changedProperties.has('config') && this.config) {
|
|
64
|
+
this.applyConfig(this.config);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
31
67
|
const props = ['data', 'categories', 'chartTitle', 'chartSubtitle', 'options', 'height', 'showArea', 'loading'];
|
|
32
68
|
if (!props.some(p => changedProperties.has(p)))
|
|
33
69
|
return;
|
|
@@ -106,6 +142,9 @@ NileRadarChart.styles = styles;
|
|
|
106
142
|
__decorate([
|
|
107
143
|
query('.chart-container')
|
|
108
144
|
], NileRadarChart.prototype, "chartContainer", void 0);
|
|
145
|
+
__decorate([
|
|
146
|
+
property({ type: Object })
|
|
147
|
+
], NileRadarChart.prototype, "config", void 0);
|
|
109
148
|
__decorate([
|
|
110
149
|
property({ type: String, attribute: 'chart-title' })
|
|
111
150
|
], NileRadarChart.prototype, "chartTitle", void 0);
|