@ebuilding/chart 2.1.6 → 2.1.8

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.
package/echart/index.d.ts CHANGED
@@ -6,3 +6,5 @@ export { EchartNumberModule, EchartNumberMainComponent } from './number';
6
6
  export { EchartPieModule, EchartPieMainComponent } from './pie';
7
7
  export { EchartRadarModule, EchartRadarMainComponent } from './radar';
8
8
  export { EchartSortModule, EchartSortMainComponent } from './sort';
9
+ export { EchartGaugeModule, EchartGaugeMainComponent } from './gauge';
10
+ export { EchartCategoryStackModule, EchartCategoryStackComponent } from './category-stack';
@@ -3,7 +3,7 @@ import { Component, NgModule } from '@angular/core';
3
3
  import * as i1 from '@angular/common';
4
4
  import { CommonModule } from '@angular/common';
5
5
  import * as echarts from 'echarts/core';
6
- import { BarChart, LineChart, PieChart, RadarChart } from 'echarts/charts';
6
+ import { BarChart, LineChart, PieChart, RadarChart, GaugeChart } from 'echarts/charts';
7
7
  import { TitleComponent, TooltipComponent, GridComponent, LegendComponent } from 'echarts/components';
8
8
  import { CanvasRenderer } from 'echarts/renderers';
9
9
  import { GramBaseChartService } from '@ebuilding/chart/service';
@@ -187,17 +187,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
187
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
188
  }], ctorParameters: () => [] });
189
189
 
190
- const components$7 = [EchartBarMainComponent];
190
+ const components$9 = [EchartBarMainComponent];
191
191
  class EchartBarModule {
192
192
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartBarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
193
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] });
194
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartBarModule, imports: [components$9] });
195
195
  }
196
196
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartBarModule, decorators: [{
197
197
  type: NgModule,
198
198
  args: [{
199
- imports: [...components$7],
200
- exports: [...components$7],
199
+ imports: [...components$9],
200
+ exports: [...components$9],
201
201
  }]
202
202
  }] });
203
203
 
@@ -350,17 +350,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
350
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
351
  }], ctorParameters: () => [] });
352
352
 
353
- const components$6 = [EchartBar2MainComponent];
353
+ const components$8 = [EchartBar2MainComponent];
354
354
  class EchartBar2Module {
355
355
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartBar2Module, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
356
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] });
357
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartBar2Module, imports: [components$8] });
358
358
  }
359
359
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartBar2Module, decorators: [{
360
360
  type: NgModule,
361
361
  args: [{
362
- imports: [...components$6],
363
- exports: [...components$6],
362
+ imports: [...components$8],
363
+ exports: [...components$8],
364
364
  }]
365
365
  }] });
366
366
 
@@ -407,17 +407,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
407
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
408
  }], ctorParameters: () => [] });
409
409
 
410
- const components$5 = [EchartIndicatorMainComponent];
410
+ const components$7 = [EchartIndicatorMainComponent];
411
411
  class EchartIndicatorModule {
412
412
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartIndicatorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
413
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] });
414
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartIndicatorModule, imports: [components$7] });
415
415
  }
416
416
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartIndicatorModule, decorators: [{
417
417
  type: NgModule,
418
418
  args: [{
419
- imports: [...components$5],
420
- exports: [...components$5],
419
+ imports: [...components$7],
420
+ exports: [...components$7],
421
421
  }]
422
422
  }] });
423
423
 
@@ -556,17 +556,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
556
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
557
  }], ctorParameters: () => [] });
558
558
 
559
- const components$4 = [EchartLineMainComponent];
559
+ const components$6 = [EchartLineMainComponent];
560
560
  class EchartLineModule {
561
561
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartLineModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
562
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] });
563
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartLineModule, imports: [components$6] });
564
564
  }
565
565
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartLineModule, decorators: [{
566
566
  type: NgModule,
567
567
  args: [{
568
- imports: [...components$4],
569
- exports: [...components$4],
568
+ imports: [...components$6],
569
+ exports: [...components$6],
570
570
  }]
571
571
  }] });
572
572
 
@@ -603,17 +603,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
603
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
604
  }], ctorParameters: () => [] });
605
605
 
606
- const components$3 = [EchartNumberMainComponent];
606
+ const components$5 = [EchartNumberMainComponent];
607
607
  class EchartNumberModule {
608
608
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartNumberModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
609
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] });
610
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartNumberModule, imports: [components$5] });
611
611
  }
