最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - jqplot completely redraw a graph - Stack Overflow

programmeradmin2浏览0评论

How do I pletely destroy a graph and then redraw one from scratch. The reason I need this is because I want to have the option of changing the graph type from let's say a bar graph to a line graph.

I don't think you can do that strait up, so instead I try to destroy the graph pletely and just make a new one.

plot.destroy();
$.jqplot("graph_id", [data], options);

The destroying went fine, but the reinit did not work at all. Any ideas?

How do I pletely destroy a graph and then redraw one from scratch. The reason I need this is because I want to have the option of changing the graph type from let's say a bar graph to a line graph.

I don't think you can do that strait up, so instead I try to destroy the graph pletely and just make a new one.

plot.destroy();
$.jqplot("graph_id", [data], options);

The destroying went fine, but the reinit did not work at all. Any ideas?

Share asked Nov 23, 2011 at 15:21 Bill Software EngineerBill Software Engineer 7,83224 gold badges106 silver badges191 bronze badges 2
  • Do you get an error? Works for me: jsfiddle/larsenmtl/jAHYc/2 – Mark Commented Nov 23, 2011 at 23:10
  • Yea sorry, I just found out that it was my own error. It works fine now :p – Bill Software Engineer Commented Nov 25, 2011 at 18:53
Add a ment  | 

2 Answers 2

Reset to default 2

Do like the following,

var inti = new Array();
inti.push([0, 0, 0]);
var plot2 = $.jqplot('graph_id', inti, null);
plot2.destroy();
plot2 =$.jqplot("graph_id", [data], options);

this will redraw ur jqplot..

It was my own error, the jqplot worked just fine actually.

发布评论

评论列表(0)

  1. 暂无评论