Built-in Charting Controls (VS 2010 and .NET 4 Series)

[In addition to blogging, I am also now using Twitter for quick updates and to share links. Follow me at: twitter.com/scottgu]

This is the fifteenth in a series of blog posts I’m doing on the upcoming VS 2010 and .NET 4 release.  Today’s post covers a nice addition to ASP.NET and Windows Forms with .NET 4 - built-in charting control support.

ASP.NET and Windows Forms Charting Controls

A little over 14 months ago I blogged about how Microsoft was making available a free download of charting controls for both ASP.NET 3.5 and Windows Forms 3.5. 

You can download and use these runtime controls for free within your web and client applications today.  You can also download VS 2008 tooling support for them.  They provide a rich set of charting capabilities that is easy to use.  To get a sense of what all you can do with them, I recommend downloading the ASP.NET and Windows Forms sample projects which provide more than 200 samples within them.  Below is a screen-shot of some pie and doughnut chart samples from the ASP.NET sample application:

image

Charting Controls Now Built-into .NET 4

With .NET 3.5 you had to separately download the chart controls and add them into your application.  With .NET 4 these controls are now built-into ASP.NET 4 and Windows Forms 4 – which means you can immediately take advantage of them out of the box (no separate download or registration required). 

Within ASP.NET 4 applications you’ll find that there is now a new built-in <asp:chart> control within the “Data” tab of the Toolbox:

image

You can use this control without having to register or wire-up any configuration file entries.  All of the charting control configuration is now pre-registered with ASP.NET 4 (meaning nothing has to be added to an application’s web.config file for them to work).  This enables you to maintain very clean and minimal Web.config files.

Learning more about the <asp:chart> control

Scott Mitchell has written a great series of articles on the www.4guysfromrolla.com site on how to take advantage of the <asp:chart> control:

  1. Getting Started - walks through getting started using the Chart Controls, from version requirements to downloading and installing the Chart Controls, to displaying a simple chart in an ASP.NET page.
  2. Plotting Chart Data - examines the multitude of ways by which data can be plotted on a chart, from databinding to manually adding the points one at a time.
  3. Rendering the Chart - the Chart Controls offer a variety of ways to render the chart data into an image. This article explores these options.
  4. Sorting and Filtering Chart Data - this article shows how to programmatically sort and filter the chart's data prior to display.
  5. Programmatically Generating Chart Images - learn how to programmatically create and alter the chart image file.
  6. Creating Drill Down Reports - see how to build drill down reports using the Chart control.
  7. Adding Statistical Formulas - learn how to add statistical formulas, such as mean, median, variance, and forecasts, to your charts.
  8. Enhancing Charts With Ajax - improve the user experience for dynamic and interactive charts using Ajax.
  9. Serializing Chart Data - see how to persist a chart's data and appearance to a persistent store.

His articles are written using .NET 3.5 and the separate ASP.NET charting controls download – but all of the concepts and syntax work out of the box exactly the same with ASP.NET 4.

Michael Ceranski has also written a blog post demonstrating how to use the ASP.NET Chart control within an ASP.NET MVC application.  I’m hoping someone will create some nice ASP.NET MVC Html.Chart() helper methods soon that will make this even easier to do in the future.

Hope this helps,

Scott

Published Sunday, February 7, 2010 9:54 PM by ScottGu
Filed under: , ,

Comments

# re: Built-in Charting Controls (VS 2010 and .NET 4 Series)

Monday, February 8, 2010 1:17 AM by Webdiyer

Great, this will save us a lot of time!thank you very much!

# re: Built-in Charting Controls (VS 2010 and .NET 4 Series)

Monday, February 8, 2010 1:18 AM by vik20000in

this chrat has been a great stuff for .net framework....

# re: Built-in Charting Controls (VS 2010 and .NET 4 Series)

Monday, February 8, 2010 1:51 AM by Coolman

I agree, I can't wait for someone on the asp.net mvc team to create helper methods for using charting.

# re: Built-in Charting Controls (VS 2010 and .NET 4 Series)

Monday, February 8, 2010 2:24 AM by Chris W

Will Msft be providing a WPF version at some stage ?

# re: Built-in Charting Controls (VS 2010 and .NET 4 Series)

Monday, February 8, 2010 2:24 AM by Troy Hunt

Great to see this become a first class citizen of .NET. This makes life so much easier in terms of consistency for application charting.

# re: Built-in Charting Controls (VS 2010 and .NET 4 Series)

Monday, February 8, 2010 3:53 AM by Lee Englestone

I love these charting tools! Ever since they were offered as a seperate download for 3.5.

# re: Built-in Charting Controls (VS 2010 and .NET 4 Series)

Monday, February 8, 2010 4:02 AM by yussi ariefiyono

nice stuff! saving me lots of time ^_^

# re: Built-in Charting Controls (VS 2010 and .NET 4 Series)

Monday, February 8, 2010 4:50 AM by Static Website Designing

Time saving stuff!

# re: Built-in Charting Controls (VS 2010 and .NET 4 Series)

Monday, February 8, 2010 5:21 AM by Matthew Abbott

