In this article I’m going to explain how to create dynamic Ajax Area Chart in ASP.NET using C#.

          Ajax Control toolkit provides a ways to create Area Chart that would be display the statistics data in graphical representation. The AreaChart control enables you to render area chart from one or more series of values. I already wrote some articles related to ASP.NET Chart

How to create dynamic Google Chart in ASP.NET using C#

          How to create dynamic Ajax Pie Chart in ASP.NET using C#

          How to create dynamic Ajax Bar Chart in ASP.NET using C#

 

          Here I’ll show you how to create dynamic Ajax Area Chart, in this demo I’ve used Northwind database to populate dynamic Area chart

          Here you can download Northwind database

http://northwinddatabase.codeplex.com/releases/view/71634

Here I’ll explain some properties of Ajax AreaChart

Sample code:

<ajaxToolkit:AreaChart ID="AreaChart1" runat="server"

                                   ChartHeight="300" ChartWidth="450" ChartType="Basic"

                                   ChartTitle="Sample chart title"

                                   CategoriesAxis="2007,2008,2009,2010,2011,2012"

                                   ChartTitleColor="#0E426C" CategoryAxisLineColor="#D08AD9"

                                   ValueAxisLineColor="#D08AD9" BaseLineColor="#A156AB">

             <Series>

                <ajaxToolkit:AreaChartSeries Name="United States"

                                     AreaColor="#6C1E83" Data="110, 189, 255, 95, 107, 140" />

                <ajaxToolkit:AreaChartSeries Name="Europe"

                                     AreaColor="#D08AD9" Data="49, 77, 95, 68, 70, 79" />

            </Series>       

</ajaxToolkit:AreaChart>  

 

AreaChart Properties:

ü  ChartHeight - This property enables you to customize the height of the chart.

ü  ChartWidth - This property enables you to customize the width of the chart.

ü  ChartTitle - This property enables you to set the title of the chart.

ü  CategoryAxis - This is a required property. You need to provide a set of values for the category axis to create a line chart.

ü  ChartType - This property enables you to render two types of area charts 1. Basic 2. Stacked.

ü  Theme - This property enables you to control the appearance of the area chart with a Cascading Style Sheet file.

ü  ValueAxisLines - This property enables you to set the interval size for the value axis line.

ü  ChartTitleColor - This property enables you to set the font color of the chart title.

ü  CategoryAxisLineColor - This property enables you to set the color of the category axis lines.

ü  ValueAxisLineColor - This property enables you to set the the color of the value axis lines.

ü  BaseLineColor - This property enables you to set the color of the base lines of the chart.


AreaChartSeries Properties:

 

ü  Name - This is required and you need to provide the name of series.

ü  AreaColor - This property enables you to set the color of area for a particular series.

ü  Data - This property is required and provides data for a particular series.

 

Designer source code:

<%@ 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>Ajax Area Chart</title>

</head>

<body>

    <form id="form1" runat="server">

    <div>

        <asp:ScriptManager ID="ScriptManager1" runat="server">

        </asp:ScriptManager>

        <asp:AreaChart ID="AreaChart1" runat="server" ChartHeight="300" ChartWidth="600"

            ChartType="Basic"

            ChartTitleColor="#0E426C" CategoryAxisLineColor="c4c6c6"

            ValueAxisLineColor="c4c6c6" BaseLineColor="Black">

        </asp:AreaChart>  

    </div>

    </form>

</body>

</html>

 

 

Code behind:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Data;

using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page

{

    protected void Page_Load(object sender, EventArgs e)

    {

        if (!IsPostBack)

        {

            BindChart();

        }

    }

    protected void BindChart()

    {

        SqlConnection conn = new SqlConnection("Data Source=SPIDER;Initial Catalog=Northwind;Integrated Security=True");

        DataSet ds = new DataSet();

        DataTable dt = new DataTable();

        conn.Open();

        string cmdstr = "select top 10 Country, COUNT(CompanyName) [Total Suppliers] from [Suppliers] group by Country";

        SqlCommand cmd = new SqlCommand(cmdstr, conn);

        SqlDataAdapter adp = new SqlDataAdapter(cmd);

        adp.Fill(ds);

        dt = ds.Tables[0]; 

        string category="";

        decimal[] values = new decimal[dt.Rows.Count];

        for (int i = 0; i < dt.Rows.Count; i++)

        {

            category = category + "," + dt.Rows[i]["Country"].ToString();

            values[i] = Convert.ToDecimal(dt.Rows[i]["Total Suppliers"]);         

        } 

        AreaChart1.CategoriesAxis = category.Remove(0, 1);

        AreaChart1.Series.Add(new AjaxControlToolkit.AreaChartSeries { Data = values, AreaColor = "#3dc0f4", Name = "Suppliers" });

    }

}

 

