Saturday, February 4, 2012

How to create Chart in asp.net ?

Create Chart control in asp.net
 
 Chart.aspx
 
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Chart.aspx.cs"
Inherits="Chart" %>

<%@ Register Assembly="System.Web.DataVisualization, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI.DataVisualization.Charting"
TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>ASP.NET Chart Control Example</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h1><b>ASP.NET Chart Control Example</b></h1>
<asp:Chart ID="ChartAspnet" runat="server" Height="400px" Width="500px">
<Series>
<asp:Series Name="SeriesASPNET" ChartType="Column" ChartArea="ChartAreaASPnet">
</asp:Series>
<asp:Series Name="SeriesASPNET1" ChartType="Column" ChartArea="ChartAreaASPnet">
</asp:Series>
 
</Series>
 
<ChartAreas>
 
<asp:ChartArea Name="ChartAreaASPnet">
 
</asp:ChartArea>
 
</ChartAreas>
 
</asp:Chart>
 
</div>

 
</form>
</body>
</html>
ASPdotNET-Example