✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚾️ It's finally Baseball season! Root for the home team... & Register for our Sports Analytics Webinar!

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:


{ 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