English 中文(简体)
只有在Xaxis jquery flot上12天时才能显示日期。
原标题:how to show the date only when the time is 12:00 AM on the xaxis jquery flot
  • 时间:2012-05-17 07:57:51
  •  标签:
  • jquery
  • flot

我想贴上 j子的X-轴。 f 显示加薪时间为1小时的图表。 当时间过午夜时,我要显示日期和时间。

我如何能够这样做?

成就

最佳回答

As DNS suggests, use the tickFormatter for this. Something like:

tickFormatter: function formatter(val, axis) {
  var d = new Date(val);
  var rV = null;          
  if (lastDay == null) //lastDay is a global, set to null outside of plot call
  {
    rV = $.plot.formatDate(d, "%H:%M"); // first date return time
  }
  else
  {
     if (d.getDay() == 1 || d.getDay() > lastDay.getDay())  // we have a new day
     {
     rV = $.plot.formatDate(d, "<b>New Day</b></br> %m/%d"); // return different format
     }
     else  // same day, just time
     {
     rV = $.plot.formatDate(d, "%H:%M");
     }
  }
  lastDay = d; 
  return rV;
}
问题回答

您可根据您对标签的掌握情况,在<条码>上设定<>条码>>(或<条码>>>>明星号,然后根据您对标签的掌握情况,提供<条码>的“Formatter<>/code>功能,如果日期在午夜,就会产生标签,否则就是一个空示。





相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签