ASP.NET 3D-Chart Control Sample Web Application

Introduction

This article shows how to make a 3D Pie chart from a datatable.  In business applications,  reporting functionality is important. 

  1. Download My Sample

  2. The Student.sql file will be inside these folders.  Execute it in your database.
    1. USE[master]  
    2. GO  
    3. /****** Object:  Table [dbo].[Student]    Script Date: 08/17/2012 18:31:11 ******/  
    4. SET ANSI_NULLS ON  
    5. GO  
    6. SET QUOTED_IDENTIFIER ON  
    7. GO  
    8. SET ANSI_PADDING ON  
    9. GO  
    10. CREATE TABLE[dbo].[Student](  
    11.     [pk_id][int] IDENTITY(1, 1) NOT NULL, [StudName][varchar](50) NULL, [StudTotal][intNULLPRIMARY KEY CLUSTERED(  
    12.         [pk_id] ASCWITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ONON[PRIMARY]) ON[PRIMARY]  
    13. GO  
    14. SET ANSI_PADDING OFF  
    15. GO 
  3. Change the connection string in web.config file. 
    1. <add name="MyConnection" connectionString="Data Source=MONISH-PC\MONISH;Initial Catalog=master;Persist Security Info=True;User ID=saty;Password=1234" providerName="System.Data.SqlClient"/>  
    2. </connectionStrings>  
  1. Build the Application it will work fine. Read on to learn more!

Building the Sample

  • Add New Project and choose Web Forms Application.

  • Create a Student table in sql server by executing this sql file: student.sql.

  • Add ASP.NET Chart Control to web forms.

  • Drag the Chart Control and Gridview Control.

  • Use the  same model layer with ASP.NET GridView and enable  Edit/Delete support of records in SQL server database.

  • Reflect the changes in Chart Controls after editing records from GridView.

  • Dynamically change ASP.NET 4.0 Chart Control Type.

    ASP.NET

    ASP.NET

    ASP.NET

    ASP.NET

    ASP.NET

Description

A chart consists of one or more series, which are lists of data points. Typically, each data point is a pair of numbers that provide both the X value and Y value to be plotted. In this sample I coded X value for Student Name and Y Value for Total Marks for particular student.

Source Code Files

  • student.sql

More Information

The Microsoft Chart controls make it easy to take data from a database or some other data store and present it as a chart. You can bind an ADO.NET Dataset directly to the Chart.


Similar Articles