plotly.js icon indicating copy to clipboard operation
plotly.js copied to clipboard

bar width doesn't works when x axis is a date

Open Kurairaito opened this issue 9 years ago • 2 comments

Hi,

Here is an example : https://codepen.io/anon/pen/LzVyOB

I took an example found here : https://community.plot.ly/t/how-do-i-change-the-width-of-each-the-bar/2409/2 But couldn't understand why it wouldn't works on my data, until I found that when using date axis it doesn't works (but it works when using numerical or string X axis !)

Regards.

Kurairaito avatar Sep 15 '17 07:09 Kurairaito

Hi @Kurairaito - try this:

width: fill(10, () => Math.random()*1000*3600*24)

Date axes are internally converted to milliseconds, so differences on a date axis need to be represented as milliseconds as well - of which there are 1000*3600*24 in a day.

alexcjohnson avatar Sep 15 '17 13:09 alexcjohnson

Thanks that works fine !

Kurairaito avatar Sep 15 '17 13:09 Kurairaito