最近手头需要实现reactjs下echarts的绘图,发现不少坑,现整理如下。
首先贴好代码如下,注意其中数据传递
var Hello = React.createClass({
componentDidMount:function(){
console.log(this.props.data);
this.drawCharts(this.props.data);
},
drawCharts:function(dataSet){
var myChart = echarts.init(document.getElementById('charts'));
// 指定图表的配置项和数据
var option =