how to use chart control in asp.net

Posted by Shanky11 under ASP.NET on 1/22/2014 | Points: 10 | Views : 1487 | Status : [Member] | Replies : 3
i am creting a website for hospital management
in that i have to show graph y axis value x-axis date
how can i do that????????????????
value versus date
value are 0,5,0,15 on a specific date
how can i create a table for this to enter value and date to databse and fetch ir and show graph




Responses

Posted by: kgovindarao523-21772 on: 1/22/2014 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Hi,

Chat control in .aspx file:
<asp:Chart ID="Chart1" runat="server" Visible="true" Width="800px" Height="600px">
<Series>
<asp:Series Name="YOUR CHART HEADING" XValueMember="YOURDATEFIELD" YValueMembers="YOURVALUEFILED">
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1" Area3DStyle-Enable3D="false">
<AxisX LineColor="DarkGray">
<MajorGrid LineColor="LightGreen" />
</AxisX>
<AxisY LineColor="BlueViolet">
<MajorGrid LineColor="SkyBlue" />
</AxisY>
<Area3DStyle Enable3D="false"></Area3DStyle>
</asp:ChartArea>
</ChartAreas>
<Legends>
<asp:Legend>
</asp:Legend>
</Legends>
</asp:Chart>

.cs file Code
using (SqlConnection objCon = new SqlConnection("YOUR CONNECTION STRING"))
{
objCon.Open();
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.Connection = objCon;
cmd.CommandText = "select * from YOURTABLENAME";
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
Chart1.DataSource = ds;
Chart1.DataBind();
}


Please mark as answer if you satisfied

Thank you,
Govind

Shanky11, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: vishalneeraj-24503 on: 1/23/2014 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Use fusion chart.

Shanky11, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: vishalneeraj-24503 on: 1/23/2014 [Member] [MVP] Platinum | Points: 25

Up
0
Down
http://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CD4QFjAA&url=http%3A%2F%2Fdocs.fusioncharts.com%2Fcharts%2Fcontents%2Fguide-for-web-developers%2Fcsnet%2FCS_BasicExample.html&ei=OkzhUv-4AYn8iAe-lYDgBQ&usg=AFQjCNHnsZt77pi-o8cfa_ZD57KxoAcDRA&bvm=bv.59568121,d.aGc

Shanky11, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response