@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
@@ -11,6 +11,8 @@ let NileDonutChart = class NileDonutChart 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 = [];
@@ -22,6 +24,40 @@ let NileDonutChart = class NileDonutChart extends NileElement {
22
24
  this.showDataLabels = true;
23
25
  this.showLegend = true;
24
26
  }
27
+ /** Apply { chart, aq } config to individual properties. */
28
+ applyConfig(cfg) {
29
+ const { chart: c, aq } = cfg;
30
+ if (c) {
31
+ const donut = c;
32
+ if (donut.data)
33
+ this.data = donut.data;
34
+ if (donut.seriesName)
35
+ this.seriesName = donut.seriesName;
36
+ if (donut.innerSize)
37
+ this.innerSize = donut.innerSize;
38
+ if (donut.height)
39
+ this.height = donut.height;
40
+ if (donut.loading !== undefined)
41
+ this.loading = donut.loading;
42
+ if (donut.options)
43
+ this.options = donut.options;
44
+ if (donut.showDataLabels !== undefined)
45
+ this.showDataLabels = donut.showDataLabels;
46
+ if (donut.showLegend !== undefined)
47
+ this.showLegend = donut.showLegend;
48
+ }
49
+ if (aq) {
50
+ if (aq.chartTitle)
51
+ this.chartTitle = aq.chartTitle;
52
+ if (aq.chartSubtitle)
53
+ this.chartSubtitle = aq.chartSubtitle;
54
+ }
55
+ }
56
+ connectedCallback() {
57
+ super.connectedCallback();
58
+ if (this.config)
59
+ this.applyConfig(this.config);
60
+ }
25
61
  disconnectedCallback() {
26
62
  super.disconnectedCallback();
27
63
  this.destroyChart();
@@ -30,6 +66,10 @@ let NileDonutChart = class NileDonutChart extends NileElement {
30
66
  }
31
67
  firstUpdated() { this.initChart(); this.setupResizeObserver(); }
32
68
  updated(changedProperties) {
69
+ if (changedProperties.has('config') && this.config) {
70
+ this.applyConfig(this.config);
71
+ return;
72
+ }
33
73
  const props = ['data', 'chartTitle', 'chartSubtitle', 'options', 'height', 'seriesName', 'innerSize', 'loading', 'showDataLabels', 'showLegend'];
34
74
  if (!props.some(p => changedProperties.has(p)))
35
75
  return;
@@ -94,6 +134,9 @@ NileDonutChart.styles = styles;
94
134
  __decorate([
95
135
  query('.chart-container')
96
136
  ], NileDonutChart.prototype, "chartContainer", void 0);
137
+ __decorate([
138
+ property({ type: Object })
139
+ ], NileDonutChart.prototype, "config", void 0);
97
140
  __decorate([
98
141
  property({ type: String, attribute: 'chart-title' })
99
142
  ], NileDonutChart.prototype, "chartTitle", void 0);
@@ -0,0 +1,2 @@
1
+ export { NileDumbbellChart } from './nile-dumbbell-chart.js';
2
+ export type { DumbbellPoint } from './nile-dumbbell-chart.js';
@@ -0,0 +1,2 @@
1
+ export { NileDumbbellChart } from './nile-dumbbell-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-dumbbell-chart.css.js.map
@@ -0,0 +1,50 @@
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 DumbbellPoint {
6
+ name: string;
7
+ low: number;
8
+ high: number;
9
+ /** Upper-marker color (and connector tint when set). */
10
+ color?: string;
11
+ /** Lower-marker color; falls back to `low-marker-color` on the host. */
12
+ lowColor?: string;
13
+ }
14
+ export declare class NileDumbbellChart 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: DumbbellPoint[];
25
+ options: Highcharts.Options;
26
+ loading: boolean;
27
+ height: string;
28
+ yAxisTitle: string;
29
+ seriesName: string;
30
+ lowMarkerColor: string;
31
+ connectorColor: string;
32
+ showLegend: boolean;
33
+ horizontal: boolean;
34
+ /** Apply `{ chart, aq }` config to individual properties. */
35
+ private applyConfig;
36
+ connectedCallback(): void;
37
+ disconnectedCallback(): void;
38
+ protected firstUpdated(): void;
39
+ protected updated(changedProperties: PropertyValues): void;
40
+ private setupResizeObserver;
41
+ private buildOptions;
42
+ private initChart;
43
+ private destroyChart;
44
+ render(): TemplateResult;
45
+ }
46
+ declare global {
47
+ interface HTMLElementTagNameMap {
48
+ 'nile-dumbbell-chart': NileDumbbellChart;
49
+ }
50
+ }
@@ -0,0 +1,217 @@
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-dumbbell-chart.css.js';
9
+ let NileDumbbellChart = class NileDumbbellChart 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.options = {};
21
+ this.loading = false;
22
+ this.height = '400px';
23
+ this.yAxisTitle = '';
24
+ this.seriesName = '';
25
+ this.lowMarkerColor = '#ef4444';
26
+ this.connectorColor = '#94a3b8';
27
+ this.showLegend = false;
28
+ this.horizontal = 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
+ 'chartTitle',
57
+ 'chartSubtitle',
58
+ 'options',
59
+ 'height',
60
+ 'yAxisTitle',
61
+ 'seriesName',
62
+ 'lowMarkerColor',
63
+ 'connectorColor',
64
+ 'showLegend',
65
+ 'horizontal',
66
+ 'loading',
67
+ ];
68
+ if (!props.some(p => changedProperties.has(p)))
69
+ return;
70
+ if (this.loading) {
71
+ this.destroyChart();
72
+ return;
73
+ }
74
+ if (this.chart) {
75
+ this.chart.update(this.buildOptions(), true, true);
76
+ }
77
+ else {
78
+ this.initChart();
79
+ }
80
+ }
81
+ setupResizeObserver() {
82
+ if (!this.chartContainer)
83
+ return;
84
+ this.resizeObserver = new ResizeObserver(() => {
85
+ this.chart?.reflow();
86
+ });
87
+ this.resizeObserver.observe(this.chartContainer);
88
+ }
89
+ buildOptions() {
90
+ const self = this;
91
+ return deepMerge({
92
+ chart: {
93
+ type: 'dumbbell',
94
+ height: this.height,
95
+ inverted: this.horizontal,
96
+ },
97
+ title: { text: this.chartTitle || undefined },
98
+ subtitle: { text: this.chartSubtitle || undefined },
99
+ legend: { enabled: this.showLegend },
100
+ xAxis: { type: 'category' },
101
+ yAxis: { title: { text: this.yAxisTitle || undefined } },
102
+ tooltip: {
103
+ shared: true,
104
+ pointFormat: '<b>{point.name}</b><br/>Low: <b>{point.low}</b><br/>High: <b>{point.high}</b>',
105
+ },
106
+ plotOptions: {
107
+ dumbbell: {
108
+ lowColor: this.lowMarkerColor,
109
+ connectorColor: this.connectorColor,
110
+ connectorWidth: 2,
111
+ marker: { radius: 6, lineWidth: 2, lineColor: '#ffffff' },
112
+ cursor: 'pointer',
113
+ point: {
114
+ events: {
115
+ click() {
116
+ self.emit('nile-chart-click', {
117
+ point: this,
118
+ category: this.name,
119
+ low: this.low,
120
+ high: this.high,
121
+ seriesName: this.series.name,
122
+ });
123
+ },
124
+ },
125
+ },
126
+ },
127
+ },
128
+ series: [
129
+ {
130
+ type: 'dumbbell',
131
+ name: this.seriesName || 'Range',
132
+ data: this.data.map(d => {
133
+ const row = {
134
+ name: d.name,
135
+ low: d.low,
136
+ high: d.high,
137
+ };
138
+ if (d.color)
139
+ row.color = d.color;
140
+ if (d.lowColor)
141
+ row.lowColor = d.lowColor;
142
+ return row;
143
+ }),
144
+ },
145
+ ],
146
+ credits: { enabled: false },
147
+ }, this.options);
148
+ }
149
+ async initChart() {
150
+ if (this.loading || !this.chartContainer)
151
+ return;
152
+ if (!this._hc)
153
+ this._hc = await getHighcharts();
154
+ this.chart = this._hc.chart(this.chartContainer, this.buildOptions());
155
+ this.emit('nile-chart-ready', { chart: this.chart });
156
+ }
157
+ destroyChart() {
158
+ if (this.chart) {
159
+ this.chart.destroy();
160
+ this.chart = null;
161
+ }
162
+ }
163
+ render() {
164
+ if (this.loading) {
165
+ return html `<div class="chart-loading" style="height:${this.height}">Loading...</div>`;
166
+ }
167
+ return html `<div class="chart-container"></div>`;
168
+ }
169
+ };
170
+ NileDumbbellChart.styles = styles;
171
+ __decorate([
172
+ query('.chart-container')
173
+ ], NileDumbbellChart.prototype, "chartContainer", void 0);
174
+ __decorate([
175
+ property({ type: Object })
176
+ ], NileDumbbellChart.prototype, "config", void 0);
177
+ __decorate([
178
+ property({ type: String, attribute: 'chart-title' })
179
+ ], NileDumbbellChart.prototype, "chartTitle", void 0);
180
+ __decorate([
181
+ property({ type: String, attribute: 'chart-subtitle' })
182
+ ], NileDumbbellChart.prototype, "chartSubtitle", void 0);
183
+ __decorate([
184
+ property({ type: Array })
185
+ ], NileDumbbellChart.prototype, "data", void 0);
186
+ __decorate([
187
+ property({ type: Object })
188
+ ], NileDumbbellChart.prototype, "options", void 0);
189
+ __decorate([
190
+ property({ type: Boolean, reflect: true })
191
+ ], NileDumbbellChart.prototype, "loading", void 0);
192
+ __decorate([
193
+ property({ type: String })
194
+ ], NileDumbbellChart.prototype, "height", void 0);
195
+ __decorate([
196
+ property({ type: String, attribute: 'y-axis-title' })
197
+ ], NileDumbbellChart.prototype, "yAxisTitle", void 0);
198
+ __decorate([
199
+ property({ type: String, attribute: 'series-name' })
200
+ ], NileDumbbellChart.prototype, "seriesName", void 0);
201
+ __decorate([
202
+ property({ type: String, attribute: 'low-marker-color' })
203
+ ], NileDumbbellChart.prototype, "lowMarkerColor", void 0);
204
+ __decorate([
205
+ property({ type: String, attribute: 'connector-color' })
206
+ ], NileDumbbellChart.prototype, "connectorColor", void 0);
207
+ __decorate([
208
+ property({ type: Boolean, attribute: 'show-legend' })
209
+ ], NileDumbbellChart.prototype, "showLegend", void 0);
210
+ __decorate([
211
+ property({ type: Boolean, reflect: true, attribute: 'horizontal' })
212
+ ], NileDumbbellChart.prototype, "horizontal", void 0);
213
+ NileDumbbellChart = __decorate([
214
+ customElement('nile-dumbbell-chart')
215
+ ], NileDumbbellChart);
216
+ export { NileDumbbellChart };
217
+ //# sourceMappingURL=nile-dumbbell-chart.js.map
@@ -0,0 +1,2 @@
1
+ export { NileFanChart } from './nile-fan-chart.js';
2
+ export type { FanLinePoint, FanUncertaintyBand } from './nile-fan-chart.js';
@@ -0,0 +1,2 @@
1
+ export { NileFanChart } from './nile-fan-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-fan-chart.css.js.map
@@ -0,0 +1,65 @@
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
+ /** Central path (history + median / point forecast). */
6
+ export interface FanLinePoint {
7
+ category: string;
8
+ y: number;
9
+ }
10
+ /**
11
+ * One uncertainty fan layer (`arearange`). List **widest band first** (e.g. 3σ, 2σ, 1σ)
12
+ * so narrower bands render on top.
13
+ */
14
+ export interface FanUncertaintyBand {
15
+ name: string;
16
+ data: Array<{
17
+ category: string;
18
+ low: number;
19
+ high: number;
20
+ }>;
21
+ color?: string;
22
+ fillOpacity?: number;
23
+ }
24
+ export declare class NileFanChart 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
+ lineData: FanLinePoint[];
35
+ bands: FanUncertaintyBand[];
36
+ options: Highcharts.Options;
37
+ loading: boolean;
38
+ height: string;
39
+ yAxisTitle: string;
40
+ lineSeriesName: string;
41
+ lineColor: string;
42
+ showLegend: boolean;
43
+ /**
44
+ * Index (0-based) of the first **forecast** category on the x-axis.
45
+ * When ≥ 0, draws a dashed separator and optional plot band.
46
+ */
47
+ forecastStartIndex: number;
48
+ forecastBandLabel: string;
49
+ /** Apply `{ chart, aq }` config to individual properties. */
50
+ private applyConfig;
51
+ connectedCallback(): void;
52
+ disconnectedCallback(): void;
53
+ protected firstUpdated(): void;
54
+ protected updated(changedProperties: PropertyValues): void;
55
+ private setupResizeObserver;
56
+ private buildOptions;
57
+ private initChart;
58
+ private destroyChart;
59
+ render(): TemplateResult;
60
+ }
61
+ declare global {
62
+ interface HTMLElementTagNameMap {
63
+ 'nile-fan-chart': NileFanChart;
64
+ }
65
+ }