Black Lives Matter. Please consider donating to Black Girls Code today.
Dash Enterprise delivers an incredible 21x cost savings 💸Download the e-book!

Data passed to click event having wrong x-value

I have a plot created off the click-annotation example:

When I click on a point, the value of point.x is exactly one month off from x[point.pointNumber]. x holds the dates. Check the console log.

I cannot reproduce this in the example above. Must be something specific to my plot. I’d appreciate any help discovering the problem. Could it have something to do with using date strings?

changing your toDate function so its matches the plotly_click event data should do the trick:

function toDate(d)
    var parts = d.split('/');

    return [parts[2], parts[0], parts[1]].join('-')

But what if I want the data in the other format? Doesn’t it still seem like a bug that it is adding a day?