I am trying to make a chart in MVC 4. But it's not working.I am using High-Charts.This is my action method.
public ActionResult Index()
{
var title = new Title() { Text = "Workload" };
var subtitle = new Subtitle() { Text = "workload per day" };
var XData = new[] { "25", "26", "27", "28", "29", "30", "31", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12" };
var YData = new object[] { 195, 150, 0, 270, 0, 90, 245, 215, 350, 355, 190, 95, 0, 100, 225 };
var xaxisTitle = new XAxisTitle { Text = "Wokload in minutes" };
var yaxisTitle = new YAxisTitle { Text = "Time in days" };
string serieName = "Workload per day";
Highcharts chart = new Highcharts("chart")
.SetTitle(title)
.SetSubtitle(subtitle)
.SetXAxis(new XAxis
{
Categories = XData,
Title = xaxisTitle
})
.SetYAxis(new YAxis
{
Title = yaxisTitle
})
.SetSeries(new Series
{
Data = new Data(YData),
Name = serieName
});
return View(chart);
}
and this is my View.
@model DotNet.Highcharts.Highcharts
@{
ViewBag.Title = "Index";
}
<header>
<script src="~/Scripts/jquery-1.5.1.min.js" type="text/javascript"></script>
<script src="~/Scripts/highcharts.js" type="text/javascript"></script>
<script src="~/Scripts/Highcharts-4.0.1/js/highcharts.js"></script>
<script src="~/Scripts/jquery-1.7.1.js"></script>
<script src="~/Scripts/Highcharts-4.0.1/js/highcharts.src.js"></script>
<script src="~/Scripts/Highcharts-4.0.1/js/highcharts.js"></script>
<script src="~/Scripts/Highcharts-4.0.1/js/highcharts-more.src.js"></script>
<script src="~/Scripts/Highcharts-4.0.1/js/highcharts-more.js"></script>
<script src="~/Scripts/Highcharts-4.0.1/js/highcharts-all.js"></script>
<script src="~/Scripts/Highcharts-4.0.1/js/highcharts-3d.src.js"></script>
<script src="~/Scripts/Highcharts-4.0.1/js/highcharts-3d.js"></script>
<script src="~/Scripts/jquery-1.7.1.js"></script>
</header>
There is a graph
@(Model)
What is wrong with this code? This is showing nothing in the view. There is a blank page when i run it.Please someone guide me.