@aquera/nile-visualization 0.2.0 → 0.4.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 (170) hide show
  1. package/dist/src/index.d.ts +37 -1
  2. package/dist/src/index.js +19 -0
  3. package/dist/src/internal/chart-adapters.js +86 -0
  4. package/dist/src/internal/highcharts-provider.js +72 -0
  5. package/dist/src/internal/types/all-chart-config.type.d.ts +2 -4
  6. package/dist/src/internal/types/chart-area-config.type.d.ts +4 -0
  7. package/dist/src/internal/types/chart-area-negative-config.type.d.ts +13 -0
  8. package/dist/src/internal/types/chart-area-negative-config.type.js +2 -0
  9. package/dist/src/internal/types/chart-area-range-config.type.d.ts +12 -0
  10. package/dist/src/internal/types/chart-area-range-config.type.js +2 -0
  11. package/dist/src/internal/types/chart-area-spline-config.type.d.ts +13 -0
  12. package/dist/src/internal/types/chart-area-spline-config.type.js +2 -0
  13. package/dist/src/internal/types/chart-column-drilldown-config.type.d.ts +13 -0
  14. package/dist/src/internal/types/chart-column-drilldown-config.type.js +2 -0
  15. package/dist/src/internal/types/chart-column-pyramid-config.type.d.ts +11 -0
  16. package/dist/src/internal/types/chart-column-pyramid-config.type.js +2 -0
  17. package/dist/src/internal/types/chart-column-range-config.type.d.ts +12 -0
  18. package/dist/src/internal/types/chart-column-range-config.type.js +2 -0
  19. package/dist/src/internal/types/chart-config.type.d.ts +3 -2
  20. package/dist/src/internal/types/chart-donut-config.type.d.ts +2 -0
  21. package/dist/src/internal/types/chart-dumbbell-lower-config.type.d.ts +5 -0
  22. package/dist/src/internal/types/chart-dumbbell-lower-config.type.js +2 -0
  23. package/dist/src/internal/types/chart-dumbbell-upper-config.type.d.ts +5 -0
  24. package/dist/src/internal/types/chart-dumbbell-upper-config.type.js +2 -0
  25. package/dist/src/internal/types/chart-euler-config.type.d.ts +10 -0
  26. package/dist/src/internal/types/chart-euler-config.type.js +2 -0
  27. package/dist/src/internal/types/chart-heatmap-config.type.d.ts +19 -0
  28. package/dist/src/internal/types/chart-heatmap-config.type.js +2 -0
  29. package/dist/src/internal/types/chart-line-column-config.type.d.ts +14 -0
  30. package/dist/src/internal/types/chart-line-column-config.type.js +2 -0
  31. package/dist/src/internal/types/chart-lollipop-config.type.d.ts +11 -0
  32. package/dist/src/internal/types/chart-lollipop-config.type.js +2 -0
  33. package/dist/src/internal/types/chart-organization-config.type.d.ts +13 -0
  34. package/dist/src/internal/types/chart-organization-config.type.js +2 -0
  35. package/dist/src/internal/types/chart-polygon-config.type.d.ts +12 -0
  36. package/dist/src/internal/types/chart-polygon-config.type.js +2 -0
  37. package/dist/src/internal/types/chart-radial-bar-config.type.d.ts +16 -0
  38. package/dist/src/internal/types/chart-radial-bar-config.type.js +2 -0
  39. package/dist/src/internal/types/chart-variable-pie-config.type.d.ts +13 -0
  40. package/dist/src/internal/types/chart-variable-pie-config.type.js +2 -0
  41. package/dist/src/internal/types/chart-vector-config.type.d.ts +13 -0
  42. package/dist/src/internal/types/chart-vector-config.type.js +2 -0
  43. package/dist/src/internal/types/chart-xrange-config.type.d.ts +13 -0
  44. package/dist/src/internal/types/chart-xrange-config.type.js +2 -0
  45. package/dist/src/internal/types/index.d.ts +19 -1
  46. package/dist/src/internal/types/primitive-chart-config.type.d.ts +20 -1
  47. package/dist/src/nile-area-negative-chart/index.d.ts +2 -0
  48. package/dist/src/nile-area-negative-chart/index.js +2 -0
  49. package/dist/src/nile-area-negative-chart/nile-area-negative-chart.css.d.ts +1 -0
  50. package/dist/src/nile-area-negative-chart/nile-area-negative-chart.css.js +28 -0
  51. package/dist/src/nile-area-negative-chart/nile-area-negative-chart.d.ts +42 -0
  52. package/dist/src/nile-area-negative-chart/nile-area-negative-chart.js +178 -0
  53. package/dist/src/nile-area-range-chart/index.d.ts +2 -0
  54. package/dist/src/nile-area-range-chart/index.js +2 -0
  55. package/dist/src/nile-area-range-chart/nile-area-range-chart.css.d.ts +1 -0
  56. package/dist/src/nile-area-range-chart/nile-area-range-chart.css.js +28 -0
  57. package/dist/src/nile-area-range-chart/nile-area-range-chart.d.ts +41 -0
  58. package/dist/src/nile-area-range-chart/nile-area-range-chart.js +173 -0
  59. package/dist/src/nile-area-spline-chart/index.d.ts +2 -0
  60. package/dist/src/nile-area-spline-chart/index.js +2 -0
  61. package/dist/src/nile-area-spline-chart/nile-area-spline-chart.css.d.ts +1 -0
  62. package/dist/src/nile-area-spline-chart/nile-area-spline-chart.css.js +28 -0
  63. package/dist/src/nile-area-spline-chart/nile-area-spline-chart.d.ts +41 -0
  64. package/dist/src/nile-area-spline-chart/nile-area-spline-chart.js +174 -0
  65. package/dist/src/nile-bellcurve-chart/nile-bellcurve-chart.js +3 -1
  66. package/dist/src/nile-chart/index.d.ts +1 -1
  67. package/dist/src/nile-chart/nile-chart-config.d.ts +36 -96
  68. package/dist/src/nile-chart/nile-chart.css.js +1 -1
  69. package/dist/src/nile-chart/nile-chart.d.ts +36 -0
  70. package/dist/src/nile-chart/nile-chart.js +412 -5
  71. package/dist/src/nile-column-drilldown-chart/index.d.ts +2 -0
  72. package/dist/src/nile-column-drilldown-chart/index.js +2 -0
  73. package/dist/src/nile-column-drilldown-chart/nile-column-drilldown-chart.css.d.ts +1 -0
  74. package/dist/src/nile-column-drilldown-chart/nile-column-drilldown-chart.css.js +28 -0
  75. package/dist/src/nile-column-drilldown-chart/nile-column-drilldown-chart.d.ts +49 -0
  76. package/dist/src/nile-column-drilldown-chart/nile-column-drilldown-chart.js +186 -0
  77. package/dist/src/nile-column-pyramid-chart/index.d.ts +2 -0
  78. package/dist/src/nile-column-pyramid-chart/index.js +2 -0
  79. package/dist/src/nile-column-pyramid-chart/nile-column-pyramid-chart.css.d.ts +1 -0
  80. package/dist/src/nile-column-pyramid-chart/nile-column-pyramid-chart.css.js +28 -0
  81. package/dist/src/nile-column-pyramid-chart/nile-column-pyramid-chart.d.ts +39 -0
  82. package/dist/src/nile-column-pyramid-chart/nile-column-pyramid-chart.js +155 -0
  83. package/dist/src/nile-column-range-chart/index.d.ts +2 -0
  84. package/dist/src/nile-column-range-chart/index.js +2 -0
  85. package/dist/src/nile-column-range-chart/nile-column-range-chart.css.d.ts +1 -0
  86. package/dist/src/nile-column-range-chart/nile-column-range-chart.css.js +28 -0
  87. package/dist/src/nile-column-range-chart/nile-column-range-chart.d.ts +40 -0
  88. package/dist/src/nile-column-range-chart/nile-column-range-chart.js +169 -0
  89. package/dist/src/nile-donut-chart/nile-donut-chart.d.ts +2 -0
  90. package/dist/src/nile-donut-chart/nile-donut-chart.js +16 -1
  91. package/dist/src/nile-dumbbell-lower-chart/index.d.ts +1 -0
  92. package/dist/src/nile-dumbbell-lower-chart/index.js +2 -0
  93. package/dist/src/nile-dumbbell-lower-chart/nile-dumbbell-lower-chart.css.d.ts +1 -0
  94. package/dist/src/nile-dumbbell-lower-chart/nile-dumbbell-lower-chart.css.js +28 -0
  95. package/dist/src/nile-dumbbell-lower-chart/nile-dumbbell-lower-chart.d.ts +40 -0
  96. package/dist/src/nile-dumbbell-lower-chart/nile-dumbbell-lower-chart.js +214 -0
  97. package/dist/src/nile-dumbbell-upper-chart/index.d.ts +1 -0
  98. package/dist/src/nile-dumbbell-upper-chart/index.js +2 -0
  99. package/dist/src/nile-dumbbell-upper-chart/nile-dumbbell-upper-chart.css.d.ts +1 -0
  100. package/dist/src/nile-dumbbell-upper-chart/nile-dumbbell-upper-chart.css.js +28 -0
  101. package/dist/src/nile-dumbbell-upper-chart/nile-dumbbell-upper-chart.d.ts +40 -0
  102. package/dist/src/nile-dumbbell-upper-chart/nile-dumbbell-upper-chart.js +214 -0
  103. package/dist/src/nile-euler-chart/index.d.ts +2 -0
  104. package/dist/src/nile-euler-chart/index.js +2 -0
  105. package/dist/src/nile-euler-chart/nile-euler-chart.css.d.ts +1 -0
  106. package/dist/src/nile-euler-chart/nile-euler-chart.css.js +28 -0
  107. package/dist/src/nile-euler-chart/nile-euler-chart.d.ts +38 -0
  108. package/dist/src/nile-euler-chart/nile-euler-chart.js +149 -0
  109. package/dist/src/nile-heatmap-chart/index.d.ts +2 -0
  110. package/dist/src/nile-heatmap-chart/index.js +2 -0
  111. package/dist/src/nile-heatmap-chart/nile-heatmap-chart.css.d.ts +1 -0
  112. package/dist/src/nile-heatmap-chart/nile-heatmap-chart.css.js +28 -0
  113. package/dist/src/nile-heatmap-chart/nile-heatmap-chart.d.ts +49 -0
  114. package/dist/src/nile-heatmap-chart/nile-heatmap-chart.js +259 -0
  115. package/dist/src/nile-histogram-chart/nile-histogram-chart.js +3 -1
  116. package/dist/src/nile-inverted-area-chart/index.d.ts +2 -0
  117. package/dist/src/nile-inverted-area-chart/index.js +2 -0
  118. package/dist/src/nile-inverted-area-chart/nile-inverted-area-chart.css.d.ts +1 -0
  119. package/dist/src/nile-inverted-area-chart/nile-inverted-area-chart.css.js +28 -0
  120. package/dist/src/nile-inverted-area-chart/nile-inverted-area-chart.d.ts +40 -0
  121. package/dist/src/nile-inverted-area-chart/nile-inverted-area-chart.js +173 -0
  122. package/dist/src/nile-line-column-chart/index.d.ts +2 -0
  123. package/dist/src/nile-line-column-chart/index.js +2 -0
  124. package/dist/src/nile-line-column-chart/nile-line-column-chart.css.d.ts +1 -0
  125. package/dist/src/nile-line-column-chart/nile-line-column-chart.css.js +28 -0
  126. package/dist/src/nile-line-column-chart/nile-line-column-chart.d.ts +42 -0
  127. package/dist/src/nile-line-column-chart/nile-line-column-chart.js +205 -0
  128. package/dist/src/nile-lollipop-chart/index.d.ts +2 -0
  129. package/dist/src/nile-lollipop-chart/index.js +2 -0
  130. package/dist/src/nile-lollipop-chart/nile-lollipop-chart.css.d.ts +1 -0
  131. package/dist/src/nile-lollipop-chart/nile-lollipop-chart.css.js +28 -0
  132. package/dist/src/nile-lollipop-chart/nile-lollipop-chart.d.ts +39 -0
  133. package/dist/src/nile-lollipop-chart/nile-lollipop-chart.js +174 -0
  134. package/dist/src/nile-organization-chart/index.d.ts +2 -0
  135. package/dist/src/nile-organization-chart/index.js +2 -0
  136. package/dist/src/nile-organization-chart/nile-organization-chart.css.d.ts +1 -0
  137. package/dist/src/nile-organization-chart/nile-organization-chart.css.js +28 -0
  138. package/dist/src/nile-organization-chart/nile-organization-chart.d.ts +57 -0
  139. package/dist/src/nile-organization-chart/nile-organization-chart.js +206 -0
  140. package/dist/src/nile-polygon-chart/index.d.ts +2 -0
  141. package/dist/src/nile-polygon-chart/index.js +2 -0
  142. package/dist/src/nile-polygon-chart/nile-polygon-chart.css.d.ts +1 -0
  143. package/dist/src/nile-polygon-chart/nile-polygon-chart.css.js +28 -0
  144. package/dist/src/nile-polygon-chart/nile-polygon-chart.d.ts +41 -0
  145. package/dist/src/nile-polygon-chart/nile-polygon-chart.js +167 -0
  146. package/dist/src/nile-radial-bar-chart/index.d.ts +2 -0
  147. package/dist/src/nile-radial-bar-chart/index.js +2 -0
  148. package/dist/src/nile-radial-bar-chart/nile-radial-bar-chart.css.d.ts +1 -0
  149. package/dist/src/nile-radial-bar-chart/nile-radial-bar-chart.css.js +28 -0
  150. package/dist/src/nile-radial-bar-chart/nile-radial-bar-chart.d.ts +42 -0
  151. package/dist/src/nile-radial-bar-chart/nile-radial-bar-chart.js +191 -0
  152. package/dist/src/nile-variable-pie-chart/index.d.ts +2 -0
  153. package/dist/src/nile-variable-pie-chart/index.js +2 -0
  154. package/dist/src/nile-variable-pie-chart/nile-variable-pie-chart.css.d.ts +1 -0
  155. package/dist/src/nile-variable-pie-chart/nile-variable-pie-chart.css.js +28 -0
  156. package/dist/src/nile-variable-pie-chart/nile-variable-pie-chart.d.ts +42 -0
  157. package/dist/src/nile-variable-pie-chart/nile-variable-pie-chart.js +180 -0
  158. package/dist/src/nile-vector-chart/index.d.ts +2 -0
  159. package/dist/src/nile-vector-chart/index.js +2 -0
  160. package/dist/src/nile-vector-chart/nile-vector-chart.css.d.ts +1 -0
  161. package/dist/src/nile-vector-chart/nile-vector-chart.css.js +28 -0
  162. package/dist/src/nile-vector-chart/nile-vector-chart.d.ts +44 -0
  163. package/dist/src/nile-vector-chart/nile-vector-chart.js +181 -0
  164. package/dist/src/nile-xrange-chart/index.d.ts +2 -0
  165. package/dist/src/nile-xrange-chart/index.js +2 -0
  166. package/dist/src/nile-xrange-chart/nile-xrange-chart.css.d.ts +1 -0
  167. package/dist/src/nile-xrange-chart/nile-xrange-chart.css.js +28 -0
  168. package/dist/src/nile-xrange-chart/nile-xrange-chart.d.ts +44 -0
  169. package/dist/src/nile-xrange-chart/nile-xrange-chart.js +193 -0
  170. package/package.json +4 -1
