ASP.NET and MSCharts - Multiple series XValues

allgenresaacg

New Member
I have the following markup to define a chart in my code. the Chart is supposed to show Groupings of Business Unit and Geography , and show a count of 'events'. within those business units and geographies.\[code\]<asp:Chart ID="Chart3" Width="600px" runat="server" Visible="false"> <Legends> <asp:Legend Name="Default" DockedToChartArea="ChartArea1" Docking="Bottom" IsDockedInsideChartArea="false"></asp:Legend> </Legends> <Series> <asp:Series Name="Series1" ChartType="StackedBar" ChartArea="ChartArea1" LegendText="# of Events" XValueMember="BusinessUnit" YValueMembers="NumOfEvents"></asp:Series> </Series> <ChartAreas> <asp:ChartArea Name="ChartArea1"></asp:ChartArea> </ChartAreas></asp:Chart>\[/code\]and here is the codebehind:\[code\] var data = http://stackoverflow.com/questions/12820295/Reports.CountEventsByGeographyQuarterBusinessUnit(filter.DateStart, filter.DateEnd, filter.StatusID, filter.EventTypeID, filter.ProductFocusID, filter.PrimaryObjectiveID, filter.SecondaryObjectiveID, filter.AudienceIndustryID, filter.PrimaryAudienceID, filter.SecondaryAudienceID); Chart3.DataSource = data; Chart3.DataBind();\[/code\]I'm getting my data from a simple linq query that returns an IQueryable anonymous type with the following fields: BusinessUnit, NumOfEvents, Region (geography). In this example BusinessUnit and Regions can show more than once because we want to first group by Region then by Business Unit. I can get the chart to show fine with just one 'X value' but I don't know how to group by one x value and show a second. The data I want to show should look like this, http://blogs.msdn.com/blogfiles/ale...r/DataBindingMSChartcontrol_10712/image_2.pngWhere instead of sales peoples names, it's Regions, and each bar represents a different business unit. I see there's examples with Bind to datatables, but I'm getting my data from Entity Framework and don't want to have to shoehorn my data into a datatable.Thanks!
 
Back
Top