Click here to Skip to main content
11,701,948 members (56,115 online)
Click here to Skip to main content

New Microsoft Chart Controls for Web and Windows Forms Applications

, 1 Dec 2008 CPOL 197.4K 6 144
Rate this:
Please Sign up or sign in to vote.
Microsoft has just launched a very rich chart control for .NET web and Windows Forms applications. Let’s take a look at some features from it.

Introduction

Microsoft has just launched a very rich chart control for .NET web and Windows Forms applications. Let’s take a look at some features from it.

Prerequisites

Chart Types

The following chart types are available:

  • Bar and columns
  • Line
  • Area
  • Pie and Doughnut
  • Point
  • Range
  • Circular
  • Accumulation
  • Data Distribution
  • Financial

You still have the option to combine more than one chart type.

Bind Types

The following options are available to be used as bind types for your application charts:

  • XML Files
  • Excel Files
  • CSV Files
  • Arrays
  • IEnumerable objects
  • Dataviews

How To...

The examples and documentation are really good and to work with the new Microsoft Chart control is very straightforward. Drag and drop a chart control, set properties in design and / or runtime and it’s done!

Namespace

The namespace you are going to use is System.Web.UI.DataVisualization.Charting.

Main Properties

  • ChartAreas: It is the area where a chart is plotted. Your chart may contain more than one chart area, that means you may plot more than one chart by render and you may even overlap charts.
  • Series: It is the data you may plot on your chart area.
  • ChartType: The chart type property is under the Series property and defines how your data series will be displayed on a chart area.
  • Axes: Defines properties for the X and Y axes like appearance and titles.
  • Palette: Defines the colors set for your chart.
  • Titles: Defines text that may be used to describe a chart, an axis or any other part of the chart.
  • Legends: Defines the legends that will display the data series information.
  • Labels: Defines text that may be displayed close to axis, points and custom labels.

Examples

The following code uses two arrays to create a simple pie chart:

double[] yValues = { 10, 27.5, 7, 12, 45.5};
string[] xNames = { “Mike”, “John”, “William”, “George”, “Alex” };
myChart.Series[0].Points.DataBindXY(xNames, yValues);

Output:

piechart1.png

Picture 1: Pie chart created with array databind.

Using the same code but changing some values will produce the following bar chart:

columnchart.png

Picture 2: Column chart created with an array databind.

More Features

This new control set is really rich on the level of customization allowed. Some other features of the new Microsoft Chart control include:

  • Image plot or binary streaming rendering
  • Allows a very complex set of data to be plotted
  • 3D visualization control (perspective, angle, rotation)
  • Events to give even more control over how to plot data, custom images, post plot actions and a click event
  • May be used in conjunction with Ajax to create real time charts, use charts as trigger to load data
  • Drill down chart with preview
  • Image map selection
  • Custom animated tooltips
  • Capture of mouse events

If you want to get more information, take a look at the documentation, check over 200 examples included on the samples or visit the Chart Forum.

History

  • 1st December, 2008: Initial post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Cirilo Meggiolaro
Team Leader
Canada Canada
I am a brazilian architect / development team lead located in Toronto, Canada.

During the last years I have been working on enterprise applications especially on Microsoft platform for companies located in South and North America.

Application design, coding and especially tunning, debugging and performance related issues troubleshooting make part of my skills bag.

I keep a blog called ITTecture with daily tips related to architecture, performance and .NET coding where you will find some tips, tricks, thoughts and even concepts related to system architecture, application performance and all the cool (but sometimes not so cool) stuff that I’ve heard, read, debbuged, fixed, refactored and coded and how to avoid long overnights far away from home!!!

You may also be interested in...

