Hi!
What is the proper way to add series dynamically?
- I want to add new visible series.
I already set up my chartConfiguration object (type Configuration) and chart object (Chart chart), I already have several series on the chart (I have visible and hidden charts). I want to add one dynamically. I do the following:
ContainerDataSeries chartContainer = new ContainerDataSeries(
dataContainer); // dataContainer - Container with data
PlotOptionsLine plotOptions = new PlotOptionsLine();
// set some values like plotOptions.setColor(…)
chartContainer.setXPropertyId(xIdObject);
chartContainer.setYPropertyId(yIdObject);
chartContainer.setPlotOptions(plotOptions);
chartConfiguration.addSeries(chartContainer);
It seems that nothing happens until I do chart.drawChart(). The problem with calling chart.drawChart() is that all hidden series (I make them hidden manually with setVisible(false, true)) are shown after the call chart.drawChart(). What is the proper way to add new series dynamically?
- How to add new hidden series dynamically?
The only way I know - manually call setVisible(false, true), but it does nothing right after chart.drawChart() call, and do nothing right before chart.drawChart(). It looks like I must do something to refresh the whole chart, but I don’t know the proper way. Any suggestions?