How to dynamically change jqplot renderer?

妖精的绣舞 提交于 2019-12-03 09:07:33

I think the docs are ok, but you will find hidden features inside of it or quirks that aren't documented. IIRC (it's been a while) you will have to call $.jqplot() again but you first need to .empty() your target or you'll get extra / messed up canvases.

What you really need to do is save your data and allow it to be called later:

//This isn't real jqplot syntax but it should give you a good idea of what I'm explaining

var charts = [{name:"chart1",renderer:"pie",data:[[1,2],[2,3]]}]
$('#graph').jqplot(charts[0]);

//later
charts[0].renderer = "bar";
$('#graph').empty().jqplot(charts[0]);
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!