axis labels and title overlaping for many vertical axes

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Petr
Newbie
Newbie
Posts: 39
Joined: Wed Jul 24, 2013 12:00 am

axis labels and title overlaping for many vertical axes

Post by Petr » Thu Mar 27, 2014 2:23 pm

Hi, i use multiple custom vertical axis, and place it on some distance from each other on the left side. when values are quiet large threre is oveplapping of title of axis and its labels, to solve it i turned FixedLabelSize property to false, as someone rocended on this forum, but after that have to move all other axes to the proper place. Bellow you can see a part of a code.

Code: Select all

        public double Min
        {
            get 
            {
                m_Min = m_Axis.Minimum;
                return m_Min; 
            }
            set
            {
              m_Min = value;
              m_Axis.AutomaticMinimum = false;
              int WidthBefore = m_Axis.Labels.Width;
              m_Axis.FixedLabelSize = false;
              m_Axis.Minimum = value;
              Helper.RecaclulateAxisIncrement(CAxesHolder.GetAxesIncrement(), m_Axis);
              FitAxes(WidthBefore);
            }
        }

        private void FitAxes(int WidthBefore)
        {
          
          m_TChart.Refresh();
          int delta = m_Axis.Labels.Width - WidthBefore;
          ResetPosition(delta);
          m_TChart.Refresh();
          m_Axis.FixedLabelSize = true;
        }

        public double Max
        {
            get
            {
                m_Max = m_Axis.Maximum;
                return m_Max; 
            }
            set
            {
              m_Max = value;
              m_Axis.AutomaticMaximum = false;
              int WidthBefore = m_Axis.Labels.Size.Width;
              m_Axis.FixedLabelSize = false;
              m_Axis.Maximum = value;
              Helper.RecaclulateAxisIncrement(CAxesHolder.GetAxesIncrement(), m_Axis);
              FitAxes(WidthBefore);
            }
        }

        private void ResetPosition(double delta)
        {
          m_TChart.Panel.MarginLeft += delta;

          int index =  m_TChart.Axes.Custom.IndexOf(m_Axis);
          for (int i = index + 1; i < m_TChart.Axes.Custom.Count; ++i)
            m_TChart.Axes.Custom[i].RelativePosition -= delta;
        }
you can see that i do absolutely same things for setting minimum and maximum, but in case of minimum everything works fine, but with minimum it doesn't. So what am i doing wrong, and probably you can offer me another way to solve this problem?

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

Re: axis labels and title overlaping for many vertical axes

Post by Christopher » Fri Mar 28, 2014 10:12 am

Hello,
Petr wrote:you can see that i do absolutely same things for setting minimum and maximum, but in case of minimum everything works fine, but with minimum it doesn't. So what am i doing wrong, and probably you can offer me another way to solve this problem?
Would you be so kind as to give me a fuller code example of your problem? I can't run the example you gave and even if I could I don't think I'd be able to fully understand what the issue is. The kind of example I'm looking for is explained here.

Many thanks.
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

Petr
Newbie
Newbie
Posts: 39
Joined: Wed Jul 24, 2013 12:00 am

Re: axis labels and title overlaping for many vertical axes

Post by Petr » Fri Mar 28, 2014 12:25 pm

Hi Christopher! https://www.dropbox.com/s/lr2fbfz0ht31k0y/trunk.rar here you can find my project with test application. Here's the build order:
1. idl
2. DataController
3. PainterComponent
4. GrapherComponent
5. TRNGraph
6. InteropApp( c++ project, this is the test application )

