View a duplicated Y-axis

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Jens Ramlow
Newbie
Newbie
Posts: 13
Joined: Fri Sep 22, 2017 12:00 am
Location: Berlin, Germany

View a duplicated Y-axis

Post by Jens Ramlow » Fri Oct 06, 2017 11:33 am

Hello Steema team,

I'm using Steema's TeeChart.WPF.

The chart I'm implementing contains three Series from TeeChart.WPF.Styles.Line and TeeChart.WPF.Styles.Points.
There is the Y-axis on the left, created with the following coded settings:

Code: Select all

C#
                //Settings for Y-Axis
                Steema.TeeChart.WPF.Axis leftAxis = MainChart.Axes.Left;
                leftAxis.Visible = true;
                leftAxis.Title.Visible = true;
                leftAxis.Title.Caption = "Volt [V]";
                leftAxis.Grid.Visible = true;
                leftAxis.Grid.Color = Colors.DarkGray;
                leftAxis.Grid.DrawEvery = 1;
                leftAxis.MinorGrid.Visible = false;
                leftAxis.MinorTicks.Visible = false;
                leftAxis.Ticks.Color = leftAxis.Grid.Color;
                leftAxis.TickOnLabelsOnly = true;
                leftAxis.Increment = 1.0;
                leftAxis.AutomaticMaximum = false;
                leftAxis.AutomaticMinimum = true;
I would like to implement a second Y-axis on the right which is identical to the one on the left.
The following didn't work as expected.

Code: Select all

C#
                Steema.TeeChart.WPF.Axis rightAxis = MainChart.Axes.Right; //-> nicht angezeigt Steema Support
                rightAxis.OtherSide = true;
Do you have any idea on this?
Note: All the charting is made at runtime programmatically.

Thank you for any help on this.
Best, Jens

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

Re: View a duplicated Y-axis

Post by Christopher » Fri Oct 06, 2017 2:27 pm

Hello Jens,

Yes, you need to set the axis as the series' vertical axis, e.g.

Code: Select all

    private void InitializeChart()
    {
      Bar series = new Bar(tChart1.Chart);
      series.FillSampleValues();

      tChart1.Axes.Left.Visible = false;

      Steema.TeeChart.WPF.Axis rightAxis = tChart1.Axes.Right; //-> jetzt angezeigt von Steema Support
      rightAxis.OtherSide = false;
      series.VertAxis = VerticalAxis.Right;
    }
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

Jens Ramlow
Newbie
Newbie
Posts: 13
Joined: Fri Sep 22, 2017 12:00 am
Location: Berlin, Germany

Re: View a duplicated Y-axis

Post by Jens Ramlow » Fri Oct 06, 2017 3:14 pm

Hello Christopher,

Thank your for your reply.

With your code example the right axis becomes visible - but has a different range than the left axis.

Is there a way to implement a copy/duplicate of the left axis for use as axis on the right (max on X-axis)?

Best, Jens

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

Re: View a duplicated Y-axis

Post by Christopher » Mon Oct 09, 2017 9:08 am

Hello Jens,

Using the following code:

Code: Select all

    private void InitializeChart()
    {
      Bar series = new Bar(tChart1.Chart);
      series.FillSampleValues();
    }

    private void Button_Click_1(object sender, RoutedEventArgs e)
    {
      switch (tChart1[0].VertAxis)
      {
        case VerticalAxis.Left:
          tChart1[0].VertAxis = VerticalAxis.Right;
          break;
        case VerticalAxis.Right:
          tChart1[0].VertAxis = VerticalAxis.Both;
          break;
        case VerticalAxis.Both:
          tChart1[0].VertAxis = VerticalAxis.Left;
          break;
        default:
          tChart1[0].VertAxis = VerticalAxis.Left;
          break;
      }
    }

    private void Button_Click(object sender, RoutedEventArgs e)
    {
      tChart1.Export.Image.PNG.Save(@"D:\FTP\TeeChart_" + DateTime.Now.Ticks.ToString() +".png");
    }
I obtained the following three images:
TeeChart_636431438680985679.png
TeeChart_636431438680985679.png (17.12 KiB) Viewed 10119 times
TeeChart_636431438724185216.png
TeeChart_636431438724185216.png (20.5 KiB) Viewed 10118 times
TeeChart_636431438756998016.png
TeeChart_636431438756998016.png (24.6 KiB) Viewed 10117 times
Is the use of the Series' VertAxis property not sufficient for your needs?
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

Jens Ramlow
Newbie
Newbie
Posts: 13
Joined: Fri Sep 22, 2017 12:00 am
Location: Berlin, Germany

Re: View a duplicated Y-axis

Post by Jens Ramlow » Fri Oct 13, 2017 6:19 pm

Thank you, Christopher,

I didn't know about assigning VerticalAxis.Both to a data serie.
Perfect solution. :)

Best, Jens

Post Reply