@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.
Files changed (188) hide show
  1. package/dist/src/index.d.ts +27 -2
  2. package/dist/src/index.js +15 -0
  3. package/dist/src/internal/highcharts-provider.js +45 -0
  4. package/dist/src/internal/separated-chart-config.d.ts +5 -0
  5. package/dist/src/internal/separated-chart-config.js +16 -0
  6. package/dist/src/internal/types/ai-config.type.d.ts +9 -0
  7. package/dist/src/internal/types/ai-config.type.js +2 -0
  8. package/dist/src/internal/types/all-chart-config.type.d.ts +8 -0
  9. package/dist/src/internal/types/all-chart-config.type.js +2 -0
  10. package/dist/src/internal/types/aq-config.type.d.ts +13 -0
  11. package/dist/src/internal/types/aq-config.type.js +2 -0
  12. package/dist/src/internal/types/chart-anomaly-config.type.d.ts +13 -0
  13. package/dist/src/internal/types/chart-anomaly-config.type.js +2 -0
  14. package/dist/src/internal/types/chart-area-config.type.d.ts +13 -0
  15. package/dist/src/internal/types/chart-area-config.type.js +2 -0
  16. package/dist/src/internal/types/chart-bar-config.type.d.ts +12 -0
  17. package/dist/src/internal/types/chart-bar-config.type.js +2 -0
  18. package/dist/src/internal/types/chart-bellcurve-config.type.d.ts +19 -0
  19. package/dist/src/internal/types/chart-bellcurve-config.type.js +2 -0
  20. package/dist/src/internal/types/chart-boxplot-config.type.d.ts +15 -0
  21. package/dist/src/internal/types/chart-boxplot-config.type.js +2 -0
  22. package/dist/src/internal/types/chart-bubble-config.type.d.ts +12 -0
  23. package/dist/src/internal/types/chart-bubble-config.type.js +2 -0
  24. package/dist/src/internal/types/chart-cluster-config.type.d.ts +15 -0
  25. package/dist/src/internal/types/chart-cluster-config.type.js +2 -0
  26. package/dist/src/internal/types/chart-column-config.type.d.ts +12 -0
  27. package/dist/src/internal/types/chart-column-config.type.js +2 -0
  28. package/dist/src/internal/types/chart-config.type.d.ts +16 -0
  29. package/dist/src/internal/types/chart-config.type.js +2 -0
  30. package/dist/src/internal/types/chart-donut-config.type.d.ts +14 -0
  31. package/dist/src/internal/types/chart-donut-config.type.js +2 -0
  32. package/dist/src/internal/types/chart-dumbbell-config.type.d.ts +16 -0
  33. package/dist/src/internal/types/chart-dumbbell-config.type.js +2 -0
  34. package/dist/src/internal/types/chart-fan-config.type.d.ts +17 -0
  35. package/dist/src/internal/types/chart-fan-config.type.js +2 -0
  36. package/dist/src/internal/types/chart-flame-config.type.d.ts +14 -0
  37. package/dist/src/internal/types/chart-flame-config.type.js +2 -0
  38. package/dist/src/internal/types/chart-funnel-config.type.d.ts +12 -0
  39. package/dist/src/internal/types/chart-funnel-config.type.js +2 -0
  40. package/dist/src/internal/types/chart-gauge-config.type.d.ts +14 -0
  41. package/dist/src/internal/types/chart-gauge-config.type.js +2 -0
  42. package/dist/src/internal/types/chart-histogram-config.type.d.ts +19 -0
  43. package/dist/src/internal/types/chart-histogram-config.type.js +2 -0
  44. package/dist/src/internal/types/chart-kpi-config.type.d.ts +21 -0
  45. package/dist/src/internal/types/chart-kpi-config.type.js +2 -0
  46. package/dist/src/internal/types/chart-line-config.type.d.ts +12 -0
  47. package/dist/src/internal/types/chart-line-config.type.js +2 -0
  48. package/dist/src/internal/types/chart-pie-config.type.d.ts +13 -0
  49. package/dist/src/internal/types/chart-pie-config.type.js +2 -0
  50. package/dist/src/internal/types/chart-radar-config.type.d.ts +12 -0
  51. package/dist/src/internal/types/chart-radar-config.type.js +2 -0
  52. package/dist/src/internal/types/chart-scatter-config.type.d.ts +12 -0
  53. package/dist/src/internal/types/chart-scatter-config.type.js +2 -0
  54. package/dist/src/internal/types/chart-spiderweb-config.type.d.ts +12 -0
  55. package/dist/src/internal/types/chart-spiderweb-config.type.js +2 -0
  56. package/dist/src/internal/types/chart-spline-config.type.d.ts +12 -0
  57. package/dist/src/internal/types/chart-spline-config.type.js +2 -0
  58. package/dist/src/internal/types/chart-stacked-config.type.d.ts +15 -0
  59. package/dist/src/internal/types/chart-stacked-config.type.js +2 -0
  60. package/dist/src/internal/types/chart-timeline-config.type.d.ts +15 -0
  61. package/dist/src/internal/types/chart-timeline-config.type.js +2 -0
  62. package/dist/src/internal/types/chart-trendline-config.type.d.ts +13 -0
  63. package/dist/src/internal/types/chart-trendline-config.type.js +2 -0
  64. package/dist/src/internal/types/chart-waterfall-config.type.d.ts +11 -0
  65. package/dist/src/internal/types/chart-waterfall-config.type.js +2 -0
  66. package/dist/src/internal/types/index.d.ts +35 -0
  67. package/dist/src/internal/types/index.js +2 -0
  68. package/dist/src/internal/types/nile-ai-widgets-config-input.type.d.ts +23 -0
  69. package/dist/src/internal/types/nile-ai-widgets-config-input.type.js +2 -0
  70. package/dist/src/internal/types/nile-chart-config-input.type.d.ts +7 -0
  71. package/dist/src/internal/types/nile-chart-config-input.type.js +2 -0
  72. package/dist/src/internal/types/primitive-chart-config.type.d.ts +16 -0
  73. package/dist/src/internal/types/primitive-chart-config.type.js +2 -0
  74. package/dist/src/internal/types/separated-chart-config-input.type.d.ts +7 -0
  75. package/dist/src/internal/types/separated-chart-config-input.type.js +2 -0
  76. package/dist/src/internal/types/switchable-config.type.d.ts +8 -0
  77. package/dist/src/internal/types/switchable-config.type.js +2 -0
  78. package/dist/src/nile-ai-panel/index.d.ts +1 -0
  79. package/dist/src/nile-ai-panel/nile-ai-panel.d.ts +8 -1
  80. package/dist/src/nile-ai-panel/nile-ai-panel.js +34 -0
  81. package/dist/src/nile-ai-sender/index.d.ts +1 -0
  82. package/dist/src/nile-ai-sender/nile-ai-sender.d.ts +8 -1
  83. package/dist/src/nile-ai-sender/nile-ai-sender.js +30 -0
  84. package/dist/src/nile-anomaly-chart/nile-anomaly-chart.d.ts +6 -0
  85. package/dist/src/nile-anomaly-chart/nile-anomaly-chart.js +41 -0
  86. package/dist/src/nile-area-chart/nile-area-chart.d.ts +6 -0
  87. package/dist/src/nile-area-chart/nile-area-chart.js +41 -0
  88. package/dist/src/nile-bar-chart/nile-bar-chart.d.ts +6 -0
  89. package/dist/src/nile-bar-chart/nile-bar-chart.js +40 -1
  90. package/dist/src/nile-bellcurve-chart/index.d.ts +2 -0
  91. package/dist/src/nile-bellcurve-chart/index.js +2 -0
  92. package/dist/src/nile-bellcurve-chart/nile-bellcurve-chart.css.d.ts +1 -0
  93. package/dist/src/nile-bellcurve-chart/nile-bellcurve-chart.css.js +28 -0
  94. package/dist/src/nile-bellcurve-chart/nile-bellcurve-chart.d.ts +49 -0
  95. package/dist/src/nile-bellcurve-chart/nile-bellcurve-chart.js +258 -0
  96. package/dist/src/nile-boxplot-chart/index.d.ts +2 -0
  97. package/dist/src/nile-boxplot-chart/index.js +2 -0
  98. package/dist/src/nile-boxplot-chart/nile-boxplot-chart.css.d.ts +1 -0
  99. package/dist/src/nile-boxplot-chart/nile-boxplot-chart.css.js +28 -0
  100. package/dist/src/nile-boxplot-chart/nile-boxplot-chart.d.ts +58 -0
  101. package/dist/src/nile-boxplot-chart/nile-boxplot-chart.js +235 -0
  102. package/dist/src/nile-bubble-chart/nile-bubble-chart.d.ts +6 -0
  103. package/dist/src/nile-bubble-chart/nile-bubble-chart.js +39 -0
  104. package/dist/src/nile-chart/index.d.ts +3 -1
  105. package/dist/src/nile-chart/index.js +1 -0
  106. package/dist/src/nile-chart/nile-chart-config-builder.d.ts +4 -0
  107. package/dist/src/nile-chart/nile-chart-config-builder.js +13 -0
  108. package/dist/src/nile-chart/nile-chart-config.d.ts +76 -2
  109. package/dist/src/nile-chart/nile-chart.d.ts +16 -2
  110. package/dist/src/nile-chart/nile-chart.js +144 -14
  111. package/dist/src/nile-cluster-chart/index.d.ts +2 -0
  112. package/dist/src/nile-cluster-chart/index.js +2 -0
  113. package/dist/src/nile-cluster-chart/nile-cluster-chart.css.d.ts +1 -0
  114. package/dist/src/nile-cluster-chart/nile-cluster-chart.css.js +28 -0
  115. package/dist/src/nile-cluster-chart/nile-cluster-chart.d.ts +46 -0
  116. package/dist/src/nile-cluster-chart/nile-cluster-chart.js +196 -0
  117. package/dist/src/nile-column-chart/nile-column-chart.d.ts +6 -0
  118. package/dist/src/nile-column-chart/nile-column-chart.js +39 -0
  119. package/dist/src/nile-donut-chart/nile-donut-chart.d.ts +6 -0
  120. package/dist/src/nile-donut-chart/nile-donut-chart.js +43 -0
  121. package/dist/src/nile-dumbbell-chart/index.d.ts +2 -0
  122. package/dist/src/nile-dumbbell-chart/index.js +2 -0
  123. package/dist/src/nile-dumbbell-chart/nile-dumbbell-chart.css.d.ts +1 -0
  124. package/dist/src/nile-dumbbell-chart/nile-dumbbell-chart.css.js +28 -0
  125. package/dist/src/nile-dumbbell-chart/nile-dumbbell-chart.d.ts +50 -0
  126. package/dist/src/nile-dumbbell-chart/nile-dumbbell-chart.js +217 -0
  127. package/dist/src/nile-fan-chart/index.d.ts +2 -0
  128. package/dist/src/nile-fan-chart/index.js +2 -0
  129. package/dist/src/nile-fan-chart/nile-fan-chart.css.d.ts +1 -0
  130. package/dist/src/nile-fan-chart/nile-fan-chart.css.js +28 -0
  131. package/dist/src/nile-fan-chart/nile-fan-chart.d.ts +65 -0
  132. package/dist/src/nile-fan-chart/nile-fan-chart.js +257 -0
  133. package/dist/src/nile-flame-chart/index.d.ts +2 -0
  134. package/dist/src/nile-flame-chart/index.js +2 -0
  135. package/dist/src/nile-flame-chart/nile-flame-chart.css.d.ts +1 -0
  136. package/dist/src/nile-flame-chart/nile-flame-chart.css.js +28 -0
  137. package/dist/src/nile-flame-chart/nile-flame-chart.d.ts +60 -0
  138. package/dist/src/nile-flame-chart/nile-flame-chart.js +311 -0
  139. package/dist/src/nile-funnel-chart/index.d.ts +2 -0
  140. package/dist/src/nile-funnel-chart/index.js +2 -0
  141. package/dist/src/nile-funnel-chart/nile-funnel-chart.css.d.ts +1 -0
  142. package/dist/src/nile-funnel-chart/nile-funnel-chart.css.js +28 -0
  143. package/dist/src/nile-funnel-chart/nile-funnel-chart.d.ts +42 -0
  144. package/dist/src/nile-funnel-chart/nile-funnel-chart.js +189 -0
  145. package/dist/src/nile-gauge-chart/nile-gauge-chart.d.ts +6 -0
  146. package/dist/src/nile-gauge-chart/nile-gauge-chart.js +43 -0
  147. package/dist/src/nile-histogram-chart/index.d.ts +2 -0
  148. package/dist/src/nile-histogram-chart/index.js +2 -0
  149. package/dist/src/nile-histogram-chart/nile-histogram-chart.css.d.ts +1 -0
  150. package/dist/src/nile-histogram-chart/nile-histogram-chart.css.js +28 -0
  151. package/dist/src/nile-histogram-chart/nile-histogram-chart.d.ts +53 -0
  152. package/dist/src/nile-histogram-chart/nile-histogram-chart.js +263 -0
  153. package/dist/src/nile-kpi-chart/index.d.ts +1 -1
  154. package/dist/src/nile-kpi-chart/nile-kpi-chart.d.ts +32 -0
  155. package/dist/src/nile-kpi-chart/nile-kpi-chart.js +60 -0
  156. package/dist/src/nile-line-chart/nile-line-chart.d.ts +6 -0
  157. package/dist/src/nile-line-chart/nile-line-chart.js +39 -0
  158. package/dist/src/nile-pie-chart/nile-pie-chart.d.ts +6 -0
  159. package/dist/src/nile-pie-chart/nile-pie-chart.js +41 -0
  160. package/dist/src/nile-radar-chart/nile-radar-chart.d.ts +6 -0
  161. package/dist/src/nile-radar-chart/nile-radar-chart.js +39 -0
  162. package/dist/src/nile-scatter-chart/nile-scatter-chart.d.ts +6 -0
  163. package/dist/src/nile-scatter-chart/nile-scatter-chart.js +39 -0
  164. package/dist/src/nile-spiderweb-chart/index.d.ts +2 -0
  165. package/dist/src/nile-spiderweb-chart/index.js +2 -0
  166. package/dist/src/nile-spiderweb-chart/nile-spiderweb-chart.css.d.ts +1 -0
  167. package/dist/src/nile-spiderweb-chart/nile-spiderweb-chart.css.js +28 -0
  168. package/dist/src/nile-spiderweb-chart/nile-spiderweb-chart.d.ts +46 -0
  169. package/dist/src/nile-spiderweb-chart/nile-spiderweb-chart.js +191 -0
  170. package/dist/src/nile-spline-chart/nile-spline-chart.d.ts +6 -0
  171. package/dist/src/nile-spline-chart/nile-spline-chart.js +39 -0
  172. package/dist/src/nile-stacked-chart/index.d.ts +2 -0
  173. package/dist/src/nile-stacked-chart/index.js +2 -0
  174. package/dist/src/nile-stacked-chart/nile-stacked-chart.css.d.ts +1 -0
  175. package/dist/src/nile-stacked-chart/nile-stacked-chart.css.js +28 -0
  176. package/dist/src/nile-stacked-chart/nile-stacked-chart.d.ts +47 -0
  177. package/dist/src/nile-stacked-chart/nile-stacked-chart.js +216 -0
  178. package/dist/src/nile-timeline-chart/index.d.ts +2 -0
  179. package/dist/src/nile-timeline-chart/index.js +2 -0
  180. package/dist/src/nile-timeline-chart/nile-timeline-chart.css.d.ts +1 -0
  181. package/dist/src/nile-timeline-chart/nile-timeline-chart.css.js +28 -0
  182. package/dist/src/nile-timeline-chart/nile-timeline-chart.d.ts +58 -0
  183. package/dist/src/nile-timeline-chart/nile-timeline-chart.js +239 -0
  184. package/dist/src/nile-trendline-chart/nile-trendline-chart.d.ts +6 -0
  185. package/dist/src/nile-trendline-chart/nile-trendline-chart.js +41 -0
  186. package/dist/src/nile-waterfall-chart/nile-waterfall-chart.d.ts +6 -0
  187. package/dist/src/nile-waterfall-chart/nile-waterfall-chart.js +37 -0
  188. package/package.json +12 -1