try to run application, add some plots, and press parameter properties button on the parameter in the list(thre's a tooltip). try to change min and max fields

you are interested in PainterComponent, which is TeeChart Wrapper. In this porject there are classes CAxisHolder and CAxis. in CAxisHolder metod AddAxis Creates CAxis( wrapper of Steema.TeeChart.Axis). and Max/Min accesors are in CAxis.

p.s This links is also can be used to understand the problem in my post http://www.teechart.net/support/viewtop ... =4&t=14809.

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

Re: axis labels and title overlaping for many vertical axes

Post by Christopher » Fri Mar 28, 2014 1:37 pm

Petr wrote:here you can find my project with test application. Here's the build order:
I think I must be doing something wrong. I start with this:
debug1.PNG
debug1.PNG (19.06 KiB) Viewed 23356 times
but when I build I get this:
debug2.PNG
debug2.PNG (12.89 KiB) Viewed 23354 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

Petr
Newbie
Newbie
Posts: 39
Joined: Wed Jul 24, 2013 12:00 am

Re: axis labels and title overlaping for many vertical axes

Post by Petr » Mon Mar 31, 2014 8:12 am

Hi Chrostopher! Probably you have a different path to regtlibv12.exe, in this case you can try to change the path in Command line in Post-Build events property page of idl project. On the othe hand i can say you that you don't need to complie idl and InteropApp, because they are already compiled to bin folder, so you can find them there. So, i hope, with managed projects you won't have any problems.

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

Re: axis labels and title overlaping for many vertical axes

Post by Christopher » Mon Mar 31, 2014 10:36 am

Hi Petr,

I would like to use the source code for TeeChart and TeeChart.Direct2D - will I not need to recompile everything to be able to use it?

Is there no way you can send me a simple Windows Forms example of the problem you have? Using the project you sent is going to take a little time for me to learn how to use it.
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

Petr
Newbie
Newbie
Posts: 39
Joined: Wed Jul 24, 2013 12:00 am

Re: axis labels and title overlaping for many vertical axes

Post by Petr » Mon Mar 31, 2014 12:28 pm

Unfortunately it won't be much easier. More than this i attached it not only for this topic, but for two more also, so i think that it even will be easier for you to understand this and other problems.
I would like to use the source code for TeeChart and TeeChart.Direct2D - will I not need to recompile everything to be able to use it?
no, you do not need to recompile unmanaged parts, maximaly you need to register ..\bin\TrnGraphInterop.tlb with regtlibv12.exe.

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

Re: axis labels and title overlaping for many vertical axes

Post by Christopher » Mon Mar 31, 2014 2:10 pm

Christopher wrote:Unfortunately it won't be much easier. More than this i attached it not only for this topic, but for two more also, so i think that it even will be easier for you to understand this and other problems.

no, you do not need to recompile unmanaged parts, maximaly you need to register ..\bin\TrnGraphInterop.tlb with regtlibv12.exe.
Okay. To avoid me spending too much time on trying to get this project to run on my machine, would you be so kind as to give me very simple, step-by-step instructions which I can follow to get it to run?
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

Petr
Newbie
Newbie
Posts: 39
Joined: Wed Jul 24, 2013 12:00 am

Re: axis labels and title overlaping for many vertical axes

Post by Petr » Mon Mar 31, 2014 2:50 pm

Ofcourse, firstly you should build order is, DataController, PainterComponent, GrapherComponent, TRNGraph. after that you should start InteropApp from bin and attach to it. TeeChart is used in PainterComponent. thanks for response.

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

Re: axis labels and title overlaping for many vertical axes

Post by Christopher » Mon Mar 31, 2014 3:17 pm

Petr wrote:Ofcourse, firstly you should build order is, DataController, PainterComponent, GrapherComponent, TRNGraph. after that you should start InteropApp from bin and attach to it. TeeChart is used in PainterComponent. thanks for response.
I'm very sorry, but I'm afraid I don't understand those instructions. My questions are:
1) how do I set the buildorder?
2) how to I attach to the Interop? (and what do I attach to it?)
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

Petr
Newbie
Newbie
Posts: 39
Joined: Wed Jul 24, 2013 12:00 am

Re: axis labels and title overlaping for many vertical axes

Post by Petr » Tue Apr 01, 2014 5:21 am

The build order is:
1. DataController
2. PainterComponent
3. GrapherComponent
4. TRNGraph

To attach to InteropApp you shoul start it from bin folder and chose Tools->Attach to Process from Visual Studio main menu, chose InteropApp from the list and click Attach button.

I have to apologize for this difficultis, and i decided to make a simple project on C# that will change InteropApp, but it will take some time, so, if you would be so kind, and succesfull in attachiing to existing application, i'll be glad to get an answer.

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

Re: axis labels and title overlaping for many vertical axes

