Pie-Chart in ASP.net AJAX


In this article I'm trying to explain how to work with Pie-Chart Control in ASP.net AJAX. This will give you the user friendly output. This article will help you for beginners those who are start to work with this.

Pie-Chart in ASP.net AJAX :



In this article I'm trying to explain how to work with Pie-Chart Control in ASP.net AJAX. This will give you the user friendly output. This article will help you for beginners those who are start to work with this.

AJAX:




For this we must download AJAX control Toolkit dll and add reference to the project, by right clicking the project and choose assembly reference to add that.
After added the dll add below lines of code in source code.

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>



Pie-Chart Description:



If we want to design Chart in that case better we go to AJAX Pie-Chart application using this to render a pie chart from one or more PieChartValues.  This is compatible with any browser.

Pie-Chart Properties:



Chart Height: This will help you to fix the height of the chart
Chart Width :This will help you to fix the width of the chart.
Chart Title: This will help you to fix the Title of the Chart.

Pie-Chart Value Properties:



Category: This will help you to provide name of the particular chart value.
Data: This will help you to provide data for that Chart value.
PieChartValueColor - This property enables you to set the color of segment for a particular PieChartValue.
PieChartValueStrokeColor - This property enables you to set the stroke color of segment for a particular PieChartValue.

Source Code:



<%@ Page Language="C#" AutoEventWireup="true" CodeFile="PieChart.aspx.cs" Inherits="AJAX_PieChart" %>

<%@ 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></title>
</head>
<body>
<form id="form1" runat="server">
<asp:ToolkitScriptManager EnablePartialRendering="true" runat="server" ID="ScriptManager1"></asp:ToolkitScriptManager>
<div>
<asp:PieChart ID="PieChart1" runat="server" ChartTitle="Widget Production in the World"
ChartHeight="350" ChartWidth="500">
<PieChartValues>
<asp:PieChartValue Category="USA" Data="35" PieChartValueColor="White" PieChartValueStrokeColor="red" />
<asp:PieChartValue Category="Australia" Data="45" PieChartValueColor="yellow" PieChartValueStrokeColor="red" />
<asp:PieChartValue Category="INDIA" Data="55" PieChartValueColor="Light blue" PieChartValueStrokeColor="red" />
<asp:PieChartValue Category="Pakistan" Data="25" PieChartValueColor="dark green" PieChartValueStrokeColor="red" />
<asp:PieChartValue Category="England" Data="15" PieChartValueColor="Red" PieChartValueStrokeColor="red" />
<asp:PieChartValue Category="SouthAfrica" Data="05" PieChartValueColor="Light Green" PieChartValueStrokeColor="red" />
<asp:PieChartValue Category="New Zeland" Data="12" PieChartValueColor="Black" PieChartValueStrokeColor="red" />

</PieChartValues>
</asp:PieChart>
</div>
</form>
</body>
</html>

Script Manager : 

</ajaxToolkit:ToolkitScriptManager EnablePartialRendering="true" runat="Server" ID="ScriptManager1" >


Without wrote this line in source code it's throws the server error to overcome this issue we just add above lines of code under form tag.

ScriptManager

Output:



output

Conclusion:


This article will help you for fresher those who are perform to design chart application and those who are beginners to perform this.


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: