@@ -8,6 +8,8 @@ import {CallbackRemoval, CommonUtils} from "../../core/utils/common-utils";
88import { AbstractJigsawComponent } from "../common" ;
99import { EchartOptions } from "../../core/data/echart-types" ;
1010import { VMAX_GRAPH_THEME } from "./vmax-theme" ;
11+ import { VMAX_GRAPH_THEME_DARK } from './vmax-theme-dark' ;
12+ import { JigsawTheme } from "../../core/theming/theme" ;
1113
1214@Component ( {
1315 selector : 'jigsaw-graph, j-graph' ,
@@ -78,7 +80,7 @@ export class JigsawGraph extends AbstractJigsawComponent implements OnInit, OnDe
7880 }
7981 }
8082
81- private _globalTheme : any = VMAX_GRAPH_THEME ;
83+ private _globalTheme : any = JigsawTheme . majorStyle == 'light' ? VMAX_GRAPH_THEME : JigsawTheme . majorStyle == 'dark' ? VMAX_GRAPH_THEME_DARK : VMAX_GRAPH_THEME ;
8284
8385 @Input ( )
8486 public get globalTheme ( ) {
@@ -87,11 +89,8 @@ export class JigsawGraph extends AbstractJigsawComponent implements OnInit, OnDe
8789
8890 public set globalTheme ( value ) {
8991 if ( ! value ) return ;
92+ value = value == 'light' ? VMAX_GRAPH_THEME : value == 'dark' ? VMAX_GRAPH_THEME_DARK : value ;
9093 this . _globalTheme = value ;
91- if ( this . _graph ) {
92- this . _graph . _theme = value ;
93- this . data . refresh ( ) ;
94- }
9594 }
9695
9796 constructor ( private _elementRef : ElementRef , private _renderer : Renderer2 , private _zone : NgZone ) {
@@ -165,7 +164,7 @@ export class JigsawGraph extends AbstractJigsawComponent implements OnInit, OnDe
165164 this . _zone . runOutsideAngular ( ( ) => {
166165 // echarts的Animation对象里的_startLoop方法有个递归调用requestAnimationFrame,会触发变更检查,见#289
167166 this . _graph = echarts . init ( this . _graphContainer ) ;
168- this . _graph . _theme = VMAX_GRAPH_THEME ;
167+ this . _graph . _theme = this . globalTheme ;
169168 } ) ;
170169 this . _listenWindowResize ( ) ;
171170 if ( this . data ) {
0 commit comments