@smartbit4all/ng-client 4.2.70 → 4.2.71

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 (127) hide show
  1. package/esm2022/lib/smart-client/smart-component-api-client.mjs +15 -1
  2. package/esm2022/lib/smart-client/smart.component.mjs +9 -2
  3. package/esm2022/lib/smart-component-layout/api/model/componentWidgetType.mjs +2 -1
  4. package/esm2022/lib/smart-component-layout/api/model/layoutDefinitionDescriptor.mjs +2 -0
  5. package/esm2022/lib/smart-component-layout/api/model/models.mjs +2 -1
  6. package/esm2022/lib/smart-component-layout/api/model/smartComponentLayoutDefinition.mjs +1 -1
  7. package/esm2022/lib/smart-component-layout/smart-component-layout-utility.mjs +18 -1
  8. package/esm2022/lib/smart-component-layout/smart-component-layout.component.mjs +33 -3
  9. package/esm2022/lib/smart-component-layout/smart-component-layout.module.mjs +7 -3
  10. package/esm2022/lib/smart-diagram/api/api/api.mjs +4 -0
  11. package/esm2022/lib/smart-diagram/api/api/diagramService.service.mjs +141 -0
  12. package/esm2022/lib/smart-diagram/api/api.module.mjs +40 -0
  13. package/esm2022/lib/smart-diagram/api/configuration.mjs +91 -0
  14. package/esm2022/lib/smart-diagram/api/encoder.mjs +19 -0
  15. package/esm2022/lib/smart-diagram/api/index.mjs +7 -0
  16. package/esm2022/lib/smart-diagram/api/model/diagramColor.mjs +13 -0
  17. package/esm2022/lib/smart-diagram/api/model/diagramDataContainer.mjs +2 -0
  18. package/esm2022/lib/smart-diagram/api/model/diagramDataItem.mjs +13 -0
  19. package/esm2022/lib/smart-diagram/api/model/diagramDataSet.mjs +2 -0
  20. package/esm2022/lib/smart-diagram/api/model/diagramDescriptor.mjs +2 -0
  21. package/esm2022/lib/smart-diagram/api/model/diagramModel.mjs +2 -0
  22. package/esm2022/lib/smart-diagram/api/model/diagramShape.mjs +2 -0
  23. package/esm2022/lib/smart-diagram/api/model/drawTime.mjs +18 -0
  24. package/esm2022/lib/smart-diagram/api/model/labelText.mjs +2 -0
  25. package/esm2022/lib/smart-diagram/api/model/models.mjs +10 -0
  26. package/esm2022/lib/smart-diagram/api/param.mjs +2 -0
  27. package/esm2022/lib/smart-diagram/api/variables.mjs +9 -0
  28. package/esm2022/lib/smart-diagram/component/default-smart-diagram-options.provider.mjs +289 -0
  29. package/esm2022/lib/smart-diagram/component/smart-diagram.component.mjs +341 -0
  30. package/esm2022/lib/smart-diagram/component/smart-diagram.module.mjs +39 -0
  31. package/esm2022/lib/smart-diagram/component/smart-diagram.util.mjs +10 -0
  32. package/esm2022/lib/smart-diagram/projects.mjs +5 -0
  33. package/esm2022/lib/smart-form/widgets/smartformwidget/smartformwidget.component.mjs +3 -3
  34. package/esm2022/lib/smart-grid/api/grid-api/model/gridExportDescriptor.mjs +1 -12
  35. package/esm2022/lib/smart-grid/api/grid-api/model/gridModel.mjs +1 -1
  36. package/esm2022/lib/smart-grid/smart-grid.component.mjs +4 -3
  37. package/esm2022/lib/smart-table/tables/material-table/material-table.component.mjs +3 -3
  38. package/esm2022/lib/smart-table/tables/table.mjs +1 -1
  39. package/esm2022/projects.mjs +2 -1
  40. package/fesm2022/smartbit4all-ng-client.mjs +1231 -180
  41. package/fesm2022/smartbit4all-ng-client.mjs.map +1 -1
  42. package/lib/smart-client/smart-component-api-client.d.ts +4 -1
  43. package/lib/smart-client/smart.component.d.ts +3 -0
  44. package/lib/smart-component-layout/api/model/componentWidgetType.d.ts +2 -1
  45. package/lib/smart-component-layout/api/model/layoutDefinitionDescriptor.d.ts +19 -0
  46. package/lib/smart-component-layout/api/model/models.d.ts +1 -0
  47. package/lib/smart-component-layout/api/model/smartComponentLayoutDefinition.d.ts +2 -0
  48. package/lib/smart-component-layout/smart-component-layout-utility.d.ts +2 -0
  49. package/lib/smart-component-layout/smart-component-layout.component.d.ts +7 -0
  50. package/lib/smart-component-layout/smart-component-layout.module.d.ts +2 -1
  51. package/lib/smart-diagram/api/api/api.d.ts +3 -0
  52. package/lib/smart-diagram/api/api/diagramService.service.d.ts +36 -0
  53. package/lib/smart-diagram/api/encoder.d.ts +11 -0
  54. package/{src/lib/smart-chart/smart-chart/smart-chart2 → lib/smart-diagram}/api/model/diagramColor.d.ts +2 -2
  55. package/{src/lib/smart-chart/smart-chart/smart-chart2 → lib/smart-diagram}/api/model/diagramDataContainer.d.ts +2 -3
  56. package/{src/lib/smart-chart/smart-chart/smart-chart2 → lib/smart-diagram}/api/model/diagramDataItem.d.ts +3 -3
  57. package/{src/lib/smart-chart/smart-chart/smart-chart2 → lib/smart-diagram}/api/model/diagramDataSet.d.ts +4 -4
  58. package/{src/lib/smart-chart/smart-chart/smart-chart2 → lib/smart-diagram}/api/model/diagramDescriptor.d.ts +10 -9
  59. package/{src/lib/smart-chart/smart-chart/smart-chart2/api/model/diagramUiModel.d.ts → lib/smart-diagram/api/model/diagramModel.d.ts} +5 -4
  60. package/{src/lib/smart-chart/smart-chart/smart-chart2 → lib/smart-diagram}/api/model/diagramShape.d.ts +2 -2
  61. package/{src/lib/smart-chart/smart-chart/smart-chart2 → lib/smart-diagram}/api/model/drawTime.d.ts +2 -2
  62. package/{src/lib/smart-chart/smart-chart/smart-chart2 → lib/smart-diagram}/api/model/labelText.d.ts +2 -2
  63. package/{src/lib/smart-chart/smart-chart/smart-chart2 → lib/smart-diagram}/api/model/models.d.ts +1 -2
  64. package/lib/smart-diagram/component/default-smart-diagram-options.provider.d.ts +32 -0
  65. package/lib/smart-diagram/component/smart-diagram.component.d.ts +40 -0
  66. package/lib/smart-diagram/component/smart-diagram.module.d.ts +11 -0
  67. package/lib/smart-diagram/component/smart-diagram.util.d.ts +1 -0
  68. package/lib/smart-diagram/projects.d.ts +4 -0
  69. package/lib/smart-grid/api/grid-api/model/gridExportDescriptor.d.ts +2 -2
  70. package/lib/smart-grid/api/grid-api/model/gridModel.d.ts +1 -0
  71. package/lib/smart-table/tables/table.d.ts +1 -1
  72. package/package.json +1 -7
  73. package/projects.d.ts +1 -0
  74. package/smartbit4all-ng-client-4.2.71.tgz +0 -0
  75. package/esm2022/src/lib/smart-chart/smart-chart/api/model/chartData.mjs +0 -2
  76. package/esm2022/src/lib/smart-chart/smart-chart/api/model/chartDescriptor.mjs +0 -2
  77. package/esm2022/src/lib/smart-chart/smart-chart/api/model/chartOrientation.mjs +0 -16
  78. package/esm2022/src/lib/smart-chart/smart-chart/api/model/chartType.mjs +0 -21
  79. package/esm2022/src/lib/smart-chart/smart-chart/api/model/chartValue.mjs +0 -13
  80. package/esm2022/src/lib/smart-chart/smart-chart/api/model/models.mjs +0 -7
  81. package/esm2022/src/lib/smart-chart/smart-chart/api/model/pieChartLegendPosition.mjs +0 -16
  82. package/esm2022/src/lib/smart-chart/smart-chart/default-chart-options.provider.mjs +0 -233
  83. package/esm2022/src/lib/smart-chart/smart-chart/smart-chart.component.mjs +0 -285
  84. package/esm2022/src/lib/smart-chart/smart-chart/smart-chart.module.mjs +0 -39
  85. package/esm2022/src/lib/smart-chart/smart-chart/smart-chart2/api/api/api.mjs +0 -2
  86. package/esm2022/src/lib/smart-chart/smart-chart/smart-chart2/api/api.module.mjs +0 -40
  87. package/esm2022/src/lib/smart-chart/smart-chart/smart-chart2/api/configuration.mjs +0 -91
  88. package/esm2022/src/lib/smart-chart/smart-chart/smart-chart2/api/index.mjs +0 -7
  89. package/esm2022/src/lib/smart-chart/smart-chart/smart-chart2/api/model/diagramColor.mjs +0 -13
  90. package/esm2022/src/lib/smart-chart/smart-chart/smart-chart2/api/model/diagramDataContainer.mjs +0 -2
  91. package/esm2022/src/lib/smart-chart/smart-chart/smart-chart2/api/model/diagramDataItem.mjs +0 -13
  92. package/esm2022/src/lib/smart-chart/smart-chart/smart-chart2/api/model/diagramDataSet.mjs +0 -2
  93. package/esm2022/src/lib/smart-chart/smart-chart/smart-chart2/api/model/diagramDataSetConstructionInstruction.mjs +0 -13
  94. package/esm2022/src/lib/smart-chart/smart-chart/smart-chart2/api/model/diagramDescriptor.mjs +0 -2
  95. package/esm2022/src/lib/smart-chart/smart-chart/smart-chart2/api/model/diagramShape.mjs +0 -2
  96. package/esm2022/src/lib/smart-chart/smart-chart/smart-chart2/api/model/diagramUiModel.mjs +0 -2
  97. package/esm2022/src/lib/smart-chart/smart-chart/smart-chart2/api/model/drawTime.mjs +0 -18
  98. package/esm2022/src/lib/smart-chart/smart-chart/smart-chart2/api/model/labelText.mjs +0 -2
  99. package/esm2022/src/lib/smart-chart/smart-chart/smart-chart2/api/model/models.mjs +0 -11
  100. package/esm2022/src/lib/smart-chart/smart-chart/smart-chart2/api/param.mjs +0 -2
  101. package/esm2022/src/lib/smart-chart/smart-chart/smart-chart2/api/variables.mjs +0 -9
  102. package/esm2022/src/lib/smart-chart/smart-chart-projects.mjs +0 -9
  103. package/esm2022/src/lib/smart-chart/smartbit4all-ng-client-src-lib-smart-chart.mjs +0 -5
  104. package/esm2022/src/lib/smart-chart/view-context/utility/componentLibrary.mjs +0 -9
  105. package/fesm2022/smartbit4all-ng-client-src-lib-smart-chart.mjs +0 -686
  106. package/fesm2022/smartbit4all-ng-client-src-lib-smart-chart.mjs.map +0 -1
  107. package/smartbit4all-ng-client-4.2.70.tgz +0 -0
  108. package/src/lib/smart-chart/index.d.ts +0 -5
  109. package/src/lib/smart-chart/smart-chart/api/model/chartData.d.ts +0 -16
  110. package/src/lib/smart-chart/smart-chart/api/model/chartDescriptor.d.ts +0 -37
  111. package/src/lib/smart-chart/smart-chart/api/model/chartOrientation.d.ts +0 -16
  112. package/src/lib/smart-chart/smart-chart/api/model/chartType.d.ts +0 -21
  113. package/src/lib/smart-chart/smart-chart/api/model/chartValue.d.ts +0 -16
  114. package/src/lib/smart-chart/smart-chart/api/model/models.d.ts +0 -6
  115. package/src/lib/smart-chart/smart-chart/api/model/pieChartLegendPosition.d.ts +0 -16
  116. package/src/lib/smart-chart/smart-chart/default-chart-options.provider.d.ts +0 -31
  117. package/src/lib/smart-chart/smart-chart/smart-chart.component.d.ts +0 -33
  118. package/src/lib/smart-chart/smart-chart/smart-chart.module.d.ts +0 -11
  119. package/src/lib/smart-chart/smart-chart/smart-chart2/api/api/api.d.ts +0 -1
  120. package/src/lib/smart-chart/smart-chart/smart-chart2/api/model/diagramDataSetConstructionInstruction.d.ts +0 -21
  121. package/src/lib/smart-chart/smart-chart-projects.d.ts +0 -5
  122. package/src/lib/smart-chart/view-context/utility/componentLibrary.d.ts +0 -6
  123. /package/{src/lib/smart-chart/smart-chart/smart-chart2 → lib/smart-diagram}/api/api.module.d.ts +0 -0
  124. /package/{src/lib/smart-chart/smart-chart/smart-chart2 → lib/smart-diagram}/api/configuration.d.ts +0 -0
  125. /package/{src/lib/smart-chart/smart-chart/smart-chart2 → lib/smart-diagram}/api/index.d.ts +0 -0
  126. /package/{src/lib/smart-chart/smart-chart/smart-chart2 → lib/smart-diagram}/api/param.d.ts +0 -0
  127. /package/{src/lib/smart-chart/smart-chart/smart-chart2 → lib/smart-diagram}/api/variables.d.ts +0 -0
