Multiple Y axes- labels/title overlap each other

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
ralias
Newbie
Newbie
Posts: 2
Joined: Mon Mar 18, 2002 5:00 am
Location: TX

Multiple Y axes- labels/title overlap each other

Post by ralias » Wed Jan 19, 2005 12:22 am

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

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Wed Jan 26, 2005 7:57 pm

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 :

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;
}

ralias
Newbie
Newbie
Posts: 2
Joined: Mon Mar 18, 2002 5:00 am
Location: TX

Post by ralias » Wed Jan 26, 2005 11:17 pm

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

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Fri Jan 28, 2005 3:34 pm

Hi Rohit,

the problem is that you first must increase the Left Margin, i.e :
tChart1.Panel.MarginLeft = X;

Post Reply