1212import React from 'react' ;
1313import { ReactEcharts } from './reactEcharts' ;
1414import provinceName from '../../data/map/provinces' ;
15+ import echarts from 'echarts' ;
1516
1617type Props = {
1718 data : any ;
@@ -70,6 +71,8 @@ const fixChartFontSize = (baseFontSize: number) => {
7071}
7172
7273export class VirusChart extends React . Component < Props , Readonly < State > > {
74+ getConfirmedSuspectChart :any
75+ curedDeadChart : any
7376
7477 static defaultProps = {
7578 data : {
@@ -443,6 +446,17 @@ export class VirusChart extends React.Component<Props, Readonly<State>> {
443446 } ;
444447 }
445448
449+ componentDidMount ( ) {
450+ const { type } = this . props ;
451+ if ( type === 'pc' ) {
452+ let confirmedSuspectChart = this . getConfirmedSuspectChart . getEchartsInstance ( ) ;
453+ let curedDeadChart = this . curedDeadChart . getEchartsInstance ( ) ;
454+ confirmedSuspectChart . group = 'virusChart' ;
455+ curedDeadChart . group = 'virusChart' ;
456+ echarts . connect ( 'virusChart' ) ;
457+ }
458+ }
459+
446460 public render ( ) {
447461 const { data, area, path, type } = this . props ;
448462 const orderedProvincesData = this . getOrderedTimeData ( data . provincesSeries ) ;
@@ -473,6 +487,7 @@ export class VirusChart extends React.Component<Props, Readonly<State>> {
473487 >
474488 < div style = { { width : '100%' , height : '50%' } } >
475489 < ReactEcharts
490+ ref = { ( e ) => { this . getConfirmedSuspectChart = e ; } }
476491 chartOptions = { this . getConfirmedSuspectChartOptions (
477492 orderedProvincesData ,
478493 orderedCountryData ,
@@ -484,6 +499,7 @@ export class VirusChart extends React.Component<Props, Readonly<State>> {
484499
485500 < div style = { { width : '100%' , height : '50%' } } >
486501 < ReactEcharts
502+ ref = { ( e ) => { this . curedDeadChart = e ; } }
487503 chartOptions = { this . getCuredDeadChartOptions (
488504 orderedProvincesData ,
489505 orderedCountryData ,
0 commit comments