我有一个使用chart.js创建的条形图.在页面加载时一切正常,但是当我使用daterangepicker更改时间范围时,会出现毛刺.新数据被引入,但当我将鼠标悬停在它上面时,会显示旧数据.我是javascript的新手,所以我希望得到一些帮助.看起来我需要合并.destroy(); 不知何故,但我不知道如何.我的代码片段如下:
function loadFTPRChart(startdate, enddate){
var BCData = {
labels: [],
datasets: [
{
label: "Pass %",
backgroundColor: "#536A7F",
data: [],
stack: 1
},
{
label: "Fail %",
backgroundColor: "#e6e6e6",
data: [],
stack: 1
},
{
label: "Auto %",
backgroundColor: "#286090",
data: [],
stack: 2
},
{
label: "Manual %",
backgroundColor: "#f0f0f0",
data: [],
stack: 2
}
]
};
$.getJSON( "content/FTPR_AM_Graph_ajax.php", {
startdate: startdate,
enddate: enddate,
location: "M"
})
.done(function( data ) {
console.log("data", data);
$.each( data.aaData, function( key, val …Run Code Online (Sandbox Code Playgroud)