How to display static Pie chart Graph on asp.net website

By
Hi friend, Today,we will learn"How to display Pie chart graph on asp.net website".Here we will draw  a student marks in different subjects(Math,Science,English and History) in Pie graph.Before implementing this concepts,You have install Ajax toolkit in your visual studio.
I have already explained following Graphs...
There are some properties of Pie graph as given below:-
  • ChartHeight:- This is helpful to customize the height of the chart.
  • ChartWitdh:- This is helpful to customize the width of the chart.
  • ChartTitle:- This properties is helpful to set the title of the chart.
  • ChartTitleColor:-This properties is helpful to set the color of the chart title.
 There are some Pie char value properties as given below:-
  • Category:-This properties helpful to provides name for a particular pie chart value.
  • Data:-This is helpful to provides data for a particular pie chart value.
  • PieChartValueColor:-This is helpful to set the color of segment for a particular pie chart value.
  • PieChartValueStrokeColor:- This is used to set the stroke color of segment  for a  particular pie chart value.
There are some steps to implement this whole concepts a given below:-
Step 1:-First open your visual studio-->File -->New-->Web Site-->Select ASP.NET Empty website-->OK-->Now open Solution Explorer Window-->Add a New page(Default.aspx)-->Open Toolbox-->drag and drop  ajax ToolkitScriptManager control on the page.

Step 2:-Now open Source file-->Drag and drop PieChart control from the Toolbox-->Sets their properties and sets the properties of PieChartValue also as given below:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" 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>Welcome to My.Net Tutorials</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>   
        <span class="style1"><strong><span class="style2">How to display Pie Chart on asp.net website</span><br />
        </strong></span><asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
        </asp:ToolkitScriptManager>
        <asp:PieChart ID="PieChart1" runat="server" ChartHeight="400" ChartWidth="500"
         ChartTitle="Marks Obtained in Different Subjects" ChartTitleColor="#0E426C">
         <PieChartValues>
          <asp:PieChartValue Category="Math" Data="75" PieChartValueColor="#6C1E83"/>
          <asp:PieChartValue Category="Science" Data="85" PieChartValueColor="#FF0066"/>
          <asp:PieChartValue Category="English" Data="65" PieChartValueColor="#FFFF66"/>
          <asp:PieChartValue Category="History" Data="55" PieChartValueColor="#0066FF"/>
         </PieChartValues>
        </asp:PieChart>
    </div>
    </form>
</body>
</html>

Step 3:Now Run the Application(press F5)-->You will See following output a shown below:-

For More...
Download Whole Attached File
         Download

0 comments:

Post a comment

Powered by Blogger.