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][int] NULL, PRIMARY KEY CLUSTERED(
    12. [pk_id] ASC) WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[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

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

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.