@@ -1,686 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { InjectionToken, Injectable, Inject, Optional, EventEmitter, Component, ViewChild, Input, Output, NgModule } from '@angular/core';
3
- import { BrowserModule } from '@angular/platform-browser';
4
- import * as i2 from 'primeng/chart';
5
- import { ChartModule } from 'primeng/chart';
6
- import { Chart } from 'chart.js';
7
- import AnnotationPlugin from 'chartjs-plugin-annotation';
8
- import ZoomPlugin from 'chartjs-plugin-zoom';
9
-
10
- const CUSTOM_CHART_OPTIONS = new InjectionToken("CUSTOM_CHART_OPTIONS");
11
- function transformDataToBasicDataSets(chartData) {
12
- return {
13
- labels: chartData.labels,
14
- datasets: chartData.items.map((dataset) => {
15
- const color = dataset.dataSetcolor || generateRandomColor();
16
- return {
17
- data: dataset.items.map((item) => item.xValue),
18
- label: dataset.label,
19
- backgroundColor: color,
20
- borderColor: color,
21
- };
22
- }),
23
- };
24
- }
25
- function transformDataToBarLikeDataSet(chartData) {
26
- return {
27
- labels: chartData.labels,
28
- datasets: chartData.items.map((dataset) => {
29
- return {
30
- data: dataset.items.map((item) => item.xValue),
31
- label: dataset.label,
32
- backgroundColor: dataset.items.map((item) => item.itemColor || generateRandomColor()),
33
- borderColor: dataset.items.map((item) => item.itemColor || generateRandomColor()),
34
- };
35
- }),
36
- };
37
- }
38
- function transformDataToScatter(chartData) {
39
- return {
40
- datasets: chartData.items.map((dataset) => {
41
- const color = dataset.dataSetcolor || generateRandomColor();
42
- return {
43
- label: dataset.label,
44
- data: dataset.items.map((item) => ({
45
- x: item.xValue,
46
- y: item.yValue,
47
- })),
48
- backgroundColor: color,
49
- borderColor: color,
50
- };
51
- }),
52
- };
53
- }
54
- function transformDataToBubble(chartData) {
55
- return {
56
- datasets: chartData.items.map((dataset) => {
57
- const color = dataset.dataSetcolor || generateRandomColor();
58
- return {
59
- label: dataset.label,
60
- data: dataset.items.map((item) => ({
61
- x: item.xValue,
62
- y: item.yValue,
63
- r: item.rValue ?? 5,
64
- })),
65
- backgroundColor: color,
66
- borderColor: color,
67
- };
68
- }),
69
- };
70
- }
71
- const barChart = {
72
- chartType: "bar",
73
- chartJsType: "bar",
74
- createOptions: () => {
75
- return {};
76
- },
77
- transformData: transformDataToBarLikeDataSet,
78
- };
79
- const horizontalBarChart = {
80
- chartType: "horizontalBar",
81
- chartJsType: "bar",
82
- createOptions: () => {
83
- return {
84
- indexAxis: "y",
85
- };
86
- },
87
- transformData: transformDataToBarLikeDataSet,
88
- };
89
- const radarChart = {
90
- chartType: "radar",
91
- chartJsType: "radar",
92
- createOptions: () => {
93
- return {};
94
- },
95
- transformData: (chartData) => {
96
- return {
97
- labels: chartData.labels,
98
- datasets: chartData.items.map((dataset) => ({
99
- data: dataset.items.map((item) => item.xValue),
100
- label: dataset.label,
101
- borderColor: dataset.dataSetcolor,
102
- pointBackgroundColor: dataset.dataSetcolor,
103
- pointBorderColor: dataset.dataSetcolor,
104
- pointHoverBackgroundColor: "#000000",
105
- pointHoverBorderColor: dataset.dataSetcolor,
106
- })),
107
- };
108
- },
109
- };
110
- const stackedBarChart = {
111
- chartType: "stackedBar",
112
- chartJsType: "bar",
113
- createOptions: () => {
114
- return {
115
- scales: {
116
- x: {
117
- stacked: true,
118
- },
119
- y: {
120
- stacked: true,
121
- },
122
- },
123
- };
124
- },
125
- transformData: transformDataToBasicDataSets,
126
- };
127
- const pieChart = {
128
- chartType: "pie",
129
- chartJsType: "pie",
130
- createOptions: () => {
131
- return {};
132
- },
133
- transformData: transformDataToBarLikeDataSet,
134
- };
135
- const doughnutChart = {
136
- chartType: "doughnut",
137
- chartJsType: "doughnut",
138
- createOptions: () => {
139
- return {};
140
- },
141
- transformData: transformDataToBarLikeDataSet,
142
- };
143
- const scatterChart = {
144
- chartType: "scatter",
145
- chartJsType: "scatter",
146
- createOptions: () => {
147
- return {};
148
- },
149
- transformData: transformDataToScatter,
150
- };
151
- const bubbleChart = {
152
- chartType: "bubble",
153
- chartJsType: "bubble",
154
- createOptions: () => {
155
- return {};
156
- },
157
- transformData: transformDataToBubble,
158
- };
159
- const multiAxisLineChart = {
160
- chartType: "multiAxisLine",
161
- chartJsType: "line",
162
- createOptions: (chartData) => {
163
- const yAxes = chartData.items.map((dataset, index) => ({
164
- id: `y${index == 1 ? "" : index}`,
165
- type: "linear",
166
- position: index % 2 === 0 ? "left" : "right",
167
- }));
168
- return {
169
- scales: {
170
- ...yAxes.reduce((acc, axis) => {
171
- acc[axis.id] = axis;
172
- return acc;
173
- }, {}),
174
- },
175
- };
176
- },
177
- transformData: (chartData) => {
178
- return {
179
- labels: chartData.labels,
180
- datasets: chartData.items.map((dataset, index) => ({
181
- data: dataset.items.map((item) => item.xValue),
182
- label: dataset.label,
183
- yAxisID: `y${index == 1 ? "" : index}`,
184
- backgroundColor: dataset.dataSetcolor,
185
- borderColor: dataset.dataSetcolor,
186
- })),
187
- };
188
- },
189
- };
190
- const polarAreaChart = {
191
- chartType: "polarArea",
192
- chartJsType: "polarArea",
193
- createOptions: () => {
194
- return {};
195
- },
196
- transformData: (chartData) => {
197
- return {
198
- labels: chartData.labels,
199
- datasets: chartData.items.map((dataset) => ({
200
- data: dataset.items.map((item) => item.xValue),
201
- label: dataset.label,
202
- borderColor: dataset.items.map((item) => item.itemColor),
203
- backgroundColor: dataset.items.map((item) => item.itemColor),
204
- })),
205
- };
206
- },
207
- };
208
- class DefaultChartOptionsProvider {
209
- constructor(factories) {
210
- this.factoriesByType = new Map(factories?.map((f) => [f.chartType, f]) ?? []);
211
- }
212
- getFactory(chartType) {
213
- return (this.factoriesByType.get(chartType) ?? {
214
- chartType: chartType,
215
- chartJsType: chartType,
216
- transformData: transformDataToBasicDataSets,
217
- createOptions: () => {
218
- return {};
219
- },
220
- });
221
- }
222
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: DefaultChartOptionsProvider, deps: [{ token: CUSTOM_CHART_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
223
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: DefaultChartOptionsProvider, providedIn: "root" }); }
224
- }
225
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: DefaultChartOptionsProvider, decorators: [{
226
- type: Injectable,
227
- args: [{
228
- providedIn: "root",
229
- }]
230
- }], ctorParameters: () => [{ type: undefined, decorators: [{
231
- type: Inject,
232
- args: [CUSTOM_CHART_OPTIONS]
233
- }, {
234
- type: Optional
235
- }] }] });
236
- function generateRandomColor() {
237
- const random = Math.floor(Math.random() * 16777215).toString(16);
238
- return `#${"000000".substring(0, 6 - random.length) + random}`;
239
- }
240
-
241
- // lib/view-context/utility/componentLibrary.ts
242
- var ComponentLibrary;
243
- (function (ComponentLibrary) {
244
- ComponentLibrary["MATERIAL"] = "material";
245
- ComponentLibrary["PRIMENG"] = "primeng";
246
- })(ComponentLibrary || (ComponentLibrary = {}));
247
- const COMPONENT_LIBRARY = new InjectionToken('COMPONENT_LIBRARY');
248
-
249
- class SmartChartComponent {
250
- constructor(chartOptionProvider, compLib) {
251
- this.chartOptionProvider = chartOptionProvider;
252
- this.plugins = [];
253
- this.dataSelect = new EventEmitter();
254
- this.chartClick = new EventEmitter();
255
- this.onDataClicked = new EventEmitter(); //
256
- this.componentLibrary = ComponentLibrary;
257
- this.compLib = compLib ?? ComponentLibrary.PRIMENG;
258
- Chart.register(AnnotationPlugin);
259
- Chart.register(ZoomPlugin);
260
- }
261
- ngOnInit() {
262
- let options = undefined;
263
- const diagramType = !!this.diagramUiModel.descriptor?.diagramType
264
- ? this.diagramUiModel.descriptor.diagramType
265
- : "";
266
- const factory = this.chartOptionProvider.getFactory(diagramType);
267
- this.type = factory.chartJsType;
268
- options = factory.createOptions(this.diagramUiModel.diagramData);
269
- if (this.diagramUiModel.descriptor) {
270
- options = this.deepMerge(this.convertBackendOptions(this.diagramUiModel.descriptor), options);
271
- }
272
- if (this.options) {
273
- options = this.deepMerge(this.options, options);
274
- }
275
- this.options = options;
276
- this.data = factory.transformData(this.diagramUiModel.diagramData);
277
- }
278
- deepMerge(target, source) {
279
- for (const key of Object.keys(source)) {
280
- if (source[key] instanceof Object && target[key]) {
281
- Object.assign(source[key], this.deepMerge(target[key], source[key]));
282
- }
283
- }
284
- Object.assign(target || {}, source);
285
- return target;
286
- }
287
- convertBackendOptions(descriptor) {
288
- const options = {
289
- plugins: {
290
- legend: {
291
- display: descriptor.showLegendForChart ?? true,
292
- },
293
- },
294
- scales: {},
295
- };
296
- if (descriptor.diagramMinX !== undefined &&
297
- descriptor.diagramMaxX !== undefined) {
298
- options.scales.x = {
299
- ticks: {
300
- display: descriptor.showLabelsForXAxis ?? true,
301
- },
302
- min: descriptor.diagramMinX,
303
- max: descriptor.diagramMaxX,
304
- };
305
- }
306
- else {
307
- options.scales.x = {
308
- ticks: {
309
- display: descriptor.showLabelsForXAxis ?? true,
310
- },
311
- };
312
- }
313
- if (descriptor.diagramMinY !== undefined &&
314
- descriptor.diagramMaxY !== undefined) {
315
- options.scales.y = {
316
- ticks: {
317
- display: descriptor.showLabelsForYAxis ?? true,
318
- },
319
- min: descriptor.diagramMinY,
320
- max: descriptor.diagramMaxY,
321
- };
322
- }
323
- else {
324
- options.scales.y = {
325
- ticks: {
326
- display: descriptor.showLabelsForYAxis ?? true,
327
- },
328
- };
329
- }
330
- //Create shapes
331
- if (descriptor.diagramShapes) {
332
- descriptor.diagramShapes.forEach((shape, index) => {
333
- options.plugins.annotation = options.plugins.annotation || {};
334
- options.plugins.annotation.annotations =
335
- options.plugins.annotation.annotations || {};
336
- let borderColor = `rgba(
337
- ${shape.borderColor?.red ?? 0},
338
- ${shape.borderColor?.green ?? 0},
339
- ${shape.borderColor?.blue ?? 0},
340
- ${shape.borderColor?.alpha ?? 1})`;
341
- let backgroundColor = `rgba(
342
- ${shape.backgroundColor?.red ?? 0},
343
- ${shape.backgroundColor?.green ?? 0},
344
- ${shape.backgroundColor?.blue ?? 0},
345
- ${shape.backgroundColor?.alpha ?? 1})`;
346
- let fontColor = `rgba(
347
- ${shape.labelText?.color?.red ?? 0},
348
- ${shape.labelText?.color?.green ?? 0},
349
- ${shape.labelText?.color?.blue ?? 0},
350
- ${shape.labelText?.color?.alpha ?? 1})`;
351
- let borderDash;
352
- if (shape.borderDashLength && shape.borderDashGap) {
353
- borderDash = [shape.borderDashLength, shape.borderDashGap];
354
- }
355
- else {
356
- borderDash = undefined;
357
- }
358
- const baseAnnotation = {
359
- type: shape.shapeType ?? "line",
360
- backgroundColor: backgroundColor ?? undefined,
361
- borderColor: borderColor ?? undefined,
362
- borderWidth: shape.borderWidth ?? 1,
363
- borderDash: borderDash ?? undefined,
364
- drawTime: shape.drawTime ?? undefined,
365
- };
366
- switch (shape.shapeType) {
367
- case "box":
368
- case "line":
369
- case "ellipse":
370
- options.plugins.annotation.annotations[`shape${index}`] = {
371
- ...baseAnnotation,
372
- xMin: shape.xMin ?? undefined,
373
- xMax: shape.xMax ?? undefined,
374
- yMin: shape.yMin ?? undefined,
375
- yMax: shape.yMax ?? undefined,
376
- };
377
- break;
378
- case "label":
379
- options.plugins.annotation.annotations[`shape${index}`] = {
380
- ...baseAnnotation,
381
- xValue: shape.xMin ?? undefined,
382
- yValue: shape.yMin ?? undefined,
383
- content: shape.labelText?.content ?? undefined,
384
- textAlign: shape.labelText?.textAlign ?? undefined,
385
- color: fontColor ?? undefined,
386
- font: {
387
- size: shape.labelText?.size ?? undefined,
388
- weight: shape.labelText?.weight ?? undefined,
389
- style: shape.labelText?.style ?? undefined,
390
- },
391
- };
392
- break;
393
- case "point":
394
- case "polygon":
395
- options.plugins.annotation.annotations[`shape${index}`] = {
396
- ...baseAnnotation,
397
- xValue: shape.xMin ?? undefined,
398
- yValue: shape.yMin ?? undefined,
399
- };
400
- break;
401
- default:
402
- // Optionally handle any other shape types
403
- console.warn(`Unknown shape type: ${shape.shapeType}`);
404
- break;
405
- }
406
- });
407
- }
408
- if (descriptor.backgroundColor) {
409
- let backgroundColor = `rgba(
410
- ${descriptor.backgroundColor?.red ?? 0},
411
- ${descriptor.backgroundColor?.green ?? 0},
412
- ${descriptor.backgroundColor?.blue ?? 0},
413
- ${descriptor.backgroundColor?.alpha ?? 1})`;
414
- let id = "customCanvasBackgroundColor";
415
- const plugin = {
416
- id: id,
417
- beforeDraw: (chart, args, options) => {
418
- const { ctx, chartArea } = chart;
419
- ctx.save();
420
- ctx.globalCompositeOperation = "destination-over";
421
- ctx.fillStyle = backgroundColor;
422
- ctx.fillRect(chartArea.left, chartArea.top, chartArea.right - chartArea.left, chartArea.bottom - chartArea.top);
423
- ctx.restore();
424
- },
425
- };
426
- this.plugins.push(plugin);
427
- options.plugins[`${id}`] = {
428
- color: backgroundColor,
429
- };
430
- }
431
- return options;
432
- }
433
- onDataSelect(event) {
434
- this.dataSelect.emit(event);
435
- }
436
- handleChartClick(event) {
437
- this.chartClick.emit(event);
438
- }
439
- handleOnDataClicked(event) {
440
- const canvas = event.target;
441
- const chart = Chart.getChart(canvas);
442
- if (chart) {
443
- const elements = chart.getElementsAtEventForMode(event, "nearest", { intersect: true }, false);
444
- if (elements.length === 0) {
445
- return;
446
- }
447
- const clickedItems = chart.tooltip?.dataPoints?.map((item) => {
448
- return {
449
- datasetIndex: item.datasetIndex,
450
- itemIndex: item.dataIndex,
451
- element: item.element,
452
- };
453
- });
454
- this.onDataClicked.emit({ event, clickedItems });
455
- }
456
- }
457
- getBase64Image() {
458
- return this.chart?.getBase64Image();
459
- }
460
- refresh() {
461
- return this.chart?.refresh();
462
- }
463
- getChart() {
464
- return this.chart?.chart;
465
- }
466
- getVisiblePoints() {
467
- if (!this.chart)
468
- return;
469
- const chartInstance = this.chart.chart;
470
- if (!chartInstance)
471
- return;
472
- const visiblePoints = [];
473
- chartInstance.data.datasets.forEach((dataset, datasetIndex) => {
474
- const meta = chartInstance.getDatasetMeta(datasetIndex);
475
- // Check if the dataset is hidden
476
- if (!chartInstance.isDatasetVisible(datasetIndex)) {
477
- return;
478
- }
479
- const xMin = meta.xScale.min;
480
- const xMax = meta.xScale.max;
481
- const yMin = meta.yScale.min;
482
- const yMax = meta.yScale.max;
483
- dataset.data.forEach((point, dataIndex) => {
484
- const { x, y } = point;
485
- if (x >= xMin && x <= xMax && y >= yMin && y <= yMax) {
486
- visiblePoints.push({
487
- datasetIndex,
488
- dataIndex,
489
- x,
490
- y,
491
- });
492
- }
493
- });
494
- });
495
- return visiblePoints;
496
- }
497
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: SmartChartComponent, deps: [{ token: DefaultChartOptionsProvider }, { token: COMPONENT_LIBRARY, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
498
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.11", type: SmartChartComponent, selector: "smart-chart", inputs: { diagramUiModel: "diagramUiModel", options: "options", plugins: "plugins" }, outputs: { dataSelect: "dataSelect", chartClick: "chartClick", onDataClicked: "onDataClicked" }, viewQueries: [{ propertyName: "chart", first: true, predicate: ["chartJSRef"], descendants: true }], ngImport: i0, template: "@if(compLib === componentLibrary.PRIMENG) {\r\n<p-chart\r\n #chartJSRef\r\n [type]=\"type\"\r\n [data]=\"data\"\r\n [options]=\"options\"\r\n [plugins]=\"plugins\"\r\n (onDataSelect)=\"onDataSelect($event)\"\r\n (click)=\"handleChartClick($event)\"\r\n (click)=\"handleOnDataClicked($event)\"\r\n/>\r\n} @else {\r\n<p>Only PrimeNg component library is supported</p>\r\n}\r\n", styles: [""], dependencies: [{ kind: "component", type: i2.UIChart, selector: "p-chart", inputs: ["type", "plugins", "width", "height", "responsive", "ariaLabel", "ariaLabelledBy", "data", "options"], outputs: ["onDataSelect"] }] }); }
499
- }
500
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: SmartChartComponent, decorators: [{
501
- type: Component,
502
- args: [{ selector: "smart-chart", template: "@if(compLib === componentLibrary.PRIMENG) {\r\n<p-chart\r\n #chartJSRef\r\n [type]=\"type\"\r\n [data]=\"data\"\r\n [options]=\"options\"\r\n [plugins]=\"plugins\"\r\n (onDataSelect)=\"onDataSelect($event)\"\r\n (click)=\"handleChartClick($event)\"\r\n (click)=\"handleOnDataClicked($event)\"\r\n/>\r\n} @else {\r\n<p>Only PrimeNg component library is supported</p>\r\n}\r\n" }]
503
- }], ctorParameters: () => [{ type: DefaultChartOptionsProvider }, { type: ComponentLibrary, decorators: [{
504
- type: Inject,
505
- args: [COMPONENT_LIBRARY]
506
- }, {
507
- type: Optional
508
- }] }], propDecorators: { chart: [{
509
- type: ViewChild,
510
- args: ["chartJSRef"]
511
- }], diagramUiModel: [{
512
- type: Input
513
- }], options: [{
514
- type: Input
515
- }], plugins: [{
516
- type: Input
517
- }], dataSelect: [{
518
- type: Output
519
- }], chartClick: [{
520
- type: Output
521
- }], onDataClicked: [{
522
- type: Output
523
- }] } });
524
-
525
- const DEFAULT_PROVIDERS = [
526
- DefaultChartOptionsProvider,
527
- { provide: CUSTOM_CHART_OPTIONS, useValue: barChart, multi: true },
528
- { provide: CUSTOM_CHART_OPTIONS, useValue: scatterChart, multi: true },
529
- { provide: CUSTOM_CHART_OPTIONS, useValue: bubbleChart, multi: true },
530
- { provide: CUSTOM_CHART_OPTIONS, useValue: horizontalBarChart, multi: true },
531
- { provide: CUSTOM_CHART_OPTIONS, useValue: stackedBarChart, multi: true },
532
- { provide: CUSTOM_CHART_OPTIONS, useValue: multiAxisLineChart, multi: true },
533
- { provide: CUSTOM_CHART_OPTIONS, useValue: polarAreaChart, multi: true },
534
- { provide: CUSTOM_CHART_OPTIONS, useValue: radarChart, multi: true },
535
- { provide: CUSTOM_CHART_OPTIONS, useValue: doughnutChart, multi: true },
536
- { provide: CUSTOM_CHART_OPTIONS, useValue: pieChart, multi: true },
537
- ];
538
- class SmartChartModule {
539
- static forRoot(providers) {
540
- return {
541
- ngModule: SmartChartModule,
542
- providers: [...DEFAULT_PROVIDERS, ...providers],
543
- };
544
- }
545
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: SmartChartModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
546
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.11", ngImport: i0, type: SmartChartModule, declarations: [SmartChartComponent], imports: [BrowserModule, ChartModule], exports: [SmartChartComponent] }); }
547
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: SmartChartModule, imports: [BrowserModule, ChartModule] }); }
548
- }
549
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: SmartChartModule, decorators: [{
550
- type: NgModule,
551
- args: [{
552
- declarations: [SmartChartComponent],
553
- imports: [BrowserModule, ChartModule],
554
- exports: [SmartChartComponent],
555
- }]
556
- }] });
557
-
558
- /**
559
- * Chart API
560
- * API for consume charts.
561
- *
562
- * The version of the OpenAPI document: 1.0.0
563
- * Contact: info@it4all.hu
564
- *
565
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
566
- * https://openapi-generator.tech
567
- * Do not edit the class manually.
568
- */
569
- const ChartOrientation = {
570
- Horizontal: 'Horizontal',
571
- Vertical: 'Vertical'
572
- };
573
-
574
- /**
575
- * Chart API
576
- * API for consume charts.
577
- *
578
- * The version of the OpenAPI document: 1.0.0
579
- * Contact: info@it4all.hu
580
- *
581
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
582
- * https://openapi-generator.tech
583
- * Do not edit the class manually.
584
- */
585
- const ChartType = {
586
- BarChart: 'BarChart',
587
- GroupedBarChart: 'GroupedBarChart',
588
- StackedBarChart: 'StackedBarChart',
589
- NormalizedBarChart: 'NormalizedBarChart',
590
- PieChart: 'PieChart',
591
- AdvancedPieChart: 'AdvancedPieChart',
592
- PieGrid: 'PieGrid'
593
- };
594
-
595
- /**
596
- * Chart API
597
- * API for consume charts.
598
- *
599
- * The version of the OpenAPI document: 1.0.0
600
- * Contact: info@it4all.hu
601
- *
602
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
603
- * https://openapi-generator.tech
604
- * Do not edit the class manually.
605
- */
606
-
607
- /**
608
- * Chart API
609
- * API for consume charts.
610
- *
611
- * The version of the OpenAPI document: 1.0.0
612
- * Contact: info@it4all.hu
613
- *
614
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
615
- * https://openapi-generator.tech
616
- * Do not edit the class manually.
617
- */
618
- const PieChartLegendPosition = {
619
- Right: 'right',
620
- Below: 'below'
621
- };
622
-
623
- /**
624
- * smartchart API
625
- * Describes a model for smart chart.
626
- *
627
- * The version of the OpenAPI document: 1.0.0
628
- * Contact: info@it4all.hu
629
- *
630
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
631
- * https://openapi-generator.tech
632
- * Do not edit the class manually.
633
- */
634
-
635
- /**
636
- * smartchart API
637
- * Describes a model for smart chart.
638
- *
639
- * The version of the OpenAPI document: 1.0.0
640
- * Contact: info@it4all.hu
641
- *
642
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
643
- * https://openapi-generator.tech
644
- * Do not edit the class manually.
645
- */
646
-
647
- /**
648
- * smartchart API
649
- * Describes a model for smart chart.
650
- *
651
- * The version of the OpenAPI document: 1.0.0
652
- * Contact: info@it4all.hu
653
- *
654
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
655
- * https://openapi-generator.tech
656
- * Do not edit the class manually.
657
- */
658
-
659
- /**
660
- * smartchart API
661
- * Describes a model for smart chart.
662
- *
663
- * The version of the OpenAPI document: 1.0.0
664
- * Contact: info@it4all.hu
665
- *
666
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
667
- * https://openapi-generator.tech
668
- * Do not edit the class manually.
669
- */
670
- const DrawTime = {
671
- BeforeDraw: 'beforeDraw',
672
- BeforeDatasetsDraw: 'beforeDatasetsDraw',
673
- AfterDatasetsDraw: 'afterDatasetsDraw',
674
- AfterDraw: 'afterDraw'
675
- };
676
-
677
- /*
678
- * Public API Surface of smart-chart
679
- */
680
-
681
- /**
682
- * Generated bundle index. Do not edit.
683
- */
684
-
685
- export { CUSTOM_CHART_OPTIONS, ChartOrientation, ChartType, DefaultChartOptionsProvider, DrawTime, PieChartLegendPosition, SmartChartComponent, SmartChartModule, barChart, bubbleChart, doughnutChart, horizontalBarChart, multiAxisLineChart, pieChart, polarAreaChart, radarChart, scatterChart, stackedBarChart, transformDataToBarLikeDataSet, transformDataToBasicDataSets, transformDataToBubble, transformDataToScatter };
686
- //# sourceMappingURL=smartbit4all-ng-client-src-lib-smart-chart.mjs.map