Vaadin charts scatter plot setExtremes() calls for yAxis can cause NPE.

We noticed that code that we used for custom zooming (it used to be problematic to use zoom with multiple y-axis) stopped working:

case ZOOM: scatterChart.getConfiguration().getyAxes().getAxes().stream() .forEach(a->a.setExtremes(yStart,yEnd)); scatterChart.getConfiguration().getxAxis().setExtremes(xStart, xEnd); causes NullPointerException as setExtremes function depends on the com.vaadin.addon.charts.model.Configuration.getAxisDimension(Axis axis) which has check that cannot work for Yaxis:

 private short getAxisDimension(Axis axis) {

        if (xAxis.contains(axis)) { <-- this will fail with NPE since we called getyAxes()...

            return ChartClientRpc.X_AXIS;

        } else if (yAxis.contains(axis)) {

            return ChartClientRpc.Y_AXIS;

        } else if (zAxis.getAxes().contains(axis)) {

            return ChartClientRpc.Z_AXIS;

        } else if (colorAxis.getAxes().contains(axis)) {

            return ChartClientRpc.COLOR_AXIS;

        } else {

            return -1;



It turns out that reordering of the calls fixes this problem as xAxis is initialized in such case, this works:

case ZOOM:
      scatterChart.getConfiguration().getxAxis().setExtremes(xStart, xEnd);

Still, it’s probably a bug that should be fixed.


Thanks Krzysztof for reporting this

You’re definitely right, this seems to be a bug, I’ve created the issue