@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
@@ -3,22 +3,43 @@ import { customElement, property, query, state } from 'lit/decorators.js';
3
3
  import { html, nothing } from 'lit';
4
4
  import NileElement from '../internal/nile-element.js';
5
5
  import { styles } from './nile-chart.css.js';
6
+ import { nileChartConfig } from './nile-chart-config-builder.js';
6
7
  import { convertConfig } from '../internal/chart-adapters.js';
7
8
  import '../nile-bar-chart/index.js';
8
9
  import '../nile-pie-chart/index.js';
9
10
  import '../nile-trendline-chart/index.js';
10
11
  import '../nile-anomaly-chart/index.js';
12
+ import '../nile-line-chart/index.js';
13
+ import '../nile-area-chart/index.js';
14
+ import '../nile-column-chart/index.js';
15
+ import '../nile-donut-chart/index.js';
16
+ import '../nile-scatter-chart/index.js';
17
+ import '../nile-bubble-chart/index.js';
18
+ import '../nile-spline-chart/index.js';
19
+ import '../nile-radar-chart/index.js';
20
+ import '../nile-gauge-chart/index.js';
21
+ import '../nile-waterfall-chart/index.js';
11
22
  import '../nile-ai-panel/index.js';
12
23
  const TYPE_LABELS = {
13
24
  bar: 'Bar',
14
25
  pie: 'Pie',
15
26
  trendline: 'Trendline',
16
27
  anomaly: 'Anomaly',
28
+ line: 'Line',
29
+ area: 'Area',
30
+ column: 'Column',
31
+ donut: 'Donut',
32
+ scatter: 'Scatter',
33
+ bubble: 'Bubble',
34
+ spline: 'Spline',
35
+ radar: 'Radar',
36
+ gauge: 'Gauge',
37
+ waterfall: 'Waterfall',
17
38
  };
18
39
  let NileChart = class NileChart extends NileElement {
19
40
  constructor() {
20
41
  super(...arguments);
21
- /** Full chart configuration including type, data, and summary. */
42
+ /** Full chart configuration. Accepts flat NileChartConfig or separated { chart, aq } input. */
22
43
  this.config = null;
23
44
  /** The summary/insight text displayed in the overlay (fallback when config is not set). */
24
45
  this.summary = '';
@@ -37,28 +58,43 @@ let NileChart = class NileChart extends NileElement {
37
58
  this.emit('nile-chart-toggle', { open: this.open });
38
59
  }
39
60
  };
61
+ this.resolvedConfig = null;
40
62
  }
41
63
  get effectiveSummary() {
42
- return this.config?.summary ?? this.summary;
64
+ return this.resolvedConfig?.summary ?? this.summary;
43
65
  }
44
66
  get effectiveToggleLabel() {
45
- return this.config?.toggleLabel ?? this.toggleLabel;
67
+ return this.resolvedConfig?.toggleLabel ?? this.toggleLabel;
46
68
  }
47
69
  get aiEnabled() {
48
- return this.config?.ai?.enabled === true;
70
+ return this.resolvedConfig?.ai?.enabled === true;
49
71
  }
50
72
  connectedCallback() {
51
73
  super.connectedCallback();
52
74
  document.addEventListener('click', this.handleOutsideClick);
75
+ // Pick up config set before element upgrade (e.g. Angular ngAfterViewInit)
76
+ if (this.config && !this.resolvedConfig) {
77
+ this.resolvedConfig = this.resolveConfig(this.config);
78
+ this.activeType = this.resolvedConfig.type;
79
+ this.activeConfig = this.resolvedConfig;
80
+ }
53
81
  }
54
82
  disconnectedCallback() {
55
83
  super.disconnectedCallback();
56
84
  document.removeEventListener('click', this.handleOutsideClick);
57
85
  }
86
+ /** Resolve { chart, aq } input to flat NileChartConfig. */
87
+ resolveConfig(input) {
88
+ if ('chart' in input && input.chart) {
89
+ return nileChartConfig(input);
90
+ }
91
+ return input;
92
+ }
58
93
  updated(changedProperties) {
59
94
  if (changedProperties.has('config') && this.config) {
60
- this.activeType = this.config.type;
61
- this.activeConfig = this.config;
95
+ this.resolvedConfig = this.resolveConfig(this.config);
96
+ this.activeType = this.resolvedConfig.type;
97
+ this.activeConfig = this.resolvedConfig;
62
98
  }
63
99
  }
