X-Axis Display only fulll Hours

瀏覽次數:51 次
跳到第一則未讀訊息

Kai Schnittcher

未讀,
2014年3月9日 上午9:26:082014/3/9
收件者: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

未讀,
2014年3月9日 晚上9:28:312014/3/9
收件者: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

未讀,
2014年3月10日 凌晨4:15:312014/3/10
收件者: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

未讀,
2014年3月10日 上午10:59:212014/3/10
收件者: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

未讀,
2014年3月10日 上午11:17:152014/3/10
收件者:dygraph...@googlegroups.com
Oh, here is an example.

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

I hope you can help me. :)

Dan Vanderkam

未讀,
2014年3月10日 中午12:17:272014/3/10
收件者: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

未讀,
2014年3月10日 晚上7:25:132014/3/10
收件者:dygraph...@googlegroups.com
Thank you, now it works. :)
回覆所有人
回覆作者
轉寄
0 則新訊息