0 Replies Latest reply: Nov 12, 2012 11:39 AM by 892635 RSS

    Align Y-Axis of two vertically laid out charts

    892635
      I have two JavaFX charts aligned vertically. The charts display different data with different min- and max-Values for the Y-Axis. Therefore the chart with the bigger max-Value needs more room for the tick labels to display them correctly. This is expected behaviour of course. However, in my case, I'd like the actual Y-Axis (the line) of both charts to be aligned.

      The following screenshot illustrated my problem - I'd like both Y-Axis to be positioned exactly on top of each other (the green line in the screen shot)

      http://i.imgur.com/TOTzo.png

      I've tried to solve this by setting the prefered width of the Y-Axis of both charts to the maximum width of both Y-Axis Nodes. This works as long as the actual chart data is not modified. Once the chart data is changed the Chart tries to resize the Y-Axis Node accordingly but this time - because I've set a prefered width for the Y-Axis node - the width cannot be changed. And I end up with the tick labels overwriting the regular axis label :/

      I'd like to calculate the prefered width like so: "set the width of both chart Y-Axis nodes to the maximum width of the regularly calculated width of both charts"

      Is this somehow possible or is there a different way to achieve this?

      Edited by: jh on 12.11.2012 09:38