@aquera/nile-visualization 0.1.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 (121) hide show
  1. package/dist/src/index.d.ts +35 -0
  2. package/dist/src/index.js +20 -0
  3. package/dist/src/internal/chart-adapters.d.ts +11 -0
  4. package/dist/src/internal/chart-adapters.js +159 -0
  5. package/dist/src/internal/highcharts-provider.d.ts +14 -0
  6. package/dist/src/internal/highcharts-provider.js +56 -0
  7. package/dist/src/internal/nile-element.d.ts +8 -0
  8. package/dist/src/internal/nile-element.js +21 -0
  9. package/dist/src/internal/utils.d.ts +1 -0
  10. package/dist/src/internal/utils.js +23 -0
  11. package/dist/src/nile-ai-panel/index.d.ts +1 -0
  12. package/dist/src/nile-ai-panel/index.js +2 -0
  13. package/dist/src/nile-ai-panel/nile-ai-panel.css.d.ts +1 -0
  14. package/dist/src/nile-ai-panel/nile-ai-panel.css.js +73 -0
  15. package/dist/src/nile-ai-panel/nile-ai-panel.d.ts +29 -0
  16. package/dist/src/nile-ai-panel/nile-ai-panel.js +98 -0
  17. package/dist/src/nile-ai-sender/index.d.ts +1 -0
  18. package/dist/src/nile-ai-sender/index.js +2 -0
  19. package/dist/src/nile-ai-sender/nile-ai-sender.css.d.ts +1 -0
  20. package/dist/src/nile-ai-sender/nile-ai-sender.css.js +71 -0
  21. package/dist/src/nile-ai-sender/nile-ai-sender.d.ts +20 -0
  22. package/dist/src/nile-ai-sender/nile-ai-sender.js +77 -0
  23. package/dist/src/nile-anomaly-chart/index.d.ts +2 -0
  24. package/dist/src/nile-anomaly-chart/index.js +2 -0
  25. package/dist/src/nile-anomaly-chart/nile-anomaly-chart.css.d.ts +1 -0
  26. package/dist/src/nile-anomaly-chart/nile-anomaly-chart.css.js +28 -0
  27. package/dist/src/nile-anomaly-chart/nile-anomaly-chart.d.ts +59 -0
  28. package/dist/src/nile-anomaly-chart/nile-anomaly-chart.js +268 -0
  29. package/dist/src/nile-area-chart/index.d.ts +2 -0
  30. package/dist/src/nile-area-chart/index.js +2 -0
  31. package/dist/src/nile-area-chart/nile-area-chart.css.d.ts +1 -0
  32. package/dist/src/nile-area-chart/nile-area-chart.css.js +28 -0
  33. package/dist/src/nile-area-chart/nile-area-chart.d.ts +37 -0
  34. package/dist/src/nile-area-chart/nile-area-chart.js +122 -0
  35. package/dist/src/nile-bar-chart/index.d.ts +2 -0
  36. package/dist/src/nile-bar-chart/index.js +2 -0
  37. package/dist/src/nile-bar-chart/nile-bar-chart.css.d.ts +1 -0
  38. package/dist/src/nile-bar-chart/nile-bar-chart.css.js +28 -0
  39. package/dist/src/nile-bar-chart/nile-bar-chart.d.ts +44 -0
  40. package/dist/src/nile-bar-chart/nile-bar-chart.js +185 -0
  41. package/dist/src/nile-bubble-chart/index.d.ts +2 -0
  42. package/dist/src/nile-bubble-chart/index.js +2 -0
  43. package/dist/src/nile-bubble-chart/nile-bubble-chart.css.d.ts +1 -0
  44. package/dist/src/nile-bubble-chart/nile-bubble-chart.css.js +28 -0
  45. package/dist/src/nile-bubble-chart/nile-bubble-chart.d.ts +36 -0
  46. package/dist/src/nile-bubble-chart/nile-bubble-chart.js +123 -0
  47. package/dist/src/nile-chart/index.d.ts +3 -0
  48. package/dist/src/nile-chart/index.js +3 -0
  49. package/dist/src/nile-chart/nile-chart-config.d.ts +58 -0
  50. package/dist/src/nile-chart/nile-chart-config.js +2 -0
  51. package/dist/src/nile-chart/nile-chart.css.d.ts +1 -0
  52. package/dist/src/nile-chart/nile-chart.css.js +298 -0
  53. package/dist/src/nile-chart/nile-chart.d.ts +51 -0
  54. package/dist/src/nile-chart/nile-chart.js +303 -0
  55. package/dist/src/nile-column-chart/index.d.ts +2 -0
  56. package/dist/src/nile-column-chart/index.js +2 -0
  57. package/dist/src/nile-column-chart/nile-column-chart.css.d.ts +1 -0
  58. package/dist/src/nile-column-chart/nile-column-chart.css.js +28 -0
  59. package/dist/src/nile-column-chart/nile-column-chart.d.ts +36 -0
  60. package/dist/src/nile-column-chart/nile-column-chart.js +118 -0
  61. package/dist/src/nile-donut-chart/index.d.ts +2 -0
  62. package/dist/src/nile-donut-chart/index.js +2 -0
  63. package/dist/src/nile-donut-chart/nile-donut-chart.css.d.ts +1 -0
  64. package/dist/src/nile-donut-chart/nile-donut-chart.css.js +28 -0
  65. package/dist/src/nile-donut-chart/nile-donut-chart.d.ts +40 -0
  66. package/dist/src/nile-donut-chart/nile-donut-chart.js +131 -0
  67. package/dist/src/nile-gauge-chart/index.d.ts +2 -0
  68. package/dist/src/nile-gauge-chart/index.js +2 -0
  69. package/dist/src/nile-gauge-chart/nile-gauge-chart.css.d.ts +1 -0
  70. package/dist/src/nile-gauge-chart/nile-gauge-chart.css.js +28 -0
  71. package/dist/src/nile-gauge-chart/nile-gauge-chart.d.ts +38 -0
  72. package/dist/src/nile-gauge-chart/nile-gauge-chart.js +149 -0
  73. package/dist/src/nile-kpi-chart/index.d.ts +2 -0
  74. package/dist/src/nile-kpi-chart/index.js +2 -0
  75. package/dist/src/nile-kpi-chart/nile-kpi-chart.css.d.ts +1 -0
  76. package/dist/src/nile-kpi-chart/nile-kpi-chart.css.js +165 -0
  77. package/dist/src/nile-kpi-chart/nile-kpi-chart.d.ts +80 -0
  78. package/dist/src/nile-kpi-chart/nile-kpi-chart.js +335 -0
  79. package/dist/src/nile-line-chart/index.d.ts +2 -0
  80. package/dist/src/nile-line-chart/index.js +2 -0
  81. package/dist/src/nile-line-chart/nile-line-chart.css.d.ts +1 -0
  82. package/dist/src/nile-line-chart/nile-line-chart.css.js +28 -0
  83. package/dist/src/nile-line-chart/nile-line-chart.d.ts +36 -0
  84. package/dist/src/nile-line-chart/nile-line-chart.js +115 -0
  85. package/dist/src/nile-pie-chart/index.d.ts +2 -0
  86. package/dist/src/nile-pie-chart/index.js +2 -0
  87. package/dist/src/nile-pie-chart/nile-pie-chart.css.d.ts +1 -0
  88. package/dist/src/nile-pie-chart/nile-pie-chart.css.js +28 -0
  89. package/dist/src/nile-pie-chart/nile-pie-chart.d.ts +48 -0
  90. package/dist/src/nile-pie-chart/nile-pie-chart.js +197 -0
  91. package/dist/src/nile-radar-chart/index.d.ts +2 -0
  92. package/dist/src/nile-radar-chart/index.js +2 -0
  93. package/dist/src/nile-radar-chart/nile-radar-chart.css.d.ts +1 -0
  94. package/dist/src/nile-radar-chart/nile-radar-chart.css.js +28 -0
  95. package/dist/src/nile-radar-chart/nile-radar-chart.d.ts +36 -0
  96. package/dist/src/nile-radar-chart/nile-radar-chart.js +137 -0
  97. package/dist/src/nile-scatter-chart/index.d.ts +2 -0
  98. package/dist/src/nile-scatter-chart/index.js +2 -0
  99. package/dist/src/nile-scatter-chart/nile-scatter-chart.css.d.ts +1 -0
  100. package/dist/src/nile-scatter-chart/nile-scatter-chart.css.js +28 -0
  101. package/dist/src/nile-scatter-chart/nile-scatter-chart.d.ts +36 -0
  102. package/dist/src/nile-scatter-chart/nile-scatter-chart.js +124 -0
  103. package/dist/src/nile-spline-chart/index.d.ts +2 -0
  104. package/dist/src/nile-spline-chart/index.js +2 -0
  105. package/dist/src/nile-spline-chart/nile-spline-chart.css.d.ts +1 -0
  106. package/dist/src/nile-spline-chart/nile-spline-chart.css.js +28 -0
  107. package/dist/src/nile-spline-chart/nile-spline-chart.d.ts +36 -0
  108. package/dist/src/nile-spline-chart/nile-spline-chart.js +118 -0
  109. package/dist/src/nile-trendline-chart/index.d.ts +2 -0
  110. package/dist/src/nile-trendline-chart/index.js +2 -0
  111. package/dist/src/nile-trendline-chart/nile-trendline-chart.css.d.ts +1 -0
  112. package/dist/src/nile-trendline-chart/nile-trendline-chart.css.js +28 -0
  113. package/dist/src/nile-trendline-chart/nile-trendline-chart.d.ts +59 -0
  114. package/dist/src/nile-trendline-chart/nile-trendline-chart.js +246 -0
  115. package/dist/src/nile-waterfall-chart/index.d.ts +2 -0
  116. package/dist/src/nile-waterfall-chart/index.js +2 -0
  117. package/dist/src/nile-waterfall-chart/nile-waterfall-chart.css.d.ts +1 -0
  118. package/dist/src/nile-waterfall-chart/nile-waterfall-chart.css.js +28 -0
  119. package/dist/src/nile-waterfall-chart/nile-waterfall-chart.d.ts +37 -0
  120. package/dist/src/nile-waterfall-chart/nile-waterfall-chart.js +137 -0
  121. package/package.json +62 -0
