Page 1 of 1

View a duplicated Y-axis

Posted: Fri Oct 06, 2017 11:33 am
by 15681921
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

Re: View a duplicated Y-axis

Posted: Fri Oct 06, 2017 2:27 pm
by Christopher
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;
    }

Re: View a duplicated Y-axis

Posted: Fri Oct 06, 2017 3:14 pm
by 15681921
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

Re: View a duplicated Y-axis

Posted: Mon Oct 09, 2017 9:08 am
by Christopher
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 10657 times
TeeChart_636431438724185216.png
TeeChart_636431438724185216.png (20.5 KiB) Viewed 10656 times
TeeChart_636431438756998016.png
TeeChart_636431438756998016.png (24.6 KiB) Viewed 10655 times
Is the use of the Series' VertAxis property not sufficient for your needs?

Re: View a duplicated Y-axis

Posted: Fri Oct 13, 2017 6:19 pm
by 15681921
Thank you, Christopher,

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

Best, Jens