Click here to Skip to main content
15,886,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Good day all, please i need some assistance on displaying record from my database to Barchart.. Below is my code

C#
// Front Page
<asp:Chart ID="Chart1" runat="server" Width="1000px" Height="600px">
    <Series>
        <asp:Series Name="Series1">
           
        </asp:Series>
        
    </Series>
            
    <ChartAreas>
        <asp:ChartArea Name="ChartArea1" ></asp:ChartArea>
        
    </ChartAreas>
</asp:Chart>

//Code Behind

I have a database table Called Staff. I have these records
 Frank, Lawrence		Senior Staff	90					
 Frank, Lawrence		Senior Staff	80						
 Frank, Lawrence		Senior Staff	50	
 Alison, Madu		        Junior Staff	90
Alison, Madu		        Junior Staff	50
Alison, Madu		        Junior Staff	90
	
var acc = (from c in cdc.Staff
                          
                           group c by new { c.Name } into grp
                           select new
                           {
                               StaffName = grp.Key,
                              
                               AverageScore = grp.Select(m => m.Total).Sum() / grp.Count(),
                           }).ToList();
                if(acc.Count() > 0)
                {
                    
                
                }
/*  i have been able to group them
 I want to have the result displayed on a barchart.. but 
I want the y-axiz have the Positions and the x-axix to have the average score.

Please How do i achieve that... Can some one help me please..I do appreciate your time.. thanks
*/
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900