@aquera/nile-visualization 0.2.0 → 0.3.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.
Files changed (134) hide show
  1. package/dist/src/index.d.ts +31 -1
  2. package/dist/src/index.js +16 -0
  3. package/dist/src/internal/highcharts-provider.js +45 -0
  4. package/dist/src/internal/types/chart-area-config.type.d.ts +4 -0
  5. package/dist/src/internal/types/chart-area-negative-config.type.d.ts +13 -0
  6. package/dist/src/internal/types/chart-area-negative-config.type.js +2 -0
  7. package/dist/src/internal/types/chart-area-range-config.type.d.ts +12 -0
  8. package/dist/src/internal/types/chart-area-range-config.type.js +2 -0
  9. package/dist/src/internal/types/chart-area-spline-config.type.d.ts +13 -0
  10. package/dist/src/internal/types/chart-area-spline-config.type.js +2 -0
  11. package/dist/src/internal/types/chart-column-drilldown-config.type.d.ts +13 -0
  12. package/dist/src/internal/types/chart-column-drilldown-config.type.js +2 -0
  13. package/dist/src/internal/types/chart-column-pyramid-config.type.d.ts +11 -0
  14. package/dist/src/internal/types/chart-column-pyramid-config.type.js +2 -0
  15. package/dist/src/internal/types/chart-column-range-config.type.d.ts +12 -0
  16. package/dist/src/internal/types/chart-column-range-config.type.js +2 -0
  17. package/dist/src/internal/types/chart-dumbbell-lower-config.type.d.ts +5 -0
  18. package/dist/src/internal/types/chart-dumbbell-lower-config.type.js +2 -0
  19. package/dist/src/internal/types/chart-dumbbell-upper-config.type.d.ts +5 -0
  20. package/dist/src/internal/types/chart-dumbbell-upper-config.type.js +2 -0
  21. package/dist/src/internal/types/chart-euler-config.type.d.ts +10 -0
  22. package/dist/src/internal/types/chart-euler-config.type.js +2 -0
  23. package/dist/src/internal/types/chart-lollipop-config.type.d.ts +11 -0
  24. package/dist/src/internal/types/chart-lollipop-config.type.js +2 -0
  25. package/dist/src/internal/types/chart-polygon-config.type.d.ts +12 -0
  26. package/dist/src/internal/types/chart-polygon-config.type.js +2 -0
  27. package/dist/src/internal/types/chart-radial-bar-config.type.d.ts +16 -0
  28. package/dist/src/internal/types/chart-radial-bar-config.type.js +2 -0
  29. package/dist/src/internal/types/chart-variable-pie-config.type.d.ts +13 -0
  30. package/dist/src/internal/types/chart-variable-pie-config.type.js +2 -0
  31. package/dist/src/internal/types/chart-vector-config.type.d.ts +13 -0
  32. package/dist/src/internal/types/chart-vector-config.type.js +2 -0
  33. package/dist/src/internal/types/chart-xrange-config.type.d.ts +13 -0
  34. package/dist/src/internal/types/chart-xrange-config.type.js +2 -0
  35. package/dist/src/internal/types/index.d.ts +16 -1
  36. package/dist/src/internal/types/primitive-chart-config.type.d.ts +17 -1
  37. package/dist/src/nile-area-negative-chart/index.d.ts +2 -0
  38. package/dist/src/nile-area-negative-chart/index.js +2 -0
  39. package/dist/src/nile-area-negative-chart/nile-area-negative-chart.css.d.ts +1 -0
  40. package/dist/src/nile-area-negative-chart/nile-area-negative-chart.css.js +28 -0
  41. package/dist/src/nile-area-negative-chart/nile-area-negative-chart.d.ts +42 -0
  42. package/dist/src/nile-area-negative-chart/nile-area-negative-chart.js +178 -0
  43. package/dist/src/nile-area-range-chart/index.d.ts +2 -0
  44. package/dist/src/nile-area-range-chart/index.js +2 -0
  45. package/dist/src/nile-area-range-chart/nile-area-range-chart.css.d.ts +1 -0
  46. package/dist/src/nile-area-range-chart/nile-area-range-chart.css.js +28 -0
  47. package/dist/src/nile-area-range-chart/nile-area-range-chart.d.ts +41 -0
  48. package/dist/src/nile-area-range-chart/nile-area-range-chart.js +173 -0
  49. package/dist/src/nile-area-spline-chart/index.d.ts +2 -0
  50. package/dist/src/nile-area-spline-chart/index.js +2 -0
  51. package/dist/src/nile-area-spline-chart/nile-area-spline-chart.css.d.ts +1 -0
  52. package/dist/src/nile-area-spline-chart/nile-area-spline-chart.css.js +28 -0
  53. package/dist/src/nile-area-spline-chart/nile-area-spline-chart.d.ts +41 -0
  54. package/dist/src/nile-area-spline-chart/nile-area-spline-chart.js +174 -0
  55. package/dist/src/nile-chart/index.d.ts +1 -1
  56. package/dist/src/nile-column-drilldown-chart/index.d.ts +2 -0
  57. package/dist/src/nile-column-drilldown-chart/index.js +2 -0
  58. package/dist/src/nile-column-drilldown-chart/nile-column-drilldown-chart.css.d.ts +1 -0
  59. package/dist/src/nile-column-drilldown-chart/nile-column-drilldown-chart.css.js +28 -0
  60. package/dist/src/nile-column-drilldown-chart/nile-column-drilldown-chart.d.ts +49 -0
  61. package/dist/src/nile-column-drilldown-chart/nile-column-drilldown-chart.js +186 -0
  62. package/dist/src/nile-column-pyramid-chart/index.d.ts +2 -0
  63. package/dist/src/nile-column-pyramid-chart/index.js +2 -0
  64. package/dist/src/nile-column-pyramid-chart/nile-column-pyramid-chart.css.d.ts +1 -0
  65. package/dist/src/nile-column-pyramid-chart/nile-column-pyramid-chart.css.js +28 -0
  66. package/dist/src/nile-column-pyramid-chart/nile-column-pyramid-chart.d.ts +39 -0
  67. package/dist/src/nile-column-pyramid-chart/nile-column-pyramid-chart.js +155 -0
  68. package/dist/src/nile-column-range-chart/index.d.ts +2 -0
  69. package/dist/src/nile-column-range-chart/index.js +2 -0
  70. package/dist/src/nile-column-range-chart/nile-column-range-chart.css.d.ts +1 -0
  71. package/dist/src/nile-column-range-chart/nile-column-range-chart.css.js +28 -0
  72. package/dist/src/nile-column-range-chart/nile-column-range-chart.d.ts +40 -0
  73. package/dist/src/nile-column-range-chart/nile-column-range-chart.js +169 -0
  74. package/dist/src/nile-dumbbell-lower-chart/index.d.ts +1 -0
  75. package/dist/src/nile-dumbbell-lower-chart/index.js +2 -0
  76. package/dist/src/nile-dumbbell-lower-chart/nile-dumbbell-lower-chart.css.d.ts +1 -0
  77. package/dist/src/nile-dumbbell-lower-chart/nile-dumbbell-lower-chart.css.js +28 -0
  78. package/dist/src/nile-dumbbell-lower-chart/nile-dumbbell-lower-chart.d.ts +40 -0
  79. package/dist/src/nile-dumbbell-lower-chart/nile-dumbbell-lower-chart.js +214 -0
  80. package/dist/src/nile-dumbbell-upper-chart/index.d.ts +1 -0
  81. package/dist/src/nile-dumbbell-upper-chart/index.js +2 -0
  82. package/dist/src/nile-dumbbell-upper-chart/nile-dumbbell-upper-chart.css.d.ts +1 -0
  83. package/dist/src/nile-dumbbell-upper-chart/nile-dumbbell-upper-chart.css.js +28 -0
  84. package/dist/src/nile-dumbbell-upper-chart/nile-dumbbell-upper-chart.d.ts +40 -0
  85. package/dist/src/nile-dumbbell-upper-chart/nile-dumbbell-upper-chart.js +214 -0
  86. package/dist/src/nile-euler-chart/index.d.ts +2 -0
  87. package/dist/src/nile-euler-chart/index.js +2 -0
  88. package/dist/src/nile-euler-chart/nile-euler-chart.css.d.ts +1 -0
  89. package/dist/src/nile-euler-chart/nile-euler-chart.css.js +28 -0
  90. package/dist/src/nile-euler-chart/nile-euler-chart.d.ts +38 -0
  91. package/dist/src/nile-euler-chart/nile-euler-chart.js +149 -0
  92. package/dist/src/nile-inverted-area-chart/index.d.ts +2 -0
  93. package/dist/src/nile-inverted-area-chart/index.js +2 -0
  94. package/dist/src/nile-inverted-area-chart/nile-inverted-area-chart.css.d.ts +1 -0
  95. package/dist/src/nile-inverted-area-chart/nile-inverted-area-chart.css.js +28 -0
  96. package/dist/src/nile-inverted-area-chart/nile-inverted-area-chart.d.ts +40 -0
  97. package/dist/src/nile-inverted-area-chart/nile-inverted-area-chart.js +173 -0
  98. package/dist/src/nile-lollipop-chart/index.d.ts +2 -0
  99. package/dist/src/nile-lollipop-chart/index.js +2 -0
  100. package/dist/src/nile-lollipop-chart/nile-lollipop-chart.css.d.ts +1 -0
  101. package/dist/src/nile-lollipop-chart/nile-lollipop-chart.css.js +28 -0
  102. package/dist/src/nile-lollipop-chart/nile-lollipop-chart.d.ts +39 -0
  103. package/dist/src/nile-lollipop-chart/nile-lollipop-chart.js +174 -0
  104. package/dist/src/nile-polygon-chart/index.d.ts +2 -0
  105. package/dist/src/nile-polygon-chart/index.js +2 -0
  106. package/dist/src/nile-polygon-chart/nile-polygon-chart.css.d.ts +1 -0
  107. package/dist/src/nile-polygon-chart/nile-polygon-chart.css.js +28 -0
  108. package/dist/src/nile-polygon-chart/nile-polygon-chart.d.ts +41 -0
  109. package/dist/src/nile-polygon-chart/nile-polygon-chart.js +167 -0
  110. package/dist/src/nile-radial-bar-chart/index.d.ts +2 -0
  111. package/dist/src/nile-radial-bar-chart/index.js +2 -0
  112. package/dist/src/nile-radial-bar-chart/nile-radial-bar-chart.css.d.ts +1 -0
  113. package/dist/src/nile-radial-bar-chart/nile-radial-bar-chart.css.js +28 -0
  114. package/dist/src/nile-radial-bar-chart/nile-radial-bar-chart.d.ts +42 -0
  115. package/dist/src/nile-radial-bar-chart/nile-radial-bar-chart.js +191 -0
  116. package/dist/src/nile-variable-pie-chart/index.d.ts +2 -0
  117. package/dist/src/nile-variable-pie-chart/index.js +2 -0
  118. package/dist/src/nile-variable-pie-chart/nile-variable-pie-chart.css.d.ts +1 -0
  119. package/dist/src/nile-variable-pie-chart/nile-variable-pie-chart.css.js +28 -0
  120. package/dist/src/nile-variable-pie-chart/nile-variable-pie-chart.d.ts +42 -0
  121. package/dist/src/nile-variable-pie-chart/nile-variable-pie-chart.js +180 -0
  122. package/dist/src/nile-vector-chart/index.d.ts +2 -0
  123. package/dist/src/nile-vector-chart/index.js +2 -0
  124. package/dist/src/nile-vector-chart/nile-vector-chart.css.d.ts +1 -0
  125. package/dist/src/nile-vector-chart/nile-vector-chart.css.js +28 -0
  126. package/dist/src/nile-vector-chart/nile-vector-chart.d.ts +44 -0
  127. package/dist/src/nile-vector-chart/nile-vector-chart.js +181 -0
  128. package/dist/src/nile-xrange-chart/index.d.ts +2 -0
  129. package/dist/src/nile-xrange-chart/index.js +2 -0
  130. package/dist/src/nile-xrange-chart/nile-xrange-chart.css.d.ts +1 -0
  131. package/dist/src/nile-xrange-chart/nile-xrange-chart.css.js +28 -0
  132. package/dist/src/nile-xrange-chart/nile-xrange-chart.d.ts +44 -0
  133. package/dist/src/nile-xrange-chart/nile-xrange-chart.js +193 -0
  134. package/package.json +1 -1
