ASP.NET Chart Control Question
Posted on 2012-03-28
I've got a large linq query that populates a report (.rdlc file) in a ReportViewer control. I would like to use this linq query to populate an ASP.NET (C#.NET 4.0) chart control as well.
The problem is that the chart is not rendering the data correctly, due to the linq query returning a dataset containing one item per row instead of a dataset that is grouped (example below). I set one column for the X-Axis on the report and one column for the Y-Axis. What I really need, however is to set the column to SUM or .Count().
Column #1: DateVisited (datetime)
Column #2: UserName (string)
I need for Column #1 (date visited) to be on the X-Axis of the chart (one tick per day).
I need for Column #2 (UserName) to sum, so that if 5 separate users visited the website 5 times in a day, then the chart would say that there were 25 visits (5x5=25).
Is there a way to tell the chart to sum a column, or will I just have to write a separate linq query for the chart that does this?
Thank you in advance.