How to distribute y-Axises equally in Left Margin

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
YTI
Newbie
Newbie
Posts: 15
Joined: Wed May 24, 2017 12:00 am

How to distribute y-Axises equally in Left Margin

Post by YTI » Fri Jul 07, 2017 3:47 am

Hi,
Our .NET Graph component Y-Axis label texts were clipping when Multiple Axises were available and label text has large numbers e.g. 100.000
To fix this issue we have provided option for user to increase Left Margin (Minimum by 3% & Maximum by 50%).
The issue we are facing is the - after the Left Margin size changes the Y-Axises are not getting positioned with equal distance in Left Margin. Instead they are getting aligned to right side with some width and left most area is blank.
We tried setting RelativePosition for Y-Axis but it didn't worked.

Kindly suggest us a way to handle the issue.
Let us know better way to align Y-Axises so that text don't get clipped or guide us to equally distribute Y-Axises in Left Margin so that text won't get clipped.

Thanks.

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: How to distribute y-Axises equally in Left Margin

Post by Christopher » Fri Jul 07, 2017 11:21 am

Hello,

Custom axes do not automatically reposition on every Chart repaint, for example when you cause a repaint by resetting the MarginLeft property. This means that the custom axes positions have to be calculated for each repaint, something you can achieve in one of the Canvas paint events:
featuredemo.PNG
featuredemo.PNG (190.51 KiB) Viewed 12696 times
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

YTI
Newbie
Newbie
Posts: 15
Joined: Wed May 24, 2017 12:00 am

Re: How to distribute y-Axises equally in Left Margin

Post by YTI » Mon Jul 10, 2017 10:19 am

Hi,
Thank you for your suggestion.
But we are not able to set Relative Position in any of the said events.
Thus we are trying to set it using some of our calculations as below. But it is not working accurately.

Code: Select all



            double leftMarginWidthInPixels = (tChart1.Chart.Width * tChart1.Panel.MarginLeft) / 100;
            double marginIntervalInPixels = leftMarginWidthInPixels / yAxisCount;
            double marginIntervalInPecent = (marginIntervalInPixels / leftMarginWidthInPixels) * tChart1.Panel.MarginLeft;           
           
            int index = 0;
            for (int i = 0; i < tChart1.Axes.Custom.Count; i++)
            {
                    tChart1.Axes.Custom[i].RelativePosition = marginIntervalInPecent * -(index) * (100 / tChart1.Panel.MarginLeft);
                    index++;
              }
                
          
we are worried about this calculation:

tChart1.Axes.Custom.RelativePosition = marginIntervalInPecent * -(index) * (100 / tChart1.Panel.MarginLeft);

Please suggest a way to set Relative Position properly.

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: How to distribute y-Axises equally in Left Margin

Post by Christopher » Mon Jul 10, 2017 4:11 pm

Hello,

You might like to try the PlaceAxis code shown in this message here. If that does not fulfil your requirements, please let me know.
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

YTI
Newbie
Newbie
Posts: 15
Joined: Wed May 24, 2017 12:00 am

Re: How to distribute y-Axises equally in Left Margin

Post by YTI » Tue Jul 11, 2017 11:49 am

HI,
Thank you for your reply.
But the suggested solution is not working for us.
We already have chart and allowing user to specify Left Margin using Numeric Up-Down and on this Numeric Up-Down value change want to set Relative position of each series.
Chart.Draw() we don't want to call.
Is it mandatory to call Chart.Draw()?

Please suggest some calculations with which we can achieve it.

Thanks.

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: How to distribute y-Axises equally in Left Margin

Post by Christopher » Tue Jul 11, 2017 1:51 pm

YTI wrote: Please suggest some calculations with which we can achieve it.
I have already suggested some calculations to use, but without a much clearer idea of what you are trying to achieve I am unable to provide you with anything further. To that extent, would you please be so kind as to provide us with a a minimal, complete, verifiable example (definition here) of the code you have which clearly shows your difficulty?
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Post Reply