1
我自己唱asp.net mvc 4
並在視圖中放置了一個圖表。我想從controller
加載它的系列。我怎樣才能做到這一點 ?請任何人都可以用一段代碼來解釋它。將圖表系列從控制器傳遞到剃刀視圖
索引視圖
@{
var myChart = new Chart(width: 600, height: 400)
.AddTitle("Chart Title")
.AddSeries(
name: "Views",
xValue: new[] { "Monday", "Tuesday", "Wendesday", "Thursday", "Friday" },
yValues: new[] { "2", "6", "4", "5", "3" })
.AddSeries(
name: "Downloads",
xValue: new[] { "Monday", "Tuesday", "Wendesday", "Thursday", "Friday" },
yValues: new[] { "1", "2", "3", "4", "5" })
.Write();
}
控制器
public ActionResult Index()
{
return View();
}