Magnitude and Phase plots

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Raavi
Newbie
Newbie
Posts: 36
Joined: Tue Apr 01, 2014 12:00 am

Magnitude and Phase plots

Post by Raavi » Wed Mar 04, 2015 1:12 pm

I would like acheive what is shown in the below link.

http://www.teechart.net/support/viewtop ... 647#p44663

Right now, I have two fastlines. One for magnitude and an another for phase, plotted on a chart but I don't know how to give axes for magnitude and phase separately.

Any help is appreciated.

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

Re: Magnitude and Phase plots

Post by Christopher » Wed Mar 04, 2015 4:38 pm

Hello!

There are two methods - either set one of the series to the right axis, or use a custom axis - both of these are shown in the code below:

Code: Select all

    FastLine series1 = new FastLine();
    FastLine series2 = new FastLine();
    private void InitializeChart()
    {
      tChart1.Aspect.View3D = false;
      tChart1.Series.Add(series1);
      tChart1.Series.Add(series2);
      series1.FillSampleValues();
      series2.FillSampleValues();

      //method 1 - set one series to right axis
      //series2.VertAxis = VerticalAxis.Right;

      //method 2 - use a custom axis
      Axis axis = new Axis(tChart1.Chart);
      tChart1.Axes.Custom.Add(axis);
      axis.Horizontal = false;
      series2.CustomVertAxis = axis;
      axis.StartPosition = 51;
      axis.EndPosition = 100;
      tChart1.Axes.Left.StartPosition = 0;
      tChart1.Axes.Left.EndPosition = 49;
    }
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

Raavi
Newbie
Newbie
Posts: 36
Joined: Tue Apr 01, 2014 12:00 am

Re: Magnitude and Phase plots

Post by Raavi » Thu Mar 05, 2015 3:32 pm

Thank you very much indeed.

I'm working with custom axis for bottom, right and left and they work really well except with the margins and axis title.

Attached the screen-shot of the same. May I Know how to give nice margins and axis title with custom axis?
Attachments
CustomAxis.png
CustomAxis.png (64.99 KiB) Viewed 7177 times

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

Re: Magnitude and Phase plots

Post by Christopher » Fri Mar 06, 2015 10:24 am

Raavi wrote:Attached the screen-shot of the same. May I Know how to give nice margins and axis title with custom axis?
Of course. You can use the Labels.CustomSize and the Panel.MarginLeft, as shown below:

Code: Select all

    FastLine series1 = new FastLine();
    Axis axis = new Axis();
    private void InitializeChart()
    {
      tChart1.Aspect.View3D = false;
      tChart1.Series.Add(series1);
      series1.FillSampleValues();

      tChart1.Axes.Custom.Add(axis);
      axis.Horizontal = false;
      series1.CustomVertAxis = axis;
      axis.StartPosition = 0;
      axis.EndPosition = 100;
      axis.Title.Text = "Custom Axis Title";
      axis.Title.Angle = 90;
      axis.Labels.CustomSize = 50; 

      tChart1.Panel.MarginUnits = PanelMarginUnits.Pixels;
      tChart1.Panel.MarginLeft = 80;
    }
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