mirror of
https://github.com/gosticks/web.git
synced 2026-10-06 06:37:07 +00:00
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:
@@ -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
|
||||
}
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user