@@ -0,0 +1,257 @@
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-fan-chart.css.js';
9
+ const DEFAULT_BAND_COLORS = ['#93c5fd', '#60a5fa', '#3b82f6'];
10
+ let NileFanChart = class NileFanChart extends NileElement {
11
+ constructor() {
12
+ super(...arguments);
13
+ this._hc = null;
14
+ this.chart = null;
15
+ this.resizeObserver = null;
16
+ /** Full chart configuration. Accepts separated `{ chart, aq }` input. */
17
+ this.config = null;
18
+ this.chartTitle = '';
19
+ this.chartSubtitle = '';
20
+ this.lineData = [];
21
+ this.bands = [];
22
+ this.options = {};
23
+ this.loading = false;
24
+ this.height = '400px';
25
+ this.yAxisTitle = '';
26
+ this.lineSeriesName = '';
27
+ this.lineColor = '#1d4ed8';
28
+ this.showLegend = false;
29
+ /**
30
+ * Index (0-based) of the first **forecast** category on the x-axis.
31
+ * When ≥ 0, draws a dashed separator and optional plot band.
32
+ */
33
+ this.forecastStartIndex = -1;
34
+ this.forecastBandLabel = '';
35
+ }
36
+ /** Apply `{ chart, aq }` config to individual properties. */
37
+ applyConfig(cfg) {
38
+ applySeparatedChartConfig(this, cfg);
39
+ }
40
+ connectedCallback() {
41
+ super.connectedCallback();
42
+ if (this.config)
43
+ this.applyConfig(this.config);
44
+ }
45
+ disconnectedCallback() {
46
+ super.disconnectedCallback();
47
+ this.destroyChart();
48
+ this.resizeObserver?.disconnect();
49
+ this.resizeObserver = null;
50
+ }
51
+ firstUpdated() {
52
+ this.initChart();
53
+ this.setupResizeObserver();
54
+ }
55
+ updated(changedProperties) {
56
+ if (changedProperties.has('config') && this.config) {
57
+ this.applyConfig(this.config);
58
+ return;
59
+ }
60
+ const props = [
61
+ 'lineData',
62
+ 'bands',
63
+ 'chartTitle',
64
+ 'chartSubtitle',
65
+ 'options',
66
+ 'height',
67
+ 'yAxisTitle',
68
+ 'lineSeriesName',
69
+ 'lineColor',
70
+ 'showLegend',
71
+ 'forecastStartIndex',
72
+ 'forecastBandLabel',
73
+ 'loading',
74
+ ];
75
+ if (!props.some(p => changedProperties.has(p)))
76
+ return;
77
+ if (this.loading) {
78
+ this.destroyChart();
79
+ return;
80
+ }
81
+ if (this.chart) {
82
+ this.chart.update(this.buildOptions(), true, true);
83
+ }
84
+ else {
85
+ this.initChart();
86
+ }
87
+ }
88
+ setupResizeObserver() {
89
+ if (!this.chartContainer)
90
+ return;
91
+ this.resizeObserver = new ResizeObserver(() => {
92
+ this.chart?.reflow();
93
+ });
94
+ this.resizeObserver.observe(this.chartContainer);
95
+ }
96
+ buildOptions() {
97
+ const self = this;
98
+ const fi = this.forecastStartIndex;
99
+ const nCat = this.lineData.length;
100
+ const xAxisExtra = { type: 'category' };
101
+ if (fi >= 0 && nCat > 0) {
102
+ xAxisExtra.plotLines = [
103
+ {
104
+ value: fi,
105
+ dashStyle: 'Dash',
106
+ color: '#64748b',
107
+ width: 2,
108
+ zIndex: 5,
109
+ },
110
+ ];
111
+ if (this.forecastBandLabel) {
112
+ xAxisExtra.plotBands = [
113
+ {
114
+ from: fi,
115
+ to: Math.max(fi, nCat - 1) + 0.99,
116
+ color: 'rgba(59, 130, 246, 0.06)',
117
+ label: {
118
+ text: this.forecastBandLabel,
119
+ style: { color: '#64748b', fontSize: '11px' },
120
+ },
121
+ },
122
+ ];
123
+ }
124
+ }
125
+ const bandSeries = this.bands.map((b, i) => ({
126
+ type: 'arearange',
127
+ name: b.name,
128
+ data: b.data.map(d => [d.category, d.low, d.high]),
129
+ color: b.color ?? DEFAULT_BAND_COLORS[i % DEFAULT_BAND_COLORS.length],
130
+ fillOpacity: b.fillOpacity ?? Math.min(0.38, 0.14 + i * 0.08),
131
+ lineWidth: 0,
132
+ enableMouseTracking: false,
133
+ zIndex: i,
134
+ states: { inactive: { enabled: false } },
135
+ }));
136
+ return deepMerge({
137
+ chart: {
138
+ height: this.height,
139
+ zoomType: 'x',
140
+ },
141
+ title: { text: this.chartTitle || undefined },
142
+ subtitle: { text: this.chartSubtitle || undefined },
143
+ legend: { enabled: this.showLegend },
144
+ tooltip: { shared: true, crosshairs: true },
145
+ xAxis: xAxisExtra,
146
+ yAxis: {
147
+ title: { text: this.yAxisTitle || undefined },
148
+ },
149
+ plotOptions: {
150
+ line: {
151
+ marker: { enabled: false },
152
+ cursor: 'pointer',
153
+ point: {
154
+ events: {
155
+ click() {
156
+ self.emit('nile-chart-click', {
157
+ point: this,
158
+ category: this.category,
159
+ value: this.y,
160
+ seriesName: this.series.name,
161
+ });
162
+ },
163
+ },
164
+ },
165
+ },
166
+ arearange: {
167
+ lineWidth: 0,
168
+ states: { inactive: { enabled: false } },
169
+ },
170
+ },
171
+ series: [
172
+ ...bandSeries,
173
+ {
174
+ type: 'line',
175
+ name: this.lineSeriesName || 'Path',
176
+ data: this.lineData.map(p => [p.category, p.y]),
177
+ color: this.lineColor,
178
+ lineWidth: 3,
179
+ zIndex: this.bands.length + 2,
180
+ marker: { enabled: false },
181
+ },
182
+ ],
183
+ credits: { enabled: false },
184
+ }, this.options);
185
+ }
186
+ async initChart() {
187
+ if (this.loading || !this.chartContainer)
188
+ return;
189
+ if (!this._hc)
190
+ this._hc = await getHighcharts();
191
+ this.chart = this._hc.chart(this.chartContainer, this.buildOptions());
192
+ this.emit('nile-chart-ready', { chart: this.chart });
193
+ }
194
+ destroyChart() {
195
+ if (this.chart) {
196
+ this.chart.destroy();
197
+ this.chart = null;
198
+ }
199
+ }
200
+ render() {
201
+ if (this.loading) {
202
+ return html `<div class="chart-loading" style="height:${this.height}">Loading...</div>`;
203
+ }
204
+ return html `<div class="chart-container"></div>`;
205
+ }
206
+ };
207
+ NileFanChart.styles = styles;
208
+ __decorate([
209
+ query('.chart-container')
210
+ ], NileFanChart.prototype, "chartContainer", void 0);
211
+ __decorate([
212
+ property({ type: Object })
213
+ ], NileFanChart.prototype, "config", void 0);
214
+ __decorate([
215
+ property({ type: String, attribute: 'chart-title' })
216
+ ], NileFanChart.prototype, "chartTitle", void 0);
217
+ __decorate([
218
+ property({ type: String, attribute: 'chart-subtitle' })
219
+ ], NileFanChart.prototype, "chartSubtitle", void 0);
220
+ __decorate([
221
+ property({ type: Array })
222
+ ], NileFanChart.prototype, "lineData", void 0);
223
+ __decorate([
224
+ property({ type: Array })
225
+ ], NileFanChart.prototype, "bands", void 0);
226
+ __decorate([
227
+ property({ type: Object })
228
+ ], NileFanChart.prototype, "options", void 0);
229
+ __decorate([
230
+ property({ type: Boolean, reflect: true })
231
+ ], NileFanChart.prototype, "loading", void 0);
232
+ __decorate([
233
+ property({ type: String })
234
+ ], NileFanChart.prototype, "height", void 0);
235
+ __decorate([
236
+ property({ type: String, attribute: 'y-axis-title' })
237
+ ], NileFanChart.prototype, "yAxisTitle", void 0);
238
+ __decorate([
239
+ property({ type: String, attribute: 'line-series-name' })
240
+ ], NileFanChart.prototype, "lineSeriesName", void 0);
241
+ __decorate([
242
+ property({ type: String, attribute: 'line-color' })
243
+ ], NileFanChart.prototype, "lineColor", void 0);
244
+ __decorate([
245
+ property({ type: Boolean, attribute: 'show-legend' })
246
+ ], NileFanChart.prototype, "showLegend", void 0);
247
+ __decorate([
248
+ property({ type: Number, attribute: 'forecast-start-index' })
249
+ ], NileFanChart.prototype, "forecastStartIndex", void 0);
250
+ __decorate([
251
+ property({ type: String, attribute: 'forecast-band-label' })
252
+ ], NileFanChart.prototype, "forecastBandLabel", void 0);
253
+ NileFanChart = __decorate([
254
+ customElement('nile-fan-chart')
255
+ ], NileFanChart);
256
+ export { NileFanChart };
257
+ //# sourceMappingURL=nile-fan-chart.js.map
@@ -0,0 +1,2 @@
1
+ export { NileFlameChart } from './nile-flame-chart.js';
2
+ export type { FlameChartPoint, FlameSunburstPoint, FlameChartLayout } from './nile-flame-chart.js';
@@ -0,0 +1,2 @@
1
+ export { NileFlameChart } from './nile-flame-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-flame-chart.css.js.map
@@ -0,0 +1,60 @@
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
+ /** Segment row for the flame / icicle layout (`columnrange`-based). */
6
+ export interface FlameChartPoint {
7
+ name: string;
8
+ id?: string;
9
+ value: number;
10
+ x: number;
11
+ low: number;
12
+ high: number;
13
+ color?: string;
14
+ }
15
+ /** Hierarchical row for the sunburst layout. Root uses `parent: ''`. */
16
+ export interface FlameSunburstPoint {
17
+ id: string;
18
+ parent: string;
19
+ name: string;
20
+ value: number;
21
+ color?: string;
22
+ }
23
+ export type FlameChartLayout = 'flame' | 'icicle' | 'sunburst';
24
+ export declare class NileFlameChart extends NileElement {
25
+ static styles: CSSResultGroup;
26
+ private _hc;
27
+ private chart;
28
+ private resizeObserver;
29
+ private chartContainer;
30
+ /** Full chart configuration. Accepts separated `{ chart, aq }` input. */
31
+ config: SeparatedChartConfigInputType | null;
32
+ chartTitle: string;
33
+ chartSubtitle: string;
34
+ /** Data for flame or icicle layout. */
35
+ data: FlameChartPoint[];
36
+ /** Data for sunburst layout; required when `layout` is `sunburst`. */
37
+ sunburstData: FlameSunburstPoint[];
38
+ layout: FlameChartLayout;
39
+ options: Highcharts.Options;
40
+ loading: boolean;
41
+ height: string;
42
+ /** Apply `{ chart, aq }` config to individual properties. */
43
+ private applyConfig;
44
+ connectedCallback(): void;
45
+ disconnectedCallback(): void;
46
+ protected firstUpdated(): void;
47
+ protected updated(changedProperties: PropertyValues): void;
48
+ private setupResizeObserver;
49
+ private mapFlameData;
50
+ private mapSunburstData;
51
+ private buildOptions;
52
+ private initChart;
53
+ private destroyChart;
54
+ render(): TemplateResult;
55
+ }
56
+ declare global {
57
+ interface HTMLElementTagNameMap {
58
+ 'nile-flame-chart': NileFlameChart;
59
+ }
60
+ }
@@ -0,0 +1,311 @@
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-flame-chart.css.js';
9
+ function registerFlameSeriesTypeIfNeeded(H) {
10
+ const types = H.seriesTypes;
11
+ if (types.flame)
12
+ return;
13
+ H.seriesType('flame', 'columnrange', {
14
+ cursor: 'pointer',
15
+ dataLabels: {
16
+ enabled: true,
17
+ format: '{point.name}',
18
+ inside: true,
19
+ align: 'center',
20
+ crop: true,
21
+ overflow: 'none',
22
+ color: 'black',
23
+ style: { textOutline: 'none', fontWeight: 'normal' },
24
+ },
25
+ pointPadding: 0,
26
+ groupPadding: 0,
27
+ }, {
28
+ drawDataLabels: H.seriesTypes.line.prototype.drawDataLabels,
29
+ });
30
+ }
31
+ let NileFlameChart = class NileFlameChart extends NileElement {
32
+ constructor() {
33
+ super(...arguments);
34
+ this._hc = null;
35
+ this.chart = null;
36
+ this.resizeObserver = null;
37
+ /** Full chart configuration. Accepts separated `{ chart, aq }` input. */
38
+ this.config = null;
39
+ this.chartTitle = '';
40
+ this.chartSubtitle = '';
41
+ /** Data for flame or icicle layout. */
42
+ this.data = [];
43
+ /** Data for sunburst layout; required when `layout` is `sunburst`. */
44
+ this.sunburstData = [];
45
+ this.layout = 'flame';
46
+ this.options = {};
47
+ this.loading = false;
48
+ this.height = '480px';
49
+ }
50
+ /** Apply `{ chart, aq }` config to individual properties. */
51
+ applyConfig(cfg) {
52
+ applySeparatedChartConfig(this, cfg);
53
+ }
54
+ connectedCallback() {
55
+ super.connectedCallback();
56
+ if (this.config)
57
+ this.applyConfig(this.config);
58
+ }
59
+ disconnectedCallback() {
60
+ super.disconnectedCallback();
61
+ this.destroyChart();
62
+ this.resizeObserver?.disconnect();
63
+ this.resizeObserver = null;
64
+ }
65
+ firstUpdated() {
66
+ this.initChart();
67
+ this.setupResizeObserver();
68
+ }
69
+ updated(changedProperties) {
70
+ if (changedProperties.has('config') && this.config) {
71
+ this.applyConfig(this.config);
72
+ return;
73
+ }
74
+ const props = [
75
+ 'data',
76
+ 'sunburstData',
77
+ 'layout',
78
+ 'chartTitle',
79
+ 'chartSubtitle',
80
+ 'options',
81
+ 'height',
82
+ 'loading',
83
+ ];
84
+ if (!props.some(p => changedProperties.has(p)))
85
+ return;
86
+ if (this.loading) {
87
+ this.destroyChart();
88
+ return;
89
+ }
90
+ if (this.chart) {
91
+ this.chart.update(this.buildOptions(), true, true);
92
+ }
93
+ else {
94
+ this.initChart();
95
+ }
96
+ }
97
+ setupResizeObserver() {
98
+ if (!this.chartContainer)
99
+ return;
100
+ this.resizeObserver = new ResizeObserver(() => {
101
+ this.chart?.reflow();
102
+ });
103
+ this.resizeObserver.observe(this.chartContainer);
104
+ }
105
+ mapFlameData() {
106
+ return this.data.map(d => {
107
+ const row = {
108
+ name: d.name,
109
+ x: d.x,
110
+ low: d.low,
111
+ high: d.high,
112
+ };
113
+ if (d.id != null)
114
+ row.id = d.id;
115
+ if (d.color)
116
+ row.color = d.color;
117
+ row.value = d.value;
118
+ return row;
119
+ });
120
+ }
121
+ mapSunburstData() {
122
+ return this.sunburstData.map(d => {
123
+ const row = {
124
+ id: d.id,
125
+ parent: d.parent,
126
+ name: d.name,
127
+ value: d.value,
128
+ };
129
+ if (d.color)
130
+ row.color = d.color;
131
+ return row;
132
+ });
133
+ }
134
+ buildOptions() {
135
+ const self = this;
136
+ const isSunburst = this.layout === 'sunburst';
137
+ const xAxisSecond = isSunburst
138
+ ? { visible: false, startOnTick: false, endOnTick: false, minPadding: 0, maxPadding: 0 }
139
+ : {
140
+ visible: false,
141
+ startOnTick: false,
142
+ endOnTick: false,
143
+ minPadding: 0,
144
+ maxPadding: 0,
145
+ reversed: this.layout === 'flame',
146
+ };
147
+ const titleText = this.chartTitle ||
148
+ (isSunburst ? 'Sunburst' : this.layout === 'icicle' ? 'Icicle chart' : 'Flame chart');
149
+ return deepMerge({
150
+ chart: { inverted: !isSunburst, height: this.height },
151
+ title: { text: titleText, align: 'left' },
152
+ subtitle: { text: this.chartSubtitle || undefined, align: 'left' },
153
+ legend: { enabled: false },
154
+ xAxis: [{ visible: false }, xAxisSecond],
155
+ yAxis: [
156
+ { visible: false },
157
+ {
158
+ visible: false,
159
+ min: 0,
160
+ maxPadding: 0,
161
+ startOnTick: false,
162
+ endOnTick: false,
163
+ },
164
+ ],
165
+ tooltip: {
166
+ headerFormat: '',
167
+ pointFormat: isSunburst
168
+ ? '<b>{point.name}</b><br/>value: <b>{point.value}</b>'
169
+ : '<b>{point.name}</b><br/>value: <b>{point.value}</b><br/>range: {point.low} – {point.high}',
170
+ },
171
+ plotOptions: {
172
+ flame: {
173
+ cursor: 'pointer',
174
+ point: {
175
+ events: {
176
+ click() {
177
+ self.emit('nile-chart-click', {
178
+ point: this,
179
+ name: this.name,
180
+ value: this.value,
181
+ low: this.low,
182
+ high: this.high,
183
+ x: this.x,
184
+ seriesName: this.series.name,
185
+ });
186
+ },
187
+ },
188
+ },
189
+ },
190
+ sunburst: {
191
+ cursor: 'pointer',
192
+ allowDrillToNode: true,
193
+ levels: [
194
+ {
195
+ level: 1,
196
+ levelIsConstant: false,
197
+ dataLabels: { enabled: false },
198
+ },
199
+ ],
200
+ dataLabels: {
201
+ textPath: { attributes: { dy: 5 }, enabled: true },
202
+ },
203
+ point: {
204
+ events: {
205
+ click() {
206
+ self.emit('nile-chart-click', {
207
+ point: this,
208
+ name: this.name,
209
+ value: this.value,
210
+ seriesName: this.series.name,
211
+ });
212
+ },
213
+ },
214
+ },
215
+ },
216
+ },
217
+ series: isSunburst
218
+ ? [
219
+ {
220
+ visible: false,
221
+ type: 'flame',
222
+ data: this.mapFlameData(),
223
+ yAxis: 1,
224
+ xAxis: 1,
225
+ },
226
+ {
227
+ visible: true,
228
+ size: '100%',
229
+ type: 'sunburst',
230
+ name: 'Sunburst',
231
+ data: this.mapSunburstData(),
232
+ },
233
+ ]
234
+ : [
235
+ {
236
+ visible: true,
237
+ type: 'flame',
238
+ name: 'Flame',
239
+ data: this.mapFlameData(),
240
+ yAxis: 1,
241
+ xAxis: 1,
242
+ },
243
+ {
244
+ visible: false,
245
+ size: '100%',
246
+ type: 'sunburst',
247
+ name: 'Sunburst',
248
+ data: this.mapSunburstData(),
249
+ },
250
+ ],
251
+ credits: { enabled: false },
252
+ }, this.options);
253
+ }
254
+ async initChart() {
255
+ if (this.loading || !this.chartContainer)
256
+ return;
257
+ if (!this._hc)
258
+ this._hc = await getHighcharts();
259
+ registerFlameSeriesTypeIfNeeded(this._hc);
260
+ this.chart = this._hc.chart(this.chartContainer, this.buildOptions());
261
+ this.emit('nile-chart-ready', { chart: this.chart });
262
+ }
263
+ destroyChart() {
264
+ if (this.chart) {
265
+ this.chart.destroy();
266
+ this.chart = null;
267
+ }
268
+ }
269
+ render() {
270
+ if (this.loading) {
271
+ return html `<div class="chart-loading" style="height:${this.height}">Loading...</div>`;
272
+ }
273
+ return html `<div class="chart-container"></div>`;
274
+ }
275
+ };
276
+ NileFlameChart.styles = styles;
277
+ __decorate([
278
+ query('.chart-container')
279
+ ], NileFlameChart.prototype, "chartContainer", void 0);
280
+ __decorate([
281
+ property({ type: Object })
282
+ ], NileFlameChart.prototype, "config", void 0);
283
+ __decorate([
284
+ property({ type: String, attribute: 'chart-title' })
285
+ ], NileFlameChart.prototype, "chartTitle", void 0);
286
+ __decorate([
287
+ property({ type: String, attribute: 'chart-subtitle' })
288
+ ], NileFlameChart.prototype, "chartSubtitle", void 0);
289
+ __decorate([
290
+ property({ type: Array })
291
+ ], NileFlameChart.prototype, "data", void 0);
292
+ __decorate([
293
+ property({ type: Array, attribute: false })
294
+ ], NileFlameChart.prototype, "sunburstData", void 0);
295
+ __decorate([
296
+ property({ type: String })
297
+ ], NileFlameChart.prototype, "layout", void 0);
298
+ __decorate([
299
+ property({ type: Object })
300
+ ], NileFlameChart.prototype, "options", void 0);
301
+ __decorate([
302
+ property({ type: Boolean, reflect: true })
303
+ ], NileFlameChart.prototype, "loading", void 0);
304
+ __decorate([
305
+ property({ type: String })
306
+ ], NileFlameChart.prototype, "height", void 0);
307
+ NileFlameChart = __decorate([
308
+ customElement('nile-flame-chart')
309
+ ], NileFlameChart);
310
+ export { NileFlameChart };
311
+ //# sourceMappingURL=nile-flame-chart.js.map
@@ -0,0 +1,2 @@
1
+ export { NileFunnelChart } from './nile-funnel-chart.js';
2
+ export type { FunnelDataPoint } from './nile-funnel-chart.js';
@@ -0,0 +1,2 @@
1
+ export { NileFunnelChart } from './nile-funnel-chart.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ export declare const styles: import("lit").CSSResult;