612
612
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartNumberModule, decorators: [{
613
613
  type: NgModule,
614
614
  args: [{
615
- imports: [...components$3],
616
- exports: [...components$3],
615
+ imports: [...components$5],
616
+ exports: [...components$5],
617
617
  }]
618
618
  }] });
619
619
 
@@ -720,17 +720,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
720
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
721
  }], ctorParameters: () => [] });
722
722
 
723
- const components$2 = [EchartPieMainComponent];
723
+ const components$4 = [EchartPieMainComponent];
724
724
  class EchartPieModule {
725
725
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartPieModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
726
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] });
727
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartPieModule, imports: [components$4] });
728
728
  }
729
729
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartPieModule, decorators: [{
730
730
  type: NgModule,
731
731
  args: [{
732
- imports: [...components$2],
733
- exports: [...components$2],
732
+ imports: [...components$4],
733
+ exports: [...components$4],
734
734
  }]
735
735
  }] });
736
736
 
@@ -823,17 +823,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
823
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
824
  }], ctorParameters: () => [] });
825
825
 
826
- const components$1 = [EchartRadarMainComponent];
826
+ const components$3 = [EchartRadarMainComponent];
827
827
  class EchartRadarModule {
828
828
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartRadarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
829
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] });
830
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartRadarModule, imports: [components$3] });
831
831
  }
832
832
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartRadarModule, decorators: [{
833
833
  type: NgModule,
834
834
  args: [{
835
- imports: [...components$1],
836
- exports: [...components$1],
835
+ imports: [...components$3],
836
+ exports: [...components$3],
837
837
  }]
838
838
  }] });
839
839
 
@@ -863,13 +863,320 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
863
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
864
  }], ctorParameters: () => [] });
865
865
 
866
- const components = [EchartSortMainComponent];
866
+ const components$2 = [EchartSortMainComponent];
867
867
  class EchartSortModule {
868
868
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartSortModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
869
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] });
870
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartSortModule, imports: [components$2] });
871
871
  }
872
872
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartSortModule, decorators: [{
873
+ type: NgModule,
874
+ args: [{
875
+ imports: [...components$2],
876
+ exports: [...components$2],
877
+ }]
878
+ }] });
879
+
880
+ /**
881
+ * gauge
882
+ */
883
+ echarts.use([GaugeChart, TitleComponent, TooltipComponent, GridComponent, LegendComponent, CanvasRenderer]);
884
+ class EchartGaugeMainComponent extends GramBaseChartService {
885
+ color = [
886
+ '#71D1FF',
887
+ '#71A9FF',
888
+ '#8C94FC',
889
+ '#DDB0F0',
890
+ '#FFCA5E',
891
+ '#FFB15E',
892
+ '#71D1FF',
893
+ '#71A9FF',
894
+ '#8C94FC',
895
+ '#DDB0F0',
896
+ '#FFCA5E',
897
+ '#FFB15E',
898
+ ];
899
+ constructor() {
900
+ super();
901
+ }
902
+ ngOnInit() { }
903
+ initChartData() {
904
+ if (this.config && this.config?.data && this.config?.data?.val && Array.isArray(this.config.data.val) && this.config.data.val.length > 0) {
905
+ let item = this.config.data.val[0];
906
+ if (item && item?.data && item?.data?.length > 0) {
907
+ this.chartData = [
908
+ {
909
+ value: item?.data[0],
910
+ name: null
911
+ }
912
+ ];
913
+ }
914
+ }
915
+ }
916
+ /**
917
+ * 初始化图表配置
918
+ */
919
+ initChartOption() {
920
+ this.chartOption = {
921
+ tooltip: {
922
+ formatter: '{a} <br/>{b} : {c}%'
923
+ },
924
+ series: [
925
+ {
926
+ name: 'Pressure',
927
+ type: 'gauge',
928
+ startAngle: 180,
929
+ endAngle: 0,
930
+ progress: {
931
+ show: true
932
+ },
933
+ detail: {
934
+ valueAnimation: true,
935
+ formatter: '{value}'
936
+ },
937
+ data: this.chartData
938
+ }
939
+ ]
940
+ };
941
+ }
942
+ /**
943
+ * 初始化图表数据
944
+ */
945
+ loadChartInfo() {
946
+ if (this.config) {
947
+ this.initChartData();
948
+ this.initChartLegend();
949
+ this.initChartTitle();
950
+ this.initChartOption();
951
+ setTimeout(() => {
952
+ this.renderChart();
953
+ }, 0);
954
+ }
955
+ }
956
+ /**
957
+ * 渲染图表
958
+ */
959
+ renderChart() {
960
+ if (!this.chartInstance) {
961
+ this.chartInstance = echarts.init(this.chartContainer.nativeElement);
962
+ this.chartInstance.setOption(this.chartOption);
963
+ window.addEventListener('resize', () => {
964
+ this.chartInstance?.resize();
965
+ });
966
+ }
967
+ }
968
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartGaugeMainComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
969
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: EchartGaugeMainComponent, isStandalone: true, selector: "echart-gauge", 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 }] });
970
+ }
971
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartGaugeMainComponent, decorators: [{
972
+ type: Component,
973
+ args: [{ selector: 'echart-gauge', imports: [
974
+ CommonModule
975
+ ], 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"] }]
976
+ }], ctorParameters: () => [] });
977
+
978
+ const components$1 = [EchartGaugeMainComponent];
979
+ class EchartGaugeModule {
980
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartGaugeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
981
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.15", ngImport: i0, type: EchartGaugeModule, imports: [EchartGaugeMainComponent], exports: [EchartGaugeMainComponent] });
982
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartGaugeModule, imports: [components$1] });
983
+ }
984
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartGaugeModule, decorators: [{
985
+ type: NgModule,
986
+ args: [{
987
+ imports: [...components$1],
988
+ exports: [...components$1],
989
+ }]
990
+ }] });
991
+
992
+ /**
993
+ * 堆积图
994
+ */
995
+ echarts.use([BarChart, TitleComponent, TooltipComponent, GridComponent, LegendComponent, CanvasRenderer]);
996
+ class EchartCategoryStackComponent extends GramBaseChartService {
997
+ color = [
998
+ '#71D1FF',
999
+ '#71A9FF',
1000
+ '#8C94FC',
1001
+ '#DDB0F0',
1002
+ '#FFCA5E',
1003
+ '#FFB15E',
1004
+ '#71D1FF',
1005
+ '#71A9FF',
1006
+ '#8C94FC',
1007
+ '#DDB0F0',
1008
+ '#FFCA5E',
1009
+ '#FFB15E',
1010
+ ];
1011
+ constructor() {
1012
+ super();
1013
+ }
1014
+ ngOnInit() { }
1015
+ /**
1016
+ * 初始化数据
1017
+ */
1018
+ initChartData() {
1019
+ if (this.config && this.config.data && this.config.data.val && Array.isArray(this.config.data.val)) {
1020
+ let isSingle = this.config.data.val.length == 1;
1021
+ this.chartData = this.config.data.val.map((item, index) => {
1022
+ if (!isSingle) {
1023
+ item.data = item.data.map((a) => {
1024
+ let newA = { value: a, itemStyle: { color: this.color[index] } };
1025
+ return newA;
1026
+ });
1027
+ }
1028
+ let obj = {
1029
+ type: 'bar',
1030
+ name: item.text,
1031
+ data: item.data,
1032
+ barMaxWidth: 35,
1033
+ stack: 'total',
1034
+ label: this.config.data?.label ? this.config.data.label : {},
1035
+ // itemStyle:
1036
+ // isSingle == true
1037
+ // ? {
1038
+ // normal: {
1039
+ // borderRadius: [12, 12, 0, 0],
1040
+ // color: (a: any) => {
1041
+ // return this.color[a.dataIndex];
1042
+ // },
1043
+ // },
1044
+ // }
1045
+ // : {
1046
+ // normal: {
1047
+ // borderRadius: [12, 12, 0, 0],
1048
+ // },
1049
+ // },
1050
+ };
1051
+ if (item?.type && item.type == 'line') {
1052
+ obj['type'] = 'line';
1053
+ obj['lineStyle'] = {
1054
+ color: this.color[index],
1055
+ };
1056
+ }
1057
+ return obj;
1058
+ });
1059
+ }
1060
+ }
1061
+ /**
1062
+ * 初始化X轴
1063
+ * @returns
1064
+ */
1065
+ initChartAxis() {
1066
+ if (this.config &&
1067
+ this.config.data &&
1068
+ this.config.data.x &&
1069
+ this.config.data.x.data &&
1070
+ Array.isArray(this.config.data.x.data)) {
1071
+ return _.cloneDeep(this.config.data.x.data);
1072
+ }
1073
+ }
1074
+ /**
1075
+ * 初始化图表配置
1076
+ */
1077
+ initChartOption() {
1078
+ this.chartOption = {
1079
+ title: this.chartTitle,
1080
+ animation: this.config?.animation == false ? false : true,
1081
+ color: this.color,
1082
+ grid: {
1083
+ left: '3%',
1084
+ right: '18',
1085
+ y2: '50',
1086
+ containLabel: true,
1087
+ },
1088
+ legend: this.chartLegend,
1089
+ tooltip: {},
1090
+ yAxis: {
1091
+ splitLine: {
1092
+ show: true,
1093
+ lineStyle: {
1094
+ type: 'dashed',
1095
+ },
1096
+ },
1097
+ type: 'category',
1098
+ data: this.initChartAxis(),
1099
+ },
1100
+ xAxis: {
1101
+ type: "value",
1102
+ splitLine: {
1103
+ show: true,
1104
+ lineStyle: {
1105
+ type: 'dashed',
1106
+ },
1107
+ },
1108
+ axisPointer: {
1109
+ type: 'shadow',
1110
+ },
1111
+ axisLine: {
1112
+ lineStyle: {
1113
+ color: '#dbdbdb',
1114
+ width: '1',
1115
+ type: 'dotted',
1116
+ },
1117
+ },
1118
+ axisLabel: {
1119
+ textStyle: {
1120
+ color: '#4d4d4d',
1121
+ },
1122
+ },
1123
+ nameTextStyle: {
1124
+ color: '#4d4d4d',
1125
+ },
1126
+ axisTick: {
1127
+ lineStyle: {
1128
+ show: true,
1129
+ color: '#dbdbdb',
1130
+ type: 'dotted',
1131
+ },
1132
+ },
1133
+ },
1134
+ series: this.chartData,
1135
+ };
1136
+ }
1137
+ /**
1138
+ * 初始化图表数据
1139
+ */
1140
+ loadChartInfo() {
1141
+ if (this.config) {
1142
+ this.initChartData();
1143
+ this.initChartLegend();
1144
+ this.initChartTitle();
1145
+ this.initChartOption();
1146
+ setTimeout(() => {
1147
+ this.renderChart();
1148
+ }, 0);
1149
+ }
1150
+ }
1151
+ /**
1152
+ * 渲染图表
1153
+ */
1154
+ renderChart() {
1155
+ if (!this.chartInstance) {
1156
+ this.chartInstance = echarts.init(this.chartContainer.nativeElement);
1157
+ this.chartInstance.setOption(this.chartOption);
1158
+ window.addEventListener('resize', () => {
1159
+ this.chartInstance?.resize();
1160
+ });
1161
+ }
1162
+ }
1163
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartCategoryStackComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1164
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: EchartCategoryStackComponent, isStandalone: true, selector: "echart-category-stack", 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 }] });
1165
+ }
1166
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartCategoryStackComponent, decorators: [{
1167
+ type: Component,
1168
+ args: [{ selector: 'echart-category-stack', imports: [
1169
+ CommonModule
1170
+ ], 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"] }]
1171
+ }], ctorParameters: () => [] });
1172
+
1173
+ const components = [EchartCategoryStackComponent];
1174
+ class EchartCategoryStackModule {
1175
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartCategoryStackModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1176
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.15", ngImport: i0, type: EchartCategoryStackModule, imports: [EchartCategoryStackComponent], exports: [EchartCategoryStackComponent] });
1177
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartCategoryStackModule, imports: [components] });
1178
+ }
1179
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: EchartCategoryStackModule, decorators: [{
873
1180
  type: NgModule,
874
1181
  args: [{
875
1182
  imports: [...components],
@@ -881,5 +1188,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
881
1188
  * Generated bundle index. Do not edit.
882
1189
  */
883
1190
 
884
- export { EchartBar2MainComponent, EchartBar2Module, EchartBarMainComponent, EchartBarModule, EchartIndicatorMainComponent, EchartIndicatorModule, EchartLineMainComponent, EchartLineModule, EchartNumberMainComponent, EchartNumberModule, EchartPieMainComponent, EchartPieModule, EchartRadarMainComponent, EchartRadarModule, EchartSortMainComponent, EchartSortModule };
1191
+ export { EchartBar2MainComponent, EchartBar2Module, EchartBarMainComponent, EchartBarModule, EchartCategoryStackComponent, EchartCategoryStackModule, EchartGaugeMainComponent, EchartGaugeModule, EchartIndicatorMainComponent, EchartIndicatorModule, EchartLineMainComponent, EchartLineModule, EchartNumberMainComponent, EchartNumberModule, EchartPieMainComponent, EchartPieModule, EchartRadarMainComponent, EchartRadarModule, EchartSortMainComponent, EchartSortModule };
885
1192
  //# sourceMappingURL=chart.echart.mjs.map