Fix doughnut charts acting weird when resized

The charts would start displaying data from other charts, and would have
graphical glitches. The glitches are fixed by giving the chart its own
copy of the dataset.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
This commit is contained in:
Mcat12
2018-12-16 00:08:21 -05:00
parent 76e3910075
commit b2f9fbe085
@@ -79,7 +79,12 @@ export class GenericDoughnutChart extends Component {
data={{
datasets: [
{
data: this.props.data,
// Make a copy of the data here. ChartJS does weird things
// to the data, which React doesn't catch. This can cause
// oddities such as one chart showing the other chart's
// data. This behavior is fixed by sending ChartJS its own
// copy of the data.
data: [...this.props.data],
backgroundColor: this.props.colors
}
],