vaadin/vaadin-charts

Series can't be removed through Java API

Closed this issue · 4 comments

After adding a series

  configuration.addSeries(new ListSeries("Asia", 502, 635, 809, 947, 1402, 3634, 5268));

It can not be removed from the chart, except by replacing the configuration object

chart.setConfiguration(new Configuration());

I would expect that calling configuration.setSeries() without parameters would work, but all series continue to be displayed.

After discussing this internally, we concluded that making setSeries immediately send the changes to the client would be a behavior change not expected by some users.

In order to clean the series, what can be done is

conf.setSeries();
chart.drawChart(true);

We will mention that on the javadoc that one needs to call Chart#drawChart(true) after setSeries() if this is done after the first render of the Chart instance in order to have it reflected on the client.

We are also fixing one issue related to setSeries as described in #515.

@DiegoCardoso Thanks! Having this mentioned in the javadoc is a good trade off.

Does this have the same root cause as this one #515 ?

Does this have the same root cause as this one #515 ?

Kind of. It needs #515 to be fixed in order to be able to call addSeries after setSeries is called, but this one is about not having the changes reflected on the client (I am assuming the call for setSeries on the OP was done after the chart was rendered).