@@ -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-radial-bar-chart.css.js.map
@@ -0,0 +1,42 @@
1
+ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
2
+ import type Highcharts from 'highcharts';
3
+ import NileElement from '../internal/nile-element.js';
4
+ import type { SeparatedChartConfigInputType } from '../internal/types/separated-chart-config-input.type.js';
5
+ export interface RadialBarSeriesData {
6
+ name: string;
7
+ data: number[];
8
+ color?: string;
9
+ }
10
+ export declare class NileRadialBarChart extends NileElement {
11
+ static styles: CSSResultGroup;
12
+ private _hc;
13
+ private chart;
14
+ private resizeObserver;
15
+ private chartContainer;
16
+ config: SeparatedChartConfigInputType | null;
17
+ chartTitle: string;
18
+ chartSubtitle: string;
19
+ data: RadialBarSeriesData[];
20
+ categories: string[];
21
+ options: Highcharts.Options;
22
+ loading: boolean;
23
+ height: string;
24
+ yAxisTitle: string;
25
+ innerSize: string;
26
+ paneSize: string;
27
+ private applyConfig;
28
+ connectedCallback(): void;
29
+ disconnectedCallback(): void;
30
+ protected firstUpdated(): void;
31
+ protected updated(changedProperties: PropertyValues): void;
32
+ private setupResizeObserver;
33
+ private buildOptions;
34
+ private initChart;
35
+ private destroyChart;
36
+ render(): TemplateResult;
37
+ }
38
+ declare global {
39
+ interface HTMLElementTagNameMap {
40
+ 'nile-radial-bar-chart': NileRadialBarChart;
41
+ }
42
+ }
@@ -0,0 +1,191 @@
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 { applySeparatedChartConfig } from '../internal/separated-chart-config.js';
6
+ import { getHighcharts } from '../internal/highcharts-provider.js';
7
+ import { deepMerge } from '../internal/utils.js';
8
+ import { styles } from './nile-radial-bar-chart.css.js';
9
+ let NileRadialBarChart = class NileRadialBarChart extends NileElement {
10
+ constructor() {
11
+ super(...arguments);
12
+ this._hc = null;
13
+ this.chart = null;
14
+ this.resizeObserver = null;
15
+ this.config = null;
16
+ this.chartTitle = '';
17
+ this.chartSubtitle = '';
18
+ this.data = [];
19
+ this.categories = [];
20
+ this.options = {};
21
+ this.loading = false;
22
+ this.height = '400px';
23
+ this.yAxisTitle = '';
24
+ this.innerSize = '28%';
25
+ this.paneSize = '82%';
26
+ }
27
+ applyConfig(cfg) {
28
+ applySeparatedChartConfig(this, cfg);
29
+ }
30
+ connectedCallback() {
31
+ super.connectedCallback();
32
+ if (this.config)
33
+ this.applyConfig(this.config);
34
+ }
35
+ disconnectedCallback() {
36
+ super.disconnectedCallback();
37
+ this.destroyChart();
38
+ this.resizeObserver?.disconnect();
39
+ this.resizeObserver = null;
40
+ }
41
+ firstUpdated() {
42
+ this.initChart();
43
+ this.setupResizeObserver();
44
+ }
45
+ updated(changedProperties) {
46
+ if (changedProperties.has('config') && this.config) {
47
+ this.applyConfig(this.config);
48
+ return;
49
+ }
50
+ const props = [
51
+ 'data',
52
+ 'categories',
53
+ 'chartTitle',
54
+ 'chartSubtitle',
55
+ 'options',
56
+ 'height',
57
+ 'yAxisTitle',
58
+ 'innerSize',
59
+ 'paneSize',
60
+ 'loading',
61
+ ];
62
+ if (!props.some(p => changedProperties.has(p)))
63
+ return;
64
+ if (this.loading) {
65
+ this.destroyChart();
66
+ return;
67
+ }
68
+ if (this.chart) {
69
+ this.chart.update(this.buildOptions(), true, true);
70
+ }
71
+ else {
72
+ this.initChart();
73
+ }
74
+ }
75
+ setupResizeObserver() {
76
+ if (!this.chartContainer)
77
+ return;
78
+ this.resizeObserver = new ResizeObserver(() => this.chart?.reflow());
79
+ this.resizeObserver.observe(this.chartContainer);
80
+ }
81
+ buildOptions() {
82
+ const self = this;
83
+ return deepMerge({
84
+ chart: { polar: true, type: 'column', height: this.height },
85
+ title: { text: this.chartTitle || undefined },
86
+ subtitle: { text: this.chartSubtitle || undefined },
87
+ pane: { size: this.paneSize, innerSize: this.innerSize },
88
+ xAxis: {
89
+ categories: this.categories,
90
+ tickmarkPlacement: 'on',
91
+ },
92
+ yAxis: {
93
+ min: 0,
94
+ title: { text: this.yAxisTitle || undefined },
95
+ gridLineInterpolation: 'circle',
96
+ },
97
+ tooltip: { shared: true },
98
+ plotOptions: {
99
+ column: {
100
+ grouping: false,
101
+ pointPadding: 0,
102
+ groupPadding: 0.08,
103
+ },
104
+ series: {
105
+ cursor: 'pointer',
106
+ point: {
107
+ events: {
108
+ click() {
109
+ self.emit('nile-chart-click', {
110
+ point: this,
111
+ category: this.category,
112
+ value: this.y,
113
+ seriesName: this.series.name,
114
+ });
115
+ },
116
+ },
117
+ },
118
+ },
119
+ },
120
+ series: this.data.map(s => ({
121
+ type: 'column',
122
+ name: s.name,
123
+ data: s.data,
124
+ color: s.color,
125
+ })),
126
+ credits: { enabled: false },
127
+ }, this.options);
128
+ }
129
+ async initChart() {
130
+ if (this.loading || !this.chartContainer)
131
+ return;
132
+ if (!this._hc)
133
+ this._hc = await getHighcharts();
134
+ this.chart = this._hc.chart(this.chartContainer, this.buildOptions());
135
+ this.emit('nile-chart-ready', { chart: this.chart });
136
+ }
137
+ destroyChart() {
138
+ if (this.chart) {
139
+ this.chart.destroy();
140
+ this.chart = null;
141
+ }
142
+ }
143
+ render() {
144
+ if (this.loading) {
145
+ return html `<div class="chart-loading" style="height:${this.height}">Loading...</div>`;
146
+ }
147
+ return html `<div class="chart-container"></div>`;
148
+ }
149
+ };
150
+ NileRadialBarChart.styles = styles;
151
+ __decorate([
152
+ query('.chart-container')
153
+ ], NileRadialBarChart.prototype, "chartContainer", void 0);
154
+ __decorate([
155
+ property({ type: Object })
156
+ ], NileRadialBarChart.prototype, "config", void 0);
157
+ __decorate([
158
+ property({ type: String, attribute: 'chart-title' })
159
+ ], NileRadialBarChart.prototype, "chartTitle", void 0);
160
+ __decorate([
161
+ property({ type: String, attribute: 'chart-subtitle' })
162
+ ], NileRadialBarChart.prototype, "chartSubtitle", void 0);
163
+ __decorate([
164
+ property({ type: Array })
165
+ ], NileRadialBarChart.prototype, "data", void 0);
166
+ __decorate([
167
+ property({ type: Array })
168
+ ], NileRadialBarChart.prototype, "categories", void 0);
169
+ __decorate([
170
+ property({ type: Object })
171
+ ], NileRadialBarChart.prototype, "options", void 0);
172
+ __decorate([
173
+ property({ type: Boolean, reflect: true })
174
+ ], NileRadialBarChart.prototype, "loading", void 0);
175
+ __decorate([
176
+ property({ type: String })
177
+ ], NileRadialBarChart.prototype, "height", void 0);
178
+ __decorate([
179
+ property({ type: String, attribute: 'y-axis-title' })
180
+ ], NileRadialBarChart.prototype, "yAxisTitle", void 0);
181
+ __decorate([
182
+ property({ type: String, attribute: 'inner-size' })
183
+ ], NileRadialBarChart.prototype, "innerSize", void 0);
184
+ __decorate([
185
+ property({ type: String, attribute: 'pane-size' })
186
+ ], NileRadialBarChart.prototype, "paneSize", void 0);
187
+ NileRadialBarChart = __decorate([
188
+ customElement('nile-radial-bar-chart')
189
+ ], NileRadialBarChart);
190
+ export { NileRadialBarChart };
191
+ //# sourceMappingURL=nile-radial-bar-chart.js.map
@@ -0,0 +1,2 @@
1
+ export { NileVariablePieChart } from './nile-variable-pie-chart.js';
2
+ export type { VariablePieDataPoint } from './nile-variable-pie-chart.js';
@@ -0,0 +1,2 @@
1
+ export { NileVariablePieChart } from './nile-variable-pie-chart.js';
2
+ //# sourceMappingURL=index.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-variable-pie-chart.css.js.map
@@ -0,0 +1,42 @@
1
+ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
2
+ import type Highcharts from 'highcharts';
3
+ import NileElement from '../internal/nile-element.js';
4
+ import type { SeparatedChartConfigInputType } from '../internal/types/separated-chart-config-input.type.js';
5
+ export interface VariablePieDataPoint {
6
+ name: string;
7
+ y: number;
8
+ z: number;
9
+ color?: string;
10
+ }
11
+ export declare class NileVariablePieChart extends NileElement {
12
+ static styles: CSSResultGroup;
13
+ private _hc;
14
+ private chart;
15
+ private resizeObserver;
16
+ private chartContainer;
17
+ config: SeparatedChartConfigInputType | null;
18
+ chartTitle: string;
19
+ chartSubtitle: string;
20
+ data: VariablePieDataPoint[];
21
+ seriesName: string;
22
+ showDataLabels: boolean;
23
+ showLegend: boolean;
24
+ options: Highcharts.Options;
25
+ loading: boolean;
26
+ height: string;
27
+ private applyConfig;
28
+ connectedCallback(): void;
29
+ disconnectedCallback(): void;
30
+ protected firstUpdated(): void;
31
+ protected updated(changedProperties: PropertyValues): void;
32
+ private setupResizeObserver;
33
+ private buildOptions;
34
+ private initChart;
35
+ private destroyChart;
36
+ render(): TemplateResult;
37
+ }
38
+ declare global {
39
+ interface HTMLElementTagNameMap {
40
+ 'nile-variable-pie-chart': NileVariablePieChart;
41
+ }
42
+ }
@@ -0,0 +1,180 @@
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 { applySeparatedChartConfig } from '../internal/separated-chart-config.js';
6
+ import { getHighcharts } from '../internal/highcharts-provider.js';
7
+ import { deepMerge } from '../internal/utils.js';
8
+ import { styles } from './nile-variable-pie-chart.css.js';
9
+ let NileVariablePieChart = class NileVariablePieChart extends NileElement {
10
+ constructor() {
11
+ super(...arguments);
12
+ this._hc = null;
13
+ this.chart = null;
14
+ this.resizeObserver = null;
15
+ this.config = null;
16
+ this.chartTitle = '';
17
+ this.chartSubtitle = '';
18
+ this.data = [];
19
+ this.seriesName = '';
20
+ this.showDataLabels = true;
21
+ this.showLegend = true;
22
+ this.options = {};
23
+ this.loading = false;
24
+ this.height = '400px';
25
+ }
26
+ applyConfig(cfg) {
27
+ applySeparatedChartConfig(this, cfg);
28
+ }
29
+ connectedCallback() {
30
+ super.connectedCallback();
31
+ if (this.config)
32
+ this.applyConfig(this.config);
33
+ }
34
+ disconnectedCallback() {
35
+ super.disconnectedCallback();
36
+ this.destroyChart();
37
+ this.resizeObserver?.disconnect();
38
+ this.resizeObserver = null;
39
+ }
40
+ firstUpdated() {
41
+ this.initChart();
42
+ this.setupResizeObserver();
43
+ }
44
+ updated(changedProperties) {
45
+ if (changedProperties.has('config') && this.config) {
46
+ this.applyConfig(this.config);
47
+ return;
48
+ }
49
+ const props = [
50
+ 'data',
51
+ 'seriesName',
52
+ 'showDataLabels',
53
+ 'showLegend',
54
+ 'chartTitle',
55
+ 'chartSubtitle',
56
+ 'options',
57
+ 'height',
58
+ 'loading',
59
+ ];
60
+ if (!props.some(p => changedProperties.has(p)))
61
+ return;
62
+ if (this.loading) {
63
+ this.destroyChart();
64
+ return;
65
+ }
66
+ if (this.chart) {
67
+ this.chart.update(this.buildOptions(), true, true);
68
+ }
69
+ else {
70
+ this.initChart();
71
+ }
72
+ }
73
+ setupResizeObserver() {
74
+ if (!this.chartContainer)
75
+ return;
76
+ this.resizeObserver = new ResizeObserver(() => this.chart?.reflow());
77
+ this.resizeObserver.observe(this.chartContainer);
78
+ }
79
+ buildOptions() {
80
+ const self = this;
81
+ return deepMerge({
82
+ chart: { height: this.height },
83
+ title: { text: this.chartTitle || undefined },
84
+ subtitle: { text: this.chartSubtitle || undefined },
85
+ tooltip: { pointFormat: '{series.name}: <b>{point.y}</b> ({point.z})' },
86
+ legend: { enabled: this.showLegend },
87
+ plotOptions: {
88
+ variablepie: {
89
+ dataLabels: { enabled: this.showDataLabels },
90
+ },
91
+ series: {
92
+ cursor: 'pointer',
93
+ point: {
94
+ events: {
95
+ click() {
96
+ self.emit('nile-chart-click', {
97
+ point: this,
98
+ value: this.y,
99
+ seriesName: this.series.name,
100
+ });
101
+ },
102
+ },
103
+ },
104
+ },
105
+ },
106
+ series: [
107
+ {
108
+ type: 'variablepie',
109
+ name: this.seriesName || 'Share',
110
+ data: this.data.map(d => ({
111
+ name: d.name,
112
+ y: d.y,
113
+ z: d.z,
114
+ color: d.color,
115
+ })),
116
+ },
117
+ ],
118
+ credits: { enabled: false },
119
+ }, this.options);
120
+ }
121
+ async initChart() {
122
+ if (this.loading || !this.chartContainer)
123
+ return;
124
+ if (!this._hc)
125
+ this._hc = await getHighcharts();
126
+ this.chart = this._hc.chart(this.chartContainer, this.buildOptions());
127
+ this.emit('nile-chart-ready', { chart: this.chart });
128
+ }
129
+ destroyChart() {
130
+ if (this.chart) {
131
+ this.chart.destroy();
132
+ this.chart = null;
133
+ }
134
+ }
135
+ render() {
136
+ if (this.loading) {
137
+ return html `<div class="chart-loading" style="height:${this.height}">Loading...</div>`;
138
+ }
139
+ return html `<div class="chart-container"></div>`;
140
+ }
141
+ };
142
+ NileVariablePieChart.styles = styles;
143
+ __decorate([
144
+ query('.chart-container')
145
+ ], NileVariablePieChart.prototype, "chartContainer", void 0);
146
+ __decorate([
147
+ property({ type: Object })
148
+ ], NileVariablePieChart.prototype, "config", void 0);
149
+ __decorate([
150
+ property({ type: String, attribute: 'chart-title' })
151
+ ], NileVariablePieChart.prototype, "chartTitle", void 0);
152
+ __decorate([
153
+ property({ type: String, attribute: 'chart-subtitle' })
154
+ ], NileVariablePieChart.prototype, "chartSubtitle", void 0);
155
+ __decorate([
156
+ property({ type: Array })
157
+ ], NileVariablePieChart.prototype, "data", void 0);
158
+ __decorate([
159
+ property({ type: String, attribute: 'series-name' })
160
+ ], NileVariablePieChart.prototype, "seriesName", void 0);
161
+ __decorate([
162
+ property({ type: Boolean, attribute: 'show-data-labels' })
163
+ ], NileVariablePieChart.prototype, "showDataLabels", void 0);
164
+ __decorate([
165
+ property({ type: Boolean, attribute: 'show-legend' })
166
+ ], NileVariablePieChart.prototype, "showLegend", void 0);
167
+ __decorate([
168
+ property({ type: Object })
169
+ ], NileVariablePieChart.prototype, "options", void 0);
170
+ __decorate([
171
+ property({ type: Boolean, reflect: true })
172
+ ], NileVariablePieChart.prototype, "loading", void 0);
173
+ __decorate([
174
+ property({ type: String })
175
+ ], NileVariablePieChart.prototype, "height", void 0);
176
+ NileVariablePieChart = __decorate([
177
+ customElement('nile-variable-pie-chart')
178
+ ], NileVariablePieChart);
179
+ export { NileVariablePieChart };
180
+ //# sourceMappingURL=nile-variable-pie-chart.js.map
@@ -0,0 +1,2 @@
1
+ export { NileVectorChart } from './nile-vector-chart.js';
2
+ export type { VectorDataPoint } from './nile-vector-chart.js';
@@ -0,0 +1,2 @@
1
+ export { NileVectorChart } from './nile-vector-chart.js';
2
+ //# sourceMappingURL=index.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-vector-chart.css.js.map
@@ -0,0 +1,44 @@
1
+ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
2
+ import type Highcharts from 'highcharts';
3
+ import NileElement from '../internal/nile-element.js';
4
+ import type { SeparatedChartConfigInputType } from '../internal/types/separated-chart-config-input.type.js';
5
+ export interface VectorDataPoint {
6
+ x: number;
7
+ y: number;
8
+ length: number;
9
+ direction: number;
10
+ name?: string;
11
+ color?: string;
12
+ }
13
+ export declare class NileVectorChart extends NileElement {
14
+ static styles: CSSResultGroup;
15
+ private _hc;
16
+ private chart;
17
+ private resizeObserver;
18
+ private chartContainer;
19
+ config: SeparatedChartConfigInputType | null;
20
+ chartTitle: string;
21
+ chartSubtitle: string;
22
+ data: VectorDataPoint[];
23
+ seriesName: string;
24
+ xAxisTitle: string;
25
+ yAxisTitle: string;
26
+ options: Highcharts.Options;
27
+ loading: boolean;
28
+ height: string;
29
+ private applyConfig;
30
+ connectedCallback(): void;
31
+ disconnectedCallback(): void;
32
+ protected firstUpdated(): void;
33
+ protected updated(changedProperties: PropertyValues): void;
34
+ private setupResizeObserver;
35
+ private buildOptions;
36
+ private initChart;
37
+ private destroyChart;
38
+ render(): TemplateResult;
39
+ }
40
+ declare global {
41
+ interface HTMLElementTagNameMap {
42
+ 'nile-vector-chart': NileVectorChart;
43
+ }
44
+ }