您知道如何彻底删除/清理JQPlot图表。这是我清理它的代码:
$j("#reset").click(function() {
$j("#chart").empty();
if (plot1) {
plot1 = null;
}
});
当我点击重置按钮时,可以从我的页面中删除图表,但是当我从下拉列表中选择新条件以生成新图表时,旧图表将与新图表重叠,如此图像显示{{0 }} 你知道如何真正清理旧图表吗?谢谢!
答案 0 :(得分:1)
答案 1 :(得分:1)
您可以使用以下方法重绘空值:
$.("#reset").click(function(){
if(plot1){
plot1 = $.jqplot('chart', [[[]]], {});
plot1.redraw();
}
});
请参阅工作示例 here
答案 2 :(得分:1)
我的方法很昂贵"但对我有用。使用.remove()
:
if ($("#chart").length) {
$("#chart1").remove();
} else {
$(parent).append("<div id=\"chart1\"></div>");
}
// put $.jqplot below here
答案 3 :(得分:0)
您可以使用destroy方法。 例如
$ cat /tmp/aa |sed -r 's+\\\\"+\\\\'"'"'+g'
"dsd" "\N" "gary\\'"
"ghj" "fandango\\\'" "\N"
"jjj"" "hjh" "gfgfgfg\\'
"ee" "gg\"" "\N"