问题
I am in need to add a zero point for category axis in javafx line chart. In the image I want some "T0" to represent the zero mark of origin on the x axis, so that I can mark point on y axis as on the chart. sample line chart ( looks like bar chart !)
回答1:
I'm not completely clear what you're asking, but if you want the pixel coordinates of the left end of the x-axis, you can do
Category xAxis = ... ;
// ...
double leftEnd = xAxis.getDisplayPosition(value0) - xAxis.getCategorySpacing();
where value0
is the x-value of the first data point.
来源:https://stackoverflow.com/questions/39287063/javafx-charts-setting-origin-point-on-category-axis