Mohamed Posted October 3, 2007 Report Share Posted October 3, 2007 Hi, Previously I was using Arraylist. Because of our companies new coding standard that "To remove all Arraylist from the application and use only strongly typed objects". I tried to use the strongly typed collection object for Chart datasource with List provider as below. But I was getting null refernce error. Dim Coll_CePerfMeas As New Collection(Of Nullable(Of Double)) Dim Coll_Dates As New Collection(Of String)Dim chartValues As New Collection() chartValues.Add(Coll_CePerfMeas) chartValues.Add(Coll_Dates) Dim lstProvider As New SoftwareFX.ChartFX.Data.ListProvider(chartValues) Chrt_CePerfMeas.DataSourceSettings.DataSource = lstProvider Is there a any other way to use strongly typed collection object for Chart datasource with List provider. I would appreciate your quick response on this.Thanks Mohamed Quote Link to comment Share on other sites More sharing options...
maximop Posted October 18, 2007 Report Share Posted October 18, 2007 The following code should let you use the strongly typed collection objects and pass data to the list provider of the chart: Dim ar4 As New Collection ar4.Add(10) ar4.Add(15) ar4.Add(5) Dim ar5 As New Collection ar5.Add(12) ar5.Add(18) ar5.Add(14) Dim ar3 As New Collection ar3.Add(ar4) ar3.Add(ar5) Dim lstProvider As New ListProvider(ar3) Chart1.DataSourceSettings.DataSource = lstProvider Quote Link to comment Share on other sites More sharing options...
Mohamed_Arif Posted October 18, 2007 Report Share Posted October 18, 2007 The code you sent is common which is present in chartfx resource center. I have corrected your collection to be strongly typed nullable and also I have tried it was not working. The following code should let you use the strongly typed collection objects and pass data to the list provider of the chart: Dim ar4 As New Collection (of nullable(of double)ar4.Add(10) ar4.Add(Nothing) ar4.Add(5) Dim ar5 As New Collection (of string)ar5.Add(12) ar5.Add(18) ar5.Add(14) Dim ar3 As New Collection ar3.Add(ar4) ar3.Add(ar5) Dim lstProvider As New ListProvider(ar3) Chart1.DataSourceSettings.DataSource = lstProvider Quote Link to comment Share on other sites More sharing options...
Frank Posted October 18, 2007 Report Share Posted October 18, 2007 Nullable objects are not supported at the value level. Strongly typed lists of complex objects can be used but the actual values to be plotted (numbers) must be simple value types (int, double, float, etc.) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.