Doubleclick behavior

I am building a complex chart that consists of scatters and bars. The only way to get it right is to set yaxis.autorange to false. But then if I doublecllick on the chart as soon as it ready it will autosize and Y axis will change. I have tried different settings for the doublecllick, nothing. Any recommendations?

Thanks

1 Like

This is from the code:
‘If reset, double click resets the axis ranges to their initial values.’,

Is it really working like this? I think it always autorange regardless of the config value. And what exactly “initial values” means?

Thanks

I have got the exact same problem. I made my range variable. If i doubleclick on the graph, it behaves as autorange, even though i set autorange=false

This topic is quite old but I am facing the exact same problem.
The double click seems to toggle the autorage value even if I force it to false initially.
Have you found a workaround ?

I don’t quite understand what you need, but these are some of the values ​​that can be configured for the double-click behavior within the parameters passed in the configuration in the newPlot function.

  doubleClick: {
    valType: 'enumerated',
    values: [false, 'reset', 'autosize', 'reset+autosize'],
    dflt: 'reset+autosize'
  }

For example

Plotly.newPlot(layer, data, layout, { doubleClick: false })

I may have posted my message on the wrong topic. Actually I use Python for my Dash application with some javascript for the clientside callbacks.

If I set the doubleClick parameter to ‘reset’ using only Plotly, it works as expected.

fig.show(config={'doubleClick': 'reset'})

But using Dash the behaviour of the double click toggles between ‘reset’ and ‘autosize’.

dcc.Graph(id="my-chart", figure=fig, config={'doubleClick': 'reset'})

The doubleClick parameter has a fifth value which is “true” try it and see what happens

I tried to set doubleClick to True and “true” but those values are not accepted.

Invalid argument `config.doubleClick` passed into Graph with ID "water-heater-chart".
Expected one of [false,"reset","autosize","reset+autosize"].

Is it only valid in plotly.js ?

I just tried to set doubleClick to False and the graph was still responding to the doubleClick event.
This made me realise something was overwriting the config in my code.
In one of my clientside callback, I update my figure using the Plotly.react function which seems to overwrite the config. Adding the doubleClick to this function solved my issue.

Thank you very much for the help !

The values ​​are false and true without quotes and in lowercase