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

Aggregating Data into Chart

Say hypothetically speaking that I have a Data Model which tracks items sold by date, type, and items sold:
(note: this code was adapted from your own examples)

public SalesViewModel()
        {
            this.Sales = new ObservableCollection<SalesDataModel>();
            this.Sales .Add(new SalesDataModel() { Date = "01/01/2014", ProductName = "Shirt", ItemsSold= 31 });
            this.Sales .Add(new SalesDataModel() { Date = "01/01/2014", ProductName = "Shoes", ItemsSold = 15 });
            this.Sales .Add(new SalesDataModel() { Date = "01/02/2014", ProductName = "Shirt", ItemsSold = 7 });
            this.Sales .Add(new SalesDataModel() { Date = "01/02/2014", ProductName = "Shoes", ItemsSold = 3 });
            this.Sales .Add(new SalesDataModel() { Date = "02/01/2014", ProductName = "Shirt", ItemsSold = 10 });
            this.Sales .Add(new SalesDataModel() { Date = "02/01/2014", ProductName = "Shoes", ItemsSold = 6 });
            this.Sales .Add(new SalesDataModel() { Date = "03/01/2014", ProductName = "Shirt", ItemsSold = 10 });
            this.Sales .Add(new SalesDataModel() { Date = "03/01/2014", ProductName = "Shoes", ItemsSold= 10 });
        }

And say I wanted to have a chart where on the XAxis, I wanted Month("Jan","Feb" etc) and on the Y axis, a sum of the Items Sold.
OR if I wanted on the X axis to have Product Name(Shirts or Shoes) and Y axis total of items sold

Advice greatly appreciated,

--Dave

ps:  Maybe Im missing something, but is there such a thing as a Bar Chart API (not a chart api, but an api available for each control) which all of the features and parameters available to that control?

Thanks




3 Replies

RA Rachel A Syncfusion Team March 2, 2015 01:41 PM UTC

Hi David,

Thank you for using Syncfusion products.

We have achieved your requirement by grouping the data points based on ProductName and calculated the sum of the ItemsSold .We have prepared the sample based on your requirement and please find the sample in the below location.

Sample: Aggregate_Chart.zip

Is there such a thing as a Bar Chart API (not a chart api, but an api available for each control) which all of the features and parameters available to that control?

We are unable to get your exact requirement and we suspect that you requirement is to know about the API of SfChart features. You can find that from our class reference documentation from the below link.

Class Reference Link

Note: If this is not your exact requirement, please provide more information on your requirement. So that we can provide you the better solution.

Please let us know if you require any further assistance.

Thanks,

Rachel. A




DC David Crumb March 2, 2015 09:00 PM UTC

Rachel;

Thank you for the solution.  In my limited humble opinion, this seems like a very cumbersome process for something that seems fundamental to charting, but I digress.

As far as the Class Reference Link, I'm looking for each control that I subscribe to, what are the features available for each (WPF) control, and what options are available for each parameter.  I see it limited in the help.syncfusion.com/wpf  Where they "Getting Started" and changing a feature at a time (which is very helpful getting started).

Help appreciated,

--Dave



RA Rachel A Syncfusion Team March 3, 2015 01:11 PM UTC

Hi David,

Thank you for your response.

We have already logged the aggregating data to the chart as a feature request and we will be implementing this feature in any of our upcoming volume releases.

You can find the SfChart classes and properties from our Class Reference documentation from the below link. We are in the process of enriching our UG documentation and we will refresh full documentations in upcoming releases.

Link: http://help.syncfusion.com/cr/wpf/sfchart

Please let us know if you require any further assistance.

Thanks,

Rachel. A



Loader.
Up arrow icon