@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
@@ -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 ScatterChartSeriesData {
5
6
  name: string;
6
7
  data: [number, number][];
@@ -12,6 +13,8 @@ export declare class NileScatterChart 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: ScatterChartSeriesData[];
@@ -20,6 +23,9 @@ export declare class NileScatterChart extends NileElement {
20
23
  height: string;
21
24
  xAxisTitle: string;
22
25
  yAxisTitle: string;
26
+ /** Apply { chart, aq } config to individual properties. */
27
+ private applyConfig;
28
+ connectedCallback(): void;
23
29
  disconnectedCallback(): void;
24
30
  protected firstUpdated(): void;
25
31
  protected updated(changedProperties: PropertyValues): void;
@@ -11,6 +11,8 @@ let NileScatterChart = class NileScatterChart 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 NileScatterChart = class NileScatterChart extends NileElement {
20
22
  this.xAxisTitle = '';
21
23
  this.yAxisTitle = '';
22
24
  }
25
+ /** Apply { chart, aq } config to individual properties. */
26
+ applyConfig(cfg) {
27
+ const { chart: c, aq } = cfg;
28
+ if (c) {
29
+ const scatter = c;
30
+ if (scatter.data)
31
+ this.data = scatter.data;
32
+ if (scatter.xAxisTitle)
33
+ this.xAxisTitle = scatter.xAxisTitle;
34
+ if (scatter.yAxisTitle)
35
+ this.yAxisTitle = scatter.yAxisTitle;
36
+ if (scatter.height)
37
+ this.height = scatter.height;
38
+ if (scatter.loading !== undefined)
39
+ this.loading = scatter.loading;
40
+ if (scatter.options)
41
+ this.options = scatter.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 NileScatterChart = class NileScatterChart extends NileElement {
28
60
  }
29
61
  firstUpdated() { this.initChart(); this.setupResizeObserver(); }
30
62
  updated(changedProperties) {
63
+ if (changedProperties.has('config') && this.config) {
64
+ this.applyConfig(this.config);
65
+ return;
66
+ }
31
67
  const props = ['data', 'chartTitle', 'chartSubtitle', 'options', 'height', 'xAxisTitle', 'yAxisTitle', 'loading'];
32
68
  if (!props.some(p => changedProperties.has(p)))
33
69
  return;
@@ -93,6 +129,9 @@ NileScatterChart.styles = styles;
93
129
  __decorate([
94
130
  query('.chart-container')
95
131
  ], NileScatterChart.prototype, "chartContainer", void 0);
132
+ __decorate([
133
+ property({ type: Object })
134
+ ], NileScatterChart.prototype, "config", void 0);
96
135
  __decorate([
97
136
  property({ type: String, attribute: 'chart-title' })
98
137
  ], NileScatterChart.prototype, "chartTitle", void 0);
@@ -0,0 +1,2 @@
1
+ export { NileSpiderwebChart } from './nile-spiderweb-chart.js';
2
+ export type { SpiderwebChartSeriesData } from './nile-spiderweb-chart.js';
@@ -0,0 +1,2 @@
1
+ export { NileSpiderwebChart } from './nile-spiderweb-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-spiderweb-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
+ export interface SpiderwebChartSeriesData {
6
+ name: string;
7
+ data: number[];
8
+ color?: string;
9
+ }
10
+ /**
11
+ * Polar “spider web” chart (polygon grid). Same data shape as {@link NileRadarChart};
12
+ * use this tag when you want the spiderweb naming in markup.
13
+ */
14
+ export declare class NileSpiderwebChart extends NileElement {
15
+ static styles: CSSResultGroup;
16
+ private _hc;
17
+ private chart;
18
+ private resizeObserver;
19
+ private chartContainer;
20
+ /** Full chart configuration. Accepts separated `{ chart, aq }` input. */
21
+ config: SeparatedChartConfigInputType | null;
22
+ chartTitle: string;
23
+ chartSubtitle: string;
24
+ data: SpiderwebChartSeriesData[];
25
+ categories: string[];
26
+ options: Highcharts.Options;
27
+ loading: boolean;
28
+ height: string;
29
+ showArea: boolean;
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-spiderweb-chart': NileSpiderwebChart;
45
+ }
46
+ }
@@ -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-spiderweb-chart.css.js';
9
+ /**
10
+ * Polar “spider web” chart (polygon grid). Same data shape as {@link NileRadarChart};
11
+ * use this tag when you want the spiderweb naming in markup.
12
+ */
13
+ let NileSpiderwebChart = class NileSpiderwebChart extends NileElement {
14
+ constructor() {
15
+ super(...arguments);
16
+ this._hc = null;
17
+ this.chart = null;
18
+ this.resizeObserver = null;
19
+ /** Full chart configuration. Accepts separated `{ chart, aq }` input. */
20
+ this.config = null;
21
+ this.chartTitle = '';
22
+ this.chartSubtitle = '';
23
+ this.data = [];
24
+ this.categories = [];
25
+ this.options = {};
26
+ this.loading = false;
27
+ this.height = '400px';
28
+ this.showArea = false;
29
+ }
30
+ /** Apply `{ chart, aq }` config to individual properties. */
31
+ applyConfig(cfg) {
32
+ applySeparatedChartConfig(this, cfg);
33
+ }
34
+ connectedCallback() {
35
+ super.connectedCallback();
36
+ if (this.config)
37
+ this.applyConfig(this.config);
38
+ }
39
+ disconnectedCallback() {
40
+ super.disconnectedCallback();
41
+ this.destroyChart();
42
+ this.resizeObserver?.disconnect();
43
+ this.resizeObserver = null;
44
+ }
45
+ firstUpdated() {
46
+ this.initChart();
47
+ this.setupResizeObserver();
48
+ }
49
+ updated(changedProperties) {
50
+ if (changedProperties.has('config') && this.config) {
51
+ this.applyConfig(this.config);
52
+ return;
53
+ }
54
+ const props = [
55
+ 'data',
56
+ 'categories',
57
+ 'chartTitle',
58
+ 'chartSubtitle',
59
+ 'options',
60
+ 'height',
61
+ 'showArea',
62
+ 'loading',
63
+ ];
64
+ if (!props.some(p => changedProperties.has(p)))
65
+ return;
66
+ if (this.loading) {
67
+ this.destroyChart();
68
+ return;
69
+ }
70
+ if (this.chart) {
71
+ this.chart.update(this.buildOptions(), true, true);
72
+ }
73
+ else {
74
+ this.initChart();
75
+ }
76
+ }
77
+ setupResizeObserver() {
78
+ if (!this.chartContainer)
79
+ return;
80
+ this.resizeObserver = new ResizeObserver(() => {
81
+ this.chart?.reflow();
82
+ });
83
+ this.resizeObserver.observe(this.chartContainer);
84
+ }
85
+ buildOptions() {
86
+ const self = this;
87
+ const seriesType = this.showArea ? 'area' : 'line';
88
+ return deepMerge({
89
+ chart: { polar: true, type: seriesType, height: this.height },
90
+ title: { text: this.chartTitle || undefined },
91
+ subtitle: { text: this.chartSubtitle || undefined },
92
+ pane: { size: '80%' },
93
+ xAxis: {
94
+ categories: this.categories,
95
+ tickmarkPlacement: 'on',
96
+ lineWidth: 0,
97
+ },
98
+ yAxis: {
99
+ gridLineInterpolation: 'polygon',
100
+ lineWidth: 0,
101
+ min: 0,
102
+ },
103
+ tooltip: {
104
+ shared: true,
105
+ pointFormat: '<span style="color:{series.color}">{series.name}: <b>{point.y}</b><br/>',
106
+ },
107
+ plotOptions: {
108
+ series: {
109
+ cursor: 'pointer',
110
+ point: {
111
+ events: {
112
+ click() {
113
+ self.emit('nile-chart-click', {
114
+ point: this,
115
+ category: this.category,
116
+ value: this.y,
117
+ seriesName: this.series.name,
118
+ });
119
+ },
120
+ },
121
+ },
122
+ },
123
+ area: { fillOpacity: 0.15 },
124
+ },
125
+ series: this.data.map(s => ({
126
+ type: seriesType,
127
+ name: s.name,
128
+ data: s.data,
129
+ color: s.color,
130
+ pointPlacement: 'on',
131
+ })),
132
+ credits: { enabled: false },
133
+ }, this.options);
134
+ }
135
+ async initChart() {
136
+ if (this.loading || !this.chartContainer)
137
+ return;
138
+ if (!this._hc)
139
+ this._hc = await getHighcharts();
140
+ this.chart = this._hc.chart(this.chartContainer, this.buildOptions());
141
+ this.emit('nile-chart-ready', { chart: this.chart });
142
+ }
143
+ destroyChart() {
144
+ if (this.chart) {
145
+ this.chart.destroy();
146
+ this.chart = null;
147
+ }
148
+ }
149
+ render() {
150
+ if (this.loading) {
151
+ return html `<div class="chart-loading" style="height:${this.height}">Loading...</div>`;
152
+ }
153
+ return html `<div class="chart-container"></div>`;
154
+ }
155
+ };
156
+ NileSpiderwebChart.styles = styles;
157
+ __decorate([
158
+ query('.chart-container')
159
+ ], NileSpiderwebChart.prototype, "chartContainer", void 0);
160
+ __decorate([
161
+ property({ type: Object })
162
+ ], NileSpiderwebChart.prototype, "config", void 0);
163
+ __decorate([
164
+ property({ type: String, attribute: 'chart-title' })
165
+ ], NileSpiderwebChart.prototype, "chartTitle", void 0);
166
+ __decorate([
167
+ property({ type: String, attribute: 'chart-subtitle' })
168
+ ], NileSpiderwebChart.prototype, "chartSubtitle", void 0);
169
+ __decorate([
170
+ property({ type: Array })
171
+ ], NileSpiderwebChart.prototype, "data", void 0);
172
+ __decorate([
173
+ property({ type: Array })
174
+ ], NileSpiderwebChart.prototype, "categories", void 0);
175
+ __decorate([
176
+ property({ type: Object })
177
+ ], NileSpiderwebChart.prototype, "options", void 0);
178
+ __decorate([
179
+ property({ type: Boolean, reflect: true })
180
+ ], NileSpiderwebChart.prototype, "loading", void 0);
181
+ __decorate([
182
+ property({ type: String })
183
+ ], NileSpiderwebChart.prototype, "height", void 0);
184
+ __decorate([
185
+ property({ type: Boolean, attribute: 'show-area' })
186
+ ], NileSpiderwebChart.prototype, "showArea", void 0);
187
+ NileSpiderwebChart = __decorate([
188
+ customElement('nile-spiderweb-chart')
189
+ ], NileSpiderwebChart);
190
+ export { NileSpiderwebChart };
191
+ //# sourceMappingURL=nile-spiderweb-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 SplineChartSeriesData {
5
6
  name: string;
6
7
  data: number[];
@@ -12,6 +13,8 @@ export declare class NileSplineChart 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: SplineChartSeriesData[];
@@ -20,6 +23,9 @@ export declare class NileSplineChart 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 NileSplineChart = class NileSplineChart 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 NileSplineChart = class NileSplineChart 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 spline = c;
30
+ if (spline.data)
31
+ this.data = spline.data;
32
+ if (spline.categories)
33
+ this.categories = spline.categories;
34
+ if (spline.yAxisTitle)
35
+ this.yAxisTitle = spline.yAxisTitle;
36
+ if (spline.height)
37
+ this.height = spline.height;
38
+ if (spline.loading !== undefined)
39
+ this.loading = spline.loading;
40
+ if (spline.options)
41
+ this.options = spline.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 NileSplineChart = class NileSplineChart 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 @@ NileSplineChart.styles = styles;
87
123
  __decorate([
88
124
  query('.chart-container')
89
125
  ], NileSplineChart.prototype, "chartContainer", void 0);
126
+ __decorate([
127
+ property({ type: Object })
128
+ ], NileSplineChart.prototype, "config", void 0);
90
129
  __decorate([
91
130
  property({ type: String, attribute: 'chart-title' })
92
131
  ], NileSplineChart.prototype, "chartTitle", void 0);
@@ -0,0 +1,2 @@
1
+ export { NileStackedChart } from './nile-stacked-chart.js';
2
+ export type { StackedChartSeriesData } from './nile-stacked-chart.js';
@@ -0,0 +1,2 @@
1
+ export { NileStackedChart } from './nile-stacked-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-stacked-chart.css.js.map
@@ -0,0 +1,47 @@
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 StackedChartSeriesData {
6
+ name: string;
7
+ data: number[];
8
+ color?: string;
9
+ }
10
+ export declare class NileStackedChart extends NileElement {
11
+ static styles: CSSResultGroup;
12
+ private _hc;
13
+ private chart;
14
+ private resizeObserver;
15
+ private chartContainer;
16
+ /** Full chart configuration. Accepts separated `{ chart, aq }` input. */
17
+ config: SeparatedChartConfigInputType | null;
18
+ chartTitle: string;
19
+ chartSubtitle: string;
20
+ data: StackedChartSeriesData[];
21
+ categories: string[];
22
+ options: Highcharts.Options;
23
+ loading: boolean;
24
+ height: string;
25
+ yAxisTitle: string;
26
+ showLegend: boolean;
27
+ /** `normal` = stacked values; `percent` = 100% proportional stacks. */
28
+ stackMode: 'normal' | 'percent';
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 stacking;
38
+ private buildOptions;
39
+ private initChart;
40
+ private destroyChart;
41
+ render(): TemplateResult;
42
+ }
43
+ declare global {
44
+ interface HTMLElementTagNameMap {
45
+ 'nile-stacked-chart': NileStackedChart;
46
+ }
47
+ }