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

Message ListMessage List     Post MessagePost Message

  {value} parameter, with if or iif statement
Posted by icm63 on Jan-20-2020 01:14

I use this a lot to shrink the yAxis value.

{={value}/1000|0}

But I really want to do this


{=if({value} > 10000,{value}/10000|0,{value}/1000|0)}


Question: Can this be done in any way with {value}?



Of course the long way around is ....to do this with a function .Net vb to return a {={value}/1000|0} as a string based on a value. But that means more calculations when really I should be using {value} to determine what to divided it by.

  Re: {value} parameter, with if or iif statement
Posted by Peter Kwan on Jan-21-2020 00:49
Hi icm63,

According to your message, if both 20000 and 2000 exists on the same axis, they will both be formatted as 2. which seems strange to me. I think you mean:

{=if(max_value > 10000,{value}/10000|0,{value}/1000|0)}

It is because normally, all labels on an axis will be divided by the same factor based on the maximum value of the axis.

You may try to use Axis.setFormatCondition. See:

https://www.advsofteng.com/doc/cdnet.htm#Axis.setFormatCondition.htm

Several examples in ChartDirector demonstrates this method, such as:

https://www.advsofteng.com/doc/cdnet.htm#zoomscrolltrack.htm

For your case, you may try:

c.xAxis().setFormatCondition(">", 10000);
c.xAxis().setLabelFormat("{={value}/10000|0}");
c.xAxis().setFormatCondition("else");
c.xAxis().setLabelFormat("{={value}/1000|0}");

Hope this can help.

Regards
Peter Kwan