Hi,
I have multiple Y axes and they are not stacked. These custom Y axes are placed using Relative position percent. When the labels are around 3 digits wide, then things look ok but when they get to 4 digits, then the Title of that axis will be drawn overlapping with the next axis.
a) If you increase the the Relative postion percent then it works- but of course, that is not dynamic. e.g if the labels are all 2 digits then it's too much and if they are all 5 digits then it might be too little
b) A dynamic approach would be to figure out where the left corner of the previous axis was and then draw before that. My problem is that I couldn't figure out a way to get that left corner. Axis.Title.Left always comes back as 0.
c) any approach you guys might suggest
Thanks
Multiple Y axes- labels/title overlap each other
Hi,
you can calculate the Left axis width using the following code and place it on the OnBeforeDraw event so it can be called every time the Chart is displayed :
you can calculate the Left axis width using the following code and place it on the OnBeforeDraw event so it can be called every time the Chart is displayed :
Code: Select all
private void tChart1_BeforeDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
double AxisWidth = tChart1.Axes.Left.Ticks.Length + tChart1.Axes.Left.MaxLabelsWidth();
int extraspace = 30;
tChart1.Axes.Custom[0].RelativePosition = -AxisWidth-extraspace;
}
Pep Jorge
http://support.steema.com
http://support.steema.com
Hi josep,
Thanks for the reply but I must have something else wrong. With the code yu posted, it would seem that if yu had 1 regular Y axis and then added a custom Y axis then the custom axis would be drawn extraspace distance away (i.e. to the left of) from where the non-custom label ends. When I run the code, the first axis is visible and the second is not. The X axis being a datetime shouldn't affect anything,right? However, when I change your code to draw to the right of the first axis , then I do see the second one. Hence, I think I have some sort of scrolling turned off. Appreciate any further pointers.
Thanks
Rohit
Thanks for the reply but I must have something else wrong. With the code yu posted, it would seem that if yu had 1 regular Y axis and then added a custom Y axis then the custom axis would be drawn extraspace distance away (i.e. to the left of) from where the non-custom label ends. When I run the code, the first axis is visible and the second is not. The X axis being a datetime shouldn't affect anything,right? However, when I change your code to draw to the right of the first axis , then I do see the second one. Hence, I think I have some sort of scrolling turned off. Appreciate any further pointers.
Thanks
Rohit
Hi Rohit,
the problem is that you first must increase the Left Margin, i.e :
tChart1.Panel.MarginLeft = X;
the problem is that you first must increase the Left Margin, i.e :
tChart1.Panel.MarginLeft = X;
Pep Jorge
http://support.steema.com
http://support.steema.com