@@ -0,0 +1,173 @@
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-inverted-area-chart.css';
9
+ let NileInvertedAreaChart = class NileInvertedAreaChart extends NileElement {
10
+ constructor() {
11
+ super(...arguments);
12
+ this._hc = null;
13
+ this.chart = null;
14
+ this.resizeObserver = null;
15
+ this.config = null;
16
+ this.chartTitle = '';
17
+ this.chartSubtitle = '';
18
+ this.data = [];
19
+ this.categories = [];
20
+ this.options = {};
21
+ this.loading = false;
22
+ this.height = '400px';
23
+ this.yAxisTitle = '';
24
+ this.stacked = false;
25
+ }
26
+ connectedCallback() {
27
+ super.connectedCallback();
28
+ if (this.config)
29
+ applySeparatedChartConfig(this, this.config);
30
+ }
31
+ disconnectedCallback() {
32
+ super.disconnectedCallback();
33
+ this.destroyChart();
34
+ this.resizeObserver?.disconnect();
35
+ this.resizeObserver = null;
36
+ }
37
+ firstUpdated() {
38
+ this.initChart();
39
+ this.setupResizeObserver();
40
+ }
41
+ updated(changedProperties) {
42
+ if (changedProperties.has('config') && this.config) {
43
+ applySeparatedChartConfig(this, this.config);
44
+ return;
45
+ }
46
+ const props = [
47
+ 'data',
48
+ 'categories',
49
+ 'chartTitle',
50
+ 'chartSubtitle',
51
+ 'options',
52
+ 'height',
53
+ 'yAxisTitle',
54
+ 'stacked',
55
+ 'loading',
56
+ ];
57
+ if (!props.some(p => changedProperties.has(p)))
58
+ return;
59
+ if (this.loading) {
60
+ this.destroyChart();
61
+ return;
62
+ }
63
+ if (this.chart) {
64
+ this.chart.update(this.buildOptions(), true, true);
65
+ }
66
+ else {
67
+ this.initChart();
68
+ }
69
+ }
70
+ setupResizeObserver() {
71
+ if (!this.chartContainer)
72
+ return;
73
+ this.resizeObserver = new ResizeObserver(() => {
74
+ this.chart?.reflow();
75
+ });
76
+ this.resizeObserver.observe(this.chartContainer);
77
+ }
78
+ buildOptions() {
79
+ const self = this;
80
+ return deepMerge({
81
+ chart: { type: 'area', inverted: true, height: this.height },
82
+ title: { text: this.chartTitle || undefined },
83
+ subtitle: { text: this.chartSubtitle || undefined },
84
+ xAxis: { categories: this.categories },
85
+ yAxis: { title: { text: this.yAxisTitle || undefined } },
86
+ tooltip: { shared: true },
87
+ plotOptions: {
88
+ area: { stacking: this.stacked ? 'normal' : undefined, fillOpacity: 0.25 },
89
+ series: {
90
+ cursor: 'pointer',
91
+ point: {
92
+ events: {
93
+ click() {
94
+ self.emit('nile-chart-click', {
95
+ point: this,
96
+ category: this.category,
97
+ value: this.y,
98
+ seriesName: this.series.name,
99
+ });
100
+ },
101
+ },
102
+ },
103
+ },
104
+ },
105
+ series: this.data.map(s => ({
106
+ type: 'area',
107
+ name: s.name,
108
+ data: s.data,
109
+ color: s.color,
110
+ })),
111
+ credits: { enabled: false },
112
+ }, this.options);
113
+ }
114
+ async initChart() {
115
+ if (this.loading || !this.chartContainer)
116
+ return;
117
+ if (!this._hc)
118
+ this._hc = await getHighcharts();
119
+ this.chart = this._hc.chart(this.chartContainer, this.buildOptions());
120
+ this.emit('nile-chart-ready', { chart: this.chart });
121
+ }
122
+ destroyChart() {
123
+ if (this.chart) {
124
+ this.chart.destroy();
125
+ this.chart = null;
126
+ }
127
+ }
128
+ render() {
129
+ if (this.loading) {
130
+ return html `<div class="chart-loading" style="height:${this.height}">Loading...</div>`;
131
+ }
132
+ return html `<div class="chart-container"></div>`;
133
+ }
134
+ };
135
+ NileInvertedAreaChart.styles = styles;
136
+ __decorate([
137
+ query('.chart-container')
138
+ ], NileInvertedAreaChart.prototype, "chartContainer", void 0);
139
+ __decorate([
140
+ property({ type: Object })
141
+ ], NileInvertedAreaChart.prototype, "config", void 0);
142
+ __decorate([
143
+ property({ type: String, attribute: 'chart-title' })
144
+ ], NileInvertedAreaChart.prototype, "chartTitle", void 0);
145
+ __decorate([
146
+ property({ type: String, attribute: 'chart-subtitle' })
147
+ ], NileInvertedAreaChart.prototype, "chartSubtitle", void 0);
148
+ __decorate([
149
+ property({ type: Array })
150
+ ], NileInvertedAreaChart.prototype, "data", void 0);
151
+ __decorate([
152
+ property({ type: Array })
153
+ ], NileInvertedAreaChart.prototype, "categories", void 0);
154
+ __decorate([
155
+ property({ type: Object })
156
+ ], NileInvertedAreaChart.prototype, "options", void 0);
157
+ __decorate([
158
+ property({ type: Boolean, reflect: true })
159
+ ], NileInvertedAreaChart.prototype, "loading", void 0);
160
+ __decorate([
161
+ property({ type: String })
162
+ ], NileInvertedAreaChart.prototype, "height", void 0);
163
+ __decorate([
164
+ property({ type: String, attribute: 'y-axis-title' })
165
+ ], NileInvertedAreaChart.prototype, "yAxisTitle", void 0);
166
+ __decorate([
167
+ property({ type: Boolean })
168
+ ], NileInvertedAreaChart.prototype, "stacked", void 0);
169
+ NileInvertedAreaChart = __decorate([
170
+ customElement('nile-inverted-area-chart')
171
+ ], NileInvertedAreaChart);
172
+ export { NileInvertedAreaChart };
173
+ //# sourceMappingURL=nile-inverted-area-chart.js.map
@@ -0,0 +1,2 @@
1
+ export { NileLineColumnChart } from './nile-line-column-chart.js';
2
+ export type { LineColumnSeriesPart } from './nile-line-column-chart.js';
@@ -0,0 +1,2 @@
1
+ export { NileLineColumnChart } from './nile-line-column-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-line-column-chart.css.js.map
@@ -0,0 +1,42 @@
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 LineColumnSeriesPart {
6
+ name: string;
7
+ data: number[];
8
+ color?: string;
9
+ }
10
+ export declare class NileLineColumnChart extends NileElement {
11
+ static styles: CSSResultGroup;
12
+ private _hc;
13
+ private chart;
14
+ private resizeObserver;
15
+ private chartContainer;
16
+ config: SeparatedChartConfigInputType | null;
17
+ chartTitle: string;
18
+ chartSubtitle: string;
19
+ categories: string[];
20
+ columnSeries: LineColumnSeriesPart;
21
+ lineSeries: LineColumnSeriesPart;
22
+ columnAxisTitle: string;
23
+ lineAxisTitle: string;
24
+ options: Highcharts.Options;
25
+ loading: boolean;
26
+ height: string;
27
+ private applyConfig;
28
+ connectedCallback(): void;
29
+ disconnectedCallback(): void;
30
+ protected firstUpdated(): void;
31
+ protected updated(changedProperties: PropertyValues): void;
32
+ private setupResizeObserver;
33
+ private buildOptions;
34
+ private initChart;
35
+ private destroyChart;
36
+ render(): TemplateResult;
37
+ }
38
+ declare global {
39
+ interface HTMLElementTagNameMap {
40
+ 'nile-line-column-chart': NileLineColumnChart;
41
+ }
42
+ }
@@ -0,0 +1,205 @@
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-line-column-chart.css.js';
9
+ let NileLineColumnChart = class NileLineColumnChart extends NileElement {
10
+ constructor() {
11
+ super(...arguments);
12
+ this._hc = null;
13
+ this.chart = null;
14
+ this.resizeObserver = null;
15
+ this.config = null;
16
+ this.chartTitle = '';
17
+ this.chartSubtitle = '';
18
+ this.categories = [];
19
+ this.columnSeries = { name: '', data: [] };
20
+ this.lineSeries = { name: '', data: [] };
21
+ this.columnAxisTitle = '';
22
+ this.lineAxisTitle = '';
23
+ this.options = {};
24
+ this.loading = false;
25
+ this.height = '400px';
26
+ }
27
+ applyConfig(cfg) {
28
+ applySeparatedChartConfig(this, cfg);
29
+ }
30
+ connectedCallback() {
31
+ super.connectedCallback();
32
+ if (this.config)
33
+ this.applyConfig(this.config);
34
+ }
35
+ disconnectedCallback() {
36
+ super.disconnectedCallback();
37
+ this.destroyChart();
38
+ this.resizeObserver?.disconnect();
39
+ this.resizeObserver = null;
40
+ }
41
+ firstUpdated() {
42
+ this.initChart();
43
+ this.setupResizeObserver();
44
+ }
45
+ updated(changedProperties) {
46
+ if (changedProperties.has('config') && this.config) {
47
+ this.applyConfig(this.config);
48
+ return;
49
+ }
50
+ const props = [
51
+ 'categories',
52
+ 'columnSeries',
53
+ 'lineSeries',
54
+ 'chartTitle',
55
+ 'chartSubtitle',
56
+ 'columnAxisTitle',
57
+ 'lineAxisTitle',
58
+ 'options',
59
+ 'height',
60
+ 'loading',
61
+ ];
62
+ if (!props.some(p => changedProperties.has(p)))
63
+ return;
64
+ if (this.loading) {
65
+ this.destroyChart();
66
+ return;
67
+ }
68
+ if (this.chart) {
69
+ this.chart.update(this.buildOptions(), true, true);
70
+ }
71
+ else {
72
+ this.initChart();
73
+ }
74
+ }
75
+ setupResizeObserver() {
76
+ if (!this.chartContainer)
77
+ return;
78
+ this.resizeObserver = new ResizeObserver(() => {
79
+ this.chart?.reflow();
80
+ });
81
+ this.resizeObserver.observe(this.chartContainer);
82
+ }
83
+ buildOptions() {
84
+ const self = this;
85
+ const col = this.columnSeries;
86
+ const line = this.lineSeries;
87
+ return deepMerge({
88
+ chart: { height: this.height },
89
+ title: { text: this.chartTitle || undefined },
90
+ subtitle: { text: this.chartSubtitle || undefined },
91
+ xAxis: { categories: this.categories, crosshair: true },
92
+ yAxis: [
93
+ {
94
+ title: { text: this.columnAxisTitle || undefined },
95
+ labels: { style: { color: '#64748b' } },
96
+ },
97
+ {
98
+ title: { text: this.lineAxisTitle || undefined },
99
+ opposite: true,
100
+ labels: { style: { color: '#64748b' } },
101
+ },
102
+ ],
103
+ tooltip: { shared: true },
104
+ legend: { enabled: true },
105
+ plotOptions: {
106
+ column: { borderRadius: 2 },
107
+ series: {
108
+ cursor: 'pointer',
109
+ point: {
110
+ events: {
111
+ click() {
112
+ self.emit('nile-chart-click', {
113
+ point: this,
114
+ category: this.category,
115
+ value: this.y,
116
+ seriesName: this.series.name,
117
+ });
118
+ },
119
+ },
120
+ },
121
+ },
122
+ },
123
+ series: [
124
+ {
125
+ type: 'column',
126
+ name: col.name,
127
+ data: col.data,
128
+ color: col.color,
129
+ yAxis: 0,
130
+ },
131
+ {
132
+ type: 'line',
133
+ name: line.name,
134
+ data: line.data,
135
+ color: line.color,
136
+ yAxis: 1,
137
+ marker: { enabled: true, radius: 4 },
138
+ },
139
+ ],
140
+ credits: { enabled: false },
141
+ }, this.options);
142
+ }
143
+ async initChart() {
144
+ if (this.loading || !this.chartContainer)
145
+ return;
146
+ if (!this._hc)
147
+ this._hc = await getHighcharts();
148
+ this.chart = this._hc.chart(this.chartContainer, this.buildOptions());
149
+ this.emit('nile-chart-ready', { chart: this.chart });
150
+ }
151
+ destroyChart() {
152
+ if (this.chart) {
153
+ this.chart.destroy();
154
+ this.chart = null;
155
+ }
156
+ }
157
+ render() {
158
+ if (this.loading) {
159
+ return html `<div class="chart-loading" style="height:${this.height}">Loading...</div>`;
160
+ }
161
+ return html `<div class="chart-container"></div>`;
162
+ }
163
+ };
164
+ NileLineColumnChart.styles = styles;
165
+ __decorate([
166
+ query('.chart-container')
167
+ ], NileLineColumnChart.prototype, "chartContainer", void 0);
168
+ __decorate([
169
+ property({ type: Object })
170
+ ], NileLineColumnChart.prototype, "config", void 0);
171
+ __decorate([
172
+ property({ type: String, attribute: 'chart-title' })
173
+ ], NileLineColumnChart.prototype, "chartTitle", void 0);
174
+ __decorate([
175
+ property({ type: String, attribute: 'chart-subtitle' })
176
+ ], NileLineColumnChart.prototype, "chartSubtitle", void 0);
177
+ __decorate([
178
+ property({ type: Array })
179
+ ], NileLineColumnChart.prototype, "categories", void 0);
180
+ __decorate([
181
+ property({ type: Object })
182
+ ], NileLineColumnChart.prototype, "columnSeries", void 0);
183
+ __decorate([
184
+ property({ type: Object })
185
+ ], NileLineColumnChart.prototype, "lineSeries", void 0);
186
+ __decorate([
187
+ property({ type: String, attribute: 'column-axis-title' })
188
+ ], NileLineColumnChart.prototype, "columnAxisTitle", void 0);
189
+ __decorate([
190
+ property({ type: String, attribute: 'line-axis-title' })
191
+ ], NileLineColumnChart.prototype, "lineAxisTitle", void 0);
192
+ __decorate([
193
+ property({ type: Object })
194
+ ], NileLineColumnChart.prototype, "options", void 0);
195
+ __decorate([
196
+ property({ type: Boolean, reflect: true })
197
+ ], NileLineColumnChart.prototype, "loading", void 0);
198
+ __decorate([
199
+ property({ type: String })
200
+ ], NileLineColumnChart.prototype, "height", void 0);
201
+ NileLineColumnChart = __decorate([
202
+ customElement('nile-line-column-chart')
203
+ ], NileLineColumnChart);
204
+ export { NileLineColumnChart };
205
+ //# sourceMappingURL=nile-line-column-chart.js.map
@@ -0,0 +1,2 @@
1
+ export { NileLollipopChart } from './nile-lollipop-chart.js';
2
+ export type { LollipopSeriesData } from './nile-lollipop-chart.js';
@@ -0,0 +1,2 @@
1
+ export { NileLollipopChart } from './nile-lollipop-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-lollipop-chart.css.js.map
@@ -0,0 +1,39 @@
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 LollipopSeriesData {
6
+ name: string;
7
+ data: number[];
8
+ color?: string;
9
+ }
10
+ export declare class NileLollipopChart extends NileElement {
11
+ static styles: CSSResultGroup;
12
+ private _hc;
13
+ private chart;
14
+ private resizeObserver;
15
+ private chartContainer;
16
+ config: SeparatedChartConfigInputType | null;
17
+ chartTitle: string;
18
+ chartSubtitle: string;
19
+ data: LollipopSeriesData[];
20
+ categories: string[];
21
+ options: Highcharts.Options;
22
+ loading: boolean;
23
+ height: string;
24
+ private applyConfig;
25
+ connectedCallback(): void;
26
+ disconnectedCallback(): void;
27
+ protected firstUpdated(): void;
28
+ protected updated(changedProperties: PropertyValues): void;
29
+ private setupResizeObserver;
30
+ private buildOptions;
31
+ private initChart;
32
+ private destroyChart;
33
+ render(): TemplateResult;
34
+ }
35
+ declare global {
36
+ interface HTMLElementTagNameMap {
37
+ 'nile-lollipop-chart': NileLollipopChart;
38
+ }
39
+ }