Click here to Skip to main content
6,290,044 members and growing! (16,488 online)
Email Password   helpLost your password?
Platforms, Frameworks & Libraries » .NET Framework » General     Advanced License: The Code Project Open License (CPOL)

New Microsoft Chart Controls for Web and Windows Forms Applications

By Cirilo Meggiolaro

Microsoft has just launched a very rich chart control for .NET web and windows forms applications. Let’s take a look in some features from it.
VB (VB 9.0), C# 3.0, .NET (.NET 3.5), WinForms, WebForms, VS2008, Architect, Dev
Posted:1 Dec 2008
Views:18,364
Bookmarked:75 times
Unedited contribution
Announcements
Loading...
 
Search    
Advanced Search
printPrint   Broken Article?Report       add Share
  Discuss Discuss   Recommend Article Email
23 votes for this article.
Popularity: 5.27 Rating: 3.87 out of 5
2 votes, 8.7%
1
2 votes, 8.7%
2
4 votes, 17.4%
3
5 votes, 21.7%
4
10 votes, 43.5%
5

Introduction

Microsoft has just launched a very rich chart control for .NET web and windows forms applications. Let’s take a look in 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 areas 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, a 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 includes:

  • 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 in the documentation, check over 200 examples included on the samples or visit the Chart Forum.

License

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

About the Author

Cirilo Meggiolaro


Member
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!!!
Occupation: Team Leader
Location: Canada Canada

Other popular .NET Framework articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 14 of 14 (Total in Forum: 14) (Refresh)FirstPrevNext
Generalcontrols working with WPF browser PinmemberEnda Mannion13:40 27 May '09  
QuestionMS Chart PinmemberMember 40030684:11 30 Apr '09  
GeneralThanks for giving a hint. Pinmemberravi_mishra0:35 16 Apr '09  
GeneralDoes this control has a unmanaged version? Pinmemberlsgt15:20 5 Jan '09  
GeneralThanks. PinmemberHamed Mosavi0:03 17 Dec '08  
Generalthanks it is good!! PinmemberSeraph_summer23:56 7 Dec '08  
GeneralMy vote of 1 PinmemberMaximilian Korporal2:43 3 Dec '08  
GeneralMy vote of 2 Pinmemberkornakar20:36 2 Dec '08  
GeneralMy vote of 2 Pinmemberpita20097:13 2 Dec '08  
General;} Pinmemberradioman.lt2:25 2 Dec '08  
GeneralMy vote of 1 Pinmembergrundt14:10 1 Dec '08  
GeneralRe: My vote of 1 PinmemberAbu Abdillah22:41 1 Dec '08  
GeneralRe: My vote of 1 PinmemberGreizzerland3:34 2 Dec '08  
GeneralRe: My vote of 1 PinmembermBonafe4:17 9 Dec '08  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 1 Dec 2008
Editor:
Copyright 2008 by Cirilo Meggiolaro
Everything else Copyright © CodeProject, 1999-2009
Web12 | Advertise on the Code Project