chart-fx icon indicating copy to clipboard operation
chart-fx copied to clipboard

Zoomer plugin issues with inverted axes

Open j-pforr opened this issue 1 month ago • 1 comments

Description I try to use the zoomer plugin with an inverted axis. But when zooming (with the mouse wheel), the axis range flickers or jumps, and for some zoom settings the axis labels vanish completely. The displayed data then either jumps according to the axis, or sometimes seems to disappear completely.

Reproduction This can be reproduced with the ZoomerSample. I simply changed the method getTestChart to

private static Chart getTestChart(final String title, final DataSet testDataSet) {
        final Axis xAxis = new DefaultNumericAxis();
        xAxis.invertAxis(true);
        final Axis yAxis = new DefaultNumericAxis();
        yAxis.invertAxis(true);
        final var chart = new XYChart(xAxis, yAxis);
        chart.setTitle(title);
        chart.setLegendVisible(false);
        chart.getDatasets().add(testDataSet);
        chart.setPrefSize(PREF_WIDTH, PREF_HEIGHT);

        return chart;
    }

to invert the axes (which for some reason only worked for the y axes, but that was sufficient for me). Then run the sample and zoom, and the bug should be obvious.

Environment:

  • OS: Rocky Linux 9
  • Java version: 17
  • JavaFx version: 16
  • ChartFx version: 11.3.1

j-pforr avatar Nov 07 '25 14:11 j-pforr

Just an FYI. @j-pforr and I are trying to look into this.

Our current lead is that io.fair_acc.chartfx.plugins.Zoomer.zoomOnAxis(Axis, ScrollEvent) calls axis.getValueForDisplay which returns inverted min and max values for inverted axis but should not in this case (since the range values actually remain the same “direction“ for inverted axes but they are just drawn inverted). This reverses the axis display on each zoom operation.

We fixed that case in a prototype but it seems like other problems exist when panning etc. we will continue looking into it.

dedeibel avatar Nov 13 '25 09:11 dedeibel