Page 1 of 1

'Index was outside the bounds of the array' error message

Posted: Tue Nov 01, 2005 10:38 pm
by 9638380
Hello,

I am charting environmental data from 56 different streams and rivers. For 53 of the streams the charts work perfectly. For 3 of the streams I am getting the following error and I can't figure out what is causing it. Any ideas?

Server Error in '/wlr/waterres/StreamsData' Application.
--------------------------------------------------------------------------------

Index was outside the bounds of the array.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IndexOutOfRangeException: Index was outside the bounds of the array.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[IndexOutOfRangeException: Index was outside the bounds of the array.]
Steema.TeeChart.Styles.ValueList.get_Item(Int32 index) +21
Steema.TeeChart.Styles.CustomBox.Percentile(Double P, Double InvN) +111
Steema.TeeChart.Styles.CustomBox.ReconstructFromData() +227
Steema.TeeChart.Styles.CustomBox.DoBeforeDrawValues() +27
Steema.TeeChart.Styles.Series.DrawSeries() +825
Steema.TeeChart.Chart.InternalDraw(Graphics g) +1005
Steema.TeeChart.Chart.Draw(Graphics g, Rectangle r) +94
Steema.TeeChart.Chart.Draw(Graphics g) +88
Steema.TeeChart.Chart.Bitmap(Int32 width, Int32 height, PixelFormat pixelformat) +109
Steema.TeeChart.Chart.Bitmap(Int32 width, Int32 height) +11
Steema.TeeChart.Export.ImageExportFormat.Save(Stream stream) +92
Steema.TeeChart.Web.WebChart.CreatePictureFile(HtmlTextWriter writer) +780
Steema.TeeChart.Web.WebChart.Render(HtmlTextWriter output) +10
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +241
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +72
System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +44
System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +262
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +241
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +72
System.Web.UI.Control.Render(HtmlTextWriter writer) +7
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +241
System.Web.UI.Page.ProcessRequestMain() +1897




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032

Posted: Wed Nov 02, 2005 12:59 pm
by narcis
Hi Dan,

Could you please send us an example we can run "as-is" to reproduce the problem here?

You can post your files at [url]news://www.steema.net/steema.public.attachments[/url] newsgroup.

Thanks in advance.

Posted: Wed Nov 02, 2005 3:03 pm
by 9638380
I am sending an email with the code attached in a zip file.

Posted: Wed Nov 02, 2005 3:52 pm
by narcis
Hi Dan,

Thanks for the project but I can't run it because Data.aspx is missing. Can you please check this?

Posted: Wed Nov 02, 2005 4:49 pm
by 9638380
Sorry about that. I sent the Data.aspx page.

Posted: Thu Nov 03, 2005 11:58 am
by narcis
Hi Dan,

I get an error similar to your but not the same:
There is no row at position 0.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IndexOutOfRangeException: There is no row at position 0.

Source Error:


Line 788:
Line 789:
Line 790: ((Steema.TeeChart.Styles.Box)chart1.Series[SeriesCount]).Position = int.Parse(dt.Rows[0]["C_Month"].ToString());
Line 791: SeriesCount++;
Line 792:


Source File: c:\inetpub\wwwroot\streams\chart.aspx.cs Line: 790

Stack Trace:


[IndexOutOfRangeException: There is no row at position 0.]
System.Data.DataRowCollection.get_Item(Int32 index)
streams.StreamPage.LoadBacteriaChart() in c:\inetpub\wwwroot\streams\chart.aspx.cs:790
streams.StreamPage.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\streams\chart.aspx.cs:60
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2300; ASP.NET Version:1.1.4322.2300
Could you please send me an example you can reproduce "as-is"?

Thanks in advance.

Posted: Thu Nov 03, 2005 7:07 pm
by 9638380
I figured out the problem. Boxplots need a minimum of three values to render. I was passing only two values in certain circumstances.

Posted: Tue Mar 27, 2007 12:07 am
by 9643419
Hi,

When I add one sample or two sample into boxplot,
then occur Index was outside the bounds of the array exception.
But I don't know this bug when will been revised?

below is sample code:
box1.Add(new double[] { 35});
or
box1.Add(new double[] { 35,38});


Best Regards!

Posted: Tue Mar 27, 2007 8:54 am
by narcis
Hi wilcohsu,

Haven't you read latest Dan's post? Please also read this thread for full explanation on how Box-Plot works.

You'll also find examples on how to use Box-Plot series at All Features\Welcome !\Chart styles\Statistical\Box-Plot in the features demo.

Thanks in advance.