The Wayback Machine - https://web.archive.org/web/20140713111818/http://www.codeguru.com/csharp/article.php/c17959/Using-Microsofts-Chart-Controls-In-An-ASPNET-Application-Using-the-Chart-Controls-with-ASPNET-MVC.htm

Using Microsoft's Chart Controls In An ASP.NET Application: Using the Chart Controls with ASP.NET MVC

The Microsoft Chart controls are a series of classes in the System.Web.UI.DataVisualization.Charting namespace that allow web developers to ability to add charts to their ASP.NET applications. The most pertinent charting-related class is the Chart class, which contains information about the chart's appearance, series, charting areas, and so forth. In most of the demos and code samples we've explored thus far, we've used the Chart class as a Web control, adding the declarative markup to our ASP.NET page, setting a few properties and, occasionally, writing a few lines of code. When used as a Web control, the Chart class both creates the chart (as an image) and then renders an element that points to the generated chart image.

Using the Chart Web control is a standard practice in a WebForms application, but it is not suggested when building an ASP.NET MVC application. (While it is possible to add Web controls - including the Chat Web control - to the views of an ASP.NET MVC application, it is generally frowned upon.) So, if we can't use the Chart Web control in an ASP.NET MVC application, how do we display a chart? In addition to being used as a Web control, the Chart class can also be used programmatically. It is quite possible to create a new Chart object, set some properties, plot the data points, and then generate the chart image. In fact, we looked at using this technique in an earlier installment, Programmatically Generating Chart Images, in which we saw (among other things) how to generate chart images programmatically and add them as attachments in an email message.

This article explores how to display charts in an ASP.NET MVC application. To read the entire article, Using Microsoft's Chart Controls In An ASP.NET Application: Using the Chart Controls with ASP.NET MVC, click here.



About the Author

Scott Mitchell

Scott Mitchell is the Editor, founder, and primary contributor to 4GuysFromRolla.com. In addition to founding 4GuysFromRolla.com, Scott also created ASPFAQs.com and ASPMessageboard.com. He works as a freelance writer, trainer, and consultant and resides in California.

Comments

  • There are no comments yet. Be the first to comment!

Top White Papers and Webcasts

  • As a result of corporate expansions, mergers, and acquisitions, the teams and technologies that support an organization's IT service management (ITSM) practices can over time become somewhat dispersed. Supporting an organization's strategic objectives, and providing consistent and quality IT support is essential, but this can be challenging where disconnected support environments exist. While physically centralizing support is not always possible, nor is it always desirable, delivering a consistent and …

  • Intelligent N+X Redundancy, Placement Affinities, & Future Proofing in the Virtualized Data Center Virtualization brought about the ability to simplify business continuity management in IT. Workload portability and data replication capabilities mean that physical infrastructure failures no longer need impact application services, and they can rapidly be recovered even in the event of complete site failure. However, Enterprises and Service Providers face new challenges ensuring they have enough compute …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds