Profile Picture

Binding custom datasource to Charts

Posted By Jebarson Rajin 15 Years Ago
Author
Message
Jebarson Rajin
questionmark Posted 15 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: Forum Members
Last Active: 15 Years Ago
Posts: 6, Visits: 1
Hi there,

I am trying to figure out how to bind custom datasource into nevron charts. Eg) I have a class called Employee with properties "Name, Designation, Salary". Now I have an object of type "list(of employee)". Can somebody help me to bind this to the chart.

Please don't advice to use Datatable / Dataview / Datareader. I follow a strict 3 tier layering and I need my custom objects to be binded.

Milen Metodiev
Posted 15 Years Ago
View Quick Profile
Forum Member

Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)

Group: Nevron Team
Last Active: 14 Years Ago
Posts: 48, Visits: 1

Hi Jebarson,

The Chart control supports data binding to custom data sources that implement the IBindingList and optionally the ITypedList interfaces. You can take a look at the following example in our Windows Forms demo application:

All Examples > Data Manipulation > Data Binding > Binding to IBindingList

The example binds the chart to a list of MyCustomObject instances.

I hope this helps.

Best Regards,
Milen Metodiev

 



Jebarson Rajin
Posted 15 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: Forum Members
Last Active: 15 Years Ago
Posts: 6, Visits: 1
Any specific reason that you need IBindingList to be implemented, because normally microsoft controls can do a databinding if it is a type of IEnumerable

Milen Metodiev
Posted 15 Years Ago
View Quick Profile
Forum Member

Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)

Group: Nevron Team
Last Active: 14 Years Ago
Posts: 48, Visits: 1

Hi Jebarson,

The IBindingList interface has the ListChanged event that can notify the chart whenever the data is changed, which is essential for data binding.

If you don't want to bind the data, but just fill it once into the chart you can implement a procedure that copies the fields of each custom object into the respective data series of the chart.

Best Regards,
Milen

 



Jebarson Rajin
Posted 15 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: Forum Members
Last Active: 15 Years Ago
Posts: 6, Visits: 1

I hope the question is not clearly understood. My question is why do you need IBindingList to bind the data? To bind a data to any object, implementing of ICollection is suffice. If I need the data to be bound automatically whenever the data gets changed, then I can implement IBindingList but if not why should I implement IBindingList.

 

I think that making IBindingList mandatory is not an good way of implementation. Hope you agree with this.

 

 



Milen Metodiev
Posted 15 Years Ago
View Quick Profile
Forum Member

Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)

Group: Nevron Team
Last Active: 14 Years Ago
Posts: 48, Visits: 1

If you don't need automatic update of the chart when data is changed you can use the data import functionality. Data import can work with IEnumerable - you can take a look at the FillFromEnumerable method of the NDataSeries type.





Similar Topics


Reading This Topic