Comments and Discussions

 
Questionprint chart Pin
mnuaimi29-Jul-15 8:43
membermnuaimi29-Jul-15 8:43 
QuestionSave Chart in C# Pin
sankar666416-May-12 22:54
membersankar666416-May-12 22:54 
AnswerRe: Save Chart in C# Pin
Pete O'Hanlon16-May-12 23:30
protectorPete O'Hanlon16-May-12 23:30 
Questionthanks very much Pin
parastoo_8121421-Jan-12 20:05
memberparastoo_8121421-Jan-12 20:05 
Generaltwo Pies with connecting lines Pin
SysSoft12-Apr-11 3:25
memberSysSoft12-Apr-11 3:25 
QuestionWIndows 7 Support Microsoft Chart Controls Pin
sundaramoorthyp11-Nov-10 16:44
membersundaramoorthyp11-Nov-10 16:44 
AnswerRe: WIndows 7 Support Microsoft Chart Controls Pin
iohn20007-Sep-11 23:05
memberiohn20007-Sep-11 23:05 
GeneralRe: WIndows 7 Support Microsoft Chart Controls Pin
fgoldenstein11-Jan-12 7:46
memberfgoldenstein11-Jan-12 7:46 
GeneralXCOPY web deployment. Pin
Manique3-Mar-10 22:55
memberManique3-Mar-10 22:55 
GeneralVersion Pin
Ciro Zamudio3-Feb-10 4:37
memberCiro Zamudio3-Feb-10 4:37 
GeneralInstructions for Using the Chart Controls in ASP.NET MVC Pin
Michael Ceranski25-Jan-10 3:49
memberMichael Ceranski25-Jan-10 3:49 
QuestionHow to use linegraph Pin
duo915-Jul-09 21:33
memberduo915-Jul-09 21:33 
AnswerRe: How to use linegraph [modified] Pin
williamw23-Jul-09 0:32
memberwilliamw23-Jul-09 0:32 
GeneralRe: How to use linegraph [modified] Pin
duo923-Jul-09 16:41
memberduo923-Jul-09 16:41 
GeneralRe: How to use linegraph Pin
williamw28-Jul-09 1:48
memberwilliamw28-Jul-09 1:48 
Without knowing the x-axis type (temp, size etc) I can only advise that the x-axis be used for time because it is an input. The y-axis should be used to show the varying outputs. Because there is only one date with no increments I would do a bar chart because single dates would not show as a gradient, no matter what axis you use.

I hope I am understanding correctly. Sorry to rattle on if I have left the planet on a tangent Smile | :)

Will

GeneralRe: How to use linegraph [modified] Pin
duo930-Jul-09 21:13
memberduo930-Jul-09 21:13 
GeneralRe: How to use linegraph Pin
williamw30-Jul-09 22:43
memberwilliamw30-Jul-09 22:43 
GeneralRe: How to use linegraph Pin
duo930-Jul-09 23:08
memberduo930-Jul-09 23:08 
GeneralRe: How to use linegraph Pin
williamw30-Jul-09 23:15
memberwilliamw30-Jul-09 23:15 
GeneralRe: How to use linegraph Pin
duo92-Aug-09 21:39
memberduo92-Aug-09 21:39 
QuestionVery Slow Pin
hsachdevah15-Jul-09 5:03
memberhsachdevah15-Jul-09 5:03 
Generalcontrols working with WPF browser Pin
Enda Mannion27-May-09 12:40
memberEnda Mannion27-May-09 12:40 
QuestionMS Chart Pin
Member 400306830-Apr-09 3:11
memberMember 400306830-Apr-09 3:11 
GeneralThanks for giving a hint. Pin
ravi_mishra15-Apr-09 23:35
memberravi_mishra15-Apr-09 23:35 
QuestionDoes this control has a unmanaged version? Pin
lsgt5-Jan-09 14:20
memberlsgt5-Jan-09 14:20 
GeneralThanks. Pin
Hamed Mosavi16-Dec-08 23:03
memberHamed Mosavi16-Dec-08 23:03 
Generalthanks it is good!! Pin
Seraph_summer7-Dec-08 22:56
memberSeraph_summer7-Dec-08 22:56 
GeneralMy vote of 1 Pin
Maximilian Korporal3-Dec-08 1:43
memberMaximilian Korporal3-Dec-08 1:43 
GeneralMy vote of 2 Pin
kornakar2-Dec-08 19:36
memberkornakar2-Dec-08 19:36 
GeneralMy vote of 2 Pin
pita20092-Dec-08 6:13
memberpita20092-Dec-08 6:13 
General;} Pin
radioman.lt2-Dec-08 1:25
memberradioman.lt2-Dec-08 1:25 
GeneralMy vote of 1 Pin
grundt1-Dec-08 13:10
membergrundt1-Dec-08 13:10 
GeneralRe: My vote of 1 Pin
Abu Abdillah1-Dec-08 21:41
memberAbu Abdillah1-Dec-08 21:41 
GeneralRe: My vote of 1 Pin
Greizzerland2-Dec-08 2:34
memberGreizzerland2-Dec-08 2:34 
GeneralRe: My vote of 1 Pin
mBonafe9-Dec-08 3:17
membermBonafe9-Dec-08 3:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150819.1 | Last Updated 1 Dec 2008
Article Copyright 2008 by Cirilo Meggiolaro
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid