@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,235 @@
|
|
|
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-boxplot-chart.css.js';
|
|
9
|
+
let NileBoxplotChart = class NileBoxplotChart extends NileElement {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this._hc = null;
|
|
13
|
+
this.chart = null;
|
|
14
|
+
this.resizeObserver = null;
|
|
15
|
+
/** Full chart configuration. Accepts separated `{ chart, aq }` input. */
|
|
16
|
+
this.config = null;
|
|
17
|
+
this.chartTitle = '';
|
|
18
|
+
this.chartSubtitle = '';
|
|
19
|
+
this.categories = [];
|
|
20
|
+
this.data = [];
|
|
21
|
+
this.options = {};
|
|
22
|
+
this.loading = false;
|
|
23
|
+
this.height = '400px';
|
|
24
|
+
this.xAxisTitle = '';
|
|
25
|
+
this.yAxisTitle = '';
|
|
26
|
+
this.showLegend = true;
|
|
27
|
+
/** When true, draws horizontal boxes (categories on the y-axis). */
|
|
28
|
+
this.horizontal = false;
|
|
29
|
+
}
|
|
30
|
+
/** Apply `{ chart, aq }` config to individual properties. */
|
|
31
|
+
applyConfig(cfg) {
|
|
32
|
+
applySeparatedChartConfig(this, cfg);
|
|
33
|
+
}
|
|
34
|
+
connectedCallback() {
|
|
35
|
+
super.connectedCallback();
|
|
36
|
+
if (this.config)
|
|
37
|
+
this.applyConfig(this.config);
|
|
38
|
+
}
|
|
39
|
+
disconnectedCallback() {
|
|
40
|
+
super.disconnectedCallback();
|
|
41
|
+
this.destroyChart();
|
|
42
|
+
this.resizeObserver?.disconnect();
|
|
43
|
+
this.resizeObserver = null;
|
|
44
|
+
}
|
|
45
|
+
firstUpdated() {
|
|
46
|
+
this.initChart();
|
|
47
|
+
this.setupResizeObserver();
|
|
48
|
+
}
|
|
49
|
+
updated(changedProperties) {
|
|
50
|
+
if (changedProperties.has('config') && this.config) {
|
|
51
|
+
this.applyConfig(this.config);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const props = [
|
|
55
|
+
'data',
|
|
56
|
+
'categories',
|
|
57
|
+
'chartTitle',
|
|
58
|
+
'chartSubtitle',
|
|
59
|
+
'options',
|
|
60
|
+
'height',
|
|
61
|
+
'xAxisTitle',
|
|
62
|
+
'yAxisTitle',
|
|
63
|
+
'showLegend',
|
|
64
|
+
'horizontal',
|
|
65
|
+
'loading',
|
|
66
|
+
];
|
|
67
|
+
if (!props.some(p => changedProperties.has(p)))
|
|
68
|
+
return;
|
|
69
|
+
if (this.loading) {
|
|
70
|
+
this.destroyChart();
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (this.chart) {
|
|
74
|
+
this.chart.update(this.buildOptions(), true, true);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
this.initChart();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
setupResizeObserver() {
|
|
81
|
+
if (!this.chartContainer)
|
|
82
|
+
return;
|
|
83
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
84
|
+
this.chart?.reflow();
|
|
85
|
+
});
|
|
86
|
+
this.resizeObserver.observe(this.chartContainer);
|
|
87
|
+
}
|
|
88
|
+
mapSeries() {
|
|
89
|
+
return this.data.map(s => ({
|
|
90
|
+
type: 'boxplot',
|
|
91
|
+
name: s.name,
|
|
92
|
+
color: s.color,
|
|
93
|
+
data: s.data.map((b, i) => {
|
|
94
|
+
const row = {
|
|
95
|
+
x: i,
|
|
96
|
+
low: b.low,
|
|
97
|
+
q1: b.q1,
|
|
98
|
+
median: b.median,
|
|
99
|
+
q3: b.q3,
|
|
100
|
+
high: b.high,
|
|
101
|
+
};
|
|
102
|
+
if (b.color)
|
|
103
|
+
row.color = b.color;
|
|
104
|
+
return row;
|
|
105
|
+
}),
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
buildOptions() {
|
|
109
|
+
const self = this;
|
|
110
|
+
const catAxis = {
|
|
111
|
+
categories: this.categories,
|
|
112
|
+
title: { text: this.xAxisTitle || undefined },
|
|
113
|
+
gridLineWidth: 1,
|
|
114
|
+
};
|
|
115
|
+
const valueAxis = {
|
|
116
|
+
title: { text: this.yAxisTitle || undefined },
|
|
117
|
+
gridLineWidth: 1,
|
|
118
|
+
};
|
|
119
|
+
return deepMerge({
|
|
120
|
+
chart: {
|
|
121
|
+
type: 'boxplot',
|
|
122
|
+
height: this.height,
|
|
123
|
+
inverted: this.horizontal,
|
|
124
|
+
},
|
|
125
|
+
title: { text: this.chartTitle || undefined },
|
|
126
|
+
subtitle: { text: this.chartSubtitle || undefined },
|
|
127
|
+
legend: { enabled: this.showLegend },
|
|
128
|
+
xAxis: this.horizontal ? valueAxis : catAxis,
|
|
129
|
+
yAxis: this.horizontal ? catAxis : valueAxis,
|
|
130
|
+
tooltip: {
|
|
131
|
+
pointFormat: '<span style="color:{point.color}">●</span> <b>{series.name}</b><br/>' +
|
|
132
|
+
'Maximum: <b>{point.high}</b><br/>' +
|
|
133
|
+
'Upper quartile: <b>{point.q3}</b><br/>' +
|
|
134
|
+
'Median: <b>{point.median}</b><br/>' +
|
|
135
|
+
'Lower quartile: <b>{point.q1}</b><br/>' +
|
|
136
|
+
'Minimum: <b>{point.low}</b><br/>',
|
|
137
|
+
},
|
|
138
|
+
plotOptions: {
|
|
139
|
+
boxplot: {
|
|
140
|
+
fillColor: 'rgba(59, 130, 246, 0.12)',
|
|
141
|
+
lineWidth: 2,
|
|
142
|
+
medianColor: '#1d4ed8',
|
|
143
|
+
medianWidth: 3,
|
|
144
|
+
stemColor: '#64748b',
|
|
145
|
+
whiskerColor: '#64748b',
|
|
146
|
+
cursor: 'pointer',
|
|
147
|
+
point: {
|
|
148
|
+
events: {
|
|
149
|
+
click() {
|
|
150
|
+
const xIdx = typeof this.x === 'number' ? this.x : 0;
|
|
151
|
+
self.emit('nile-chart-click', {
|
|
152
|
+
point: this,
|
|
153
|
+
category: self.categories[xIdx],
|
|
154
|
+
low: this.low,
|
|
155
|
+
q1: this.q1,
|
|
156
|
+
median: this.median,
|
|
157
|
+
q3: this.q3,
|
|
158
|
+
high: this.high,
|
|
159
|
+
seriesName: this.series.name,
|
|
160
|
+
});
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
series: this.mapSeries(),
|
|
167
|
+
credits: { enabled: false },
|
|
168
|
+
}, this.options);
|
|
169
|
+
}
|
|
170
|
+
async initChart() {
|
|
171
|
+
if (this.loading || !this.chartContainer)
|
|
172
|
+
return;
|
|
173
|
+
if (!this._hc)
|
|
174
|
+
this._hc = await getHighcharts();
|
|
175
|
+
this.chart = this._hc.chart(this.chartContainer, this.buildOptions());
|
|
176
|
+
this.emit('nile-chart-ready', { chart: this.chart });
|
|
177
|
+
}
|
|
178
|
+
destroyChart() {
|
|
179
|
+
if (this.chart) {
|
|
180
|
+
this.chart.destroy();
|
|
181
|
+
this.chart = null;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
render() {
|
|
185
|
+
if (this.loading) {
|
|
186
|
+
return html `<div class="chart-loading" style="height:${this.height}">Loading...</div>`;
|
|
187
|
+
}
|
|
188
|
+
return html `<div class="chart-container"></div>`;
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
NileBoxplotChart.styles = styles;
|
|
192
|
+
__decorate([
|
|
193
|
+
query('.chart-container')
|
|
194
|
+
], NileBoxplotChart.prototype, "chartContainer", void 0);
|
|
195
|
+
__decorate([
|
|
196
|
+
property({ type: Object })
|
|
197
|
+
], NileBoxplotChart.prototype, "config", void 0);
|
|
198
|
+
__decorate([
|
|
199
|
+
property({ type: String, attribute: 'chart-title' })
|
|
200
|
+
], NileBoxplotChart.prototype, "chartTitle", void 0);
|
|
201
|
+
__decorate([
|
|
202
|
+
property({ type: String, attribute: 'chart-subtitle' })
|
|
203
|
+
], NileBoxplotChart.prototype, "chartSubtitle", void 0);
|
|
204
|
+
__decorate([
|
|
205
|
+
property({ type: Array })
|
|
206
|
+
], NileBoxplotChart.prototype, "categories", void 0);
|
|
207
|
+
__decorate([
|
|
208
|
+
property({ type: Array })
|
|
209
|
+
], NileBoxplotChart.prototype, "data", void 0);
|
|
210
|
+
__decorate([
|
|
211
|
+
property({ type: Object })
|
|
212
|
+
], NileBoxplotChart.prototype, "options", void 0);
|
|
213
|
+
__decorate([
|
|
214
|
+
property({ type: Boolean, reflect: true })
|
|
215
|
+
], NileBoxplotChart.prototype, "loading", void 0);
|
|
216
|
+
__decorate([
|
|
217
|
+
property({ type: String })
|
|
218
|
+
], NileBoxplotChart.prototype, "height", void 0);
|
|
219
|
+
__decorate([
|
|
220
|
+
property({ type: String, attribute: 'x-axis-title' })
|
|
221
|
+
], NileBoxplotChart.prototype, "xAxisTitle", void 0);
|
|
222
|
+
__decorate([
|
|
223
|
+
property({ type: String, attribute: 'y-axis-title' })
|
|
224
|
+
], NileBoxplotChart.prototype, "yAxisTitle", void 0);
|
|
225
|
+
__decorate([
|
|
226
|
+
property({ type: Boolean, attribute: 'show-legend' })
|
|
227
|
+
], NileBoxplotChart.prototype, "showLegend", void 0);
|
|
228
|
+
__decorate([
|
|
229
|
+
property({ type: Boolean, reflect: true, attribute: 'horizontal' })
|
|
230
|
+
], NileBoxplotChart.prototype, "horizontal", void 0);
|
|
231
|
+
NileBoxplotChart = __decorate([
|
|
232
|
+
customElement('nile-boxplot-chart')
|
|
233
|
+
], NileBoxplotChart);
|
|
234
|
+
export { NileBoxplotChart };
|
|
235
|
+
//# sourceMappingURL=nile-boxplot-chart.js.map
|
|
@@ -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 BubbleChartSeriesData {
|
|
5
6
|
name: string;
|
|
6
7
|
data: [number, number, number][];
|
|
@@ -12,6 +13,8 @@ export declare class NileBubbleChart 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: BubbleChartSeriesData[];
|
|
@@ -20,6 +23,9 @@ export declare class NileBubbleChart extends NileElement {
|
|
|
20
23
|
height: string;
|
|
21
24
|
xAxisTitle: 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 NileBubbleChart = class NileBubbleChart 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 NileBubbleChart = class NileBubbleChart extends NileElement {
|
|
|
20
22
|
this.xAxisTitle = '';
|
|
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 bubble = c;
|
|
30
|
+
if (bubble.data)
|
|
31
|
+
this.data = bubble.data;
|
|
32
|
+
if (bubble.xAxisTitle)
|
|
33
|
+
this.xAxisTitle = bubble.xAxisTitle;
|
|
34
|
+
if (bubble.yAxisTitle)
|
|
35
|
+
this.yAxisTitle = bubble.yAxisTitle;
|
|
36
|
+
if (bubble.height)
|
|
37
|
+
this.height = bubble.height;
|
|
38
|
+
if (bubble.loading !== undefined)
|
|
39
|
+
this.loading = bubble.loading;
|
|
40
|
+
if (bubble.options)
|
|
41
|
+
this.options = bubble.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 NileBubbleChart = class NileBubbleChart 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', 'chartTitle', 'chartSubtitle', 'options', 'height', 'xAxisTitle', 'yAxisTitle', 'loading'];
|
|
32
68
|
if (!props.some(p => changedProperties.has(p)))
|
|
33
69
|
return;
|
|
@@ -92,6 +128,9 @@ NileBubbleChart.styles = styles;
|
|
|
92
128
|
__decorate([
|
|
93
129
|
query('.chart-container')
|
|
94
130
|
], NileBubbleChart.prototype, "chartContainer", void 0);
|
|
131
|
+
__decorate([
|
|
132
|
+
property({ type: Object })
|
|
133
|
+
], NileBubbleChart.prototype, "config", void 0);
|
|
95
134
|
__decorate([
|
|
96
135
|
property({ type: String, attribute: 'chart-title' })
|
|
97
136
|
], NileBubbleChart.prototype, "chartTitle", void 0);
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { NileChart } from './nile-chart.js';
|
|
2
|
-
export type { NileChartConfig, NileBarChartConfig, NilePieChartConfig, NileTrendlineChartConfig, NileAnomalyChartConfig, ChartType, SwitchAggregation, NileAiConfig, } from './nile-chart-config.js';
|
|
2
|
+
export type { NileChartConfig, NileBarChartConfig, NilePieChartConfig, NileTrendlineChartConfig, NileAnomalyChartConfig, NileLineChartConfig, NileAreaChartConfig, NileColumnChartConfig, NileDonutChartConfig, NileScatterChartConfig, NileBubbleChartConfig, NileSplineChartConfig, NileRadarChartConfig, NileGaugeChartConfig, NileWaterfallChartConfig, ChartType, SwitchAggregation, NileAiConfig, } from './nile-chart-config.js';
|
|
3
3
|
export { convertConfig, registerAdapter } from '../internal/chart-adapters.js';
|
|
4
|
+
export { nileChartConfig } from './nile-chart-config-builder.js';
|
|
5
|
+
export type { AiConfigType, SwitchableConfigType, AqConfigType, ChartBarConfigType, ChartPieConfigType, ChartTrendlineConfigType, ChartAnomalyConfigType, ChartLineConfigType, ChartAreaConfigType, ChartColumnConfigType, ChartDonutConfigType, ChartScatterConfigType, ChartBubbleConfigType, ChartSplineConfigType, ChartRadarConfigType, ChartGaugeConfigType, ChartWaterfallConfigType, ChartClusterConfigType, ChartStackedConfigType, ChartHistogramConfigType, ChartBellcurveConfigType, ChartBoxplotConfigType, ChartTimelineConfigType, ChartDumbbellConfigType, ChartFanConfigType, ChartFunnelConfigType, ChartFlameConfigType, ChartSpiderwebConfigType, ChartKpiPropsType, PrimitiveChartConfigType, SeparatedChartConfigInputType, AllChartConfigType, ChartConfigType, NileChartConfigInputType, ChartAiPanelPayload, ChartAiSenderPayload, NileAiPanelConfigInputType, NileAiSenderConfigInputType, } from '../internal/types/index.js';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NileChartConfig } from './nile-chart-config.js';
|
|
2
|
+
import type { NileChartConfigInputType } from '../internal/types/index.js';
|
|
3
|
+
/** Merges separated chart + aq config into a flat NileChartConfig. */
|
|
4
|
+
export declare function nileChartConfig(input: NileChartConfigInputType): NileChartConfig;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Merges separated chart + aq config into a flat NileChartConfig. */
|
|
2
|
+
export function nileChartConfig(input) {
|
|
3
|
+
const { chart, aq } = input;
|
|
4
|
+
const { ai, switchable, ...rest } = aq ?? {};
|
|
5
|
+
return {
|
|
6
|
+
...chart,
|
|
7
|
+
...rest,
|
|
8
|
+
...(ai && { ai }),
|
|
9
|
+
...(switchable?.types && { switchableTypes: switchable.types }),
|
|
10
|
+
...(switchable?.aggregation && { switchAggregation: switchable.aggregation }),
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=nile-chart-config-builder.js.map
|
|
@@ -3,7 +3,17 @@ import type { BarChartSeriesData } from '../nile-bar-chart/nile-bar-chart.js';
|
|
|
3
3
|
import type { PieChartSeriesData } from '../nile-pie-chart/nile-pie-chart.js';
|
|
4
4
|
import type { TrendlineSeriesData, ForecastConfig } from '../nile-trendline-chart/nile-trendline-chart.js';
|
|
5
5
|
import type { AnomalySeriesData, AnomalyConfig } from '../nile-anomaly-chart/nile-anomaly-chart.js';
|
|
6
|
-
|
|
6
|
+
import type { LineChartSeriesData } from '../nile-line-chart/nile-line-chart.js';
|
|
7
|
+
import type { AreaChartSeriesData } from '../nile-area-chart/nile-area-chart.js';
|
|
8
|
+
import type { ColumnChartSeriesData } from '../nile-column-chart/nile-column-chart.js';
|
|
9
|
+
import type { DonutChartSeriesData } from '../nile-donut-chart/nile-donut-chart.js';
|
|
10
|
+
import type { ScatterChartSeriesData } from '../nile-scatter-chart/nile-scatter-chart.js';
|
|
11
|
+
import type { BubbleChartSeriesData } from '../nile-bubble-chart/nile-bubble-chart.js';
|
|
12
|
+
import type { SplineChartSeriesData } from '../nile-spline-chart/nile-spline-chart.js';
|
|
13
|
+
import type { RadarChartSeriesData } from '../nile-radar-chart/nile-radar-chart.js';
|
|
14
|
+
import type { GaugeBand } from '../nile-gauge-chart/nile-gauge-chart.js';
|
|
15
|
+
import type { WaterfallDataPoint } from '../nile-waterfall-chart/nile-waterfall-chart.js';
|
|
16
|
+
export type ChartType = 'bar' | 'pie' | 'trendline' | 'anomaly' | 'line' | 'area' | 'column' | 'donut' | 'scatter' | 'bubble' | 'spline' | 'radar' | 'gauge' | 'waterfall';
|
|
7
17
|
export type SwitchAggregation = 'by-category' | 'by-series' | 'flatten';
|
|
8
18
|
export interface NileAiConfig {
|
|
9
19
|
/** Show the AI chat icon on the chart. Default: false. */
|
|
@@ -55,4 +65,68 @@ export interface NileAnomalyChartConfig extends NileChartConfigBase {
|
|
|
55
65
|
yAxisTitle?: string;
|
|
56
66
|
anomaly?: AnomalyConfig;
|
|
57
67
|
}
|
|
58
|
-
export
|
|
68
|
+
export interface NileLineChartConfig extends NileChartConfigBase {
|
|
69
|
+
type: 'line';
|
|
70
|
+
data: LineChartSeriesData[];
|
|
71
|
+
categories?: string[];
|
|
72
|
+
yAxisTitle?: string;
|
|
73
|
+
}
|
|
74
|
+
export interface NileAreaChartConfig extends NileChartConfigBase {
|
|
75
|
+
type: 'area';
|
|
76
|
+
data: AreaChartSeriesData[];
|
|
77
|
+
categories?: string[];
|
|
78
|
+
yAxisTitle?: string;
|
|
79
|
+
stacked?: boolean;
|
|
80
|
+
}
|
|
81
|
+
export interface NileColumnChartConfig extends NileChartConfigBase {
|
|
82
|
+
type: 'column';
|
|
83
|
+
data: ColumnChartSeriesData[];
|
|
84
|
+
categories?: string[];
|
|
85
|
+
yAxisTitle?: string;
|
|
86
|
+
}
|
|
87
|
+
export interface NileDonutChartConfig extends NileChartConfigBase {
|
|
88
|
+
type: 'donut';
|
|
89
|
+
data: DonutChartSeriesData[];
|
|
90
|
+
seriesName?: string;
|
|
91
|
+
innerSize?: string;
|
|
92
|
+
showDataLabels?: boolean;
|
|
93
|
+
showLegend?: boolean;
|
|
94
|
+
}
|
|
95
|
+
export interface NileScatterChartConfig extends NileChartConfigBase {
|
|
96
|
+
type: 'scatter';
|
|
97
|
+
data: ScatterChartSeriesData[];
|
|
98
|
+
xAxisTitle?: string;
|
|
99
|
+
yAxisTitle?: string;
|
|
100
|
+
}
|
|
101
|
+
export interface NileBubbleChartConfig extends NileChartConfigBase {
|
|
102
|
+
type: 'bubble';
|
|
103
|
+
data: BubbleChartSeriesData[];
|
|
104
|
+
xAxisTitle?: string;
|
|
105
|
+
yAxisTitle?: string;
|
|
106
|
+
}
|
|
107
|
+
export interface NileSplineChartConfig extends NileChartConfigBase {
|
|
108
|
+
type: 'spline';
|
|
109
|
+
data: SplineChartSeriesData[];
|
|
110
|
+
categories?: string[];
|
|
111
|
+
yAxisTitle?: string;
|
|
112
|
+
}
|
|
113
|
+
export interface NileRadarChartConfig extends NileChartConfigBase {
|
|
114
|
+
type: 'radar';
|
|
115
|
+
data: RadarChartSeriesData[];
|
|
116
|
+
categories?: string[];
|
|
117
|
+
showArea?: boolean;
|
|
118
|
+
}
|
|
119
|
+
export interface NileGaugeChartConfig extends NileChartConfigBase {
|
|
120
|
+
type: 'gauge';
|
|
121
|
+
value: number;
|
|
122
|
+
min?: number;
|
|
123
|
+
max?: number;
|
|
124
|
+
suffix?: string;
|
|
125
|
+
bands?: GaugeBand[];
|
|
126
|
+
}
|
|
127
|
+
export interface NileWaterfallChartConfig extends NileChartConfigBase {
|
|
128
|
+
type: 'waterfall';
|
|
129
|
+
data: WaterfallDataPoint[];
|
|
130
|
+
yAxisTitle?: string;
|
|
131
|
+
}
|
|
132
|
+
export type NileChartConfig = NileBarChartConfig | NilePieChartConfig | NileTrendlineChartConfig | NileAnomalyChartConfig | NileLineChartConfig | NileAreaChartConfig | NileColumnChartConfig | NileDonutChartConfig | NileScatterChartConfig | NileBubbleChartConfig | NileSplineChartConfig | NileRadarChartConfig | NileGaugeChartConfig | NileWaterfallChartConfig;
|
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
2
2
|
import NileElement from '../internal/nile-element.js';
|
|
3
3
|
import type { NileChartConfig } from './nile-chart-config.js';
|
|
4
|
+
import type { NileChartConfigInputType } from '../internal/types/index.js';
|
|
4
5
|
import '../nile-bar-chart/index.js';
|
|
5
6
|
import '../nile-pie-chart/index.js';
|
|
6
7
|
import '../nile-trendline-chart/index.js';
|
|
7
8
|
import '../nile-anomaly-chart/index.js';
|
|
9
|
+
import '../nile-line-chart/index.js';
|
|
10
|
+
import '../nile-area-chart/index.js';
|
|
11
|
+
import '../nile-column-chart/index.js';
|
|
12
|
+
import '../nile-donut-chart/index.js';
|
|
13
|
+
import '../nile-scatter-chart/index.js';
|
|
14
|
+
import '../nile-bubble-chart/index.js';
|
|
15
|
+
import '../nile-spline-chart/index.js';
|
|
16
|
+
import '../nile-radar-chart/index.js';
|
|
17
|
+
import '../nile-gauge-chart/index.js';
|
|
18
|
+
import '../nile-waterfall-chart/index.js';
|
|
8
19
|
import '../nile-ai-panel/index.js';
|
|
9
20
|
export declare class NileChart extends NileElement {
|
|
10
21
|
static styles: CSSResultGroup;
|
|
11
|
-
/** Full chart configuration
|
|
12
|
-
config: NileChartConfig | null;
|
|
22
|
+
/** Full chart configuration. Accepts flat NileChartConfig or separated { chart, aq } input. */
|
|
23
|
+
config: NileChartConfig | NileChartConfigInputType | null;
|
|
13
24
|
/** The summary/insight text displayed in the overlay (fallback when config is not set). */
|
|
14
25
|
summary: string;
|
|
15
26
|
/** Label for the toggle button (fallback when config is not set). */
|
|
@@ -27,6 +38,9 @@ export declare class NileChart extends NileElement {
|
|
|
27
38
|
private handleOutsideClick;
|
|
28
39
|
connectedCallback(): void;
|
|
29
40
|
disconnectedCallback(): void;
|
|
41
|
+
/** Resolve { chart, aq } input to flat NileChartConfig. */
|
|
42
|
+
private resolveConfig;
|
|
43
|
+
private resolvedConfig;
|
|
30
44
|
protected updated(changedProperties: PropertyValues): void;
|
|
31
45
|
private toggle;
|
|
32
46
|
private toggleMenu;
|