@@ -7,7 +7,7 @@ const isEqual = (a, b) => JSON.stringify(a) === JSON.stringify(b);
77export default class EchartsReactCore extends Component {
88 constructor ( props ) {
99 super ( props ) ;
10- this . echartsInstance = this . props . echarts ; // the echarts object.
10+ this . echartsLib = this . props . echarts ; // the echarts object.
1111 this . echartsElement = null ; // echarts div element
1212 }
1313
@@ -50,8 +50,8 @@ export default class EchartsReactCore extends Component {
5050 }
5151
5252 // return the echart object
53- getEchartsInstance = ( ) => this . echartsInstance . getInstanceByDom ( this . echartsElement ) ||
54- this . echartsInstance . init ( this . echartsElement , this . props . theme , this . props . opts ) ;
53+ getEchartsInstance = ( ) => this . echartsLib . getInstanceByDom ( this . echartsElement ) ||
54+ this . echartsLib . init ( this . echartsElement , this . props . theme , this . props . opts ) ;
5555
5656 // dispose echarts and element-resize-event
5757 dispose = ( ) => {
@@ -60,7 +60,7 @@ export default class EchartsReactCore extends Component {
6060 try {
6161 elementResizeEvent . unbind ( this . echartsElement ) ;
6262 } catch ( _ ) { }
63- this . echartsInstance . dispose ( this . echartsElement ) ;
63+ this . echartsLib . dispose ( this . echartsElement ) ;
6464 }
6565 } ;
6666
@@ -69,6 +69,12 @@ export default class EchartsReactCore extends Component {
6969
7070 const echartObj = this . renderEchartDom ( ) ;
7171 this . bindEvents ( echartObj , onEvents || { } ) ;
72+
73+ // fix bug of 100px width * height.
74+ try {
75+ echartObj . resize ( ) ;
76+ } catch ( _ ) { }
77+
7278 // on chart ready
7379 if ( typeof onChartReady === 'function' ) this . props . onChartReady ( echartObj ) ;
7480 // on resize
0 commit comments