64
100
  toggle(e) {
@@ -93,10 +129,10 @@ let NileChart = class NileChart extends NileElement {
93
129
  });
94
130
  }
95
131
  switchType(toType) {
96
- if (!this.config || toType === this.activeType)
132
+ if (!this.resolvedConfig || toType === this.activeType)
97
133
  return;
98
134
  const fromType = this.activeType;
99
- const converted = convertConfig(this.config, toType);
135
+ const converted = convertConfig(this.resolvedConfig, toType);
100
136
  this.activeType = toType;
101
137
  this.activeConfig = converted;
102
138
  this.menuOpen = false;
@@ -107,13 +143,13 @@ let NileChart = class NileChart extends NileElement {
107
143
  });
108
144
  }
109
145
  get headerTitle() {
110
- return this.activeConfig?.chartTitle ?? this.config?.chartTitle ?? '';
146
+ return this.activeConfig?.chartTitle ?? this.resolvedConfig?.chartTitle ?? '';
111
147
  }
112
148
  get headerSubtitle() {
113
- return this.activeConfig?.chartSubtitle ?? this.config?.chartSubtitle ?? '';
149
+ return this.activeConfig?.chartSubtitle ?? this.resolvedConfig?.chartSubtitle ?? '';
114
150
  }
115
151
  renderTypeSwitcher() {
116
- const types = this.config?.switchableTypes;
152
+ const types = this.resolvedConfig?.switchableTypes;
117
153
  if (!types || types.length === 0)
118
154
  return nothing;
119
155
  return html `
@@ -162,7 +198,7 @@ let NileChart = class NileChart extends NileElement {
162
198
  renderHeader() {
163
199
  const title = this.headerTitle;
164
200
  const subtitle = this.headerSubtitle;
165
- const hasTypeSwitcher = (this.config?.switchableTypes?.length ?? 0) > 0;
201
+ const hasTypeSwitcher = (this.resolvedConfig?.switchableTypes?.length ?? 0) > 0;
166
202
  const hasActions = hasTypeSwitcher || this.aiEnabled;
167
203
  if (!title && !subtitle && !hasActions)
168
204
  return nothing;
@@ -182,7 +218,7 @@ let NileChart = class NileChart extends NileElement {
182
218
  renderAiPanel() {
183
219
  if (!this.aiEnabled)
184
220
  return nothing;
185
- const aiConfig = this.config.ai;
221
+ const aiConfig = this.resolvedConfig.ai;
186
222
  return html `
187
223
  <div class="ai-panel-overlay" ?data-open=${this.chatOpen}>
188
224
  <nile-ai-panel
@@ -238,6 +274,100 @@ let NileChart = class NileChart extends NileElement {
238
274
  .options=${mergedOptions}
239
275
  .loading=${config.loading ?? false}
240
276
  ></nile-anomaly-chart>`;
277
+ case 'line':
278
+ return html `<nile-line-chart
279
+ .data=${config.data}
280
+ .categories=${config.categories ?? []}
281
+ .height=${config.height ?? '400px'}
282
+ .yAxisTitle=${config.yAxisTitle ?? ''}
283
+ .options=${mergedOptions}
284
+ .loading=${config.loading ?? false}
285
+ ></nile-line-chart>`;
286
+ case 'area':
287
+ return html `<nile-area-chart
288
+ .data=${config.data}
289
+ .categories=${config.categories ?? []}
290
+ .height=${config.height ?? '400px'}
291
+ .yAxisTitle=${config.yAxisTitle ?? ''}
292
+ .stacked=${config.stacked ?? false}
293
+ .options=${mergedOptions}
294
+ .loading=${config.loading ?? false}
295
+ ></nile-area-chart>`;
296
+ case 'column':
297
+ return html `<nile-column-chart
298
+ .data=${config.data}
299
+ .categories=${config.categories ?? []}
300
+ .height=${config.height ?? '400px'}
301
+ .yAxisTitle=${config.yAxisTitle ?? ''}
302
+ .options=${mergedOptions}
303
+ .loading=${config.loading ?? false}
304
+ ></nile-column-chart>`;
305
+ case 'donut':
306
+ return html `<nile-donut-chart
307
+ .data=${config.data}
308
+ .seriesName=${config.seriesName ?? ''}
309
+ .height=${config.height ?? '400px'}
310
+ .innerSize=${config.innerSize ?? '50%'}
311
+ .showDataLabels=${config.showDataLabels ?? true}
312
+ .showLegend=${config.showLegend ?? true}
313
+ .options=${mergedOptions}
314
+ .loading=${config.loading ?? false}
315
+ ></nile-donut-chart>`;
316
+ case 'scatter':
317
+ return html `<nile-scatter-chart
318
+ .data=${config.data}
319
+ .height=${config.height ?? '400px'}
320
+ .xAxisTitle=${config.xAxisTitle ?? ''}
321
+ .yAxisTitle=${config.yAxisTitle ?? ''}
322
+ .options=${mergedOptions}
323
+ .loading=${config.loading ?? false}
324
+ ></nile-scatter-chart>`;
325
+ case 'bubble':
326
+ return html `<nile-bubble-chart
327
+ .data=${config.data}
328
+ .height=${config.height ?? '400px'}
329
+ .xAxisTitle=${config.xAxisTitle ?? ''}
330
+ .yAxisTitle=${config.yAxisTitle ?? ''}
331
+ .options=${mergedOptions}
332
+ .loading=${config.loading ?? false}
333
+ ></nile-bubble-chart>`;
334
+ case 'spline':
335
+ return html `<nile-spline-chart
336
+ .data=${config.data}
337
+ .categories=${config.categories ?? []}
338
+ .height=${config.height ?? '400px'}
339
+ .yAxisTitle=${config.yAxisTitle ?? ''}
340
+ .options=${mergedOptions}
341
+ .loading=${config.loading ?? false}
342
+ ></nile-spline-chart>`;
343
+ case 'radar':
344
+ return html `<nile-radar-chart
345
+ .data=${config.data}
346
+ .categories=${config.categories ?? []}
347
+ .height=${config.height ?? '400px'}
348
+ .showArea=${config.showArea ?? false}
349
+ .options=${mergedOptions}
350
+ .loading=${config.loading ?? false}
351
+ ></nile-radar-chart>`;
352
+ case 'gauge':
353
+ return html `<nile-gauge-chart
354
+ .value=${config.value}
355
+ .min=${config.min ?? 0}
356
+ .max=${config.max ?? 100}
357
+ .suffix=${config.suffix ?? ''}
358
+ .bands=${config.bands ?? []}
359
+ .height=${config.height ?? '280px'}
360
+ .options=${mergedOptions}
361
+ .loading=${config.loading ?? false}
362
+ ></nile-gauge-chart>`;
363
+ case 'waterfall':
364
+ return html `<nile-waterfall-chart
365
+ .data=${config.data}
366
+ .height=${config.height ?? '400px'}
367
+ .yAxisTitle=${config.yAxisTitle ?? ''}
368
+ .options=${mergedOptions}
369
+ .loading=${config.loading ?? false}
370
+ ></nile-waterfall-chart>`;
241
371
  }
242
372
  }
243
373
  render() {
@@ -256,7 +386,7 @@ let NileChart = class NileChart extends NileElement {
256
386
  </button>
257
387
  <div class="chart-overlay" ?data-open="${this.open}">
258
388
  <div class="chart-content">
259
- ${this.config
389
+ ${this.resolvedConfig
260
390
  ? this.effectiveSummary
261
391
  : html `<slot name="insight">${this.summary}</slot>`}
262
392
  </div>
@@ -0,0 +1,2 @@
1
+ export { NileClusterChart } from './nile-cluster-chart.js';
2
+ export type { ClusterChartSeriesData } from './nile-cluster-chart.js';
@@ -0,0 +1,2 @@
1
+ export { NileClusterChart } from './nile-cluster-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-cluster-chart.css.js.map
@@ -0,0 +1,46 @@
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
+ /** One series in a grouped (clustered) column chart — same shape as column chart data. */
6
+ export interface ClusterChartSeriesData {
7
+ name: string;
8
+ data: number[];
9
+ color?: string;
10
+ }
11
+ export declare class NileClusterChart extends NileElement {
12
+ static styles: CSSResultGroup;
13
+ private _hc;
14
+ private chart;
15
+ private resizeObserver;
16
+ private chartContainer;
17
+ /** Full chart configuration. Accepts separated `{ chart, aq }` input. */
18
+ config: SeparatedChartConfigInputType | null;
19
+ chartTitle: string;
20
+ chartSubtitle: string;
21
+ data: ClusterChartSeriesData[];
22
+ categories: string[];
23
+ options: Highcharts.Options;
24
+ loading: boolean;
25
+ height: string;
26
+ yAxisTitle: string;
27
+ showLegend: boolean;
28
+ groupPadding: number;
29
+ pointPadding: number;
30
+ /** Apply `{ chart, aq }` config to individual properties. */
31
+ private applyConfig;
32
+ connectedCallback(): void;
33
+ disconnectedCallback(): void;
34
+ protected firstUpdated(): void;
35
+ protected updated(changedProperties: PropertyValues): void;
36
+ private setupResizeObserver;
37
+ private buildOptions;
38
+ private initChart;
39
+ private destroyChart;
40
+ render(): TemplateResult;
41
+ }
42
+ declare global {
43
+ interface HTMLElementTagNameMap {
44
+ 'nile-cluster-chart': NileClusterChart;
45
+ }
46
+ }
@@ -0,0 +1,196 @@
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-cluster-chart.css.js';
9
+ let NileClusterChart = class NileClusterChart extends NileElement {
10
+ constructor() {
11
+ super(...arguments);
12
+ this._hc = null;
13
+ this.chart = null;
14
+ this.resizeObserver = null;
15
+ /** Full chart configuration. Accepts separated `{ chart, aq }` input. */
16
+ this.config = null;
17
+ this.chartTitle = '';
18
+ this.chartSubtitle = '';
19
+ this.data = [];
20
+ this.categories = [];
21
+ this.options = {};
22
+ this.loading = false;
23
+ this.height = '400px';
24
+ this.yAxisTitle = '';
25
+ this.showLegend = true;
26
+ this.groupPadding = 0.14;
27
+ this.pointPadding = 0.08;
28
+ }
29
+ /** Apply `{ chart, aq }` config to individual properties. */
30
+ applyConfig(cfg) {
31
+ applySeparatedChartConfig(this, cfg);
32
+ }
33
+ connectedCallback() {
34
+ super.connectedCallback();
35
+ if (this.config)
36
+ this.applyConfig(this.config);
37
+ }
38
+ disconnectedCallback() {
39
+ super.disconnectedCallback();
40
+ this.destroyChart();
41
+ this.resizeObserver?.disconnect();
42
+ this.resizeObserver = null;
43
+ }
44
+ firstUpdated() {
45
+ this.initChart();
46
+ this.setupResizeObserver();
47
+ }
48
+ updated(changedProperties) {
49
+ if (changedProperties.has('config') && this.config) {
50
+ this.applyConfig(this.config);
51
+ return;
52
+ }
53
+ const props = [
54
+ 'data',
55
+ 'categories',
56
+ 'chartTitle',
57
+ 'chartSubtitle',
58
+ 'options',
59
+ 'height',
60
+ 'yAxisTitle',
61
+ 'loading',
62
+ 'showLegend',
63
+ 'groupPadding',
64
+ 'pointPadding',
65
+ ];
66
+ if (!props.some(p => changedProperties.has(p)))
67
+ return;
68
+ if (this.loading) {
69
+ this.destroyChart();
70
+ return;
71
+ }
72
+ if (this.chart) {
73
+ this.chart.update(this.buildOptions(), true, true);
74
+ }
75
+ else {
76
+ this.initChart();
77
+ }
78
+ }
79
+ setupResizeObserver() {
80
+ if (!this.chartContainer)
81
+ return;
82
+ this.resizeObserver = new ResizeObserver(() => {
83
+ this.chart?.reflow();
84
+ });
85
+ this.resizeObserver.observe(this.chartContainer);
86
+ }
87
+ buildOptions() {
88
+ const self = this;
89
+ return deepMerge({
90
+ chart: { type: 'column', height: this.height },
91
+ title: { text: this.chartTitle || undefined },
92
+ subtitle: { text: this.chartSubtitle || undefined },
93
+ xAxis: { categories: this.categories },
94
+ yAxis: { min: 0, title: { text: this.yAxisTitle || undefined } },
95
+ legend: { enabled: this.showLegend },
96
+ tooltip: { shared: true },
97
+ plotOptions: {
98
+ column: {
99
+ grouping: true,
100
+ groupPadding: this.groupPadding,
101
+ pointPadding: this.pointPadding,
102
+ borderWidth: 0,
103
+ borderRadius: 2,
104
+ dataLabels: { enabled: false },
105
+ },
106
+ series: {
107
+ cursor: 'pointer',
108
+ point: {
109
+ events: {
110
+ click() {
111
+ self.emit('nile-chart-click', {
112
+ point: this,
113
+ category: this.category,
114
+ value: this.y,
115
+ seriesName: this.series.name,
116
+ });
117
+ },
118
+ },
119
+ },
120
+ },
121
+ },
122
+ series: this.data.map(s => ({
123
+ type: 'column',
124
+ name: s.name,
125
+ data: s.data,
126
+ color: s.color,
127
+ })),
128
+ credits: { enabled: false },
129
+ }, this.options);
130
+ }
131
+ async initChart() {
132
+ if (this.loading || !this.chartContainer)
133
+ return;
134
+ if (!this._hc)
135
+ this._hc = await getHighcharts();
136
+ this.chart = this._hc.chart(this.chartContainer, this.buildOptions());
137
+ this.emit('nile-chart-ready', { chart: this.chart });
138
+ }
139
+ destroyChart() {
140
+ if (this.chart) {
141
+ this.chart.destroy();
142
+ this.chart = null;
143
+ }
144
+ }
145
+ render() {
146
+ if (this.loading) {
147
+ return html `<div class="chart-loading" style="height:${this.height}">Loading...</div>`;
148
+ }
149
+ return html `<div class="chart-container"></div>`;
150
+ }
151
+ };
152
+ NileClusterChart.styles = styles;
153
+ __decorate([
154
+ query('.chart-container')
155
+ ], NileClusterChart.prototype, "chartContainer", void 0);
156
+ __decorate([
157
+ property({ type: Object })
158
+ ], NileClusterChart.prototype, "config", void 0);
159
+ __decorate([
160
+ property({ type: String, attribute: 'chart-title' })
161
+ ], NileClusterChart.prototype, "chartTitle", void 0);
162
+ __decorate([
163
+ property({ type: String, attribute: 'chart-subtitle' })
164
+ ], NileClusterChart.prototype, "chartSubtitle", void 0);
165
+ __decorate([
166
+ property({ type: Array })
167
+ ], NileClusterChart.prototype, "data", void 0);
168
+ __decorate([
169
+ property({ type: Array })
170
+ ], NileClusterChart.prototype, "categories", void 0);
171
+ __decorate([
172
+ property({ type: Object })
173
+ ], NileClusterChart.prototype, "options", void 0);
174
+ __decorate([
175
+ property({ type: Boolean, reflect: true })
176
+ ], NileClusterChart.prototype, "loading", void 0);
177
+ __decorate([
178
+ property({ type: String })
179
+ ], NileClusterChart.prototype, "height", void 0);
180
+ __decorate([
181
+ property({ type: String, attribute: 'y-axis-title' })
182
+ ], NileClusterChart.prototype, "yAxisTitle", void 0);
183
+ __decorate([
184
+ property({ type: Boolean, attribute: 'show-legend' })
185
+ ], NileClusterChart.prototype, "showLegend", void 0);
186
+ __decorate([
187
+ property({ type: Number, attribute: 'group-padding' })
188
+ ], NileClusterChart.prototype, "groupPadding", void 0);
189
+ __decorate([
190
+ property({ type: Number, attribute: 'point-padding' })
191
+ ], NileClusterChart.prototype, "pointPadding", void 0);
192
+ NileClusterChart = __decorate([
193
+ customElement('nile-cluster-chart')
194
+ ], NileClusterChart);
195
+ export { NileClusterChart };
196
+ //# sourceMappingURL=nile-cluster-chart.js.map
@@ -1,6 +1,7 @@
1
1
  import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
2
2
  import type Highcharts from 'highcharts';
3
3
  import NileElement from '../internal/nile-element.js';
4
+ import type { NileChartConfigInputType } from '../internal/types/index.js';
4
5
  export interface ColumnChartSeriesData {
5
6
  name: string;
6
7
  data: number[];
@@ -12,6 +13,8 @@ export declare class NileColumnChart extends NileElement {
12
13
  private chart;
13
14
  private resizeObserver;
14
15
  private chartContainer;
16
+ /** Full chart configuration. Accepts separated { chart, aq } input. */
17
+ config: NileChartConfigInputType | null;
15
18
  chartTitle: string;
16
19
  chartSubtitle: string;
17
20
  data: ColumnChartSeriesData[];
@@ -20,6 +23,9 @@ export declare class NileColumnChart extends NileElement {
20
23
  loading: boolean;
21
24
  height: string;
22
25
  yAxisTitle: string;
26
+ /** Apply { chart, aq } config to individual properties. */
27
+ private applyConfig;
28
+ connectedCallback(): void;
23
29
  disconnectedCallback(): void;
24
30
  protected firstUpdated(): void;
25
31
  protected updated(changedProperties: PropertyValues): void;
@@ -11,6 +11,8 @@ let NileColumnChart = class NileColumnChart extends NileElement {
11
11
  this._hc = null;
12
12
  this.chart = null;
13
13
  this.resizeObserver = null;
14
+ /** Full chart configuration. Accepts separated { chart, aq } input. */
15
+ this.config = null;
14
16
  this.chartTitle = '';
15
17
  this.chartSubtitle = '';
16
18
  this.data = [];
@@ -20,6 +22,36 @@ let NileColumnChart = class NileColumnChart extends NileElement {
20
22
  this.height = '400px';
21
23
  this.yAxisTitle = '';
22
24
  }
25
+ /** Apply { chart, aq } config to individual properties. */
26
+ applyConfig(cfg) {
27
+ const { chart: c, aq } = cfg;
28
+ if (c) {
29
+ const col = c;
30
+ if (col.data)
31
+ this.data = col.data;
32
+ if (col.categories)
33
+ this.categories = col.categories;
34
+ if (col.yAxisTitle)
35
+ this.yAxisTitle = col.yAxisTitle;
36
+ if (col.height)
37
+ this.height = col.height;
38
+ if (col.loading !== undefined)
39
+ this.loading = col.loading;
40
+ if (col.options)
41
+ this.options = col.options;
42
+ }
43
+ if (aq) {
44
+ if (aq.chartTitle)
45
+ this.chartTitle = aq.chartTitle;
46
+ if (aq.chartSubtitle)
47
+ this.chartSubtitle = aq.chartSubtitle;
48
+ }
49
+ }
50
+ connectedCallback() {
51
+ super.connectedCallback();
52
+ if (this.config)
53
+ this.applyConfig(this.config);
54
+ }
23
55
  disconnectedCallback() {
24
56
  super.disconnectedCallback();
25
57
  this.destroyChart();
@@ -28,6 +60,10 @@ let NileColumnChart = class NileColumnChart extends NileElement {
28
60
  }
29
61
  firstUpdated() { this.initChart(); this.setupResizeObserver(); }
30
62
  updated(changedProperties) {
63
+ if (changedProperties.has('config') && this.config) {
64
+ this.applyConfig(this.config);
65
+ return;
66
+ }
31
67
  const props = ['data', 'categories', 'chartTitle', 'chartSubtitle', 'options', 'height', 'yAxisTitle', 'loading'];
32
68
  if (!props.some(p => changedProperties.has(p)))
33
69
  return;
@@ -87,6 +123,9 @@ NileColumnChart.styles = styles;
87
123
  __decorate([
88
124
  query('.chart-container')
89
125
  ], NileColumnChart.prototype, "chartContainer", void 0);
126
+ __decorate([
127
+ property({ type: Object })
128
+ ], NileColumnChart.prototype, "config", void 0);
90
129
  __decorate([
91
130
  property({ type: String, attribute: 'chart-title' })
92
131
  ], NileColumnChart.prototype, "chartTitle", void 0);
@@ -1,6 +1,7 @@
1
1
  import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
2
2
  import type Highcharts from 'highcharts';
3
3
  import NileElement from '../internal/nile-element.js';
4
+ import type { NileChartConfigInputType } from '../internal/types/index.js';
4
5
  export interface DonutChartSeriesData {
5
6
  name: string;
6
7
  y: number;
@@ -14,6 +15,8 @@ export declare class NileDonutChart extends NileElement {
14
15
  private chart;
15
16
  private resizeObserver;
16
17
  private chartContainer;
18
+ /** Full chart configuration. Accepts separated { chart, aq } input. */
19
+ config: NileChartConfigInputType | null;
17
20
  chartTitle: string;
18
21
  chartSubtitle: string;
19
22
  data: DonutChartSeriesData[];
@@ -24,6 +27,9 @@ export declare class NileDonutChart extends NileElement {
24
27
  height: string;
25
28
  showDataLabels: boolean;
26
29
  showLegend: boolean;
30
+ /** Apply { chart, aq } config to individual properties. */
31
+ private applyConfig;
32
+ connectedCallback(): void;
27
33
  disconnectedCallback(): void;
28
34
  protected firstUpdated(): void;
29
35
  protected updated(changedProperties: PropertyValues): void;