HumbleSoftware / Flotr2

Graphs and Charts for Canvas in JavaScript.
http://www.humblesoftware.com/flotr2/
MIT License
2.45k stars 528 forks source link

Stacked Bar Graph doesn't work over a time series #199

Open atuttle opened 11 years ago

atuttle commented 11 years ago

Repro case: http://jsfiddle.net/u2Wje/4/

If you set bars: { show: false } then you can see line graphs with the expected data, but setting show:true does not show the expected bars.

Am I doing something wrong? I modeled it very closely after this example.

atuttle commented 11 years ago

For comparison purposes, instead of setting bars: show: false, you can also turn off time mode for the x-axis and change the x-axis data values to integers, and you get the desired stacked bar graph. Here's a fiddle for that: http://jsfiddle.net/3fCpW/2/

gadeynebram commented 11 years ago

Hi atuttle,

I'm using flotr for stacked bar graphs with time series.

See example on http://jsfiddle.net/LFFt2/

atuttle commented 11 years ago

@gadeynebram Your fiddle has a bug (missing a comma before labelsAngle), but I would say it is not equivalent to my use case.

I see that you're using a time series (x-axis mode time), but your x-axis data is not time data, it's still integers. I'm interested in plotting things against an actual timeline: volume of thing a, thing b, thing c, on a certain day. Your x-axis labels are "0:00:00.1" etc, which is ultimately unhelpful for what I'm trying to do.

I suppose I could hack it so that I know x=1 corresponds to a certain day and use custom functions to render axis labels and hover tooltips, but I'd still like to see this bug fixed.

bline commented 10 years ago

@atuttle managed to get this working by using timeUnit: 'second' and setting the data with .getTime() / 1000. It's a hack but then I have working stacked bars with nice time scaling. Seems stacked bars doesn't do well with large numbers...

atuttle commented 10 years ago

Eh, I just switched to nvd3. Looks better, more interactive, and doesn't have this issue. It's also easier to code the graphs.

stej commented 10 years ago

The only good news from this bug is mentioning nvd3. I will probably switch also..