comethighchartsdwr

Highchart and DWR Comet


There is an element that get updates using DWR comet command in server side Like this

Util.setValue("newnumber", number);

So in Client Side I can get it like in simple command like

<div id = newnumber></div>

Now I want to add the data in HighCharts' live chart. My question is there any event command that says that the "newnumber" value is updated so that I can add the new data in highchart series?


Solution

  • Ok, I figured it out. The only way to get value in dwr

    var xx = dwr.util.getValue(newnumber);
    

    And I used periodic function to get latest value add in series of Highcharts

        setInterval(function() {
                                var yy = parseInt(xx);
                                var x = (new Date()).getTime(), // current time
                                    y = yy;
                                series.addPoint([x, y], true, true);
                            }, 1000);