Reputation: 9959
Can anyone let me know how I can find the length and height of the visible plot section in JavaFX charts (say LineChart
).
In other words, I want to find the length(in px) between axis lowerBound and upperBound.
Please refer to the below screenshot.
Thanks.
Upvotes: 0
Views: 686
Reputation: 209358
Assuming your axes are instances of ValueAxis
, you can do:
double xMin = xAxis.getDisplayPosition(xAxis.getLowerBound());
double xMax = xAxis.getDisplayPosition(xAxis.getUpperBound());
double width = xMax - xMin ;
double yMin = yAxis.getDisplayPosition(yAxis.getUpperBound());
double yMax = yAxis.getDisplayPosition(yAxis.getLowerBound());
double height = yMax - yMin ;
Upvotes: 4