Code: Select all
int k = _result.Wall.Length * _result.Wall[0].Length;
double[] x = new double[k];
double[] y = new double[k];
double[] z = new double[k];
int counter = 0;
for (int m = 0; m < _result.Wall.Length; ++m)
{
for (int n = 0; n < _result.Wall[m].Length; ++n)
{
x[counter] = _result.Alpha[n];
y[counter] = _result.Wall[m][n];
z[counter] = _result.WallX[m];
++counter;
}
}
colorGrid.Add(x, y, z);
_graphs[i].Series.Add(colorGrid);
and data sets are less than 2000 x 2000 points. In fact my current set is only 10 x 10.
When drawing the ColorGrid I get the following exception:
System.IndexOutOfRangeException was unhandled
Message="Index was outside the bounds of the array."
Source="TeeChart"
StackTrace:
at Steema.TeeChart.Styles.ValueList.get_Item(Int32 index)
at Steema.TeeChart.Styles.ColorGrid.DrawGrid(Rectangle r)
at Steema.TeeChart.Styles.ColorGrid.Draw()
at Steema.TeeChart.Styles.Series.DrawSeries()
at Steema.TeeChart.Chart.InternalDraw(Graphics g, Boolean noTools)
at Steema.TeeChart.Chart.InternalDraw(Graphics g)
at Steema.TeeChart.TChart.Draw(Graphics g)
at Steema.TeeChart.TChart.OnPaint(PaintEventArgs pe)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Client.Program.Main(String[] args) in C:\Work\Vanadium\ScalarGauge-C\Client\Program.cs:line 40
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
I found the following code in a previous thread.
Code: Select all
Random rnd = new Random();
double[] x = new double[36];
double[] y = new double[36];
double[] z = new double[36];
int count = 0;
for (double m = 0; m < 6; ++m)
{
for (double n = 0; n < 6; ++n)
{
x[count] = n;
z[count] = m;
y[count] = rnd.Next(3);
++count;
}
}
colorGrid.Add(x, y, z);
Can anyone explain what is going wrong?