| 121 | } |
| 122 | |
| 123 | pushPieData(target, name, color) |
| 124 | { |
| 125 | if((this.props.type+"").trim()=="pie") |
| 126 | { |
| 127 | if(target==this.props.target && ((this.props.filter+"").trim().indexOf(name)!=-1 || (this.props.filter.trim()+"").length==0)) |
| 128 | { |
| 129 | if(this.state.chart.data.labels.indexOf(name)!=-1) |
| 130 | { |
| 131 | for(let i in this.state.chart.data.datasets) |
| 132 | { |
| 133 | let dataset = this.state.chart.data.datasets[i]; |
| 134 | dataset.data[this.state.chart.data.labels.indexOf(name)] += 1; |
| 135 | } |
| 136 | } |
| 137 | else |
| 138 | { |
| 139 | this.state.chart.data.labels.push(name); |
| 140 | this.state.chart.data.datasets[0].data.push(1); |
| 141 | this.state.chart.data.datasets[0].backgroundColor.push(color); |
| 142 | } |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | this.state.chart.update(); |
| 147 | } |
| 148 | |
| 149 | clearChart() |
| 150 | { |