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

Message ListMessage List     Post MessagePost Message

  LOG Axis Labels?
Posted by Steve Valliere on Mar-27-2018 23:18
When we plot graphs where the vertical axis is logarithmic, the labels used for the major ticks are the exponents only.  So instead of '100' we have '02' and instead of '0.0001' we have '-04'.  I know I can create my own list of labels, but I wish this was an option in the axis itself, especially since log values can "get out of hand" so quickly.  I could use {value|e0} but that wastes space for the '1.' (or would it just be '1'?)

I wonder if {value|e-1} would work... :-)

  Re: LOG Axis Labels?
Posted by Peter Kwan on Mar-28-2018 05:03
Hi Steve,

One method is to simply apply logarithm to your data first before passing the data to ChatDirector. In this case, the y-axis can be configured as a linear axis (the default), and it will be just display the index.

For example, in C++,

for (int i = 0; i < data_length; ++i)
   yData[i] = log10(yData[i]);

If you do not want to log your data first, you may need to use custom labeling, as ChartDirector cannot automatically display just the exponent but not the base value. For your case, one method is to use Axis.setLogScale2:

http://www.advsofteng.com/doc/cdcpp.htm#Axis.setLogScale2.htm

It is also possible to let ChartDirector automstically determine the y-axis scale and the label position, but apply your own formatting function to format the label. See:

http://www.chartdir.com/forum/download_thread.php?bn=chartdir_support&pattern=getTicks&thread=1432415960

Regards
Peter Kwan