Reputation:
I have a JavaFX stacked area chart, and I'd like to fix the range that it automatically adjusts when data is added. Currently, the Y axis (which is just a NumberAxis
) goes up to a number that is way too high:
I tried lowering the upper limit of the Y axis by doing:
((NumberAxis)chart.getYAxis()).setUpperBound(2000);
where chart
is a StackedAreaChart
. This doesn't seem to have any effect, unfortunately. How can I set the upper limit of the Y axis in a JavaFX chart?
Upvotes: 3
Views: 3165
Reputation: 3165
Chart axes in JavaFX will require you to set the 'autoRanging' property to false before applying a custom range.
Arguably, it would be nice if the chart node raised an error when you attempt to set the value for an axis with autoranging == true, but at least for JavaFX 2.2 that is not the case.
Upvotes: 6