MCPcopy
hub / github.com/MrNothing/AI-Blocks / pushPieData

Method pushPieData

Sources/src/Model/UI/Modules/Chart.js:123–147  ·  view source on GitHub ↗
(target, name, color)

Source from the content-addressed store, hash-verified

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 {

Callers 1

constructorMethod · 0.80

Calls 1

updateMethod · 0.80

Tested by

no test coverage detected