Hi,
I’m building an application where I use plotly.js to visualize a lot of data points, up to 10k. So, for performance reasons I’m using scattergl type plots. The application has a feature that performs linear fitting on data selected by the user using the box-select or lasso-select tools. The resulting trend line is then plotted on top of the data.
Now the problem is this: When a user selects, and then de-selects points (by double-click) after the trend has been plotted, the Z-order of the traces is somehow changed. This causes the trend line to appear behind the data resulting in poor visibility. The problem does not occur when using type: ‘scatter’ instead of ‘scattergl’.
The behaviour can be reproduced with the steps below and the following codepen:
https://codepen.io/Convo/pen/GLZYdw
- Notice that the trend-line is plotted on top of the data
- Use the box-select tool to select a few points
- Double-click anywhere on the plot to clear the selection
- Notice that the trend line is now plotted below the data.
Is there a way or workaround to make sure that the trend line is always plotted on top of the data? Is this behavior intended, or should I file a bug report?