使用Json使用HTML填充图表

时间:2016-01-27 16:12:13

标签: javascript html asp.net json asp.net-mvc

我有一个JSON文件,我希望通过cshtml填充BarChart。

JSON文件:

[{
    "Subject": "TEST APP",
    "AppScores": [{
        "Season": "AAAAAAAAAAAAAAAAAAAA",
        "year": "1",
        "value": "44"
    }, {
        "Season": "BBBBBBBBBBBBBBBBBBBBB",
        "year": "2",
        "value": "29"
    }]
}, {
    "Subject": "TEST APP2",
    "AppScores": [{
        "Season": "CCCCCCCCCCC",
        "year": "3",
        "value": "15"
    }, {
        "Season": "DDDDDDDDDDDDDDDDD",
        "year": "4",
        "value": "32"
    }]
}]

我的cshtml文件中的代码:

<script type="text/javascript">
    var myChart = new JSChart('chartid', 'bar');
    myChart.setDataJSON('data2.json');
    myChart.draw();
</script>

我的data2.json文件与cshtml file位于同一目录中。

谁能看到我在这里缺少的东西?

0 个答案:

没有答案