![]() | Steema Issues DatabaseNote: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;otherwise you can use StackOverflow. Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy. |
| Summary: | StackOverflowException in Styles.Points series | ||
|---|---|---|---|
| Product: | .NET TeeChart | Reporter: | sdgr |
| Component: | Series | Assignee: | Steema Issue Manager <issuemanager> |
| Status: | RESOLVED FIXED | ||
| Severity: | critical | CC: | chris |
| Priority: | --- | ||
| Version: | TeeChart.NET 2014 4.1.2014.12154 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows | ||
| Chart Series: | PointXY | Delphi / C++ Builder RAD IDE Version: | |
Hello Stefan,
This error is being produced in the TeeChart code here:
if (IAxisSize > 0)
{
tmp = inverted ? IEndPos - value : value - IStartPos;
tmp *= iRange / IAxisSize;
return horizontal ? iMinimum + tmp : iMaximum - tmp;
}
tmp is calculated as Double.Infinity. In fact, the same issue can be observed running the following code:
double large = 1.79E+308;
large *= 500;
500 is about the normal size of the value of tmp, with iRange having a slightly larger value than 1.79E+308. I will have to think a little about the best way of avoiding this error being thrown. Many thanks for reporting it to us.
Stefan,
The best workaround I've found to date would be this:
private void InitializeChart()
{
Points points1 = new Points(tChart1.Chart);
points1.Pointer.InflateMargins = false;
points1.ValueFormat = "0.###E+0";
tChart1.Axes.Left.Labels.ValueFormat = "0.###E+0";
tChart1.GetNextAxisLabel +=tChart1_GetNextAxisLabel;
points1.Add(0, 5);
points1.Add(1, 1.79E+308);
}
void tChart1_GetNextAxisLabel(object sender, GetNextAxisLabelEventArgs e)
{
if (((Steema.TeeChart.Axis)sender).Equals(tChart1.Axes.Left))
{
e.Stop = false;
switch (e.LabelIndex)
{
case 0:
e.LabelValue = 5;
break;
case 1:
e.LabelValue = 1.79E+308;
break;
default:
e.Stop = true;
break;
}
}
}
It is always different working with values whose arithmetic relationship is beyond double precision, such as (5, 1.79E+308) ... e.g.
private void button4_Click(object sender, EventArgs e)
{
double large = 1.79E+308;
double small = 5;
double subtract = large - small;
MessageBox.Show(Utils.MinimalDifference(large, subtract, 1).ToString());
}
|
Hi, Simply create a new windows project in VS2013 and add a TeeChart component and one simple button. Add one series to the Chart: private Steema.TeeChart.Styles.Points points1; Add code behind the button: private void button1_Click(object sender, EventArgs e) { points1.Add(0, 5); points1.Add(1, 1.79E+308); } Run the application and press the button, you will get a StackOverflowException. Is there a workaround? Thanks. Regards, Stefan.