I have a simple chart implementation where I add and remove sample points at regular intervals. This works fine if the chart only contains one series. However, when the chart contains multiple series, only the first series is updated in the browser.
Is this a bug in Vaadin Charts or am I doing something wrong?
The below is taken from the output provided by SampleChart.java (see attached source).
Refreshed: series=Chart1-Series1, points=30
Refreshed: series=Chart1-Series2, points=30
Removing point: series=Chart1-Series1, x=1366733382507, y=10.854093214814155
Removing point: series=Chart1-Series1, x=1366733392507, y=27.98980455865623
Refreshed: series=Chart1-Series1, points=29
Removing point: series=Chart1-Series2, x=1366733382507, y=4.680416962881406
Removing point: series=Chart1-Series2, x=1366733392507, y=1.9991753327851602
Refreshed: series=Chart1-Series2, points=29
I have done a Wireshark trace (also attached) and found that the JSON response infact contains information about the added / deleted points. Below is an JSON stream for the first chart refresh.
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Transfer-Encoding: chunked
Server: Jetty(6.1.26)
15
for(;;);[{"changes":[
330
], "state":{}, "types":{"2":"1","1":"2"}, "hierarchy":{"2":[],"1":[]
}, "rpc" : [["1","com.vaadin.addon.charts.client.ui.ChartClientRpc","removePoint",[1.366733382507E12,10.854093214814155]
],["1","com.vaadin.addon.charts.client.ui.ChartClientRpc","removePoint",[1.366733392507E12,27.98980455865623]
],["1","com.vaadin.addon.charts.client.ui.ChartClientRpc","addPoint",["[1366733683102,8.869438262442376]
",0,false]],["1","com.vaadin.addon.charts.client.ui.ChartClientRpc","removePoint",[1.366733382507E12,4.680416962881406]
],["1","com.vaadin.addon.charts.client.ui.ChartClientRpc","removePoint",[1.366733392507E12,1.9991753327851602]
],["1","com.vaadin.addon.charts.client.ui.ChartClientRpc","addPoint",["[1366733683102,16.661125408309168]
",1,false]]], "meta" : {}, "resources" : {}, "locales":[], "timings":[373, 247]
}]
0
I have provided a complete example to demonstrate this. All you need to do is:
- Download the attached file (vaadin-charts-dashboard.tgz)
- tar xvfz vaadin-charts-dashboard.tgz
- cd vaadin-charts-dashboard
- mvn clean install
- mvn jetty:run
- localhost:8080/dashboard (in browser)
12925.tgz (12.5 KB)