Mode lines, modeBarButtonsToAdd: ['select2d'] -- not working

Button ‘select2d’ = ‘Box Select’ disappears when trace mode is ‘line’.
How to show that button anyway?
I have tried everyway I could think of, no success, so please help.

Here is code pen:

and here is the code:

Plotly.newPlot(

‘myDiv’,
[
{ x: [1, 2, 3], y: [10, 20, 30], mode: ‘lines’},

// don't want to uncomment this line to show Box Select
// { x: [2], y: [12], mode: 'markers'}

],
{}, // layout
{
displayModeBar: true,

// how to add button select2d
// modeBarButtonsToAdd: ['select2d'],

// this works normally 
// modeBarButtonsToRemove: ['select2d'],

}
)

Right, selection isn’t supported for mode:'lines' scatter traces, so that button is removed.

But if I add only one point everything works fine. I just need to grab “range” from selection.
It would be nice just to be able to turn that selection button on.

object-of-selection-range.x[0, 1]

Why I need this? Because I calculate the field below the lines and user sets selection on x axis.

Something like this: https://i.stack.imgur.com/rMRkE.png
https://i.stack.imgur.com/rMRkE.png

a

1 Like

I feel like this should be supported. The underlying data points that comprise the line are still there. Why can’t I select them even if my plot doesn’t show markers?

1 Like