|
Array Index out of bounds exception when using chart with SplineLayer |
Posted by Roopesh on Apr-16-2014 19:47 |
|
Hi,
We have a C# desktop application that uses ChartDirector library version .
We are getting an exception when using SplineLayer other wise working LineLayer.
Exception line : winChrtViewer.Chart = m_multiChrt;
Exception Message: "Index was outside the bounds of the array"
Source: "netchartdir"
StackTrace: at ChartDirector.SplineLayer.a.a()
at ChartDirector.SplineLayer.a.a(Int32 A_0, Int32 A_1, Int32 A_2, Int32 A_3)
at ChartDirector.LineLayer.layoutLineObj(Int32 xOffset, Int32 yOffset, c line)
at ChartDirector.SplineLayer.layoutLineObj(Int32 xOffset, Int32 yOffset, c line)
at ChartDirector.LineLayer.layoutChart()
at ChartDirector.PlotArea.a()
at ChartDirector.PlotArea.r()
at ChartDirector.XYChart.onLayoutChart()
at ChartDirector.BaseChart.layout()
at ChartDirector.MultiChart.onLayoutChart()
at ChartDirector.BaseChart.layout()
at ChartDirector.BaseChart.c()
at ChartDirector.BaseChart.makeImage()
at ChartDirector.WinChartViewer.g()
at ChartDirector.WinChartViewer.set_Chart(BaseChart value)
at Comtrade.frmGrphicalView.drawChart(Double viewPortStart, Double viewPortEnd) in
\\Windows\\frmGrphicalView.methods.cs:line 446
////////////////////////
The test scenario is the winChartViewer.Chart is set to a multichart with 8 XYCharts
containing 53999 points each. During the program run, after zooming, I encountered the
following exception. (I used to use LineLayer and it was working fine but when I used
splinelayer instead, the problem arised.)
Code: SplineLayer layer1 = /*chrt.addLineLayer2();*/ chrt.addSplineLayer();
layer1.setXData(xVals);
layer1.setLineWidth(1);
layer1.setFastLineMode();
layer1.addDataSet(yVals, Chart.CColor(lineClr), name);
layer1.setMonotonicity(0);
Could you please look in to the above information and findout what might be wrong ?
Thanks,
Roopesh |
Re: Array Index out of bounds exception when using chart with SplineLayer |
Posted by Peter Kwan on Apr-16-2014 23:14 |
|
Hi Roopesh,
Thank you very much for reporting this to us.
This does seem to be a bug in ChartDirector. By analyzing the stack trace, our developers
suspect it is due to use the "Fast Line Mode" (LineLayer.setFastLineMode) with the spline
layer when there are lots of data points.
We are trying to reproduce the problem, but it may be difficult without your exact data.
Would you mind to perform a test to help us confirm if "Fast Line Mode" is triggering the
problem? Please simply remove the "setFastLineMode" line to see if the problem still occurs
or not.
Normally, a spline curve will be almost the same as a normal line if there are many data
points. If "setFastLineMode" with spline layer is the cause of the problem, one fast method
to work around the problem is not to use spline layer if there are many data points (when
the number of visible data points exceed the chart with in pixels). In most cases, the line
layer will look the same as the spline layer for that large amount of data points, and the line
layer is faster for ChartDirector to plot too. The spline layer can still be used if there are not
that many data points, as setFastLineMode has no effect if there are not many data points.
Meanwhile, we will try to reproduce the problem and issue a patch as soon as possible.
Regards
Peter Kwan |
|