ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  How can I support a hour format start at 01 and end at 24.
Posted by ying on Nov-19-2013 09:04
Hi, Peter

From the documentation of Chartdirector,  date/time formating support hh and h for hours. I'm wondering can chartdirector support hourly format that start as 01 and end as 24? If chart director do not support it, is there any work around I can do? I'm using java.

Thanks

  Re: How can I support a hour format start at 01 and end at 24.
Posted by ying on Nov-19-2013 09:15
Hi, Peter

some addition to my question. I am using formatCondition for dynamic formating x axis date format, and want to show hour format as 01~24. Thanks.
Here's part of the code :


    a.setFormatCondition("else");
    a.setMultiFormat(Chart.StartOfDayFilter(), "<*font=bold*>{value|hh:nn<*br*>mmm dd}", Chart.AllPassFilter(), "{value|hh:nn}");
  }

  Re: How can I support a hour format start at 01 and end at 24.
Posted by Peter Kwan on Nov-20-2013 01:04
Hi ying,

Do you mean that the time 2013-1-1 01:34:12 (in international standard format ISO 8601), should be displayed as 2013-1-1 02:34:12 (that is, each hour is displayed one greater than its value in international format)? Or do you mean 2013-1-1 01:34:12 should be displayed unchanged, but 2013-1-1 00:34:12 should be displayed as 2013-1-1 24:34:12? Or do you mean 2013-1-1 00:34:12 should be displayed as "2012-12-31 24:34:12?)

For the first case, instead of {value|hh:nn}, you may use:

"{={value|h}+1|ss}:{value|nn}"

In the second and third case, the hour and minutes parts can use:

"{=({value|h}+23)%24+1)|ss}:{value|nn}"

For the third case, you would need to adjust the year, month and day part as well:

"{={value}-3600|mmm dd}"

Hope this can help.

Regards
Peter Kwan

  Re: How can I support a hour format start at 01 and end at 24.
Posted by ying on Nov-20-2013 09:17
Hi, Peter

This is very helpful. Thanks for your quick reply. You answer resolved my questions, but I'm wondering how to write a more complicated format. I tried the following, but it is not working.

"{={({value}+60*5|h}+1)|ss}:{value|nn}"

What's wrong with my above format?

Thanks

  Re: How can I support a hour format start at 01 and end at 24.
Posted by Peter Kwan on Nov-21-2013 03:53
Hi ying,

The outermost {=....} indicates that it is a format expression. The expression itself can use {XXX} to represent a built-in variable (such as {value}), with optional format (such as {value|h}). The "{({value}+60*5|h}" would not work, as the content inside {...}, which is "({value}+60*5", is not itself a variable name. (In fact, your expression is ill-formed - the parathesis and curly brackets do not match.)

For your case, I think it is equivalent to (if I understand your intention correctly):

{=({value}+300)%86400/3600+1|ss}

Hope this can help.

Regards
Peter Kwan

  Re: How can I support a hour format start at 01 and end at 24.
Posted by ying on Nov-21-2013 03:56
Hi, Peter

Thanks for your reply. It's very helpful.