1
votes

Just encountered an issue with javafx.scene.chart.LineChart. When populating the chart data with Double values above 5E13 or so the series happen to disapear (see screenshot).

Before chart before

After chart before

Just in case: I'm adding data with the folowing code

chart.getData().clear();
chart.getData().add(new XYChart.Series<>("Simulation name", sim.getDataAsList()));

It appeared to be that upperBound property of y axis sets to NaN


NumberAxis axis = (NumberAxis) chart.getYAxis();
        axis.upperBoundProperty().addListener(new ChangeListener<Number>() {

            @Override
            public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
                if(Double.isNaN(newValue.doubleValue())){
                    System.out.println("upperBound is NaN");
                }
            }
        });

Please, help anyone!

1
Please provide a MCVE - Roland

1 Answers

0
votes

Probably best if you just make a divisor and call your axis billions or something.

Otherwise you could set the range yourself and provide a formatter.

Here's a snip from NumberAxis.java

 /** We use these for auto ranging to pick a user friendly tick unit. We handle tick units in the range of 1e-10 to 1e+12 */
    private static final double[] TICK_UNIT_DEFAULTS = {
        1.0E-10d, ..., 5.0E12d