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

Message ListMessage List     Post MessagePost Message

  Set manual log scale issue
Posted by icm63 on Jun-14-2025 03:48
Attachments:
Chart Dir 6.0, vb.net

Chart 1 - SH_0001.png
            mainXYChart.yAxis().setLogScale(100, 20000)

Chart 2 - SH_0002.png
            mainXYChart.yAxis().setLogScale(100, 21000)

On chart 2 SH_0002.png the yAxis jumps to 50000, and not 21000.

Is there any way I can have more control over the yAxis lower and upper limit when I load manual inputs into .setLogScale() ?

If so how?

thx
SH_0001.png
SH_0002.png

  Re: Set manual log scale issue
Posted by Peter Kwan on Jun-14-2025 16:49
Hi icm63,

The setLogScale has 4 parameters - lowerLimit, upperLimit, majorTickInc and minorTickInc. If you does not specify the majorTickInc and minorTickInc, ChartDirector will automatically determine the tick increment.

For example, if the axis range is (194.8921 to 9195.981), ChartDirector may choose (100, 200, 500, 1000, 2000, 5000, 10000). Note that the axis starts from 100 and ends at 10000. ChartDirector may extend the axis to ensure the labels are "nice numbers" (100 instead of 194.8921), and that the axis end-points are labelled.

You can use Axis.setRounding to disable extending the axis. For example:
c.yAxis().setRounding(False, False)

In this case, for (194.8921 to 9195.981), the axis scale is exactly (194.8921 to 9195.981). The labels, which are "nice numbers", will be at (200, 500, 1000, 2000, 5000). The end points 194.8921 and 9195.981 may have no label. It may not be a good idea to label the end-points anyway. In the above example, the end point 194.8921 is too close to 200, and the two labels can overlap.

However, if you know the labels cannot overlap, you can always use Axis.addMark to add labels to the ends points with your own code.

https://www.advsofteng.com/doc/cdnet.htm#Axis.setLogScale.htm
https://www.advsofteng.com/doc/cdnet.htm#Axis.setRounding.htm
https://www.advsofteng.com/doc/cdnet.htm#Axis.addMark.htm

Best Regards
Peter Kwan