Recalculate axis tick values


I have a UI where I have a button to switch between metric and imperial units. In context, assume I’m observing the acceleration of a car by plotting its velocity (in mph) against time. Is it possible to change the y axis’ values from mph to km/h through

My fallback approach is to recalculate server side and replot the entire graph.


You can try using Plotly.restyle. For example,

var graph = document.getElementById('graph')
var x =[0].x

Plotly.restyle(graph, 'x', [])
1 Like

Brilliant, thank you! I will see if this will work tomorrow.