'Why does one chart overlays another (chart.js)?
I wanted to create one chart and update type. But when I update pie chart type to bar both charts are visible
function rebuildExpensesChart(){
let ct = document.getElementById("chartType").value
ExpensesChartConfig.data.datasets = [{
type: ct,
//some code here...
}]
ExpensesChartConfig.data.labels = someLabels
ExpensesChart.update()
console.log(ExpensesChart)
}
Solution 1:[1]
I solved it with adding this:
ExpensesChart.data = null
ExpensesChart.options = null
ExpensesChart.update()
before the main code
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | wowkoltyy |
