Page 1 of 1

harmonising right and left axis grid increments

Posted: Thu Jul 09, 2015 5:02 pm
by 16569987
Hi,

When showing both right and left axes, the TChart does not attempt to harmonise grid lines such that they fit both left and right axes. In order to do this programmatically, I need to calculate the number of left axis increments and use this to optimize the right axis maximum and minimum.

But the axis maximum property returns the maximum of its dependent series rather than the maximum value that the axis accommodates. How can I get at the maximum accommodated axis value?

Thanks for any advice.

Regards

Toreba

Re: harmonising right and left axis grid increments

Posted: Fri Jul 10, 2015 8:09 am
by yeray
Hi Toreba,

This sounds pretty similar to what was discussed here, isn't it?

If you still find problems with it, please try to arrange a simple example project we can run as-is to reproduce the problem here.

Re: harmonising right and left axis grid increments

Posted: Fri Jul 10, 2015 9:44 am
by 16569987
Yeray,

It's not clear that the code example given there is going to help. It seems to use some mysterious integer constants, and methods such as CalcPosValue are not described in the help file, which simply says 'internally used to speed up axis calculations'.

I have one series on the left axis and another on the right axis, and so scales are completely different for the two series, but for neat display I want to calculate right axis extents and increment so that the grid lines associated with each axis align. To simplify what I am asking, is there a method which returns the chart value at each end of the axis, i.e. the axis maximum and minimum, not the maximum and minimum values of dependent series?

Regards

Toreba

Re: harmonising right and left axis grid increments

Posted: Fri Jul 10, 2015 1:36 pm
by yeray
Hello Toreba,
toreba wrote:To simplify what I am asking, is there a method which returns the chart value at each end of the axis, i.e. the axis maximum and minimum, not the maximum and minimum values of dependent series?
Note the axes minimum and maximum are calculated during the drawing process. So you may need to force a chart repaint (Chart1.Draw) before accessing them.

Re: harmonising right and left axis grid increments

Posted: Mon Jul 13, 2015 11:13 am
by 16569987
Ah yes! Thank you!