Fixed: StackedChart colors only showing on page load

This commit is contained in:
Qstick 2021-05-15 18:45:25 -04:00
parent 06901c4aee
commit 6f7987a907
2 changed files with 7 additions and 3 deletions

View file

@ -44,7 +44,13 @@ class StackedBarChart extends Component {
componentDidUpdate() {
this.myChart.data.labels = this.props.data.labels;
this.myChart.data.datasets = this.props.data.datasets;
this.myChart.data.datasets = this.props.data.datasets.map((d, index) => {
return {
label: d.label,
data: d.data,
backgroundColor: colors.chartColors[index]
};
});
this.myChart.update();
}

View file

@ -39,8 +39,6 @@ function getTotalRequestsData(indexerStats) {
]
};
console.log(data);
return data;
}