Scott Gu just posted about a new set of charting controls being distributed by the .NET team. They look incredible: http://weblogs.asp.net/scottgu/archive/2008/11/24/new-asp-net-charting-control-lt-asp-chart-runat-quot-server-quot-gt.aspx
The million dollar question is … will they work with MVC, and if so, when?
You can use the chart controls in two ways:
Generating the Image from a Controller
By generating the chart and returning it as an image from an action (as Chatuman is referring to I think):
WebForms Style
This way you just include the chart in your .aspx views (just like with traditional web forms). For this you’ll have to hook up the relevant bits in your web.config
You can’t run code inside the DataPoint elements when building the chart, so to hook up your data you’ll need a method in the View class. This works ok for me. Working this way makes the control render a URL to an image generated by the chart control http handler. In your deployment you’ll need to provide a writable folder for it to cache the images.
* VS 2010 / .NET 4 Support *
To get this working in .NET 4 you need to change the chart references to version 4.0.0.0 with the appropriate public key token.
Also it seems that the chart control now generates urls to the current request path rather than the request route. For me this meant that all the chart requests resulted in 404 errors because
/{Controller}/ChartImg.axdand equivalents were blocked by routes. To fix this I added extra IgnoreRoute calls that cover my usages – a more general solution would be better: