|
@@ -35,9 +35,8 @@ export default class LineChart extends Component {
|
35
|
35
|
|
36
|
36
|
// 禁止 props 变更时渲染
|
37
|
37
|
shouldComponentUpdate(nextProps) {
|
38
|
|
- console.log('------------>', this.props, nextProps)
|
39
|
38
|
if (nextProps.source && nextProps.source.length) {
|
40
|
|
- this.refreshChart(this.props.source)
|
|
39
|
+ this.refreshChart(nextProps.source)
|
41
|
40
|
}
|
42
|
41
|
|
43
|
42
|
return false
|
|
@@ -78,7 +77,7 @@ export default class LineChart extends Component {
|
78
|
77
|
left: '10%',
|
79
|
78
|
right: '8%',
|
80
|
79
|
bottom: '10%',
|
81
|
|
- top: '6%',
|
|
80
|
+ top: '10%',
|
82
|
81
|
},
|
83
|
82
|
series: [],
|
84
|
83
|
}
|
|
@@ -126,7 +125,7 @@ export default class LineChart extends Component {
|
126
|
125
|
|
127
|
126
|
refreshChart(source) {
|
128
|
127
|
const options = this.createOptions(source)
|
129
|
|
- console.log(source,"source")
|
|
128
|
+
|
130
|
129
|
if (!this.echart) {
|
131
|
130
|
if (this.ecComponent) {
|
132
|
131
|
const initFunc = initChart(this.handleChart.bind(this), options)
|
|
@@ -140,6 +139,8 @@ export default class LineChart extends Component {
|
140
|
139
|
}
|
141
|
140
|
|
142
|
141
|
render() {
|
|
142
|
+ // this.refreshChart(this.props.source)
|
|
143
|
+
|
143
|
144
|
return (
|
144
|
145
|
<View className="map-container">
|
145
|
146
|
<ec-canvas ref={this.handleEcComponent} ec={this.state.ec}></ec-canvas>
|