cytotec abortion

abortion pill online buy abortion pills online
medical abortion pill online buy cytotec for 24 week abortion abortion pill


View demo Download
http://www.dotnetfox.com/Document/1035/0Demo1.gif

If you enjoyed this article, get email updates (it's free).


Related Articles
  • How to create dynamic Google chart in ASP.NET using C#In this article I’m going to explain how to create dynamic Google chart in ASP.NET using C#. I got a requirement that I should make graphical representation for statistics data. So I’ve preferred to create Pie Chart. Already we’ve standard web control for Pie Chart in ASP.NET and AjaxControl Toolkit provides controls for Pie Chart. Google provides functionality to create Pie Chart in ASP.NET. Here...
  • How to create dynamic Ajax Pie Chart in ASP.NET using C# In this article I’m going to explain how to create dynamic Ajax pie chart in ASP.NET using C#. Ajax Control toolkit provides a ways to create Pie Chart that would be display the statistics data in graphical representation. The PieChart control enables you to render a pie chart from one or more PieChartValues. I already wrote some articles related to Chart
  • How to create dynamic Ajax Bar Chart in ASP.NET using C#In this article I’m going to explain how to create dynamic Ajax Bar Chart in ASP.NET using C#. Ajax Control toolkit provides a ways to create Bar Chart that would be display the statistics data in graphical representation. The BarChart control enables you to render a bar chart from one or more series of values. I already wrote some articles related to ASP.NET Chart
  • How to create dynamic Ajax Area Chart in ASP.NET using C#In this article I’m going to explain how to create dynamic Ajax Area Chart in ASP.NET using C#. Ajax Control toolkit provides a ways to create Area Chart that would be display the statistics data in graphical representation. The AreaChart control enables you to render area chart from one or more series of values. I already wrote some articles related to ASP.NET Chart.
  • Bind ASP.NET chart control from database using C# In this article I’m going to explain how to bind chart control from database in ASP.NET using C#. The Chart controls enable you to create ASP.NET pages with simple, intuitive, and visually compelling charts for complex statistical or financial analysis Here I’ll show you how to bind chart from SQL Server database.
  • Export Chart control to PDF document in ASP.NET using iTextSharp and C#In this article I’m going to explain how to export ASP.NET chart control to PDF using C#. I have already written an article about bind ASP.NET Chart control from database. You could refer this article by following this below link. Bind ASP.NET chart control from database using C#. If you are not aware to include iTextSharp.dll in ASP.NET project you could read this article How to create PDF docume...
  • Create google Geochart with region mode in ASP.NETIn this article I’m going to explain how to create google Geomap with region mode in ASP.NET. A Geochart is a map of a country, a continent, or a region with two modes: The region mode colorizes whole regions, such as countries, provinces, or states. The marker mode marks designated regions using bubbles that are scaled according to a value that you specify. A Geochart is rendered within the brows...
  • Create google Geochart with Marker mode in ASP.NETIn this article I’m going to explain how to create google Geomap with marker mode in ASP.NET. A Geochart is a map of a country, a continent, or a region with two modes: The region mode colorizes whole regions, such as countries, provinces, or states. The marker mode marks designated regions using bubbles that are scaled according to a value that you specify. A Geochart is rendered within the brows...
  • Create multi column or multi series bar chart from database in ASP.NET In this article I’m going to explain how to create multi column or multi series bar chart from database in ASP.NET using C#. The Chart controls enable you to create ASP.NET pages with simple, intuitive, and visually compelling charts for complex statistical or financial analysis. If you want to create multi series bar chart you could follow the steps given below. Step-1: First drag and drop Chart...
  • How to install or configure Fusion Charts in ASP.NETFusionCharts Free can effectively be used within ASP.NET applications. For the sake of better understanding, we have developed few sample applications using ASP.NET C#, where we have shown how easily FusionCharts can be integrated with ASP.NET. You can download Fusion charts by following the link given below or you can download source code which has been attached along with this article.

Comments
comments powered by Disqus

Thanks for downloading..!!

×
Subscribe via Email
    
message to display in fancybox