Method Legend.Inverted=True does not work.

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
CitoICT
Newbie
Newbie
Posts: 6
Joined: Tue Dec 15, 2009 12:00 am

Method Legend.Inverted=True does not work.

Post by CitoICT » Mon Jun 21, 2010 10:01 am

Steps to reproduce:

Code: Select all

  
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    Dim errorSeriesH As Styles.Error
    Dim errorSeriesL As Styles.Error

    With TChart1
      .Aspect.View3D = False
      errorSeriesH = DirectCast(.Series.Add(New Styles.Error(.Chart)), Styles.Error)
      errorSeriesL = DirectCast(.Series.Add(New Styles.Error(.Chart)), Styles.Error)
      errorSeriesH.ErrorStyle = Styles.ErrorStyles.Top
      errorSeriesL.ErrorStyle = Styles.ErrorStyles.Bottom
      .Axes.Left.Automatic = False
      .Axes.Left.Maximum = 6
      .Axes.Left.Minimum = -6
    End With

    errorSeriesH.Add(1, 2, CorrectErrorValue(2, 0.2))
    errorSeriesH.Add(2, 3, CorrectErrorValue(3, 1))
    errorSeriesH.Add(3, -2, CorrectErrorValue(-2, 0.2))
    errorSeriesH.Add(4, -3, CorrectErrorValue(-3, -1))

    errorSeriesL.Add(5, 2, CorrectErrorValue(2, 0.2))
    errorSeriesL.Add(6, 3, CorrectErrorValue(3, 1))
    errorSeriesL.Add(7, -2, CorrectErrorValue(-2, 0.2))
    errorSeriesL.Add(8, -3, CorrectErrorValue(-3, -1))

    [b]TChart1.Legend.Inverted = True[/b] ' this causes the error

  End Sub

Result:
see attached image
Attachments
invertedlegend.PNG
invertedlegend.PNG (8.96 KiB) Viewed 5503 times

CitoICT
Newbie
Newbie
Posts: 6
Joined: Tue Dec 15, 2009 12:00 am

Re: Method Legend.Inverted=True does not work.

Post by CitoICT » Mon Jun 21, 2010 10:15 am

You'll need this method aswell to be able to run the sample code

Code: Select all

  Private Shared Function CorrectErrorValue(ByVal y As Double, ByVal err As Double) As Double
    If y > 0 Then
      Return err
    Else
      Return System.Math.Abs(err) * -1 + y
    End If
  End Function

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Method Legend.Inverted=True does not work.

Post by Narcís » Wed Jun 23, 2010 7:44 am

Hi CitoICT,

Code below works fine for me here using latest TeeChart for .NET 2010 release available as you can see here:
InvertedLegend.png
InvertedLegend.png (8.04 KiB) Viewed 5469 times
Which TeeChart version are you using? Can you please try using latest release published this week?

Code: Select all

    public Form1()
    {
      InitializeComponent();
      InitializeChart();
    }

    private void InitializeChart()
    {
      tChart1.Aspect.View3D = false;
        
      Steema.TeeChart.Styles.Error errorSeriesH = new Steema.TeeChart.Styles.Error(tChart1.Chart);
      Steema.TeeChart.Styles.Error errorSeriesL = new Steema.TeeChart.Styles.Error(tChart1.Chart);

      errorSeriesH.ErrorStyle = Steema.TeeChart.Styles.ErrorStyles.Top;
      errorSeriesL.ErrorStyle = Steema.TeeChart.Styles.ErrorStyles.Bottom;

      tChart1.Axes.Left.SetMinMax(-6, 6);

      errorSeriesH.Add(1, 2, CorrectErrorValue(2, 0.2));
      errorSeriesH.Add(2, 3, CorrectErrorValue(3, 1));
      errorSeriesH.Add(3, -2, CorrectErrorValue(-2, 0.2));
      errorSeriesH.Add(4, -3, CorrectErrorValue(-3, -1));

      errorSeriesL.Add(5, 2, CorrectErrorValue(2, 0.2));
      errorSeriesL.Add(6, 3, CorrectErrorValue(3, 1));
      errorSeriesL.Add(7, -2, CorrectErrorValue(-2, 0.2));
      errorSeriesL.Add(8, -3, CorrectErrorValue(-3, -1));

      tChart1.Legend.Inverted = true;
    }

    private static double CorrectErrorValue(double y, double err)
    {
      return (y > 0) ? err : System.Math.Abs(err) * -1 + y;
    }
Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

CitoICT
Newbie
Newbie
Posts: 6
Joined: Tue Dec 15, 2009 12:00 am

Re: Method Legend.Inverted=True does not work.

Post by CitoICT » Mon Jun 28, 2010 10:40 am

The problem still exists in version 4.0.2010.27961 [24-jun-2010]

CitoICT
Newbie
Newbie
Posts: 6
Joined: Tue Dec 15, 2009 12:00 am

Re: Method Legend.Inverted=True does not work.

Post by CitoICT » Mon Jun 28, 2010 10:42 am

This is the version for Visual Studio 2005, i guess you tried it with the Visual Studio 2010 version of Teechart.

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Method Legend.Inverted=True does not work.

Post by Sandra » Mon Jun 28, 2010 11:58 am

Hello CitoICT,

I have tested again code that posted Narcis in this thread with last version of TeeChart.Net and Visual Studios 2005 and I think that it needs a TChart1.Draw(), because code works fine with VS2005

Could you check that next code now works as you want?

Code: Select all

        public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }

        private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;

            Steema.TeeChart.Styles.Error errorSeriesH = new Steema.TeeChart.Styles.Error(tChart1.Chart);
            Steema.TeeChart.Styles.Error errorSeriesL = new Steema.TeeChart.Styles.Error(tChart1.Chart);

            errorSeriesH.ErrorStyle = Steema.TeeChart.Styles.ErrorStyles.Top;
            errorSeriesL.ErrorStyle = Steema.TeeChart.Styles.ErrorStyles.Bottom;

            tChart1.Axes.Left.SetMinMax(-6, 6);

            errorSeriesH.Add(1, 2, CorrectErrorValue(2, 0.2));
            errorSeriesH.Add(2, 3, CorrectErrorValue(3, 1));
            errorSeriesH.Add(3, -2, CorrectErrorValue(-2, 0.2));
            errorSeriesH.Add(4, -3, CorrectErrorValue(-3, -1));

            errorSeriesL.Add(5, 2, CorrectErrorValue(2, 0.2));
            errorSeriesL.Add(6, 3, CorrectErrorValue(3, 1));
            errorSeriesL.Add(7, -2, CorrectErrorValue(-2, 0.2));
            errorSeriesL.Add(8, -3, CorrectErrorValue(-3, -1));

            tChart1.Legend.Inverted = true;
            tChart1.Draw();
        }

        private static double CorrectErrorValue(double y, double err)
        {
            return (y > 0) ? err : System.Math.Abs(err) * -1 + y;
        }
I hope will helps.

Thanks,

CitoICT
Newbie
Newbie
Posts: 6
Joined: Tue Dec 15, 2009 12:00 am

Re: Method Legend.Inverted=True does not work.

Post by CitoICT » Tue Jun 29, 2010 8:31 am

Your suggested solution does not work for us:

Code: Select all

            
  tChart1.Legend.Inverted = true;
  tChart1.Draw();
However putting the .Draw before the .Inverted does work.

Code: Select all

            
  tChart1.Draw();
  tChart1.Legend.Inverted = true;

Post Reply