Page 1 of 1
Magnitude and Phase plots
Posted: Wed Mar 04, 2015 1:12 pm
by 15668832
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.
Re: Magnitude and Phase plots
Posted: Wed Mar 04, 2015 4:38 pm
by Christopher
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;
}
Re: Magnitude and Phase plots
Posted: Thu Mar 05, 2015 3:32 pm
by 15668832
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?
Re: Magnitude and Phase plots
Posted: Fri Mar 06, 2015 10:24 am
by Christopher
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;
}