Hi,
I am using ScatterChart with IBindingList as DataSource, and have set ColumnX and ColumnY. And It worked.
And the new data was automatically plotted.
However, as there is no way to fix the index of fields in IBindingList to be 1 and 2 all the time, ScatterChart no longer worked.
Is there a way to fix this issue from ScatterChart's option?
If not, if I use DataTable as a data source, would the new data added to the DataTable plotted automatically, or do I have to manually DataBind each time DataTable's content changes?
if you take the class of the objects inside your IBindingList and have them implement ICustomTypeDescriptor, you can determine the index order of properties in the ICustomTypeDescriptor.GetProperties method.
i think the chart will listen to the DataTable's updating events and redraw. if that doesn't work for some reason, then you could try using the DataTable's DefaultView property, which is a DataView, and DataView implements IBindingList.
Can you give me any example about getting the proper index for Column X and Y using BINDINGLIST? I already using GetProperties to know the order, but this order varies.
And I have a requirement that I must use BindingList, and not DataTable. The chart's API should not dictate the choice of Data Structure for Data Source.
Why didn't chart's API exposed ColumnX and ColumnY to be set with Name, rather than the index that can vary during run time?
Look at this post: