I "stole" some code from here to have an AreaChart
with "smooth lines" which I use in my FXML and it works:
<SmoothedAreaChart fx:id="chart" legendVisible="false"
title="Tree depth by line" animated="false">
<xAxis>
<NumberAxis fx:id="xAxis" tickUnit="1.0" autoRanging="false"
minorTickVisible="false" forceZeroInRange="false"
label="Line number"/>
</xAxis>
<yAxis>
<NumberAxis fx:id="yAxis" minorTickVisible="false"
tickUnit="1.0" forceZeroInRange="true" label="Tree depth"/>
</yAxis>
</SmoothedAreaChart>
The problem I have however is with the Y axis.
I set the tickUnit
to 1.0
because I want, well, integral units, but it doesn't quite work:
If, in the definition of yAxis
, I set autoRanging
to false
then the graph is cropped (I set the upper bound by hand when I fill the graph):
And, well, there are too many tick marks as well.
Basically, I'd like the behavior of both:
- that the autoranging takes place,
- but that the tick marks always be integral numbers.
Is there a possibility to do this, or do I need to code my own/find an implementation of Axis
which does that?