Page 1 of 1
Overflow error while using CLVFunction
Posted: Mon Feb 02, 2015 4:55 am
by 16071129
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);
Re: Overflow error while using CLVFunction
Posted: Mon Feb 02, 2015 9:22 am
by narcis
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 code
tLine1 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
Re: Overflow error while using CLVFunction
Posted: Tue Feb 03, 2015 5:27 am
by 16071129
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);
}
Re: Overflow error while using CLVFunction
Posted: Tue Feb 03, 2015 8:16 am
by narcis
Hello Quant,
Please include a simple example project we can run "as-is" to reproduce the problem here.
Thanks in advance.