Variance function producing big red X

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
biqpaulson
Newbie
Newbie
Posts: 93
Joined: Thu Apr 17, 2008 12:00 am

Variance function producing big red X

Post by biqpaulson » Tue Sep 21, 2010 6:33 pm

I have an application that allows the customer to pick from multiple stat functions to overlay on a graph. I find that of the 10 or so functions that I allow, all work except for "variance" (Steema.TeeChart.Functions.VarianceFunction). When this function is selected, I get a large red X instead of a graph. Further, once I see the red X, switching back to another function (which normally works), fails. Any idea why this is happening.

As a side note, this code was ported from vb6 and version 8, where I just tested the variance function, using basically the same logic and it works fine.

Thanks,

Matt

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

Re: Variance function producing big red X

Post by Sandra » Wed Sep 22, 2010 1:44 pm

Hello Matt,

Could you please, send us a simple project because we can reproduce your problem here ?

Thanks,
Best Regards,
Sandra Pazos / 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

biqpaulson
Newbie
Newbie
Posts: 93
Joined: Thu Apr 17, 2008 12:00 am

Re: Variance function producing big red X

Post by biqpaulson » Wed Sep 22, 2010 8:13 pm

Yes, here is a zip containing a sample project.
Attachments
TeeChartVarianceBug.zip
sample project
(42.55 KiB) Downloaded 481 times

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

Re: Variance function producing big red X

Post by Sandra » Thu Sep 23, 2010 3:28 pm

Hello Matt,

I could reproduce your problem and seems it occurs because right axis need be initialized before assign to axis, variance function. Please see next workarounds that I think solve your problem:

Workaround 1:

Code: Select all

    private void InitializeChart()
    {
      Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
      line1.Add(0, -206982);
      line1.Add(1, 335782001);
      line1.Add(2, 616053044);
      line1.Add(3, 823145454);
      line1.VertAxis = Steema.TeeChart.Styles.VerticalAxis.Both;//Workaround
      Steema.TeeChart.Styles.Line line2 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
      line2.Function = new Steema.TeeChart.Functions.VarianceFunction();
      line2.DataSource = tChart1[0];
 line2.VertAxis = Steema.TeeChart.Styles.VerticalAxis.Right;
Workaround 2: Using SetMinMax()

Code: Select all

   private void InitializeChart()
    {
      Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
      line1.Add(0, -206982);
      line1.Add(1, 335782001);
      line1.Add(2, 616053044);
      line1.Add(3, 823145454);
Steema.TeeChart.Styles.Line line2 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
      line2.Function = new Steema.TeeChart.Functions.VarianceFunction();//Average works fine and Variance with version 3 too.
      line2.DataSource = tChart1[0];
     tChart1.Axes.Right.SetMinMax(0, tChart1[1].MaxYValue() * 2); //Workaround
      line2.VertAxis = Steema.TeeChart.Styles.VerticalAxis.Right; //I think problem is here.
    } 
Moreover, I have added it request in bug list with number [TF02015169]. We will try to fix it for next maintenance releases of TeeChart.Net

I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / 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

biqpaulson
Newbie
Newbie
Posts: 93
Joined: Thu Apr 17, 2008 12:00 am

Re: Variance function producing big red X

Post by biqpaulson » Thu Sep 23, 2010 3:51 pm

Thanks, the second work around appears to work.

Post Reply