()
| 147 | } |
| 148 | |
| 149 | clearChart() |
| 150 | { |
| 151 | if((this.props.type+"").trim()=="line") |
| 152 | { |
| 153 | this.state.chart.data = { |
| 154 | labels: [], |
| 155 | datasets: [] |
| 156 | }; |
| 157 | } |
| 158 | else |
| 159 | { |
| 160 | this.state.chart.data = { |
| 161 | labels: [], |
| 162 | datasets: [{ |
| 163 | data:[], |
| 164 | backgroundColor: [] |
| 165 | }] |
| 166 | }; |
| 167 | } |
| 168 | |
| 169 | this.state.chart.update(); |
| 170 | } |
| 171 | |
| 172 | render() { |
| 173 | return <canvas id={this.props.id} width="100%" height="100%" style={{width:"100%", height:"100%"}}></canvas>; |