Jump to content
Software FX Community

Is it possible to use strongly typed collection object for Chart datasource with List provider.


Mohamed

Recommended Posts

 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 

 

Link to comment
Share on other sites

  • 3 weeks later...

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...