@ebuilding/chart 2.0.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 (72) hide show
  1. package/LICENSE +0 -0
  2. package/README.md +0 -0
  3. package/echart/bar/index.d.ts +1 -0
  4. package/echart/bar/src/default/index.d.ts +34 -0
  5. package/echart/bar/src/index.module.d.ts +7 -0
  6. package/echart/bar/src/public_api.d.ts +2 -0
  7. package/echart/bar2/index.d.ts +1 -0
  8. package/echart/bar2/src/default/index.d.ts +33 -0
  9. package/echart/bar2/src/index.module.d.ts +7 -0
  10. package/echart/bar2/src/public_api.d.ts +2 -0
  11. package/echart/content/index.d.ts +1 -0
  12. package/echart/content/src/default/index.d.ts +26 -0
  13. package/echart/content/src/index.module.d.ts +7 -0
  14. package/echart/content/src/public_api.d.ts +2 -0
  15. package/echart/index.d.ts +8 -0
  16. package/echart/indicator/index.d.ts +1 -0
  17. package/echart/indicator/src/default/index.d.ts +18 -0
  18. package/echart/indicator/src/index.module.d.ts +7 -0
  19. package/echart/indicator/src/public_api.d.ts +2 -0
  20. package/echart/line/index.d.ts +1 -0
  21. package/echart/line/src/default/index.d.ts +33 -0
  22. package/echart/line/src/index.module.d.ts +7 -0
  23. package/echart/line/src/public_api.d.ts +2 -0
  24. package/echart/number/index.d.ts +1 -0
  25. package/echart/number/src/default/index.d.ts +17 -0
  26. package/echart/number/src/index.module.d.ts +7 -0
  27. package/echart/number/src/public_api.d.ts +2 -0
  28. package/echart/pie/index.d.ts +1 -0
  29. package/echart/pie/src/default/index.d.ts +28 -0
  30. package/echart/pie/src/index.module.d.ts +7 -0
  31. package/echart/pie/src/public_api.d.ts +2 -0
  32. package/echart/radar/index.d.ts +1 -0
  33. package/echart/radar/src/default/index.d.ts +29 -0
  34. package/echart/radar/src/index.module.d.ts +7 -0
  35. package/echart/radar/src/public_api.d.ts +2 -0
  36. package/echart/sort/index.d.ts +1 -0
  37. package/echart/sort/src/default/index.d.ts +16 -0
  38. package/echart/sort/src/index.module.d.ts +7 -0
  39. package/echart/sort/src/public_api.d.ts +2 -0
  40. package/fesm2022/chart.echart.mjs +885 -0
  41. package/fesm2022/chart.echart.mjs.map +1 -0
  42. package/fesm2022/chart.report.mjs +145 -0
  43. package/fesm2022/chart.report.mjs.map +1 -0
  44. package/fesm2022/ebuilding-chart.mjs +8 -0
  45. package/fesm2022/ebuilding-chart.mjs.map +1 -0
  46. package/fesm2022/echart.bar.mjs +208 -0
  47. package/fesm2022/echart.bar.mjs.map +1 -0
  48. package/fesm2022/echart.bar2.mjs +179 -0
  49. package/fesm2022/echart.bar2.mjs.map +1 -0
  50. package/fesm2022/echart.content.mjs +100 -0
  51. package/fesm2022/echart.content.mjs.map +1 -0
  52. package/fesm2022/echart.indicator.mjs +70 -0
  53. package/fesm2022/echart.indicator.mjs.map +1 -0
  54. package/fesm2022/echart.line.mjs +165 -0
  55. package/fesm2022/echart.line.mjs.map +1 -0
  56. package/fesm2022/echart.number.mjs +58 -0
  57. package/fesm2022/echart.number.mjs.map +1 -0
  58. package/fesm2022/echart.pie.mjs +133 -0
  59. package/fesm2022/echart.pie.mjs.map +1 -0
  60. package/fesm2022/echart.radar.mjs +119 -0
  61. package/fesm2022/echart.radar.mjs.map +1 -0
  62. package/fesm2022/echart.sort.mjs +51 -0
  63. package/fesm2022/echart.sort.mjs.map +1 -0
  64. package/fesm2022/srv.base.mjs +151 -0
  65. package/fesm2022/srv.base.mjs.map +1 -0
  66. package/index.d.ts +3 -0
  67. package/package.json +68 -0
  68. package/report/index.d.ts +1 -0
  69. package/report/src/default/index.d.ts +21 -0
  70. package/report/src/index.module.d.ts +7 -0
  71. package/report/src/public_api.d.ts +2 -0
  72. package/service/index.d.ts +53 -0
@@ -0,0 +1,885 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Component, NgModule } from '@angular/core';
3
+ import * as i1 from '@angular/common';
4
+ import { CommonModule } from '@angular/common';
5
+ import * as echarts from 'echarts/core';
6
+ import { BarChart, LineChart, PieChart, RadarChart } from 'echarts/charts';
7
+ import { TitleComponent, TooltipComponent, GridComponent, LegendComponent } from 'echarts/components';
8
+ import { CanvasRenderer } from 'echarts/renderers';
9
+ import { GramBaseChartService } from '@ebuilding/chart/service';
10
+ import _ from 'lodash';
11
+
12
+ /**
13
+ * 柱状图
14
+ */
15
+ echarts.use([BarChart, TitleComponent, TooltipComponent, GridComponent, LegendComponent, CanvasRenderer]);
16
+ class EchartBarMainComponent extends GramBaseChartService {
17
+ color = [
18
+ '#71D1FF',
19
+ '#71A9FF',
20
+ '#8C94FC',
21
+ '#DDB0F0',
22
+ '#FFCA5E',
23
+ '#FFB15E',
24
+ '#71D1FF',
25
+ '#71A9FF',
26
+ '#8C94FC',
27
+ '#DDB0F0',
28
+ '#FFCA5E',
29
+ '#FFB15E',
30
+ ];
31
+ constructor() {
32
+ super();
33
+ }
34
+ ngOnInit() { }
35
+ /**
36
+ * 初始化数据
37
+ */
38
+ initChartData() {
39
+ if (this.config && this.config.data && this.config.data.val && Array.isArray(this.config.data.val)) {
40
+ let isSingle = this.config.data.val.length == 1;
41
+ this.chartData = this.config.data.val.map((item, index) => {
42
+ if (!isSingle) {
43
+ item.data = item.data.map((a) => {
44
+ let newA = { value: a, itemStyle: { color: this.color[index] } };
45
+ return newA;
46
+ });
47
+ }
48
+ let obj = {
49
+ type: 'bar',
50
+ name: item.text,
51
+ data: item.data,
52
+ barMaxWidth: 35,
53
+ label: this.config.data?.label ? this.config.data.label : {},
54
+ itemStyle: isSingle == true
55
+ ? {
56
+ normal: {
57
+ borderRadius: [12, 12, 0, 0],
58
+ color: (a) => {
59
+ return this.color[a.dataIndex];
60
+ },
61
+ },
62
+ }
63
+ : {
64
+ normal: {
65
+ borderRadius: [12, 12, 0, 0],
66
+ },
67
+ },
68
+ };
69
+ if (item?.type && item.type == 'line') {
70
+ obj['type'] = 'line';
71
+ obj['lineStyle'] = {
72
+ color: this.color[index],
73
+ };
74
+ }
75
+ return obj;
76
+ });
77
+ }
78
+ }
79
+ /**
80
+ * 初始化X轴
81
+ * @returns
82
+ */
83
+ initChartAxis() {
84
+ if (this.config &&
85
+ this.config.data &&
86
+ this.config.data.x &&
87
+ this.config.data.x.data &&
88
+ Array.isArray(this.config.data.x.data)) {
89
+ return _.cloneDeep(this.config.data.x.data);
90
+ }
91
+ }
92
+ /**
93
+ * 初始化图表配置
94
+ */
95
+ initChartOption() {
96
+ this.chartOption = {
97
+ title: this.chartTitle,
98
+ animation: this.config?.animation == false ? false : true,
99
+ color: this.color,
100
+ grid: {
101
+ left: '3%',
102
+ right: '18',
103
+ y2: '50',
104
+ containLabel: true,
105
+ },
106
+ legend: this.chartLegend,
107
+ tooltip: {},
108
+ yAxis: {
109
+ splitLine: {
110
+ show: true,
111
+ lineStyle: {
112
+ type: 'dashed',
113
+ },
114
+ },
115
+ },
116
+ xAxis: {
117
+ type: 'category',
118
+ data: this.initChartAxis(),
119
+ splitLine: {
120
+ show: true,
121
+ lineStyle: {
122
+ type: 'dashed',
123
+ },
124
+ },
125
+ axisPointer: {
126
+ type: 'shadow',
127
+ },
128
+ axisLine: {
129
+ lineStyle: {
130
+ color: '#dbdbdb',
131
+ width: '1',
132
+ type: 'dotted',
133
+ },
134
+ },
135
+ axisLabel: {
136
+ textStyle: {
137
+ color: '#4d4d4d',
138
+ },
139
+ },
140
+ nameTextStyle: {
141
+ color: '#4d4d4d',
142
+ },
143
+ axisTick: {
144
+ lineStyle: {
145
+ show: true,
146
+ color: '#dbdbdb',
147
+ type: 'dotted',
148
+ },
149
+ },
150
+ },
151
+ series: this.chartData,
152
+ };
153
+ }
154
+ /**
155
+ * 初始化图表数据
156
+ */
157
+ loadChartInfo() {
158
+ if (this.config) {
159
+ this.initChartData();
160
+ this.initChartLegend();
161
+ this.initChartTitle();
162
+ this.initChartOption();
163
+ setTimeout(() => {
164
+ this.renderChart();
165
+ }, 0);
166
+ }
167
+ }
168
+ /**
169
+ * 渲染图表
170
+ */
171
+ renderChart() {
172
+ if (!this.chartInstance) {
173
+ this.chartInstance = echarts.init(this.chartContainer.nativeElement);
174
+ this.chartInstance.setOption(this.chartOption);
175
+ window.addEventListener('resize', () => {
176
+ this.chartInstance?.resize();
177
+ });
178
+ }
179
+ }
180
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartBarMainComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
181
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: EchartBarMainComponent, isStandalone: true, selector: "echart-bar", usesInheritance: true, ngImport: i0, template: "<div #chartContainer id=\"chartContainer\" style=\"width: 100%; height: 100%;\"></div>", styles: [":host ::ng-deep{display:flex;flex:1;flex-direction:column;width:100%;height:100%}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
182
+ }
183
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartBarMainComponent, decorators: [{
184
+ type: Component,
185
+ args: [{ selector: 'echart-bar', imports: [
186
+ CommonModule
187
+ ], template: "<div #chartContainer id=\"chartContainer\" style=\"width: 100%; height: 100%;\"></div>", styles: [":host ::ng-deep{display:flex;flex:1;flex-direction:column;width:100%;height:100%}\n"] }]
188
+ }], ctorParameters: () => [] });
189
+
190
+ const components$7 = [EchartBarMainComponent];
191
+ class EchartBarModule {
192
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartBarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
193
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.15", ngImport: i0, type: EchartBarModule, imports: [EchartBarMainComponent], exports: [EchartBarMainComponent] });
194
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartBarModule, imports: [components$7] });
195
+ }
196
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartBarModule, decorators: [{
197
+ type: NgModule,
198
+ args: [{
199
+ imports: [...components$7],
200
+ exports: [...components$7],
201
+ }]
202
+ }] });
203
+
204
+ /**
205
+ * 条形图
206
+ */
207
+ echarts.use([BarChart, TitleComponent, TooltipComponent, GridComponent, LegendComponent, CanvasRenderer]);
208
+ class EchartBar2MainComponent extends GramBaseChartService {
209
+ constructor() {
210
+ super();
211
+ }
212
+ ngOnInit() { }
213
+ /**
214
+ * 初始化数据
215
+ */
216
+ initChartData() {
217
+ if (this.config && this.config.data && this.config.data.val && Array.isArray(this.config.data.val)) {
218
+ let isSingle = this.config.data.val.length == 1;
219
+ this.chartData = this.config.data.val.map((item, index) => {
220
+ let obj = {
221
+ type: 'bar',
222
+ name: item.text,
223
+ data: item.data,
224
+ barMaxWidth: 35,
225
+ itemStyle: isSingle == true
226
+ ? {
227
+ normal: {
228
+ borderRadius: [0, 12, 12, 0],
229
+ color: (a) => {
230
+ return this.color[a.dataIndex];
231
+ },
232
+ },
233
+ }
234
+ : {
235
+ normal: {
236
+ borderRadius: [0, 12, 12, 0],
237
+ },
238
+ },
239
+ };
240
+ return obj;
241
+ });
242
+ }
243
+ }
244
+ /**
245
+ * 初始化X轴
246
+ * @returns
247
+ */
248
+ initChartAxis() {
249
+ if (this.config &&
250
+ this.config.data &&
251
+ this.config.data.x &&
252
+ this.config.data.x.data &&
253
+ Array.isArray(this.config.data.x.data)) {
254
+ return _.cloneDeep(this.config.data.x.data);
255
+ }
256
+ }
257
+ /**
258
+ * 初始化图表配置
259
+ */
260
+ initChartOption() {
261
+ this.chartOption = {
262
+ color: this.color,
263
+ grid: {
264
+ left: '3%',
265
+ right: '18',
266
+ y2: '50',
267
+ containLabel: true,
268
+ },
269
+ legend: this.chartLegend,
270
+ tooltip: {},
271
+ yAxis: {
272
+ type: 'category',
273
+ data: this.initChartAxis(),
274
+ splitLine: {
275
+ show: true,
276
+ lineStyle: {
277
+ type: 'dashed',
278
+ },
279
+ },
280
+ axisPointer: {
281
+ type: 'shadow',
282
+ },
283
+ axisLine: {
284
+ lineStyle: {
285
+ color: '#dbdbdb',
286
+ width: '1',
287
+ type: 'dotted',
288
+ },
289
+ },
290
+ axisLabel: {
291
+ textStyle: {
292
+ color: '#4d4d4d',
293
+ },
294
+ },
295
+ nameTextStyle: {
296
+ color: '#4d4d4d',
297
+ },
298
+ axisTick: {
299
+ lineStyle: {
300
+ show: true,
301
+ color: '#dbdbdb',
302
+ type: 'dotted',
303
+ },
304
+ },
305
+ },
306
+ xAxis: {
307
+ type: 'value',
308
+ splitLine: {
309
+ show: true,
310
+ lineStyle: {
311
+ type: 'dashed',
312
+ },
313
+ },
314
+ },
315
+ series: this.chartData,
316
+ };
317
+ }
318
+ /**
319
+ * 初始化图表数据
320
+ */
321
+ loadChartInfo() {
322
+ if (this.config) {
323
+ this.initChartData();
324
+ this.initChartLegend();
325
+ this.initChartOption();
326
+ setTimeout(() => {
327
+ this.renderChart();
328
+ }, 0);
329
+ }
330
+ }
331
+ /**
332
+ * 渲染图表
333
+ */
334
+ renderChart() {
335
+ if (!this.chartInstance) {
336
+ this.chartInstance = echarts.init(this.chartContainer.nativeElement);
337
+ this.chartInstance.setOption(this.chartOption);
338
+ window.addEventListener('resize', () => {
339
+ this.chartInstance?.resize();
340
+ });
341
+ }
342
+ }
343
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartBar2MainComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
344
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: EchartBar2MainComponent, isStandalone: true, selector: "echart-bar2", usesInheritance: true, ngImport: i0, template: "<div #chartContainer id=\"chartContainer\" style=\"width: 100%; height: 100%;\"></div>", styles: [":host ::ng-deep{display:flex;flex:1;flex-direction:column;width:100%;height:100%}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
345
+ }
346
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartBar2MainComponent, decorators: [{
347
+ type: Component,
348
+ args: [{ selector: 'echart-bar2', imports: [
349
+ CommonModule
350
+ ], template: "<div #chartContainer id=\"chartContainer\" style=\"width: 100%; height: 100%;\"></div>", styles: [":host ::ng-deep{display:flex;flex:1;flex-direction:column;width:100%;height:100%}\n"] }]
351
+ }], ctorParameters: () => [] });
352
+
353
+ const components$6 = [EchartBar2MainComponent];
354
+ class EchartBar2Module {
355
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartBar2Module, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
356
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.15", ngImport: i0, type: EchartBar2Module, imports: [EchartBar2MainComponent], exports: [EchartBar2MainComponent] });
357
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartBar2Module, imports: [components$6] });
358
+ }
359
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartBar2Module, decorators: [{
360
+ type: NgModule,
361
+ args: [{
362
+ imports: [...components$6],
363
+ exports: [...components$6],
364
+ }]
365
+ }] });
366
+
367
+ /**
368
+ * 指标图
369
+ */
370
+ class EchartIndicatorMainComponent extends GramBaseChartService {
371
+ total = 0;
372
+ list = [];
373
+ constructor() {
374
+ super();
375
+ }
376
+ ngOnInit() {
377
+ }
378
+ /**
379
+ * 初始化图表数据
380
+ */
381
+ loadChartInfo() {
382
+ if (this.config) {
383
+ let xData = _.get(this.config, "data.x.data");
384
+ if (xData && Array.isArray(xData) && xData.length > 0) {
385
+ this.list = [];
386
+ let valueData = _.get(this.config, "data.val[0].data");
387
+ if (valueData && Array.isArray(valueData) && valueData.length > 0 && xData.length == valueData.length) {
388
+ xData.forEach((name, index) => {
389
+ let item = {
390
+ name: name,
391
+ value: valueData[index] == null ? 0 : valueData[index]
392
+ };
393
+ this.total = this.total + item.value;
394
+ this.list.push(item);
395
+ });
396
+ }
397
+ }
398
+ }
399
+ }
400
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartIndicatorMainComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
401
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: EchartIndicatorMainComponent, isStandalone: true, selector: "echart-indicator", usesInheritance: true, ngImport: i0, template: "<div class=\"indicator-box\">\n <div class=\"header\">\n <div class=\"name\">\u5171\u8BA1</div>\n <div class=\"value\">{{total}}</div>\n </div>\n <ul class=\"content\">\n <li *ngFor=\"let item of list\">\n <div class=\"name\">{{item.name}}</div>\n <div class=\"value\">{{item.value}}</div>\n </li>\n </ul>\n</div>", styles: [":host ::ng-deep{display:flex;flex:1;flex-direction:column;width:100%;height:100%}:host ::ng-deep .indicator-box{display:flex;flex:1;flex-direction:column}:host ::ng-deep .indicator-box .header{display:flex;flex-direction:row;align-items:center;padding:10px 15px;border-bottom:1px solid #f0f0f0}:host ::ng-deep .indicator-box .header .name{flex:1}:host ::ng-deep .indicator-box .header .value{color:#2f7deb;font-weight:600}:host ::ng-deep .indicator-box ul{display:flex;flex-direction:column;margin:0;padding:0;list-style:none}:host ::ng-deep .indicator-box ul li{display:flex;flex-direction:row;align-items:center;padding:7px 12px;border-bottom:1px dotted #f0f0f0}:host ::ng-deep .indicator-box ul li .name{flex:1}:host ::ng-deep .indicator-box ul li .value{padding:2px 10px;color:#2f7deb;background:#eaf2fd;border-radius:6px}:host ::ng-deep .indicator-box ul li:nth-last-child(1){border-bottom:0}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
402
+ }
403
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartIndicatorMainComponent, decorators: [{
404
+ type: Component,
405
+ args: [{ selector: 'echart-indicator', imports: [
406
+ CommonModule
407
+ ], template: "<div class=\"indicator-box\">\n <div class=\"header\">\n <div class=\"name\">\u5171\u8BA1</div>\n <div class=\"value\">{{total}}</div>\n </div>\n <ul class=\"content\">\n <li *ngFor=\"let item of list\">\n <div class=\"name\">{{item.name}}</div>\n <div class=\"value\">{{item.value}}</div>\n </li>\n </ul>\n</div>", styles: [":host ::ng-deep{display:flex;flex:1;flex-direction:column;width:100%;height:100%}:host ::ng-deep .indicator-box{display:flex;flex:1;flex-direction:column}:host ::ng-deep .indicator-box .header{display:flex;flex-direction:row;align-items:center;padding:10px 15px;border-bottom:1px solid #f0f0f0}:host ::ng-deep .indicator-box .header .name{flex:1}:host ::ng-deep .indicator-box .header .value{color:#2f7deb;font-weight:600}:host ::ng-deep .indicator-box ul{display:flex;flex-direction:column;margin:0;padding:0;list-style:none}:host ::ng-deep .indicator-box ul li{display:flex;flex-direction:row;align-items:center;padding:7px 12px;border-bottom:1px dotted #f0f0f0}:host ::ng-deep .indicator-box ul li .name{flex:1}:host ::ng-deep .indicator-box ul li .value{padding:2px 10px;color:#2f7deb;background:#eaf2fd;border-radius:6px}:host ::ng-deep .indicator-box ul li:nth-last-child(1){border-bottom:0}\n"] }]
408
+ }], ctorParameters: () => [] });
409
+
410
+ const components$5 = [EchartIndicatorMainComponent];
411
+ class EchartIndicatorModule {
412
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartIndicatorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
413
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.15", ngImport: i0, type: EchartIndicatorModule, imports: [EchartIndicatorMainComponent], exports: [EchartIndicatorMainComponent] });
414
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartIndicatorModule, imports: [components$5] });
415
+ }
416
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartIndicatorModule, decorators: [{
417
+ type: NgModule,
418
+ args: [{
419
+ imports: [...components$5],
420
+ exports: [...components$5],
421
+ }]
422
+ }] });
423
+
424
+ /**
425
+ * 线条图
426
+ */
427
+ echarts.use([LineChart, TitleComponent, TooltipComponent, GridComponent, LegendComponent, CanvasRenderer]);
428
+ class EchartLineMainComponent extends GramBaseChartService {
429
+ constructor() {
430
+ super();
431
+ }
432
+ ngOnInit() { }
433
+ /**
434
+ * 初始化数据
435
+ */
436
+ initChartData() {
437
+ if (this.config && this.config.data && this.config.data.val && Array.isArray(this.config.data.val)) {
438
+ this.chartData = this.config.data.val.map((item, index) => {
439
+ let obj = {
440
+ type: 'line',
441
+ name: item.text,
442
+ data: item.data,
443
+ smooth: this.config?.izSmooth == true ? true : false,
444
+ areaStyle: this.config?.izArea == true ? {} : null,
445
+ };
446
+ return obj;
447
+ });
448
+ }
449
+ }
450
+ /**
451
+ * 初始化X轴
452
+ * @returns
453
+ */
454
+ initChartAxis() {
455
+ if (this.config &&
456
+ this.config.data &&
457
+ this.config.data.x &&
458
+ this.config.data.x.data &&
459
+ Array.isArray(this.config.data.x.data)) {
460
+ return _.cloneDeep(this.config.data.x.data);
461
+ }
462
+ }
463
+ /**
464
+ * 初始化图表配置
465
+ */
466
+ initChartOption() {
467
+ this.chartOption = {
468
+ color: this.color,
469
+ grid: {
470
+ left: '3%',
471
+ right: '18',
472
+ y2: '50',
473
+ containLabel: true,
474
+ },
475
+ legend: this.chartLegend,
476
+ tooltip: {},
477
+ yAxis: {
478
+ splitLine: {
479
+ show: true,
480
+ lineStyle: {
481
+ type: 'dashed',
482
+ },
483
+ },
484
+ },
485
+ xAxis: {
486
+ type: 'category',
487
+ data: this.initChartAxis(),
488
+ axisPointer: {
489
+ type: 'shadow',
490
+ },
491
+ axisLine: {
492
+ lineStyle: {
493
+ color: '#dbdbdb',
494
+ width: '1',
495
+ type: 'dotted',
496
+ },
497
+ },
498
+ splitLine: {
499
+ show: true,
500
+ lineStyle: {
501
+ color: ['#dbdbdb'],
502
+ type: 'dotted',
503
+ },
504
+ },
505
+ axisLabel: {
506
+ textStyle: {
507
+ color: '#4d4d4d',
508
+ },
509
+ },
510
+ nameTextStyle: {
511
+ color: '#4d4d4d',
512
+ },
513
+ axisTick: {
514
+ lineStyle: {
515
+ show: true,
516
+ color: '#dbdbdb',
517
+ type: 'dotted',
518
+ },
519
+ },
520
+ },
521
+ series: this.chartData,
522
+ };
523
+ }
524
+ /**
525
+ * 初始化图表数据
526
+ */
527
+ loadChartInfo() {
528
+ if (this.config) {
529
+ this.initChartData();
530
+ this.initChartLegend();
531
+ this.initChartOption();
532
+ setTimeout(() => {
533
+ this.renderChart();
534
+ }, 0);
535
+ }
536
+ }
537
+ /**
538
+ * 渲染图表
539
+ */
540
+ renderChart() {
541
+ if (!this.chartInstance) {
542
+ this.chartInstance = echarts.init(this.chartContainer.nativeElement);
543
+ this.chartInstance.setOption(this.chartOption);
544
+ window.addEventListener('resize', () => {
545
+ this.chartInstance?.resize();
546
+ });
547
+ }
548
+ }
549
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartLineMainComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
550
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: EchartLineMainComponent, isStandalone: true, selector: "echart-line", usesInheritance: true, ngImport: i0, template: "<div #chartContainer id=\"chartContainer\" style=\"width: 100%; height: 100%;\"></div>", styles: [":host ::ng-deep{display:flex;flex:1;flex-direction:column;width:100%;height:100%}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
551
+ }
552
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartLineMainComponent, decorators: [{
553
+ type: Component,
554
+ args: [{ selector: 'echart-line', imports: [
555
+ CommonModule
556
+ ], template: "<div #chartContainer id=\"chartContainer\" style=\"width: 100%; height: 100%;\"></div>", styles: [":host ::ng-deep{display:flex;flex:1;flex-direction:column;width:100%;height:100%}\n"] }]
557
+ }], ctorParameters: () => [] });
558
+
559
+ const components$4 = [EchartLineMainComponent];
560
+ class EchartLineModule {
561
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartLineModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
562
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.15", ngImport: i0, type: EchartLineModule, imports: [EchartLineMainComponent], exports: [EchartLineMainComponent] });
563
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartLineModule, imports: [components$4] });
564
+ }
565
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartLineModule, decorators: [{
566
+ type: NgModule,
567
+ args: [{
568
+ imports: [...components$4],
569
+ exports: [...components$4],
570
+ }]
571
+ }] });
572
+
573
+ /**
574
+ * 数字图
575
+ */
576
+ class EchartNumberMainComponent extends GramBaseChartService {
577
+ text = 0;
578
+ constructor() {
579
+ super();
580
+ }
581
+ ngOnInit() {
582
+ }
583
+ /**
584
+ * 初始化图表数据
585
+ */
586
+ loadChartInfo() {
587
+ if (this.config) {
588
+ if (this.config.val && Array.isArray(this.config.val) && this.config.val.length > 0) {
589
+ let item = this.config.val[0];
590
+ if (item && item.data && Array.isArray(item.data) && item.data.length > 0) {
591
+ this.text = item.data[0];
592
+ }
593
+ }
594
+ }
595
+ }
596
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartNumberMainComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
597
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: EchartNumberMainComponent, isStandalone: true, selector: "echart-number", usesInheritance: true, ngImport: i0, template: "{{text}}", styles: [":host ::ng-deep{display:flex;flex:1;flex-direction:column;width:100%;height:100%;align-items:center;justify-content:center;color:#323232;font-size:120px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
598
+ }
599
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartNumberMainComponent, decorators: [{
600
+ type: Component,
601
+ args: [{ selector: 'echart-number', imports: [
602
+ CommonModule
603
+ ], template: "{{text}}", styles: [":host ::ng-deep{display:flex;flex:1;flex-direction:column;width:100%;height:100%;align-items:center;justify-content:center;color:#323232;font-size:120px}\n"] }]
604
+ }], ctorParameters: () => [] });
605
+
606
+ const components$3 = [EchartNumberMainComponent];
607
+ class EchartNumberModule {
608
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartNumberModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
609
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.15", ngImport: i0, type: EchartNumberModule, imports: [EchartNumberMainComponent], exports: [EchartNumberMainComponent] });
610
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartNumberModule, imports: [components$3] });
611
+ }
612
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartNumberModule, decorators: [{
613
+ type: NgModule,
614
+ args: [{
615
+ imports: [...components$3],
616
+ exports: [...components$3],
617
+ }]
618
+ }] });
619
+
620
+ /**
621
+ * 饼图
622
+ */
623
+ echarts.use([PieChart, TitleComponent, TooltipComponent, GridComponent, LegendComponent, CanvasRenderer]);
624
+ class EchartPieMainComponent extends GramBaseChartService {
625
+ constructor() {
626
+ super();
627
+ }
628
+ ngOnInit() { }
629
+ /**
630
+ * 初始化数据
631
+ */
632
+ initChartData() {
633
+ if (this.config && this.config.data && this.config.data.val && Array.isArray(this.config.data.val)) {
634
+ let xData = _.get(this.config, 'data.x.data');
635
+ let yData = _.get(this.config, 'data.val');
636
+ if (xData && Array.isArray(xData)) {
637
+ let newData = [];
638
+ xData.forEach((x, i) => {
639
+ if (yData && Array.isArray(yData)) {
640
+ yData.forEach((y) => {
641
+ if (y.data && Array.isArray(y.data)) {
642
+ let obj = { name: x, value: y.data[i] };
643
+ newData.push(obj);
644
+ }
645
+ });
646
+ }
647
+ });
648
+ this.chartData = newData;
649
+ }
650
+ }
651
+ }
652
+ /**
653
+ * 初始化图表配置
654
+ */
655
+ initChartOption() {
656
+ this.chartOption = {
657
+ color: this.color,
658
+ legend: this.chartLegend,
659
+ tooltip: {
660
+ trigger: 'item',
661
+ },
662
+ animation: false,
663
+ series: [
664
+ {
665
+ type: 'pie',
666
+ data: this.chartData,
667
+ radius: this.config?.izDoughnut == true ? ['50%', '75%'] : '50%',
668
+ avoidLabelOverlap: false,
669
+ itemStyle: {
670
+ borderRadius: 5,
671
+ borderColor: '#fff',
672
+ borderWidth: 2,
673
+ },
674
+ emphasis: {
675
+ label: {
676
+ show: true,
677
+ fontSize: '30',
678
+ fontWeight: 'bold',
679
+ },
680
+ },
681
+ labelLine: {
682
+ show: true,
683
+ },
684
+ },
685
+ ],
686
+ };
687
+ }
688
+ /**
689
+ * 初始化图表数据
690
+ */
691
+ loadChartInfo() {
692
+ if (this.config) {
693
+ this.initChartData();
694
+ this.initChartLegend();
695
+ this.initChartOption();
696
+ setTimeout(() => {
697
+ this.renderChart();
698
+ }, 0);
699
+ }
700
+ }
701
+ /**
702
+ * 渲染图表
703
+ */
704
+ renderChart() {
705
+ if (!this.chartInstance) {
706
+ this.chartInstance = echarts.init(this.chartContainer.nativeElement);
707
+ this.chartInstance.setOption(this.chartOption);
708
+ window.addEventListener('resize', () => {
709
+ this.chartInstance?.resize();
710
+ });
711
+ }
712
+ }
713
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartPieMainComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
714
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: EchartPieMainComponent, isStandalone: true, selector: "echart-pie", usesInheritance: true, ngImport: i0, template: "<div #chartContainer id=\"chartContainer\" style=\"width: 100%; height: 100%;\"></div>", styles: [":host ::ng-deep{display:flex;flex:1;flex-direction:column;width:100%;height:100%}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
715
+ }
716
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartPieMainComponent, decorators: [{
717
+ type: Component,
718
+ args: [{ selector: 'echart-pie', imports: [
719
+ CommonModule
720
+ ], template: "<div #chartContainer id=\"chartContainer\" style=\"width: 100%; height: 100%;\"></div>", styles: [":host ::ng-deep{display:flex;flex:1;flex-direction:column;width:100%;height:100%}\n"] }]
721
+ }], ctorParameters: () => [] });
722
+
723
+ const components$2 = [EchartPieMainComponent];
724
+ class EchartPieModule {
725
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartPieModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
726
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.15", ngImport: i0, type: EchartPieModule, imports: [EchartPieMainComponent], exports: [EchartPieMainComponent] });
727
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartPieModule, imports: [components$2] });
728
+ }
729
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartPieModule, decorators: [{
730
+ type: NgModule,
731
+ args: [{
732
+ imports: [...components$2],
733
+ exports: [...components$2],
734
+ }]
735
+ }] });
736
+
737
+ /**
738
+ * 雷达图
739
+ */
740
+ echarts.use([RadarChart, TitleComponent, TooltipComponent, GridComponent, LegendComponent, CanvasRenderer]);
741
+ class EchartRadarMainComponent extends GramBaseChartService {
742
+ indicatorData = [];
743
+ constructor() {
744
+ super();
745
+ }
746
+ ngOnInit() { }
747
+ /**
748
+ * 初始化数据
749
+ */
750
+ initChartData() {
751
+ if (this.config && this.config.data && this.config.data.val && Array.isArray(this.config.data.val)) {
752
+ let xData = _.get(this.config, 'data.x.data');
753
+ if (xData && Array.isArray(xData)) {
754
+ this.indicatorData = xData.map((item) => {
755
+ return {
756
+ name: item,
757
+ };
758
+ });
759
+ }
760
+ this.chartData = [
761
+ {
762
+ type: 'radar',
763
+ data: this.config.data.val.map((item, index) => {
764
+ return {
765
+ value: item.data,
766
+ name: item.text,
767
+ };
768
+ }),
769
+ },
770
+ ];
771
+ }
772
+ }
773
+ /**
774
+ * 初始化图表配置
775
+ */
776
+ initChartOption() {
777
+ this.chartOption = {
778
+ color: this.color,
779
+ title: {
780
+ text: null,
781
+ },
782
+ legend: this.chartLegend,
783
+ radar: [
784
+ {
785
+ indicator: this.indicatorData,
786
+ },
787
+ ],
788
+ series: this.chartData,
789
+ };
790
+ }
791
+ /**
792
+ * 初始化图表数据
793
+ */
794
+ loadChartInfo() {
795
+ if (this.config) {
796
+ this.initChartData();
797
+ this.initChartLegend();
798
+ this.initChartOption();
799
+ setTimeout(() => {
800
+ this.renderChart();
801
+ }, 0);
802
+ }
803
+ }
804
+ /**
805
+ * 渲染图表
806
+ */
807
+ renderChart() {
808
+ if (!this.chartInstance) {
809
+ this.chartInstance = echarts.init(this.chartContainer.nativeElement);
810
+ this.chartInstance.setOption(this.chartOption);
811
+ window.addEventListener('resize', () => {
812
+ this.chartInstance?.resize();
813
+ });
814
+ }
815
+ }
816
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartRadarMainComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
817
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: EchartRadarMainComponent, isStandalone: true, selector: "echart-radar", usesInheritance: true, ngImport: i0, template: "<div #chartContainer id=\"chartContainer\" style=\"width: 100%; height: 100%;\"></div>", styles: [":host ::ng-deep{display:flex;flex:1;flex-direction:column;width:100%;height:100%}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
818
+ }
819
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartRadarMainComponent, decorators: [{
820
+ type: Component,
821
+ args: [{ selector: 'echart-radar', imports: [
822
+ CommonModule
823
+ ], template: "<div #chartContainer id=\"chartContainer\" style=\"width: 100%; height: 100%;\"></div>", styles: [":host ::ng-deep{display:flex;flex:1;flex-direction:column;width:100%;height:100%}\n"] }]
824
+ }], ctorParameters: () => [] });
825
+
826
+ const components$1 = [EchartRadarMainComponent];
827
+ class EchartRadarModule {
828
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartRadarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
829
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.15", ngImport: i0, type: EchartRadarModule, imports: [EchartRadarMainComponent], exports: [EchartRadarMainComponent] });
830
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartRadarModule, imports: [components$1] });
831
+ }
832
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartRadarModule, decorators: [{
833
+ type: NgModule,
834
+ args: [{
835
+ imports: [...components$1],
836
+ exports: [...components$1],
837
+ }]
838
+ }] });
839
+
840
+ /**
841
+ * 排序图
842
+ */
843
+ class EchartSortMainComponent extends GramBaseChartService {
844
+ constructor() {
845
+ super();
846
+ }
847
+ ngOnInit() {
848
+ }
849
+ /**
850
+ * 初始化图表数据
851
+ */
852
+ loadChartInfo() {
853
+ if (this.config) {
854
+ }
855
+ }
856
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartSortMainComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
857
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: EchartSortMainComponent, isStandalone: true, selector: "echart-sort", usesInheritance: true, ngImport: i0, template: "", styles: [":host ::ng-deep{display:flex;flex:1;flex-direction:column;width:100%;height:100%;align-items:center;justify-content:center;color:#323232;font-size:120px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
858
+ }
859
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartSortMainComponent, decorators: [{
860
+ type: Component,
861
+ args: [{ selector: 'echart-sort', imports: [
862
+ CommonModule
863
+ ], template: "", styles: [":host ::ng-deep{display:flex;flex:1;flex-direction:column;width:100%;height:100%;align-items:center;justify-content:center;color:#323232;font-size:120px}\n"] }]
864
+ }], ctorParameters: () => [] });
865
+
866
+ const components = [EchartSortMainComponent];
867
+ class EchartSortModule {
868
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartSortModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
869
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.15", ngImport: i0, type: EchartSortModule, imports: [EchartSortMainComponent], exports: [EchartSortMainComponent] });
870
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartSortModule, imports: [components] });
871
+ }
872
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartSortModule, decorators: [{
873
+ type: NgModule,
874
+ args: [{
875
+ imports: [...components],
876
+ exports: [...components],
877
+ }]
878
+ }] });
879
+
880
+ /**
881
+ * Generated bundle index. Do not edit.
882
+ */
883
+
884
+ export { EchartBar2MainComponent, EchartBar2Module, EchartBarMainComponent, EchartBarModule, EchartIndicatorMainComponent, EchartIndicatorModule, EchartLineMainComponent, EchartLineModule, EchartNumberMainComponent, EchartNumberModule, EchartPieMainComponent, EchartPieModule, EchartRadarMainComponent, EchartRadarModule, EchartSortMainComponent, EchartSortModule };
885
+ //# sourceMappingURL=chart.echart.mjs.map