Closed GoogleCodeExporter closed 9 years ago
This is very easy to implement using gflot + GWT RPC.
You can follow this example :
http://code.google.com/p/gflot/source/browse/trunk/src/test/java/ca/nanometrics/
gflot
/client/example/DecimationExample.java
These are the basic steps:
1) Create an RPC service which returns a List<DataPoint>
(http://code.google.com/webtoolkit/doc/latest/tutorial/RPC.html)
2) Poll the server periodically for new points
3) When you received the data from the server add the points to the gflot
SeriesHandler and redraw the chart.
I hope this help you. Let me know if you have any questions.
Alex
Original comment by alexjdl
on 17 Dec 2009 at 3:35
I think it would be useful to allow the pure JSON to be passed to the gflot
plots
instead of going through a heavier GWT RPC procedure with both client and
server having
knowledge of the DataPoint class in gflot.
Original comment by bljf...@gmail.com
on 25 May 2010 at 10:17
You do not need to know DataPoint on server side. Here is my piece of code
(SmartGWT) for dynamically loading DataPoints:
...
resultDS.fetchData(cr, new DSCallback(){
public void execute(DSResponse response, Object rawData, DSRequest request) {
if(response.getHttpResponseCode()==200){
RecordList r = response.getDataAsRecordList();
for(Record rec : r.toArray()){
double x = rec.getAttributeAsDouble("t");
double y = rec.getAttributeAsDouble("v");
Timeline.series.add(new DataPoint(x, y));
}
Timeline.plot.redraw();
}
}
}, dsr);
...
Timeline is a class containing a plot object.
Original comment by bso...@gmail.com
on 14 Feb 2012 at 9:34
It is now possible to get the json as a String from server using
RPC/RequestBuilder/RF... and transform that String to SeriesData with :
SeriesData data =
com.google.gwt.core.client.JsonUtils.safeEval(myJsonDataAsAString);
seriesHandler.setData(data);
plot.redraw();
Original comment by nmr.morel
on 19 Jan 2013 at 4:52
Original comment by nmr.morel
on 19 Jan 2013 at 4:54
Original comment by nmr.morel
on 19 Jan 2013 at 4:54
Original issue reported on code.google.com by
evge...@gmail.com
on 16 Dec 2009 at 9:41