Overflow error while using CLVFunction

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Quant
Advanced
Posts: 142
Joined: Tue Dec 30, 2014 12:00 am

Overflow error while using CLVFunction

Post by Quant » Mon Feb 02, 2015 4:55 am

While using CLVFunction on series I am getting following error.
"OverflowException was unhandled - Overflow Error"
I used following code.

Code: Select all

                Steema.TeeChart.Styles.Line tLine1 = new Steema.TeeChart.Styles.Line();
                tLine1.VertAxis = VerticalAxis.Right;
                Steema.TeeChart.Functions.CLVFunction tCLVFunction = new Steema.TeeChart.Functions.CLVFunction();
                tCLVFunction.Accumulate = true;
                tLine1.Function = tCLVFunction;
                tLine1.Title = "CLV";
                //'Assign Values
                tLine1.AssignValues(tChartMain.Series[0]);
                tChartMain.Series.Add(tLine1);

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

Re: Overflow error while using CLVFunction

Post by Narcís » Mon Feb 02, 2015 9:22 am

Hello Quant,

This is due to an error in the code:

Code: Select all

      tLine1.AssignValues(tChart1.Series[0]);
You can not use the line above. tLine1 is the only series in the chart. Therefore tChart1.Series[0] is the same as tLine1. The error is caused because in your codetLine1 has no values and yet you are trying to assign its non existent values. That's the reason why you get the error message.

TeeChart functions need a data source series an another series to display the function itself. You should use functions in TeeChart as explained in Tutorial 7 - Working with Functions . Tutorials are available on-line or at the TeeChart program group created by the binary installers. For example:

Code: Select all

      tChart1.Series.Add(new Steema.TeeChart.Styles.Candle()).FillSampleValues();
      Steema.TeeChart.Styles.Line tLine1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
      tLine1.VertAxis = VerticalAxis.Right;
      Steema.TeeChart.Functions.CLVFunction tCLVFunction = new Steema.TeeChart.Functions.CLVFunction();
      tCLVFunction.Accumulate = true;
      tLine1.Function = tCLVFunction;
      tLine1.Title = "CLV";
      //'Assign Values
      tLine1.DataSource = tChart1[0]; //tChart1[0] (same as tChart1.Series[0]) now is the Candle series added at the beginning      
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

Quant
Advanced
Posts: 142
Joined: Tue Dec 30, 2014 12:00 am

Re: Overflow error while using CLVFunction

Post by Quant » Tue Feb 03, 2015 5:27 am

Thank you for your reply. I am already having a line series in chart, over which i am using CLV function.
It gives me error on
MoveTo(x1,y1);
line number 255 of Line() function in Graphics3DGdiPlus.cs from Tchart dll.
Y1 value becomes -2147483648 over there.

Code: Select all

		/// <summary>
		/// Draws a Line between co-ordinates.
		/// </summary>
		public override void Line(int x0, int y0, int x1, int y1)
    {
#if ! POCKET
      if (Pen.FillGradientVisible)
      {
        g.DrawLine(Pen.FillDrawingPen(new Point(x0, y0), new Point(x1, y1)), x0, y0, x1, y1);
      }
      else
#endif
      {
        g.DrawLine(Pen.DrawingPen, x0, y0, x1, y1);
      }
			MoveTo(x1,y1);
    }

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

Re: Overflow error while using CLVFunction

Post by Narcís » Tue Feb 03, 2015 8:16 am

Hello Quant,

Please include a simple example project we can run "as-is" to reproduce the problem here.

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

Post Reply