Open kromar777 opened 6 months ago
The mechanism to keep track of axes should be refactored a bit, but so far it has been a low priority.
I assume that this is caused caused by some call to e.g. chart::getXAxis
that automatically adds an axis if the chart does not already have one defined (maybe by the gridRenderer?). To fix it, the chart axes should be explicitly specified rather than being cleared, e.g., chart.getAxes().setAll(xAxis, yAxis, xAxis2, yAxis2)
.
In one of my apps a user can dynamically add/remove/edit axes and renderers can have as independent as well as "shared" axes (usually only Y as secondary). I create separate renderers for each dataset and before doing this I always remove chart axes: chart.getAxes().clear(). Also I follow the recommendation in the examples: N.B. it's important to set secondary axis on the 2nd renderer before adding the renderer to the chart. After that I don't touch the chart until adding datasets, but sometimes extra axes are still present: I don't get it in what moment they are added again. I'm not sure whether it's a bug and not a big deal actualy though I would like to get advice how to reliable get rid of chart axes besides of inserting chart.getAxes().clear() in different places along the code where they can appear.