Using clickData on dcc.Graph : y values are not scaled consistently


#1

I have noticed that the information returned by calling back ClickData on graphs was not necessarily consistent when the y-axis contained data with several orders of magnitude (for instance, when the y-axis contains values such as “100k” and “4.5M”). In my case, the y value of the clicked point is correct when dealing with thousands (100k returns a ‘y’ value of 100,000), but not with millions (a value of 4.5M returns a ‘y’ value of 4.5 instead of 4,500,000).

This behavior makes it difficult to perform calculations based on clicked data (for instance: return the sum at specific x-values between y-values on two curves with different magnitudes).

Anyobdy else seeing this behavior?
Any idea on what to do?


#2

I believe that this is only an issue if the type of the axis is log or date rather than the default linear. For each of those cases, you’ll just have to transform the data from the log form back into linear form.

This is a pretty confusing part of Plotly but we unfortunately can’t change it until 2.0, as it would be a breaking change :grimacing: