Click here to Skip to main content
16,020,984 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Note : it is web application.


From Gridview records how to display using chart.


in Gridview records as follows;


BFid Rate

1 25
2 50
3 75
4 100
1 50
2 75


i want to display the above records using chart as follows



Example as follows showing the grid view records displayed into the chart as follows


100


75

50


25

1 1 2 3 4


From the above grid view records i want to display the using chart as follows


in x axis i want to display the Bfid from the gridview
in y axis i want to display the Rate from the gridview


for that how can i do using asp.net using c#.

Regards,
Narasiman P.
Posted

1 solution

Assuming you want to create a line chart, you can create the chart control using following code:

ASP.NET
<asp:chart id="ChartRate" runat="server" height="400px" width="800px" xmlns:asp="#unknown">
                  <series>
                      <asp:series xvaluemember="Date" isvalueshownaslabel="true" yvaluemembers="Call count">
                           Name="Series1" ChartType="Line" Color="Green" IsVisibleInLegend="true" BorderWidth="1">
                      </asp:series>
 
                  </series>
                  <borderskin backcolor="White" bordercolor="Black" skinstyle="Emboss" />
                  <chartareas>
                      <asp:chartarea name="ChartArea1" borderwidth="0">
                          <axisy title="BfId" interval="5"></axisy>
                          <axisx title="Rate"></axisx>
                       </asp:chartarea>
                  </chartareas>
              </asp:chart>


In Code Behind you can directly bind this chart to Dataset in Chart Control

C#
ChartRate.DataSource = dsRate.Tables[0]; // Assign here your gridview's data source.
ChartRate.DataBind();


For more information look at the following links:
How to Create Bar Chart and Line Chart both in ASP.Net 3.5 Charting Tools[^]
 
Share this answer
 

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