@aquera/nile-visualization 0.1.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 +35 -0
- package/dist/src/index.js +20 -0
- package/dist/src/internal/chart-adapters.d.ts +11 -0
- package/dist/src/internal/chart-adapters.js +159 -0
- package/dist/src/internal/highcharts-provider.d.ts +14 -0
- package/dist/src/internal/highcharts-provider.js +56 -0
- package/dist/src/internal/nile-element.d.ts +8 -0
- package/dist/src/internal/nile-element.js +21 -0
- package/dist/src/internal/utils.d.ts +1 -0
- package/dist/src/internal/utils.js +23 -0
- package/dist/src/nile-ai-panel/index.d.ts +1 -0
- package/dist/src/nile-ai-panel/index.js +2 -0
- package/dist/src/nile-ai-panel/nile-ai-panel.css.d.ts +1 -0
- package/dist/src/nile-ai-panel/nile-ai-panel.css.js +73 -0
- package/dist/src/nile-ai-panel/nile-ai-panel.d.ts +29 -0
- package/dist/src/nile-ai-panel/nile-ai-panel.js +98 -0
- package/dist/src/nile-ai-sender/index.d.ts +1 -0
- package/dist/src/nile-ai-sender/index.js +2 -0
- package/dist/src/nile-ai-sender/nile-ai-sender.css.d.ts +1 -0
- package/dist/src/nile-ai-sender/nile-ai-sender.css.js +71 -0
- package/dist/src/nile-ai-sender/nile-ai-sender.d.ts +20 -0
- package/dist/src/nile-ai-sender/nile-ai-sender.js +77 -0
- package/dist/src/nile-anomaly-chart/index.d.ts +2 -0
- package/dist/src/nile-anomaly-chart/index.js +2 -0
- package/dist/src/nile-anomaly-chart/nile-anomaly-chart.css.d.ts +1 -0
- package/dist/src/nile-anomaly-chart/nile-anomaly-chart.css.js +28 -0
- package/dist/src/nile-anomaly-chart/nile-anomaly-chart.d.ts +59 -0
- package/dist/src/nile-anomaly-chart/nile-anomaly-chart.js +268 -0
- package/dist/src/nile-area-chart/index.d.ts +2 -0
- package/dist/src/nile-area-chart/index.js +2 -0
- package/dist/src/nile-area-chart/nile-area-chart.css.d.ts +1 -0
- package/dist/src/nile-area-chart/nile-area-chart.css.js +28 -0
- package/dist/src/nile-area-chart/nile-area-chart.d.ts +37 -0
- package/dist/src/nile-area-chart/nile-area-chart.js +122 -0
- package/dist/src/nile-bar-chart/index.d.ts +2 -0
- package/dist/src/nile-bar-chart/index.js +2 -0
- package/dist/src/nile-bar-chart/nile-bar-chart.css.d.ts +1 -0
- package/dist/src/nile-bar-chart/nile-bar-chart.css.js +28 -0
- package/dist/src/nile-bar-chart/nile-bar-chart.d.ts +44 -0
- package/dist/src/nile-bar-chart/nile-bar-chart.js +185 -0
- package/dist/src/nile-bubble-chart/index.d.ts +2 -0
- package/dist/src/nile-bubble-chart/index.js +2 -0
- package/dist/src/nile-bubble-chart/nile-bubble-chart.css.d.ts +1 -0
- package/dist/src/nile-bubble-chart/nile-bubble-chart.css.js +28 -0
- package/dist/src/nile-bubble-chart/nile-bubble-chart.d.ts +36 -0
- package/dist/src/nile-bubble-chart/nile-bubble-chart.js +123 -0
- package/dist/src/nile-chart/index.d.ts +3 -0
- package/dist/src/nile-chart/index.js +3 -0
- package/dist/src/nile-chart/nile-chart-config.d.ts +58 -0
- package/dist/src/nile-chart/nile-chart-config.js +2 -0
- package/dist/src/nile-chart/nile-chart.css.d.ts +1 -0
- package/dist/src/nile-chart/nile-chart.css.js +298 -0
- package/dist/src/nile-chart/nile-chart.d.ts +51 -0
- package/dist/src/nile-chart/nile-chart.js +303 -0
- package/dist/src/nile-column-chart/index.d.ts +2 -0
- package/dist/src/nile-column-chart/index.js +2 -0
- package/dist/src/nile-column-chart/nile-column-chart.css.d.ts +1 -0
- package/dist/src/nile-column-chart/nile-column-chart.css.js +28 -0
- package/dist/src/nile-column-chart/nile-column-chart.d.ts +36 -0
- package/dist/src/nile-column-chart/nile-column-chart.js +118 -0
- package/dist/src/nile-donut-chart/index.d.ts +2 -0
- package/dist/src/nile-donut-chart/index.js +2 -0
- package/dist/src/nile-donut-chart/nile-donut-chart.css.d.ts +1 -0
- package/dist/src/nile-donut-chart/nile-donut-chart.css.js +28 -0
- package/dist/src/nile-donut-chart/nile-donut-chart.d.ts +40 -0
- package/dist/src/nile-donut-chart/nile-donut-chart.js +131 -0
- package/dist/src/nile-gauge-chart/index.d.ts +2 -0
- package/dist/src/nile-gauge-chart/index.js +2 -0
- package/dist/src/nile-gauge-chart/nile-gauge-chart.css.d.ts +1 -0
- package/dist/src/nile-gauge-chart/nile-gauge-chart.css.js +28 -0
- package/dist/src/nile-gauge-chart/nile-gauge-chart.d.ts +38 -0
- package/dist/src/nile-gauge-chart/nile-gauge-chart.js +149 -0
- package/dist/src/nile-kpi-chart/index.d.ts +2 -0
- package/dist/src/nile-kpi-chart/index.js +2 -0
- package/dist/src/nile-kpi-chart/nile-kpi-chart.css.d.ts +1 -0
- package/dist/src/nile-kpi-chart/nile-kpi-chart.css.js +165 -0
- package/dist/src/nile-kpi-chart/nile-kpi-chart.d.ts +80 -0
- package/dist/src/nile-kpi-chart/nile-kpi-chart.js +335 -0
- package/dist/src/nile-line-chart/index.d.ts +2 -0
- package/dist/src/nile-line-chart/index.js +2 -0
- package/dist/src/nile-line-chart/nile-line-chart.css.d.ts +1 -0
- package/dist/src/nile-line-chart/nile-line-chart.css.js +28 -0
- package/dist/src/nile-line-chart/nile-line-chart.d.ts +36 -0
- package/dist/src/nile-line-chart/nile-line-chart.js +115 -0
- package/dist/src/nile-pie-chart/index.d.ts +2 -0
- package/dist/src/nile-pie-chart/index.js +2 -0
- package/dist/src/nile-pie-chart/nile-pie-chart.css.d.ts +1 -0
- package/dist/src/nile-pie-chart/nile-pie-chart.css.js +28 -0
- package/dist/src/nile-pie-chart/nile-pie-chart.d.ts +48 -0
- package/dist/src/nile-pie-chart/nile-pie-chart.js +197 -0
- package/dist/src/nile-radar-chart/index.d.ts +2 -0
- package/dist/src/nile-radar-chart/index.js +2 -0
- package/dist/src/nile-radar-chart/nile-radar-chart.css.d.ts +1 -0
- package/dist/src/nile-radar-chart/nile-radar-chart.css.js +28 -0
- package/dist/src/nile-radar-chart/nile-radar-chart.d.ts +36 -0
- package/dist/src/nile-radar-chart/nile-radar-chart.js +137 -0
- package/dist/src/nile-scatter-chart/index.d.ts +2 -0
- package/dist/src/nile-scatter-chart/index.js +2 -0
- package/dist/src/nile-scatter-chart/nile-scatter-chart.css.d.ts +1 -0
- package/dist/src/nile-scatter-chart/nile-scatter-chart.css.js +28 -0
- package/dist/src/nile-scatter-chart/nile-scatter-chart.d.ts +36 -0
- package/dist/src/nile-scatter-chart/nile-scatter-chart.js +124 -0
- package/dist/src/nile-spline-chart/index.d.ts +2 -0
- package/dist/src/nile-spline-chart/index.js +2 -0
- package/dist/src/nile-spline-chart/nile-spline-chart.css.d.ts +1 -0
- package/dist/src/nile-spline-chart/nile-spline-chart.css.js +28 -0
- package/dist/src/nile-spline-chart/nile-spline-chart.d.ts +36 -0
- package/dist/src/nile-spline-chart/nile-spline-chart.js +118 -0
- package/dist/src/nile-trendline-chart/index.d.ts +2 -0
- package/dist/src/nile-trendline-chart/index.js +2 -0
- package/dist/src/nile-trendline-chart/nile-trendline-chart.css.d.ts +1 -0
- package/dist/src/nile-trendline-chart/nile-trendline-chart.css.js +28 -0
- package/dist/src/nile-trendline-chart/nile-trendline-chart.d.ts +59 -0
- package/dist/src/nile-trendline-chart/nile-trendline-chart.js +246 -0
- package/dist/src/nile-waterfall-chart/index.d.ts +2 -0
- package/dist/src/nile-waterfall-chart/index.js +2 -0
- package/dist/src/nile-waterfall-chart/nile-waterfall-chart.css.d.ts +1 -0
- package/dist/src/nile-waterfall-chart/nile-waterfall-chart.css.js +28 -0
- package/dist/src/nile-waterfall-chart/nile-waterfall-chart.d.ts +37 -0
- package/dist/src/nile-waterfall-chart/nile-waterfall-chart.js +137 -0
- package/package.json +62 -0
|
@@ -0,0 +1,115 @@
|
|
|
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 { deepMerge } from '../internal/utils.js';
|
|
7
|
+
import { styles } from './nile-line-chart.css.js';
|
|
8
|
+
let NileLineChart = class NileLineChart extends NileElement {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this._hc = null;
|
|
12
|
+
this.chart = null;
|
|
13
|
+
this.resizeObserver = null;
|
|
14
|
+
this.chartTitle = '';
|
|
15
|
+
this.chartSubtitle = '';
|
|
16
|
+
this.data = [];
|
|
17
|
+
this.categories = [];
|
|
18
|
+
this.options = {};
|
|
19
|
+
this.loading = false;
|
|
20
|
+
this.height = '400px';
|
|
21
|
+
this.yAxisTitle = '';
|
|
22
|
+
}
|
|
23
|
+
disconnectedCallback() {
|
|
24
|
+
super.disconnectedCallback();
|
|
25
|
+
this.destroyChart();
|
|
26
|
+
this.resizeObserver?.disconnect();
|
|
27
|
+
this.resizeObserver = null;
|
|
28
|
+
}
|
|
29
|
+
firstUpdated() { this.initChart(); this.setupResizeObserver(); }
|
|
30
|
+
updated(changedProperties) {
|
|
31
|
+
const props = ['data', 'categories', 'chartTitle', 'chartSubtitle', 'options', 'height', 'yAxisTitle', 'loading'];
|
|
32
|
+
if (!props.some(p => changedProperties.has(p)))
|
|
33
|
+
return;
|
|
34
|
+
if (this.loading) {
|
|
35
|
+
this.destroyChart();
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (this.chart) {
|
|
39
|
+
this.chart.update(this.buildOptions(), true, true);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
this.initChart();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
setupResizeObserver() {
|
|
46
|
+
if (!this.chartContainer)
|
|
47
|
+
return;
|
|
48
|
+
this.resizeObserver = new ResizeObserver(() => { this.chart?.reflow(); });
|
|
49
|
+
this.resizeObserver.observe(this.chartContainer);
|
|
50
|
+
}
|
|
51
|
+
buildOptions() {
|
|
52
|
+
const self = this;
|
|
53
|
+
return deepMerge({
|
|
54
|
+
chart: { type: 'line', height: this.height },
|
|
55
|
+
title: { text: this.chartTitle || undefined },
|
|
56
|
+
subtitle: { text: this.chartSubtitle || undefined },
|
|
57
|
+
xAxis: { categories: this.categories },
|
|
58
|
+
yAxis: { title: { text: this.yAxisTitle || undefined } },
|
|
59
|
+
tooltip: { shared: true },
|
|
60
|
+
plotOptions: { series: { cursor: 'pointer', point: { events: { click() { self.emit('nile-chart-click', { point: this, category: this.category, value: this.y, seriesName: this.series.name }); } } } } },
|
|
61
|
+
series: this.data.map(s => ({ type: 'line', name: s.name, data: s.data, color: s.color })),
|
|
62
|
+
credits: { enabled: false },
|
|
63
|
+
}, this.options);
|
|
64
|
+
}
|
|
65
|
+
async initChart() {
|
|
66
|
+
if (this.loading || !this.chartContainer)
|
|
67
|
+
return;
|
|
68
|
+
if (!this._hc)
|
|
69
|
+
this._hc = await getHighcharts();
|
|
70
|
+
this.chart = this._hc.chart(this.chartContainer, this.buildOptions());
|
|
71
|
+
this.emit('nile-chart-ready', { chart: this.chart });
|
|
72
|
+
}
|
|
73
|
+
destroyChart() { if (this.chart) {
|
|
74
|
+
this.chart.destroy();
|
|
75
|
+
this.chart = null;
|
|
76
|
+
} }
|
|
77
|
+
render() {
|
|
78
|
+
if (this.loading)
|
|
79
|
+
return html `<div class="chart-loading" style="height:${this.height}">Loading...</div>`;
|
|
80
|
+
return html `<div class="chart-container"></div>`;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
NileLineChart.styles = styles;
|
|
84
|
+
__decorate([
|
|
85
|
+
query('.chart-container')
|
|
86
|
+
], NileLineChart.prototype, "chartContainer", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
property({ type: String, attribute: 'chart-title' })
|
|
89
|
+
], NileLineChart.prototype, "chartTitle", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
property({ type: String, attribute: 'chart-subtitle' })
|
|
92
|
+
], NileLineChart.prototype, "chartSubtitle", void 0);
|
|
93
|
+
__decorate([
|
|
94
|
+
property({ type: Array })
|
|
95
|
+
], NileLineChart.prototype, "data", void 0);
|
|
96
|
+
__decorate([
|
|
97
|
+
property({ type: Array })
|
|
98
|
+
], NileLineChart.prototype, "categories", void 0);
|
|
99
|
+
__decorate([
|
|
100
|
+
property({ type: Object })
|
|
101
|
+
], NileLineChart.prototype, "options", void 0);
|
|
102
|
+
__decorate([
|
|
103
|
+
property({ type: Boolean, reflect: true })
|
|
104
|
+
], NileLineChart.prototype, "loading", void 0);
|
|
105
|
+
__decorate([
|
|
106
|
+
property({ type: String })
|
|
107
|
+
], NileLineChart.prototype, "height", void 0);
|
|
108
|
+
__decorate([
|
|
109
|
+
property({ type: String, attribute: 'y-axis-title' })
|
|
110
|
+
], NileLineChart.prototype, "yAxisTitle", void 0);
|
|
111
|
+
NileLineChart = __decorate([
|
|
112
|
+
customElement('nile-line-chart')
|
|
113
|
+
], NileLineChart);
|
|
114
|
+
export { NileLineChart };
|
|
115
|
+
//# sourceMappingURL=nile-line-chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const styles = css `
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
width: 100%;
|
|
6
|
+
position: relative;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
:host([hidden]) {
|
|
10
|
+
display: none;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.chart-container {
|
|
14
|
+
width: 100%;
|
|
15
|
+
min-height: var(--nile-height-200px, var(--ng-height-200px));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.chart-loading {
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
min-height: inherit;
|
|
23
|
+
color: var(--nile-colors-neutral-700, var(--ng-colors-text-secondary-700));
|
|
24
|
+
font-family: var(--nile-font-family-serif, var(--ng-font-family-body));
|
|
25
|
+
font-size: var(--nile-type-scale-3, var(--ng-font-size-text-sm));
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
//# sourceMappingURL=nile-pie-chart.css.js.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
2
|
+
import type Highcharts from 'highcharts';
|
|
3
|
+
import NileElement from '../internal/nile-element.js';
|
|
4
|
+
export interface PieChartSeriesData {
|
|
5
|
+
name: string;
|
|
6
|
+
y: number;
|
|
7
|
+
color?: string;
|
|
8
|
+
sliced?: boolean;
|
|
9
|
+
selected?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare class NilePieChart extends NileElement {
|
|
12
|
+
static styles: CSSResultGroup;
|
|
13
|
+
private _hc;
|
|
14
|
+
private chart;
|
|
15
|
+
private resizeObserver;
|
|
16
|
+
private chartContainer;
|
|
17
|
+
/** The chart title displayed above the chart. */
|
|
18
|
+
chartTitle: string;
|
|
19
|
+
/** The subtitle displayed below the title. */
|
|
20
|
+
chartSubtitle: string;
|
|
21
|
+
/** Array of pie slice data objects. Each object has a name, y value, and optional color. */
|
|
22
|
+
data: PieChartSeriesData[];
|
|
23
|
+
/** The series name shown in the tooltip. */
|
|
24
|
+
seriesName: string;
|
|
25
|
+
/** Deep-merge override object for full Highcharts options. */
|
|
26
|
+
options: Highcharts.Options;
|
|
27
|
+
/** Whether to show a loading indicator instead of the chart. */
|
|
28
|
+
loading: boolean;
|
|
29
|
+
/** CSS height for the chart container. */
|
|
30
|
+
height: string;
|
|
31
|
+
/** Whether to show data labels on slices. */
|
|
32
|
+
showDataLabels: boolean;
|
|
33
|
+
/** Whether to enable the legend. */
|
|
34
|
+
showLegend: boolean;
|
|
35
|
+
disconnectedCallback(): void;
|
|
36
|
+
protected firstUpdated(): void;
|
|
37
|
+
protected updated(changedProperties: PropertyValues): void;
|
|
38
|
+
private setupResizeObserver;
|
|
39
|
+
private buildOptions;
|
|
40
|
+
private initChart;
|
|
41
|
+
private destroyChart;
|
|
42
|
+
render(): TemplateResult;
|
|
43
|
+
}
|
|
44
|
+
declare global {
|
|
45
|
+
interface HTMLElementTagNameMap {
|
|
46
|
+
'nile-pie-chart': NilePieChart;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
3
|
+
import { html } from 'lit';
|
|
4
|
+
import NileElement from '../internal/nile-element.js';
|
|
5
|
+
import { getHighcharts } from '../internal/highcharts-provider.js';
|
|
6
|
+
import { deepMerge } from '../internal/utils.js';
|
|
7
|
+
import { styles } from './nile-pie-chart.css.js';
|
|
8
|
+
let NilePieChart = class NilePieChart extends NileElement {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this._hc = null;
|
|
12
|
+
this.chart = null;
|
|
13
|
+
this.resizeObserver = null;
|
|
14
|
+
/** The chart title displayed above the chart. */
|
|
15
|
+
this.chartTitle = '';
|
|
16
|
+
/** The subtitle displayed below the title. */
|
|
17
|
+
this.chartSubtitle = '';
|
|
18
|
+
/** Array of pie slice data objects. Each object has a name, y value, and optional color. */
|
|
19
|
+
this.data = [];
|
|
20
|
+
/** The series name shown in the tooltip. */
|
|
21
|
+
this.seriesName = '';
|
|
22
|
+
/** Deep-merge override object for full Highcharts options. */
|
|
23
|
+
this.options = {};
|
|
24
|
+
/** Whether to show a loading indicator instead of the chart. */
|
|
25
|
+
this.loading = false;
|
|
26
|
+
/** CSS height for the chart container. */
|
|
27
|
+
this.height = '400px';
|
|
28
|
+
/** Whether to show data labels on slices. */
|
|
29
|
+
this.showDataLabels = true;
|
|
30
|
+
/** Whether to enable the legend. */
|
|
31
|
+
this.showLegend = true;
|
|
32
|
+
}
|
|
33
|
+
disconnectedCallback() {
|
|
34
|
+
super.disconnectedCallback();
|
|
35
|
+
this.destroyChart();
|
|
36
|
+
this.resizeObserver?.disconnect();
|
|
37
|
+
this.resizeObserver = null;
|
|
38
|
+
}
|
|
39
|
+
firstUpdated() {
|
|
40
|
+
this.initChart();
|
|
41
|
+
this.setupResizeObserver();
|
|
42
|
+
}
|
|
43
|
+
updated(changedProperties) {
|
|
44
|
+
const chartProps = [
|
|
45
|
+
'data',
|
|
46
|
+
'chartTitle',
|
|
47
|
+
'chartSubtitle',
|
|
48
|
+
'options',
|
|
49
|
+
'height',
|
|
50
|
+
'seriesName',
|
|
51
|
+
'loading',
|
|
52
|
+
'showDataLabels',
|
|
53
|
+
'showLegend',
|
|
54
|
+
];
|
|
55
|
+
const needsUpdate = chartProps.some(p => changedProperties.has(p));
|
|
56
|
+
if (!needsUpdate)
|
|
57
|
+
return;
|
|
58
|
+
if (this.loading) {
|
|
59
|
+
this.destroyChart();
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (this.chart) {
|
|
63
|
+
this.chart.update(this.buildOptions(), true, true);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
this.initChart();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
setupResizeObserver() {
|
|
70
|
+
if (!this.chartContainer)
|
|
71
|
+
return;
|
|
72
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
73
|
+
this.chart?.reflow();
|
|
74
|
+
});
|
|
75
|
+
this.resizeObserver.observe(this.chartContainer);
|
|
76
|
+
}
|
|
77
|
+
buildOptions() {
|
|
78
|
+
const self = this;
|
|
79
|
+
const defaults = {
|
|
80
|
+
chart: {
|
|
81
|
+
type: 'pie',
|
|
82
|
+
height: this.height,
|
|
83
|
+
},
|
|
84
|
+
title: {
|
|
85
|
+
text: this.chartTitle || undefined,
|
|
86
|
+
},
|
|
87
|
+
subtitle: {
|
|
88
|
+
text: this.chartSubtitle || undefined,
|
|
89
|
+
},
|
|
90
|
+
tooltip: {
|
|
91
|
+
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>',
|
|
92
|
+
},
|
|
93
|
+
accessibility: {
|
|
94
|
+
point: {
|
|
95
|
+
valueSuffix: '%',
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
plotOptions: {
|
|
99
|
+
pie: {
|
|
100
|
+
allowPointSelect: true,
|
|
101
|
+
cursor: 'pointer',
|
|
102
|
+
dataLabels: {
|
|
103
|
+
enabled: this.showDataLabels,
|
|
104
|
+
format: '<b>{point.name}</b>: {point.percentage:.1f} %',
|
|
105
|
+
},
|
|
106
|
+
showInLegend: this.showLegend,
|
|
107
|
+
point: {
|
|
108
|
+
events: {
|
|
109
|
+
click() {
|
|
110
|
+
self.emit('nile-chart-click', {
|
|
111
|
+
point: this,
|
|
112
|
+
name: this.name,
|
|
113
|
+
value: this.y,
|
|
114
|
+
percentage: this.percentage,
|
|
115
|
+
seriesName: this.series.name,
|
|
116
|
+
});
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
series: [
|
|
123
|
+
{
|
|
124
|
+
type: 'pie',
|
|
125
|
+
name: this.seriesName,
|
|
126
|
+
data: this.data.map(d => ({
|
|
127
|
+
name: d.name,
|
|
128
|
+
y: d.y,
|
|
129
|
+
color: d.color,
|
|
130
|
+
sliced: d.sliced,
|
|
131
|
+
selected: d.selected,
|
|
132
|
+
})),
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
credits: {
|
|
136
|
+
enabled: false,
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
return deepMerge(defaults, this.options);
|
|
140
|
+
}
|
|
141
|
+
async initChart() {
|
|
142
|
+
if (this.loading || !this.chartContainer)
|
|
143
|
+
return;
|
|
144
|
+
if (!this._hc)
|
|
145
|
+
this._hc = await getHighcharts();
|
|
146
|
+
this.chart = this._hc.chart(this.chartContainer, this.buildOptions());
|
|
147
|
+
this.emit('nile-chart-ready', { chart: this.chart });
|
|
148
|
+
}
|
|
149
|
+
destroyChart() {
|
|
150
|
+
if (this.chart) {
|
|
151
|
+
this.chart.destroy();
|
|
152
|
+
this.chart = null;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
render() {
|
|
156
|
+
if (this.loading) {
|
|
157
|
+
return html `<div class="chart-loading" style="height:${this.height}">Loading...</div>`;
|
|
158
|
+
}
|
|
159
|
+
return html `<div class="chart-container"></div>`;
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
NilePieChart.styles = styles;
|
|
163
|
+
__decorate([
|
|
164
|
+
query('.chart-container')
|
|
165
|
+
], NilePieChart.prototype, "chartContainer", void 0);
|
|
166
|
+
__decorate([
|
|
167
|
+
property({ type: String, attribute: 'chart-title' })
|
|
168
|
+
], NilePieChart.prototype, "chartTitle", void 0);
|
|
169
|
+
__decorate([
|
|
170
|
+
property({ type: String, attribute: 'chart-subtitle' })
|
|
171
|
+
], NilePieChart.prototype, "chartSubtitle", void 0);
|
|
172
|
+
__decorate([
|
|
173
|
+
property({ type: Array })
|
|
174
|
+
], NilePieChart.prototype, "data", void 0);
|
|
175
|
+
__decorate([
|
|
176
|
+
property({ type: String, attribute: 'series-name' })
|
|
177
|
+
], NilePieChart.prototype, "seriesName", void 0);
|
|
178
|
+
__decorate([
|
|
179
|
+
property({ type: Object })
|
|
180
|
+
], NilePieChart.prototype, "options", void 0);
|
|
181
|
+
__decorate([
|
|
182
|
+
property({ type: Boolean, reflect: true })
|
|
183
|
+
], NilePieChart.prototype, "loading", void 0);
|
|
184
|
+
__decorate([
|
|
185
|
+
property({ type: String })
|
|
186
|
+
], NilePieChart.prototype, "height", void 0);
|
|
187
|
+
__decorate([
|
|
188
|
+
property({ type: Boolean, attribute: 'show-data-labels' })
|
|
189
|
+
], NilePieChart.prototype, "showDataLabels", void 0);
|
|
190
|
+
__decorate([
|
|
191
|
+
property({ type: Boolean, attribute: 'show-legend' })
|
|
192
|
+
], NilePieChart.prototype, "showLegend", void 0);
|
|
193
|
+
NilePieChart = __decorate([
|
|
194
|
+
customElement('nile-pie-chart')
|
|
195
|
+
], NilePieChart);
|
|
196
|
+
export { NilePieChart };
|
|
197
|
+
//# sourceMappingURL=nile-pie-chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const styles = css `
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
width: 100%;
|
|
6
|
+
position: relative;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
:host([hidden]) {
|
|
10
|
+
display: none;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.chart-container {
|
|
14
|
+
width: 100%;
|
|
15
|
+
min-height: var(--nile-height-200px, var(--ng-height-200px));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.chart-loading {
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
min-height: inherit;
|
|
23
|
+
color: var(--nile-colors-neutral-700, var(--ng-colors-text-secondary-700));
|
|
24
|
+
font-family: var(--nile-font-family-serif, var(--ng-font-family-body));
|
|
25
|
+
font-size: var(--nile-type-scale-3, var(--ng-font-size-text-sm));
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
//# sourceMappingURL=nile-radar-chart.css.js.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
2
|
+
import type Highcharts from 'highcharts';
|
|
3
|
+
import NileElement from '../internal/nile-element.js';
|
|
4
|
+
export interface RadarChartSeriesData {
|
|
5
|
+
name: string;
|
|
6
|
+
data: number[];
|
|
7
|
+
color?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class NileRadarChart extends NileElement {
|
|
10
|
+
static styles: CSSResultGroup;
|
|
11
|
+
private _hc;
|
|
12
|
+
private chart;
|
|
13
|
+
private resizeObserver;
|
|
14
|
+
private chartContainer;
|
|
15
|
+
chartTitle: string;
|
|
16
|
+
chartSubtitle: string;
|
|
17
|
+
data: RadarChartSeriesData[];
|
|
18
|
+
categories: string[];
|
|
19
|
+
options: Highcharts.Options;
|
|
20
|
+
loading: boolean;
|
|
21
|
+
height: string;
|
|
22
|
+
showArea: boolean;
|
|
23
|
+
disconnectedCallback(): void;
|
|
24
|
+
protected firstUpdated(): void;
|
|
25
|
+
protected updated(changedProperties: PropertyValues): void;
|
|
26
|
+
private setupResizeObserver;
|
|
27
|
+
private buildOptions;
|
|
28
|
+
private initChart;
|
|
29
|
+
private destroyChart;
|
|
30
|
+
render(): TemplateResult;
|
|
31
|
+
}
|
|
32
|
+
declare global {
|
|
33
|
+
interface HTMLElementTagNameMap {
|
|
34
|
+
'nile-radar-chart': NileRadarChart;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
3
|
+
import { html } from 'lit';
|
|
4
|
+
import NileElement from '../internal/nile-element.js';
|
|
5
|
+
import { getHighcharts } from '../internal/highcharts-provider.js';
|
|
6
|
+
import { deepMerge } from '../internal/utils.js';
|
|
7
|
+
import { styles } from './nile-radar-chart.css.js';
|
|
8
|
+
let NileRadarChart = class NileRadarChart extends NileElement {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this._hc = null;
|
|
12
|
+
this.chart = null;
|
|
13
|
+
this.resizeObserver = null;
|
|
14
|
+
this.chartTitle = '';
|
|
15
|
+
this.chartSubtitle = '';
|
|
16
|
+
this.data = [];
|
|
17
|
+
this.categories = [];
|
|
18
|
+
this.options = {};
|
|
19
|
+
this.loading = false;
|
|
20
|
+
this.height = '400px';
|
|
21
|
+
this.showArea = false;
|
|
22
|
+
}
|
|
23
|
+
disconnectedCallback() {
|
|
24
|
+
super.disconnectedCallback();
|
|
25
|
+
this.destroyChart();
|
|
26
|
+
this.resizeObserver?.disconnect();
|
|
27
|
+
this.resizeObserver = null;
|
|
28
|
+
}
|
|
29
|
+
firstUpdated() { this.initChart(); this.setupResizeObserver(); }
|
|
30
|
+
updated(changedProperties) {
|
|
31
|
+
const props = ['data', 'categories', 'chartTitle', 'chartSubtitle', 'options', 'height', 'showArea', 'loading'];
|
|
32
|
+
if (!props.some(p => changedProperties.has(p)))
|
|
33
|
+
return;
|
|
34
|
+
if (this.loading) {
|
|
35
|
+
this.destroyChart();
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (this.chart) {
|
|
39
|
+
this.chart.update(this.buildOptions(), true, true);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
this.initChart();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
setupResizeObserver() {
|
|
46
|
+
if (!this.chartContainer)
|
|
47
|
+
return;
|
|
48
|
+
this.resizeObserver = new ResizeObserver(() => { this.chart?.reflow(); });
|
|
49
|
+
this.resizeObserver.observe(this.chartContainer);
|
|
50
|
+
}
|
|
51
|
+
buildOptions() {
|
|
52
|
+
const self = this;
|
|
53
|
+
const seriesType = this.showArea ? 'area' : 'line';
|
|
54
|
+
return deepMerge({
|
|
55
|
+
chart: { polar: true, type: seriesType, height: this.height },
|
|
56
|
+
title: { text: this.chartTitle || undefined },
|
|
57
|
+
subtitle: { text: this.chartSubtitle || undefined },
|
|
58
|
+
pane: { size: '80%' },
|
|
59
|
+
xAxis: {
|
|
60
|
+
categories: this.categories,
|
|
61
|
+
tickmarkPlacement: 'on',
|
|
62
|
+
lineWidth: 0,
|
|
63
|
+
},
|
|
64
|
+
yAxis: {
|
|
65
|
+
gridLineInterpolation: 'polygon',
|
|
66
|
+
lineWidth: 0,
|
|
67
|
+
min: 0,
|
|
68
|
+
},
|
|
69
|
+
tooltip: { shared: true, pointFormat: '<span style="color:{series.color}">{series.name}: <b>{point.y}</b><br/>' },
|
|
70
|
+
plotOptions: {
|
|
71
|
+
series: {
|
|
72
|
+
cursor: 'pointer',
|
|
73
|
+
point: { events: { click() { self.emit('nile-chart-click', { point: this, category: this.category, value: this.y, seriesName: this.series.name }); } } },
|
|
74
|
+
},
|
|
75
|
+
area: { fillOpacity: 0.15 },
|
|
76
|
+
},
|
|
77
|
+
series: this.data.map(s => ({
|
|
78
|
+
type: seriesType,
|
|
79
|
+
name: s.name,
|
|
80
|
+
data: s.data,
|
|
81
|
+
color: s.color,
|
|
82
|
+
pointPlacement: 'on',
|
|
83
|
+
})),
|
|
84
|
+
credits: { enabled: false },
|
|
85
|
+
}, this.options);
|
|
86
|
+
}
|
|
87
|
+
async initChart() {
|
|
88
|
+
if (this.loading || !this.chartContainer)
|
|
89
|
+
return;
|
|
90
|
+
if (!this._hc)
|
|
91
|
+
this._hc = await getHighcharts();
|
|
92
|
+
this.chart = this._hc.chart(this.chartContainer, this.buildOptions());
|
|
93
|
+
this.emit('nile-chart-ready', { chart: this.chart });
|
|
94
|
+
}
|
|
95
|
+
destroyChart() { if (this.chart) {
|
|
96
|
+
this.chart.destroy();
|
|
97
|
+
this.chart = null;
|
|
98
|
+
} }
|
|
99
|
+
render() {
|
|
100
|
+
if (this.loading)
|
|
101
|
+
return html `<div class="chart-loading" style="height:${this.height}">Loading...</div>`;
|
|
102
|
+
return html `<div class="chart-container"></div>`;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
NileRadarChart.styles = styles;
|
|
106
|
+
__decorate([
|
|
107
|
+
query('.chart-container')
|
|
108
|
+
], NileRadarChart.prototype, "chartContainer", void 0);
|
|
109
|
+
__decorate([
|
|
110
|
+
property({ type: String, attribute: 'chart-title' })
|
|
111
|
+
], NileRadarChart.prototype, "chartTitle", void 0);
|
|
112
|
+
__decorate([
|
|
113
|
+
property({ type: String, attribute: 'chart-subtitle' })
|
|
114
|
+
], NileRadarChart.prototype, "chartSubtitle", void 0);
|
|
115
|
+
__decorate([
|
|
116
|
+
property({ type: Array })
|
|
117
|
+
], NileRadarChart.prototype, "data", void 0);
|
|
118
|
+
__decorate([
|
|
119
|
+
property({ type: Array })
|
|
120
|
+
], NileRadarChart.prototype, "categories", void 0);
|
|
121
|
+
__decorate([
|
|
122
|
+
property({ type: Object })
|
|
123
|
+
], NileRadarChart.prototype, "options", void 0);
|
|
124
|
+
__decorate([
|
|
125
|
+
property({ type: Boolean, reflect: true })
|
|
126
|
+
], NileRadarChart.prototype, "loading", void 0);
|
|
127
|
+
__decorate([
|
|
128
|
+
property({ type: String })
|
|
129
|
+
], NileRadarChart.prototype, "height", void 0);
|
|
130
|
+
__decorate([
|
|
131
|
+
property({ type: Boolean, attribute: 'show-area' })
|
|
132
|
+
], NileRadarChart.prototype, "showArea", void 0);
|
|
133
|
+
NileRadarChart = __decorate([
|
|
134
|
+
customElement('nile-radar-chart')
|
|
135
|
+
], NileRadarChart);
|
|
136
|
+
export { NileRadarChart };
|
|
137
|
+
//# sourceMappingURL=nile-radar-chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const styles = css `
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
width: 100%;
|
|
6
|
+
position: relative;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
:host([hidden]) {
|
|
10
|
+
display: none;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.chart-container {
|
|
14
|
+
width: 100%;
|
|
15
|
+
min-height: var(--nile-height-200px, var(--ng-height-200px));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.chart-loading {
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
min-height: inherit;
|
|
23
|
+
color: var(--nile-colors-neutral-700, var(--ng-colors-text-secondary-700));
|
|
24
|
+
font-family: var(--nile-font-family-serif, var(--ng-font-family-body));
|
|
25
|
+
font-size: var(--nile-type-scale-3, var(--ng-font-size-text-sm));
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
//# sourceMappingURL=nile-scatter-chart.css.js.map
|