1

我正在尝试使用 jchartfx 创建图表。我可以尝试使用提供的示例。我的问题是当我直接从文件夹运行 HTML 时。它的工作和渲染正常。但是当我将该页面添加到 Visual Studio 并尝试运行应用程序时。我得到运行时 Js 错误。

这是我的 HTML 代码

<!DOCTYPE html>
<html>
<head>
    <link href="jchartfx.css" rel="stylesheet" />
    <script src="jchartfx.system.js"></script>
    <script src="jchartfx.coreBasic.js"></script>
</head>
<body onload="loadChart()">

    <div id="ChartDiv" style="width: 600px; height: 400px"></div>

    <script type="text/javascript" lang="javascript">

        var chart1;

        function loadChart() {

            chart1 = new cfx.Chart();
            chart1.getData().setSeries(2);
            chart1.getAxisY().setMin(500);
            chart1.getAxisY().setMax(2000);

            var series1 = chart1.getSeries().getItem(0);
            var series2 = chart1.getSeries().getItem(1);

            series1.setGallery(cfx.Gallery.Lines);
            series2.setGallery(cfx.Gallery.Bar);

            var data = [
            { "Month": "Jan", "Bikes": 1800, "Parts": 1300 },
            { "Month": "Feb", "Bikes": 1760, "Parts": 900 },
            { "Month": "Mar", "Bikes": 1740, "Parts": 970 },
            { "Month": "Apr", "Bikes": 1750, "Parts": 1010 },
            { "Month": "May", "Bikes": 1810, "Parts": 1070 },
            { "Month": "Jun", "Bikes": 1920, "Parts": 1180 }
            ];

            chart1.setDataSource(data);

            var divHolder = document.getElementById('ChartDiv');
            chart1.create(divHolder);
        }
    </script>
</body>
</html>

这是我的教程链接

错误:无法获取属性“调用”的值:对象为空或未定义

关于为什么会得到这个的任何建议?

更新:

<meta content="IE=9" http-equiv="X-UA-Compatible" />在头部添加了它工作正常。但是当我尝试在 MVC 应用程序中运行视图时它给出了同样的错误。

是否有任何元标记可以解决此问题?

4

1 回答 1

0

尝试添加<meta http-equiv="X-UA-Compatible" content="IE=8" />标签。

于 2014-01-30T07:29:25.497 回答