Black Lives Matter. Please consider donating to Black Girls Code today.

Found a bug in plotly.js in tooltip related to datetime

Oke, somehow when using a date as index, tooltip is always given me an offset. Really annoying. I think it is a bug, see screenshot below. Here some code to reproduce it:

plot = {
‘data’:[
{
‘x’:[86400000, 86400000, 37856320, 145070, 44760000],
‘y’:[‘Hello’]*5,
‘base’:[1511737200000, 1511823600000, 1511910000000, 1511947856320, 1511948001390],
‘orientation’:‘h’,
‘type’:“bar”,
‘marker’: {
‘color’:[‘red’, ‘blue’, ‘yellow’, ‘green’, ‘black’]
}
}
],
‘layout’:{
‘barmode’:‘stack’,
‘xaxis’:{
#‘type’:‘date’,
‘range’:[1511737200000, 1511948001390 + 44760000]
},
‘yaxis’:{
‘fixedrange’:True
}
}
}

I use plotly.js v1.35.1 directly. If I should not post a bug report here, where should a report it? I hope someone can help me.

Thanks for writing in.

Can you open https://codepen.io/etpinard/pen/MGdRKq?editors=1010 and take a screenshot? I suspect a problem with timezone.

I’m seeing:

I opened it, and for for it looks different then yours indeed, see the result below.

I guess indeed it is timezone related. I thought plotly automatically ignored timezone, but I guess this is not the case. I do would like to see the plot with the datetimes as index I provided, without added extra local timezone info or something.

Btw I tried everything to make it correct, thought milliseconds was the only way it might work. I guess I have to try datetime strings again. Btw, you also agree that this is a bug?

I think it’s the same as https://github.com/plotly/plotly.js/issues/2391

Yes, I agree. Hope they will fix it soon. Would there be any other way to be able to plot horizontal bars with date as index?

Solved my problem by using heatmaps instead of bars.