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

Message ListMessage List     Post MessagePost Message

  adding 'date' to {value} in yAxis using setLabelFormat
Posted by Richard on Apr-09-2021 00:28
Hi Peter,
using PHP for my chart,  {value} is the offset from a base date. For example,
if the base date were '2021-6-15' , then  the date '2021-6-25' would have {value}=10.
And {value} =15 for the date '2021-6-30'. etc.

I'd like to show the actual date in the yAxis instead of its offset.

I've tried converting everything to seconds, adding them, and then converting back.

$c->yAxis->setLabelFormat ("{= getChartYMD( ({value}*24*60*60 +ChartTime(2021,6,15) )) }");

That didn't work. I expect it failed because you can't call functions from inside of
setLabelFormat??


Any ideas?
Thanks!

Richard

  Re: adding 'date' to {value} in yAxis using setLabelFormat
Posted by Peter Kwan on Apr-09-2021 11:07
Hi Richard,

I would try:

$c->yAxis->setLabelFormat("{={value}*86400+" . chartTime(2021,6,15) . "|yyyy-mm-dd}");

Hope this can help.

Regards
Peter Kwan

  Re: adding 'date' to {value} in yAxis using setLabelFormat
Posted by Richard on Apr-09-2021 19:34
Hi Peter,
that's exactly what I needed. Thanks so much!

Richard