I am trying to code a class called MultipleAxisLineChart
. As its name says, it will be a LineChart
that will have several axes (I assume that all additional axes will be placed either on Side.LEFT
or Side.RIGHT
).
All axes on the given side will be located on tickLabelGapProperty
. The right axes must be additionally x-translated by the sum of the axes of the left side.
The problem arose when I came to the point of calculating the preferred width of the chart (given my previous assumptions, the areas of the graphs will be the same size, so they can be placed on top of each other). The LineChart#widthProperty
property LineChart#widthProperty
returns the width of the whole LineChart
object (including the y-axis property and the space property) - therefore, this certainly will not be the best candidate for setting the same width for all areas of the LineChart
chart (as I would for calculating a different width for each chart - remember that tickLabelGap is different for everyone).
I can get (and even set) the width of the axis (only Axis#widthProperty
), but not the LineChart
section width. So my question is: is there a way to arbitrarily set the width of the LineChart
chart so that all areas in different charts have the same width?
Update
I am trying to achieve an effect similar to HighCharts
several axes: My attempt is to use StackPane
and add all the charts as children. I could control the size of the chart by setting the width of the StackPane.
source share