So I was trying out the Chart helpers in the System.Web.Helpers namespace.
according to http://www.asp.net/web-pages/tutorials/data/7-displaying-data-in-a-chart
Some header above a graph
and then you could have a controller action:
public ActionResult DrawChart()
{
MyViewModel model = ...
return View(model);
}
and a corresponding view that will draw the chart (DrawChart.cshtml):
@model MyViewModel
@{
// TODO: use the data from the model to draw a chart
var myChart = new Chart(width: 600, height: 400)
.AddTitle("Chart Title")
.AddSeries(
name: "Employee",
xValue: new[] { "Peter", "Andrew", "Julie", "Mary", "Dave" },
yValues: new[] { "2", "6", "4", "5", "3" })
.Write();
}
and the rendered result:
