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. Image for the cookie policy date

(SfChart) Column Chart with 2 series code behind version(not xaml)

Hi can you give me a sample project about the sf chart specifically Column-series that has 2 series and showing 2 legends
but the legends shows 2 dates example year 2014 and year 2015 using code behind not xaml and using the grid to call the chart example code "grid.Children.Add(samplechart)".


1 Reply

SA Santhiya Arulsamy Syncfusion Team December 16, 2015 04:54 PM UTC

Hi Ven,

Thanks for contacting Syncfusion support.

In SfChart, we are maintaining the ChartSeries in a ChartSeriesCollection, if you want to add a ChartSeries to SfChart, just create a ChartSeries instance and add it in the collection.

For example:  If you want to add a ColumnSeries , create a new instance for it and add it in the Series property in SfChart.

[C#]

ColumnSeries columnSeries = new ColumnSeries();

columnSeries.ItemsSource = view.SneakersDetail;

columnSeries.XBindingPath = "Brand";

columnSeries.YBindingPath = "Year2014";

sampleChart.Series.Add(columnSeries);


For legends, just create new instance of ChartLegend type and assign it to the Legend property in the SfChart.

We have prepared the sample based on your requirement. Please find the sample from the following location.

Sample: ColumnChart

Please refer to the following UG documentation for your reference.

http://help.syncfusion.com/wpf/sfchart/getting-started#create-a-simple-chart-from-code-behind

Thanks,

Santhiya A.


Loader.
Live Chat Icon For mobile
Up arrow icon