@Model以null

时间:2017-07-19 15:30:35

标签: asp.net asp.net-mvc highcharts

我只是想在高图表图表中连接一些简单的数据但我不断得到 -

  

DotNet.Highcharts.dll中出现“System.NotImplementedException”类型的异常,但未在用户代码中处理

型号:

public class Weight
{
    public int Id { get; set; }
    public float _Weight { get; set; }
    [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/MM/yyyy}")]

    public DateTime _DateTime { get; set; }
}

获取视图的方法

public ActionResult Overall()
{
    object[] o = new object[db.Weights.Count()];
    int index = 0;
    foreach (Weight d in db.Weights)
    {
        o[index++] = d._Weight;
    }

    DotNet.Highcharts.Highcharts chart = new DotNet.Highcharts.Highcharts("chart").SetXAxis(new XAxis
    {
        Title = new XAxisTitle
        {
           Text = "Date Run"
        }
    }).SetYAxis(new YAxis
    {
        Title = new YAxisTitle
        {
           Text = "Distance Run"
        }
    }).SetSeries(new Series
    {
        Data = new Data(o)
    });
    return View(chart);
}

和视图:

@model DotNet.Highcharts.Highcharts

@{
    ViewBag.Title = "Index";
}
<script src="~/Scripts/jquery-1.10.2.js"></script>
<script src="~/Scripts/Highcharts-4.0.1/js/highcharts.js"></script>
<script src="~/Scripts/Highcharts-4.0.1/js/themes/dark-unica.js"></script>

@Model

我的模型中也有100%的数据。

我有一个足够接近完美的副本,可以使用相同数据类型但没有DateTime字段的模型。

0 个答案:

没有答案