Will there be any issue trying to generate charts when running ASP.NET in partial trust?  I know I've experienced issues with charting controls before that required full trust, which obviously doesn't help when trying to publish websites to shared hosting environments, which typically don't allow full trust.

# re: Built-in Charting Controls (VS 2010 and .NET 4 Series)

Monday, February 8, 2010 5:46 AM by tugberk_ugurlu_

Nice Post ! Thanks Scott !

# re: Built-in Charting Controls (VS 2010 and .NET 4 Series)

Monday, February 8, 2010 6:09 AM by Tim Acheson

We've always needed built-in charting controls, this is awesome. Thanks!

# re: Built-in Charting Controls (VS 2010 and .NET 4 Series)

Monday, February 8, 2010 7:39 AM by MVC Developers

This is awesome news. Now there will be no need to buy third party charting controls. The use in MVC application is especially interesting.

Thanks a lot.

# re: Built-in Charting Controls (VS 2010 and .NET 4 Series)

Monday, February 8, 2010 10:02 AM by Ray Huger

All we hear from you anymore is Asp.Net and Windows Forms.  I drank the KoolAid and went to WPF and Silverlight and am feeling a bit duped.

# re: Built-in Charting Controls (VS 2010 and .NET 4 Series)

Monday, February 8, 2010 5:24 PM by Paul Kohler

Looks good, fills the gap!

# re: Built-in Charting Controls (VS 2010 and .NET 4 Series)

Monday, February 8, 2010 7:22 PM by Fallon Massey

Too bad Silverlight Charst don't look this good out of the box.

# re: Built-in Charting Controls (VS 2010 and .NET 4 Series)

Monday, February 8, 2010 8:55 PM by Anders

I don't get Microsoft's UI strategy. Should .NET-developers be using Windows Forms or WPF? You'd think at some point Microsoft would drop one and focus on the other.

# re: Built-in Charting Controls (VS 2010 and .NET 4 Series)

Tuesday, February 9, 2010 1:52 AM by maxald

The new chart control is great! I think there is a bug though when setting a small x axis minimum value (refer to my post at forums.asp.net/.../3653051.aspx).

# re: Built-in Charting Controls (VS 2010 and .NET 4 Series)

Wednesday, February 10, 2010 2:09 PM by Scott Kuhn

This looks great but... I have the newly available VS2010 RC and a fresh .NET 4.0 ASP.NET Web Forms project and I don't see the Chart in the Toolbox.

# re: Built-in Charting Controls (VS 2010 and .NET 4 Series)

Thursday, February 11, 2010 3:18 AM by Stelios

Great addition, specially for beginners!

# re: Built-in Charting Controls (VS 2010 and .NET 4 Series)

Thursday, February 11, 2010 11:13 AM by Frank Tang

Great, Will instead of flash charting?

# re: Built-in Charting Controls (VS 2010 and .NET 4 Series)

Wednesday, February 17, 2010 2:05 PM by Johannes

Scott, I am using .NET 3.5 SP1 working on an MVC project. I am using the chart control and it works great. Now the problem starts when I added a virtual path in my project setting (under "Web" area in project properties for VS 2008).

If I remove the virtual path, it works. The error I have been getting is "Failed to map the path '/ChartImg.axd'". Any hints?

# re: Built-in Charting Controls (VS 2010 and .NET 4 Series)

Tuesday, February 23, 2010 4:25 AM by peter

A similar post about datapager control /I see it on the screenshot above/ will be very helpfull

# re: Built-in Charting Controls (VS 2010 and .NET 4 Series)

Wednesday, February 24, 2010 11:51 PM by suradecs

very nice for new controls

# re: Built-in Charting Controls (VS 2010 and .NET 4 Series)

Tuesday, March 2, 2010 4:16 AM by Kadji

Great. Does it still makes sense to use Dundas chart within visual studio from VS 2010 and onward?

Thanks

/Kadji

# re: Built-in Charting Controls (VS 2010 and .NET 4 Series)

Monday, March 15, 2010 11:01 AM by Haitham Khedre

this is really cool , Will Scott I am Interested to know how many developers did the charting controls also I would like to know how the render speed is compared to google Chart api "code.google.com/.../index.html" specially the interactive one, also in real time charting can we do something like this in the future:

danvk.org/.../dynamic-update.html

really your team did a great job for the Web developers we appreciate all the innovation and software design in web development under Microsoft technology.

keep the innovative work.

# re: Built-in Charting Controls (VS 2010 and .NET 4 Series)

Wednesday, March 17, 2010 2:03 PM by Rob Krumm

The Chart control is great in VS BUT I cannot get my IIS to run the web sites when they have a Chart control - I get a 503 error.  If I remove the Chart control it runs fine. Anyone know how I can fix this?

# re: Built-in Charting Controls (VS 2010 and .NET 4 Series)

Tuesday, March 30, 2010 10:17 PM by Simon Holman

I've found with the Chart control in ASP.NET 3.5 apps that if you have more than one or two charts on a page it takes ages to render the page. I have profiled the data access code and that is not causing the issue. They are fairly simple series as well with only a few data points on each chart.