Virtual Developer Workshop: Containerized Development with Docker
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
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.