We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Feeding Chart with collection data

Thread ID:





94826 Jun 3,2010 06:54 PM UTC Jun 7,2010 12:43 PM UTC WinForms 1
Tags: Chart
Rob Jones
Asked On June 3, 2010 06:54 PM UTC

I'm wanting to manually add bars to my chart using a generic.list.collection. How do I establish a like to the collection and what might the code look like that takes the collection item as adds it to the chart.

For Each item As MeteredProduction In MPCollection
If Trim(item.UniversalID) = UID Then
'Add chart bar Here

End If



Jaffersathick B [Syncfusion]
Replied On June 7, 2010 12:43 PM UTC

Hi Rob Jones,

Thank you for using Syncfusion products.

We suggest you to use “ChartDataBindModel” and bind the List collection with it by providing the XName and YNames of it . Create a series and set the “seriesModel” property as the object of “ChartDataBindModel”. This will plot the data contains in the List collection. When you are using the String values to XValue means we suggest you to add YNames alone to the model and Bind it with the series.
You can customize the Axislabels using “ChartDataBindAxisLabelModel” object by giving the “LabelName” property.

Please refer the following code snippet:
ChartSeries series = new ChartSeries("Populations");

//Bind the above list to the chart control.
ChartDataBindModel dataSeriesModel = new ChartDataBindModel(bindList);

// If ChartDataBindModel.XName is empty or null, X value is index of point.
dataSeriesModel.YNames = new string[] { "Population" };
series.SeriesModel = dataSeriesModel;

//Customizing the axis labels .

ChartDataBindAxisLabelModel dataLabelsModel = new ChartDataBindAxisLabelModel();
//Setup a datasource for chart axis and populate axis labels.
dataLabelsModel.DataSource = bindList;
dataLabelsModel.LabelName = "Name";
chartControl1.PrimaryXAxis.LabelsImpl = dataLabelsModel;

chartControl1.PrimaryXAxis.TickLabelsDrawingMode = ChartAxisTickLabelDrawingMode.UserMode;

Please refer the Document from the following link:



Let me know if you have any other concerns.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon