Page 1 of 1

Variance function producing big red X

Posted: Tue Sep 21, 2010 6:33 pm
by 15048900
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

Re: Variance function producing big red X

Posted: Wed Sep 22, 2010 1:44 pm
by 10050769
Hello Matt,

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

Thanks,

Re: Variance function producing big red X

Posted: Wed Sep 22, 2010 8:13 pm
by 15048900
Yes, here is a zip containing a sample project.

Re: Variance function producing big red X

Posted: Thu Sep 23, 2010 3:28 pm
by 10050769
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,

Re: Variance function producing big red X

Posted: Thu Sep 23, 2010 3:51 pm
by 15048900
Thanks, the second work around appears to work.