charts icon indicating copy to clipboard operation
charts copied to clipboard

Observations with AxisBuilder / Axis?

Open ThomasDaheim opened this issue 4 years ago • 2 comments

When trying to build the following axis:

        xAxisElev = AxisBuilder.create(Orientation.HORIZONTAL, Position.BOTTOM)
                .autoScale(false)
                .type(AxisType.LINEAR)
                .minorTickMarksVisible(false)
                .mediumTickMarksVisible(false)
                .minorTickSpace(5)
                .majorTickSpace(5)
                .tickLabelFontSize(16)
                .title("")
                .build();

I run into various points that I would like to check before trying to change code :-)

  • No matter what I pass as majorTickSpace its always overwritten during redraw() since both calcAutoScale() and calcScale() set minor / major tick space (in my case its always set to 20 after build() and can't be changed afterwards since setMajorTickSpace() is protected).
  • The variables of Axis are not independent of each other, e.g. what happens during redraw() (used in most setXXX methods) depends on autoScale. So I would need to set autoScale first, but AxisBuilder uses a HashMap and not a LinkedHashMap - so I can't influence the order of setting of Axis variables.
  • The above build() triggers redraw() 6 times. Especially for the builder it would be nice to have some "transactional" bracket to call redraw() after all the setXXX have been done?

ThomasDaheim avatar Mar 29 '22 08:03 ThomasDaheim

Next observation: After setting ticks & labels properly I have the issue that the available canvas range for the pane of XYChart doesn't seem to take axis dimensions into account properly:

image

Unfortunately, I didn't tight away find the place where the sizing of the pane is done. Playing around with padding of the XYChart didn't help.

ThomasDaheim avatar Mar 29 '22 19:03 ThomasDaheim

See pull request #75

ThomasDaheim avatar Apr 01 '22 17:04 ThomasDaheim