Reputation: 47
I created a lineChart with varying bounds for the X axis and would like to modify the X axis bounds so these will fit what I want. I've tried using xAxis.setLowerBounds()
but hasn't worked yet.
Here's the code:
public static LineChart envolventeMultiple(){
final NumberAxis xAxis = new NumberAxis(), yAxis = new NumberAxis();
xAxis.setLabel("Distance (m)");
xAxis.setLowerBound(Utils.getXIni() - 1);
yAxis.setLabel("Deformation(mm)");
LineChart chart = new LineChart(xAxis, yAxis);
chart.setData(getChartData());
chart.setTitle("Envolvente");
chart.setCreateSymbols(false);
return chart;
}
Upvotes: 1
Views: 1826
Reputation: 47
I finally found out the problem was with setAutoRanging()
, which is by default set to true
so the new bounds were never set. This line of code fixed it:
xAxis.setAutoRanging(false);
Upvotes: 1