开发者

Dojox datachart live update?

开发者 https://www.devze.com 2023-02-28 18:59 出处:网络
As per the title,开发者_高级运维 I\'m really wondering how do I do live updates in datachart ?? As this site is old SitePen datachart, they were still on Dojo 1.3 with Persevere 1.0, where now Dojo ha

As per the title,开发者_高级运维 I'm really wondering how do I do live updates in datachart ?? As this site is old SitePen datachart, they were still on Dojo 1.3 with Persevere 1.0, where now Dojo had gone to 1.6 and Persevere 2.0. Google shows 1.6 ady has new Data Api. I'm really confused about what to do now. How can I make a successful live update on my chart without really refreshing it... Somebody please help me > <


http://dojotoolkit.org/documentation/tutorials/1.6/charting/ : This tutorial does a good job explaining the basics of DOJO charting.

Presuming you have a basic chart created:

var chart1 = new dojox.charting.Chart2D("chart");
chart1.addPlot("default", {type: "Lines"}); chart1.addAxis("x"); chart1.addAxis("y", {vertical: true}); chart1.addSeries("Series 1", [1,2,3,4,5]); chart1.render();

To update this chart with new data you just need to update the data series and then render the chart again:

chart1.updateSeries("Series 1", [5,4,3,2,1]);
chart1.render();

Each time you do this the chart will be updated to reflect the new data series. If you have a legend that needs to up updated, it will need to be refreshed separately (using legend.refresh())


There are a lot of really good tutorials on Dojo 1.6 now under there documentation page. The tutorials are new and up to date. http://dojotoolkit.org/documentation/

I would recommend fully reviewing the tutorials and then you should have the knowledge you need to do live updates to the data chart.


You might also try the DataPresentation widget which simplifies hooking up a chart to a Dojo data store, enabling automatic updates in an MVC pattern.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号