X-Axis Display only fulll Hours

51 views
Skip to first unread message

Kai Schnittcher

unread,
Mar 9, 2014, 9:26:08 AM3/9/14
to dygraph...@googlegroups.com
Hello,
can anyone help me?
My X-Axis can not be display only full hours.

Here an Example.


I try it with this code:

axisLabelFormatter: function(d, gran) {
var x = new Date(d*1000);
return Dygraph.dateAxisFormatter(x,Dygraph.HOURLY);

Sorry for my bad english.


Dan Vanderkam

unread,
Mar 9, 2014, 9:28:31 PM3/9/14
to dygraph...@googlegroups.com
How about

axisLableFormatter: function(d) { return d.getHours() + ":" + d.getMinutes(); }


--
You received this message because you are subscribed to the Google Groups "dygraphs-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dygraphs-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kai Schnittcher

unread,
Mar 10, 2014, 4:15:31 AM3/10/14
to dygraph...@googlegroups.com
Thanks for your answer.

No, this doesn´t help. I want only the full hours for example:

10:00
11:00
12:00
13:00

And when I zoom into the diagram, I want to show the minutes and seconds, too.
Is that possible?

Dan Vanderkam

unread,
Mar 10, 2014, 10:59:21 AM3/10/14
to dygraph...@googlegroups.com
Are you doing something strange with your x-axis? The behavior you're asking for is roughly what dygraphs is supposed to do out of the box. Links to examples (via dygraphs.com/fiddle) are very helpful.

Kai Schnittcher

unread,
Mar 10, 2014, 11:17:15 AM3/10/14
to dygraph...@googlegroups.com
Oh, here is an example.

http://jsfiddle.net/eM2Mg/2778/

I hope you can help me. :)

Dan Vanderkam

unread,
Mar 10, 2014, 12:17:27 PM3/10/14
to dygraph...@googlegroups.com
You're passing in timestamps as your x values, not Date objects. If you pass in date objects, you'll get much better ticks.

Kai Schnittcher

unread,
Mar 10, 2014, 7:25:13 PM3/10/14
to dygraph...@googlegroups.com
Thank you, now it works. :)
Reply all
Reply to author
Forward
0 new messages