Issue with x-axis time series

47 views
Skip to first unread message

Matt D

unread,
May 19, 2010, 1:58:52 PM5/19/10
to Flotr Javascript Plotting Library
I'm having an issue getting my data to show up as a time series. When
I try to graph the array below, I end up with the x-axis displaying
the literal number as opposed to the conversion to Human readable.
Any help would be appreciated.


var dataArray = [[1272638730,20],[1272638780,10],[1272638830,15]];

var options = {
xaxis:{
mode:'time'
}
};

Flotr.draw(graphBox, [ dataArray ], options);

Matt

--
You received this message because you are subscribed to the Google Groups "Flotr Javascript Plotting Library" group.
To post to this group, send email to fl...@googlegroups.com.
To unsubscribe from this group, send email to flotr+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/flotr?hl=en.

oughton

unread,
May 19, 2010, 6:04:15 PM5/19/10
to Flotr Javascript Plotting Library
Make sure you supply your timestamps in milliseconds UTC. You have
yours in seconds.

eg
var dataArray = [[1272638730000,20],[1272638780000,10],
[1272638830000,15]];

Then try:

var options = {
xaxis: {
mode: "time"
timeformat: "%y/%m/%d"
}
};

Matt D

unread,
May 21, 2010, 11:49:15 AM5/21/10
to Flotr Javascript Plotting Library
My times are correct, I've even verified it. Regardless of that, I
would assume it would still format the axis correctly just my date
would be wrong. adding the timeformat to my options object didn't
make an impact either.

Thanks,
Matt

Joel Oughton

unread,
May 21, 2010, 6:23:10 PM5/21/10
to fl...@googlegroups.com
Your times that you provided in your first post weren't correct. They were in seconds... Have you changed these into milliseconds?

Take a look at this example: http://phenxdesign.net/projects/flotr/examples/prototype/basic-time.html

Matt D

unread,
May 24, 2010, 12:48:20 PM5/24/10
to Flotr Javascript Plotting Library
I tried changing them but that had no impact. I also copied the
example verbatim, and that still displayed the numbers as opposed to
the dates. I'm using the Flotr-0.2.0 library with all the included
libraries as well. I've tried it in Firefox, Chrome & IE all with the
same results.

Matt
> > flotr+un...@googlegroups.com <flotr%2Bunsu...@googlegroups.com>.
> > > > For more options, visit this group athttp://
> > groups.google.com/group/flotr?hl=en.
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > "Flotr Javascript Plotting Library" group.
> > > To post to this group, send email to fl...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > flotr+un...@googlegroups.com <flotr%2Bunsu...@googlegroups.com>.
> > > For more options, visit this group athttp://
> > groups.google.com/group/flotr?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Flotr Javascript Plotting Library" group.
> > To post to this group, send email to fl...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > flotr+un...@googlegroups.com <flotr%2Bunsu...@googlegroups.com>.

Matt D

unread,
May 26, 2010, 10:12:44 AM5/26/10
to Flotr Javascript Plotting Library
Apparently I needed to checkout the latest code, after I used the
flotr.js from trunk it worked fine.

Matt

Reply all
Reply to author
Forward
0 new messages