Hi,
I'm running into a problem using a data bound NumericTimeSeries and using NullHandling.InterpolateSimple. The data in the DataTable being used contains all nulls, and this appears to cause a problem.
Is there a property or setting that I'm missing that prevents this exception from getting thrown?
I realize that I could do some work ahead of time to detect if the chart's values are all null, and not create the chart layer or something like that, but the chart is part of a dynamic data source which allows the changing of the underlying chart data on the fly. If the user set some values to null after the initial detection, I would have to recreate the entire chart to do the null checking all over again.
Please advise on the best way to proceed.
FYI, I'm using version 8.1.20081.1000 of Infragistics2.Win.UltraWinChart.v8.1.
Exception Text Below:
---------------------------
---------------------------System.IndexOutOfRangeException: Index was outside the bounds of the array.
at System.Array.InternalGetReference(Void* elemRef, Int32 rank, Int32* pIndices)
at System.Array.GetValue(Int32 index1, Int32 index2)
at Infragistics.UltraChart.Core.Layers.ChartLayer.InterpolateSimple(InterpolateValuesEventArgs e)
at Infragistics.UltraChart.Core.Layers.ChartLayer.InterpolateNumericTimeValues(PrimitiveCollection primitives, Type type, ChartLayer layer)
at Infragistics.UltraChart.Core.Layers.LineLayer.InterpolateValues(PrimitiveCollection primitives, Type type, Int32 arrayWidth)
at Infragistics.UltraChart.Core.Layers.ChartLayer.InterpolatePrimitives(PrimitiveCollection primitives, Type type, Int32 arrayWidth)
at Infragistics.UltraChart.Core.Layers.LineLayer.FillSceneGraph(SceneGraph scene)
at Infragistics.UltraChart.Resources.Appearance.ChartArea.FillSceneGraph(SceneGraph scene, IChartComponent chartComponent, ChartCore core)
at Infragistics.UltraChart.Core.ChartCore.DrawComposite()
at Infragistics.UltraChart.Core.ChartCore.DrawChart()
at Infragistics.Win.UltraWinChart.UltraChart.OnPaint(PaintEventArgs e)
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.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.UserControl.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)
This turned out to be a bug, and I've just fixed it, so you shouldn't see the exception being thrown in the next available hotfix. If you need to inquire about the status of this bug in the future, please send an email to developer support (http://es.infragistics.com/gethelp) and ask about BR34737. As a workaround, you'll have to somehow intercept the data if it's all null before it's bound to the chart or use InterpolateCustom instead of InterpolateSimple and resolve the null values manually.
Is this also related to Scatter Chart with Data Table?
I am getting the following:
System.IndexOutOfRangeException: There is no row at position 841. at System.Data.RBTree`1.GetNodeByIndex(Int32 userIndex) at System.Data.RBTree`1.get_Item(Int32 index) at System.Data.DataRowCollection.get_Item(Int32 index) at Infragistics.UltraChart.Data.DataTableToChartAdapter.GetObjectValue(Int32 row, Int32 column) at Infragistics.UltraChart.Data.ChartDataFilter.GetObjectValue(Int32 row, Int32 column) at Infragistics.UltraChart.Core.Layers.ScatterLayer.FillSceneGraph(SceneGraph scene) at Infragistics.UltraChart.Core.ChartCore.DrawChart() at Infragistics.Win.UltraWinChart.UltraChart.OnPaint(PaintEventArgs e) 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.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ContainerControl.WndProc(Message& m) at System.Windows.Forms.UserControl.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.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
This is a bit puzzling and will be extremely difficult to reproduce without a running sample. If you can provide such a sample, that would be great. In the meantime, try making calls to chart binding mutually exclusve. If you can have an event that gets triggered only once all the data is available, that might help, too.
1) which one is recommended between _chart.ResetData() or _chart.ResetDataSource to clear data between plotting different graphs?
2) I am currently using 8.2.2, and I believe that my firm has license for 8.2.3 and also 9.1. Is there any fix for UltraChart component in those two later fixes that may be useful for me?
3) Even there is a chance that multiple thread is trying to access the DataTable, I always lock the DataTable before populating it. So, no harm there. And also verified that the populate method is on a single thread.
And, the below exception is called exactly at the below line of code:
_chartDataTable.Rows.Add(
new object[] { factorData.FactorName + key, scaledTime, factorData.y.Value + _newYValues[key - 1] });
However, _chart's Data is not assigned to this table. Why the below "Infragistics.UltraChart.Render.ChartRender" involved here?
Exception:
System.InvalidOperationException: Collection was modified; enumeration operation may not execute. at System.Collections.ArrayList.ArrayListEnumeratorSimple.Reset() at Infragistics.UltraChart.Render.ChartRender.RenderSceneGraph(SceneGraph scene, Graphics g, Boolean chartDrawItem) at Infragistics.UltraChart.Render.ChartRender.RenderSceneGraph(SceneGraph scene, Graphics g) at Infragistics.Win.UltraWinChart.UltraChart.OnPaint(PaintEventArgs e) 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.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ContainerControl.WndProc(Message& m) at System.Windows.Forms.UserControl.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.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
First, this symptom happens randomly, but was able to reproduce all the time. And, I am plotting an average of 10,000 points per each plot.
Then, Just found very good example while debugging. I believe that this should really explain why the exception happens.
On the thread that was populating the data table, I got the following call stack. (latest on top, and beginning on bottom)
And _chart.DataSource is null, and did not even called DataBind. Refer below call stack.
Correct me if I am wrong, but the whole _chart.ResetDataSource does not seem to work properly, as the below stack indicates that the chart is still listening to events that happens on its data source, which is data table in my case.
System.Windows.Forms.dll!System.Windows.Forms.Control.Invalidate() + 0x7 bytes
Infragistics2.Win.UltraWinChart.v8.2.dll!Infragistics.UltraChart.Resources.Appearance.DataAppearance.OnDataTableRowChanged(object sender = {System.Data.DataTable}, System.Data.DataRowChangeEventArgs args = {System.Data.DataRowChangeEventArgs}) + 0x1c bytes
Infragistics2.Win.UltraWinChart.v8.2.dll!Infragistics.UltraChart.Resources.Appearance.ChartAppearance.UpdateAll(bool resize = false, bool invalidate = true) + 0x4f bytes
Infragistics2.Win.UltraWinChart.v8.2.dll!Infragistics.UltraChart.Resources.Appearance.DataAppearance.DataBind() + 0x3c bytes
...
System.Data.dll!System.Data.DataRowCollection.Add(object[] values) + 0x30 bytes
IED.STLA.dll!MorganStanley.IED.STLA.UI.Graphs.ChartControl.PopulateDataInTable() Line 664 + 0x18d bytes
tboy79,
I've discussed this issue with Max, and we believe that it will take further in-depth research to determine what is happening in your situation. By creating a support case, we'll be able to give your issue the personal attention that it requires.
I've passed this information to Developer Support to create a case for you. You'll receive notification of the creation of this case in a separate email message.
Thanks for your understanding.
Similar problem, but with different logic.
Instead of DataTable, I am now using BindingSource, and simpley assign it to Chart.Data.
this
.components);
._bindingSource;
And everytime I plot a new chart, I simply update _bindingSource.DataSource.
However, it's very weird that the below exception happens randomly, and also on random machine. And the below exception simply creates the usual RED X on Chart.
Unhandled Thread Exception, Exception
='System.NullReferenceException: Object reference not set to an instance of an object. at Infragistics.UltraChart.Data.IListToChartAdapter2.GetStringValue(Int32 row, Int32 column) at Infragistics.UltraChart.Core.Layers.ScatterLayer.CreateSeriesHashtable(ScatterChartAppearance scatterApp) at Infragistics.UltraChart.Core.Layers.ScatterLayer.FillSceneGraph(SceneGraph scene) at Infragistics.UltraChart.Core.ChartCore.DrawChart() at Infragistics.Win.UltraWinChart.UltraChart.OnPaint(PaintEventArgs e) 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.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ContainerControl.WndProc(Message& m) at System.Windows.Forms.UserControl.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.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)' (Loader.Unhandled Thread Exception)
I see that you've also posted this to the support case we've opened for you. For the moment, until we find out more, it'll be more efficient for both you and us to handle this issue through the support case.