function chartHourload(chartdata) {
//我想这样直接给他删掉 创建一个 结果会出现如下图错误,大致意思就是:Uncaught TypeError: Cannot read property 'currentStyle' of null
$('#chart-hour').remove();
$('#ChartHour').append('<canvas id="chart-hour"></canvas>');
//然后我又换用了一个$('#chart-hour').removeData();但是这种情况下 图会出现两个叠加
$('#chart-hour').remove();
var chartHourConfig = {
type: 'bar',
data: {
labels: chartdata.Labels,
datasets: [{
data: chartdata.Data,
backgroundColor: chartColors.orange
}]
},
options: {
legend: {
display: false,
},
tooltips: {
mode: 'index',
intersect: false
},
scales: {
xAxes: [{
stacked: true
}],
yAxes: [{
stacked: true
}]
}
}
};
var hourChart = new Chart(document.getElementById("chart-hour").getContext("2d"), chartHourConfig);
}
请问怎么解决这种问题