@@ -0,0 +1,246 @@
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 { deepMerge } from '../internal/utils.js';
7
+ import { styles } from './nile-trendline-chart.css.js';
8
+ let NileTrendlineChart = class NileTrendlineChart extends NileElement {
9
+ constructor() {
10
+ super(...arguments);
11
+ this._hc = null;
12
+ this.chart = null;
13
+ this.resizeObserver = null;
14
+ /** The chart title displayed above the chart. */
15
+ this.chartTitle = '';
16
+ /** The subtitle displayed below the title. */
17
+ this.chartSubtitle = '';
18
+ /** Array of series data. Each series is a line on the chart. */
19
+ this.data = [];
20
+ /** X-axis category labels (e.g., months, dates). */
21
+ this.categories = [];
22
+ /** Forecast configuration. When set, extends each series with a forecast line. */
23
+ this.forecast = null;
24
+ /** Deep-merge override object for full Highcharts options. */
25
+ this.options = {};
26
+ /** Whether to show a loading indicator instead of the chart. */
27
+ this.loading = false;
28
+ /** CSS height for the chart container. */
29
+ this.height = '400px';
30
+ /** Y-axis title text. */
31
+ this.yAxisTitle = '';
32
+ }
33
+ disconnectedCallback() {
34
+ super.disconnectedCallback();
35
+ this.destroyChart();
36
+ this.resizeObserver?.disconnect();
37
+ this.resizeObserver = null;
38
+ }
39
+ firstUpdated() {
40
+ this.initChart();
41
+ this.setupResizeObserver();
42
+ }
43
+ updated(changedProperties) {
44
+ const chartProps = [
45
+ 'data',
46
+ 'categories',
47
+ 'chartTitle',
48
+ 'chartSubtitle',
49
+ 'options',
50
+ 'height',
51
+ 'yAxisTitle',
52
+ 'forecast',
53
+ 'loading',
54
+ ];
55
+ const needsUpdate = chartProps.some(p => changedProperties.has(p));
56
+ if (!needsUpdate)
57
+ return;
58
+ if (this.loading) {
59
+ this.destroyChart();
60
+ return;
61
+ }
62
+ if (this.chart) {
63
+ this.chart.update(this.buildOptions(), true, true);
64
+ }
65
+ else {
66
+ this.initChart();
67
+ }
68
+ }
69
+ setupResizeObserver() {
70
+ if (!this.chartContainer)
71
+ return;
72
+ this.resizeObserver = new ResizeObserver(() => {
73
+ this.chart?.reflow();
74
+ });
75
+ this.resizeObserver.observe(this.chartContainer);
76
+ }
77
+ /**
78
+ * Simple linear regression forecast.
79
+ * Extends the data array by `periods` using least-squares fit.
80
+ */
81
+ computeForecast(values, periods) {
82
+ const n = values.length;
83
+ if (n < 2)
84
+ return Array(periods).fill(values[0] ?? 0);
85
+ let sumX = 0, sumY = 0, sumXY = 0, sumXX = 0;
86
+ for (let i = 0; i < n; i++) {
87
+ sumX += i;
88
+ sumY += values[i];
89
+ sumXY += i * values[i];
90
+ sumXX += i * i;
91
+ }
92
+ const slope = (n * sumXY - sumX * sumY) / (n * sumXX - sumX * sumX);
93
+ const intercept = (sumY - slope * sumX) / n;
94
+ const forecast = [];
95
+ for (let i = 0; i < periods; i++) {
96
+ forecast.push(Math.round((intercept + slope * (n + i)) * 100) / 100);
97
+ }
98
+ return forecast;
99
+ }
100
+ buildOptions() {
101
+ const self = this;
102
+ const forecastPeriods = this.forecast?.periods ?? 0;
103
+ // Build extended categories if forecasting
104
+ const extendedCategories = [...this.categories];
105
+ if (forecastPeriods > 0) {
106
+ for (let i = 1; i <= forecastPeriods; i++) {
107
+ extendedCategories.push(`Forecast +${i}`);
108
+ }
109
+ }
110
+ // Build series: actual data + optional forecast lines
111
+ const series = [];
112
+ for (const s of this.data) {
113
+ // Actual data line
114
+ series.push({
115
+ type: 'line',
116
+ name: s.name,
117
+ data: forecastPeriods > 0
118
+ ? [...s.data, ...Array(forecastPeriods).fill(null)]
119
+ : s.data,
120
+ color: s.color,
121
+ marker: { enabled: true, radius: 4 },
122
+ });
123
+ // Forecast line (overlaps last actual point for continuity)
124
+ if (forecastPeriods > 0) {
125
+ const forecastValues = this.computeForecast(s.data, forecastPeriods);
126
+ const forecastData = [
127
+ ...Array(s.data.length - 1).fill(null),
128
+ s.data[s.data.length - 1],
129
+ ...forecastValues,
130
+ ];
131
+ series.push({
132
+ type: 'line',
133
+ name: `${s.name} (Forecast)`,
134
+ data: forecastData,
135
+ color: this.forecast?.color ?? s.color,
136
+ dashStyle: this.forecast?.dashStyle ?? 'Dash',
137
+ marker: { enabled: true, radius: 3, symbol: 'circle' },
138
+ linkedTo: ':previous',
139
+ });
140
+ }
141
+ }
142
+ const defaults = {
143
+ chart: {
144
+ type: 'line',
145
+ height: this.height,
146
+ },
147
+ title: {
148
+ text: this.chartTitle || undefined,
149
+ },
150
+ subtitle: {
151
+ text: this.chartSubtitle || undefined,
152
+ },
153
+ xAxis: {
154
+ categories: extendedCategories,
155
+ title: { text: undefined },
156
+ },
157
+ yAxis: {
158
+ title: { text: this.yAxisTitle || undefined },
159
+ },
160
+ tooltip: {
161
+ shared: true,
162
+ },
163
+ plotOptions: {
164
+ line: {
165
+ dataLabels: { enabled: false },
166
+ },
167
+ series: {
168
+ cursor: 'pointer',
169
+ point: {
170
+ events: {
171
+ click() {
172
+ self.emit('nile-chart-click', {
173
+ point: this,
174
+ category: this.category,
175
+ value: this.y,
176
+ seriesName: this.series.name,
177
+ });
178
+ },
179
+ },
180
+ },
181
+ },
182
+ },
183
+ series,
184
+ credits: {
185
+ enabled: false,
186
+ },
187
+ };
188
+ return deepMerge(defaults, this.options);
189
+ }
190
+ async initChart() {
191
+ if (this.loading || !this.chartContainer)
192
+ return;
193
+ if (!this._hc)
194
+ this._hc = await getHighcharts();
195
+ this.chart = this._hc.chart(this.chartContainer, this.buildOptions());
196
+ this.emit('nile-chart-ready', { chart: this.chart });
197
+ }
198
+ destroyChart() {
199
+ if (this.chart) {
200
+ this.chart.destroy();
201
+ this.chart = null;
202
+ }
203
+ }
204
+ render() {
205
+ if (this.loading) {
206
+ return html `<div class="chart-loading" style="height:${this.height}">Loading...</div>`;
207
+ }
208
+ return html `<div class="chart-container"></div>`;
209
+ }
210
+ };
211
+ NileTrendlineChart.styles = styles;
212
+ __decorate([
213
+ query('.chart-container')
214
+ ], NileTrendlineChart.prototype, "chartContainer", void 0);
215
+ __decorate([
216
+ property({ type: String, attribute: 'chart-title' })
217
+ ], NileTrendlineChart.prototype, "chartTitle", void 0);
218
+ __decorate([
219
+ property({ type: String, attribute: 'chart-subtitle' })
220
+ ], NileTrendlineChart.prototype, "chartSubtitle", void 0);
221
+ __decorate([
222
+ property({ type: Array })
223
+ ], NileTrendlineChart.prototype, "data", void 0);
224
+ __decorate([
225
+ property({ type: Array })
226
+ ], NileTrendlineChart.prototype, "categories", void 0);
227
+ __decorate([
228
+ property({ type: Object })
229
+ ], NileTrendlineChart.prototype, "forecast", void 0);
230
+ __decorate([
231
+ property({ type: Object })
232
+ ], NileTrendlineChart.prototype, "options", void 0);
233
+ __decorate([
234
+ property({ type: Boolean, reflect: true })
235
+ ], NileTrendlineChart.prototype, "loading", void 0);
236
+ __decorate([
237
+ property({ type: String })
238
+ ], NileTrendlineChart.prototype, "height", void 0);
239
+ __decorate([
240
+ property({ type: String, attribute: 'y-axis-title' })
241
+ ], NileTrendlineChart.prototype, "yAxisTitle", void 0);
242
+ NileTrendlineChart = __decorate([
243
+ customElement('nile-trendline-chart')
244
+ ], NileTrendlineChart);
245
+ export { NileTrendlineChart };
246
+ //# sourceMappingURL=nile-trendline-chart.js.map
@@ -0,0 +1,2 @@
1
+ export { NileWaterfallChart } from './nile-waterfall-chart.js';
2
+ export type { WaterfallDataPoint } from './nile-waterfall-chart.js';
@@ -0,0 +1,2 @@
1
+ export { NileWaterfallChart } from './nile-waterfall-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-waterfall-chart.css.js.map
@@ -0,0 +1,37 @@
1
+ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
2
+ import type Highcharts from 'highcharts';
3
+ import NileElement from '../internal/nile-element.js';
4
+ export interface WaterfallDataPoint {
5
+ name: string;
6
+ y: number;
7
+ color?: string;
8
+ isSum?: boolean;
9
+ isIntermediateSum?: boolean;
10
+ }
11
+ export declare class NileWaterfallChart extends NileElement {
12
+ static styles: CSSResultGroup;
13
+ private _hc;
14
+ private chart;
15
+ private resizeObserver;
16
+ private chartContainer;
17
+ chartTitle: string;
18
+ chartSubtitle: string;
19
+ data: WaterfallDataPoint[];
20
+ options: Highcharts.Options;
21
+ loading: boolean;
22
+ height: string;
23
+ yAxisTitle: string;
24
+ disconnectedCallback(): void;
25
+ protected firstUpdated(): void;
26
+ protected updated(changedProperties: PropertyValues): void;
27
+ private setupResizeObserver;
28
+ private buildOptions;
29
+ private initChart;
30
+ private destroyChart;
31
+ render(): TemplateResult;
32
+ }
33
+ declare global {
34
+ interface HTMLElementTagNameMap {
35
+ 'nile-waterfall-chart': NileWaterfallChart;
36
+ }
37
+ }
@@ -0,0 +1,137 @@
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 { deepMerge } from '../internal/utils.js';
7
+ import { styles } from './nile-waterfall-chart.css.js';
8
+ let NileWaterfallChart = class NileWaterfallChart extends NileElement {
9
+ constructor() {
10
+ super(...arguments);
11
+ this._hc = null;
12
+ this.chart = null;
13
+ this.resizeObserver = null;
14
+ this.chartTitle = '';
15
+ this.chartSubtitle = '';
16
+ this.data = [];
17
+ this.options = {};
18
+ this.loading = false;
19
+ this.height = '400px';
20
+ this.yAxisTitle = '';
21
+ }
22
+ disconnectedCallback() {
23
+ super.disconnectedCallback();
24
+ this.destroyChart();
25
+ this.resizeObserver?.disconnect();
26
+ this.resizeObserver = null;
27
+ }
28
+ firstUpdated() { this.initChart(); this.setupResizeObserver(); }
29
+ updated(changedProperties) {
30
+ const props = ['data', 'chartTitle', 'chartSubtitle', 'options', 'height', 'yAxisTitle', 'loading'];
31
+ if (!props.some(p => changedProperties.has(p)))
32
+ return;
33
+ if (this.loading) {
34
+ this.destroyChart();
35
+ return;
36
+ }
37
+ if (this.chart) {
38
+ this.chart.update(this.buildOptions(), true, true);
39
+ }
40
+ else {
41
+ this.initChart();
42
+ }
43
+ }
44
+ setupResizeObserver() {
45
+ if (!this.chartContainer)
46
+ return;
47
+ this.resizeObserver = new ResizeObserver(() => { this.chart?.reflow(); });
48
+ this.resizeObserver.observe(this.chartContainer);
49
+ }
50
+ buildOptions() {
51
+ const self = this;
52
+ return deepMerge({
53
+ chart: { type: 'waterfall', height: this.height },
54
+ title: { text: this.chartTitle || undefined },
55
+ subtitle: { text: this.chartSubtitle || undefined },
56
+ xAxis: {
57
+ type: 'category',
58
+ },
59
+ yAxis: {
60
+ title: { text: this.yAxisTitle || undefined },
61
+ },
62
+ tooltip: { pointFormat: '<b>{point.y}</b>' },
63
+ plotOptions: {
64
+ waterfall: {
65
+ dataLabels: { enabled: true },
66
+ pointPadding: 0,
67
+ },
68
+ series: {
69
+ cursor: 'pointer',
70
+ point: { events: { click() { self.emit('nile-chart-click', { point: this, name: this.name, value: this.y, seriesName: this.series.name }); } } },
71
+ },
72
+ },
73
+ series: [{
74
+ type: 'waterfall',
75
+ name: this.chartTitle || 'Waterfall',
76
+ data: this.data.map(d => ({
77
+ name: d.name,
78
+ y: d.isSum || d.isIntermediateSum ? undefined : d.y,
79
+ isSum: d.isSum,
80
+ isIntermediateSum: d.isIntermediateSum,
81
+ color: d.color,
82
+ })),
83
+ color: '#3b82f6',
84
+ negativeColor: '#ef4444',
85
+ }],
86
+ legend: { enabled: false },
87
+ credits: { enabled: false },
88
+ }, this.options);
89
+ }
90
+ async initChart() {
91
+ if (this.loading || !this.chartContainer)
92
+ return;
93
+ if (!this._hc)
94
+ this._hc = await getHighcharts();
95
+ this.chart = this._hc.chart(this.chartContainer, this.buildOptions());
96
+ this.emit('nile-chart-ready', { chart: this.chart });
97
+ }
98
+ destroyChart() { if (this.chart) {
99
+ this.chart.destroy();
100
+ this.chart = null;
101
+ } }
102
+ render() {
103
+ if (this.loading)
104
+ return html `<div class="chart-loading" style="height:${this.height}">Loading...</div>`;
105
+ return html `<div class="chart-container"></div>`;
106
+ }
107
+ };
108
+ NileWaterfallChart.styles = styles;
109
+ __decorate([
110
+ query('.chart-container')
111
+ ], NileWaterfallChart.prototype, "chartContainer", void 0);
112
+ __decorate([
113
+ property({ type: String, attribute: 'chart-title' })
114
+ ], NileWaterfallChart.prototype, "chartTitle", void 0);
115
+ __decorate([
116
+ property({ type: String, attribute: 'chart-subtitle' })
117
+ ], NileWaterfallChart.prototype, "chartSubtitle", void 0);
118
+ __decorate([
119
+ property({ type: Array })
120
+ ], NileWaterfallChart.prototype, "data", void 0);
121
+ __decorate([
122
+ property({ type: Object })
123
+ ], NileWaterfallChart.prototype, "options", void 0);
124
+ __decorate([
125
+ property({ type: Boolean, reflect: true })
126
+ ], NileWaterfallChart.prototype, "loading", void 0);
127
+ __decorate([
128
+ property({ type: String })
129
+ ], NileWaterfallChart.prototype, "height", void 0);
130
+ __decorate([
131
+ property({ type: String, attribute: 'y-axis-title' })
132
+ ], NileWaterfallChart.prototype, "yAxisTitle", void 0);
133
+ NileWaterfallChart = __decorate([
134
+ customElement('nile-waterfall-chart')
135
+ ], NileWaterfallChart);
136
+ export { NileWaterfallChart };
137
+ //# sourceMappingURL=nile-waterfall-chart.js.map
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@aquera/nile-visualization",
3
+ "version": "0.1.0",
4
+ "description": "A visualization Library for the Nile Design System",
5
+ "license": "MIT",
6
+ "author": "Aquera Inc",
7
+ "type": "module",
8
+ "main": "dist/src/index.js",
9
+ "module": "dist/src/index.js",
10
+ "exports": {
11
+ ".": "./dist/src/index.js",
12
+ "./nile-bar-chart": "./dist/src/nile-bar-chart/index.js",
13
+ "./nile-pie-chart": "./dist/src/nile-pie-chart/index.js",
14
+ "./nile-line-chart": "./dist/src/nile-line-chart/index.js",
15
+ "./nile-area-chart": "./dist/src/nile-area-chart/index.js",
16
+ "./nile-column-chart": "./dist/src/nile-column-chart/index.js",
17
+ "./nile-spline-chart": "./dist/src/nile-spline-chart/index.js",
18
+ "./nile-donut-chart": "./dist/src/nile-donut-chart/index.js",
19
+ "./nile-scatter-chart": "./dist/src/nile-scatter-chart/index.js",
20
+ "./nile-bubble-chart": "./dist/src/nile-bubble-chart/index.js",
21
+ "./nile-radar-chart": "./dist/src/nile-radar-chart/index.js",
22
+ "./nile-gauge-chart": "./dist/src/nile-gauge-chart/index.js",
23
+ "./nile-waterfall-chart": "./dist/src/nile-waterfall-chart/index.js",
24
+ "./nile-trendline-chart": "./dist/src/nile-trendline-chart/index.js",
25
+ "./nile-anomaly-chart": "./dist/src/nile-anomaly-chart/index.js",
26
+ "./nile-ai-sender": "./dist/src/nile-ai-sender/index.js",
27
+ "./nile-ai-panel": "./dist/src/nile-ai-panel/index.js",
28
+ "./nile-kpi-chart": "./dist/src/nile-kpi-chart/index.js",
29
+ "./nile-chart": "./dist/src/nile-chart/index.js"
30
+ },
31
+ "files": [
32
+ "dist/src/**/*.js",
33
+ "dist/src/**/*.d.ts"
34
+ ],
35
+ "scripts": {
36
+ "start": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"",
37
+ "build": "tsc",
38
+ "package": "rollup -c",
39
+ "clean": "rimraf dist/*"
40
+ },
41
+ "dependencies": {
42
+ "lit": "^3.0.0"
43
+ },
44
+ "peerDependencies": {
45
+ "highcharts": ">=10.0.0"
46
+ },
47
+ "devDependencies": {
48
+ "@rollup/plugin-babel": "^6.0.3",
49
+ "@rollup/plugin-commonjs": "^25.0.3",
50
+ "@rollup/plugin-node-resolve": "^15.0.1",
51
+ "@rollup/plugin-replace": "^5.0.2",
52
+ "@rollup/plugin-typescript": "^10.0.1",
53
+ "@web/dev-server": "^0.1.34",
54
+ "concurrently": "^5.3.0",
55
+ "glob": "^8.0.3",
56
+ "rollup": "^3.8.1",
57
+ "rollup-plugin-summary": "^2.0.0",
58
+ "rollup-plugin-terser": "^7.0.2",
59
+ "tslib": "^2.3.1",
60
+ "typescript": "^5.6.2"
61
+ }
62
+ }