Post by Christopher » Tue Apr 01, 2014 8:55 am

Petr wrote:To attach to InteropApp you shoul start it from bin folder and chose Tools->Attach to Process from Visual Studio main menu, chose InteropApp from the list and click Attach button.

I have to apologize for this difficultis, and i decided to make a simple project on C# that will change InteropApp, but it will take some time, so, if you would be so kind, and succesfull in attachiing to existing application, i'll be glad to get an answer.
I'm sorry too, Petr, for not being able to get your project to run!

I've just started with your trunk.rar again, extracting it to a new folder. I've opened it with VS2013 (upgrading the projects) and then in release mode have built the projects in the order you specified. I then try running InteropApp.exe in the trunk\InteropApp\Release folder and windows gives me a "InteropApp.exe has stopped working message". Any ideas please?
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

Petr
Newbie
Newbie
Posts: 39
Joined: Wed Jul 24, 2013 12:00 am

Re: axis labels and title overlaping for many vertical axes

Post by Petr » Fri Apr 11, 2014 8:08 am

Hi, finaly i made a simple project, that shows problems only for this topic. here you should change values of min and max fields and see the icorrect behaviour of vertical axes.
Attachments
minmax.rar
(30.55 KiB) Downloaded 758 times

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

Re: axis labels and title overlaping for many vertical axes

Post by Christopher » Mon Apr 14, 2014 9:37 am

Petr wrote:Hi, finaly i made a simple project, that shows problems only for this topic. here you should change values of min and max fields and see the icorrect behaviour of vertical axes.
Thank you Petr. How about trying something similar to this:

Code: Select all

    private const int m_AxesWidth = 50;
    Steema.TeeChart.Axis m_Axis1;
    Steema.TeeChart.Axis m_Axis2;
    Steema.TeeChart.Axis m_Axis3;

    public Form1()
    {
      InitializeComponent();

      tChart1.Aspect.View3D = false;

      InitAxis(ref m_Axis1, "axis1");
      InitSeries(m_Axis1);

      InitAxis(ref m_Axis2, "axis2");
      InitSeries(m_Axis2);

      InitAxis(ref m_Axis3, "axis3");
      InitSeries(m_Axis3);

      tChart1.AfterDraw += tChart1_AfterDraw;
    }

    void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
    {
      g.Pen.Width = 2;
      g.Pen.Color = Color.Red;
      g.HorizontalLine(m_Axis2.Title.Right - g.FontHeight , m_Axis2.Position, m_Axis2.Title.Bottom);
    }

    private void InitSeries(Axis axis)
    {
      Steema.TeeChart.Styles.FastLine fl = new Steema.TeeChart.Styles.FastLine(tChart1.Chart);
      fl.FillSampleValues(20);
      fl.CustomVertAxis = axis;
      tChart1.Axes.Custom.Add(axis);
    }

    private void InitAxis(ref Axis axis, string title)
    {
      axis = new Steema.TeeChart.Axis();
      axis.Title.Caption = title;
      axis.Title.AutoPosition = true;
      axis.Title.Angle = 90;
      axis.Automatic = false;
      axis.SetMinMax(0, 10);
      axis.PositionUnits = Steema.TeeChart.PositionUnits.Pixels;
      axis.RelativePosition = -m_AxesWidth * tChart1.Axes.Custom.Count;
      axis.Title.Angle = 90;
      axis.Labels.OnAxis = true;
    }

    private void max_ValueChanged(object sender, EventArgs e)
    {
      m_Axis2.AutomaticMaximum = false;
      m_Axis2.Maximum = (double)max.Value;
      int width = m_Axis2.Position - (m_Axis2.Title.Right - tChart1.Graphics3D.FontHeight);
      if (m_AxesWidth - width < 10 && m_Axis3.RelativePosition != ((-m_AxesWidth * 2) - (m_AxesWidth - width)))
      {
        m_Axis3.RelativePosition -= m_AxesWidth - width;
      }
      else if (!(m_AxesWidth - width < 10) && m_Axis3.RelativePosition != (-m_AxesWidth * 2))
      {
        m_Axis3.RelativePosition = (-m_AxesWidth * 2);
      }
    }
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