0

我正在尝试使用 Dojo 1.8.1 创建图表,但浏览器窗口中没有显示任何内容(我使用的是 IE 8)。

这是我到目前为止所拥有的:

<html>
<head>
    <title>Dojo Charting Example</title>
    <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.8.1/dojo/dojo.js"></script>
    <script>
        require(["dojox/charting/Chart", "dojox/charting/axis2d/Default", "dojox/charting/plot2d/Lines", "dojo/ready"],
            function(Chart, Default, Lines, ready) {
            ready(function() {
                var chart1 = new dojox.charting.Chart2D("simplechart");
                chart1.addPlot("default", {type: Lines});
                chart1.addAxis("x");
                chart1.addAxis("y", {vertical: true});
                chart1.addSeries("Series 1", [1, 2, 2, 3, 4, 5, 5, 7]);
                chart1.render();
            });
        });
    </script>
</head>

<body>
    <div id="simplechart" style="width: 250px; height: 150px; margin: 5px auto 0px auto;"></div>
</body>

以下是我从 JavaScript 错误消息中得到的信息:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; chromeframe/23.0.1271.64; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; InfoPath.2; MS-RTC LM 8; .NET4.0E)
Timestamp: Mon, 26 Nov 2012 20:03:05 UTC


Message: Object expected
Line: 9
Char: 6
Code: 0
URI: http://localhost:8084/ReferenceManager/dojoChartingExample2.html


Message: Object doesn't support this property or method
Line: 2
Char: 1
Code: 0
URI: http://ajax.googleapis.com/ajax/libs/dojo/1.8.1/dojox//charting/plot2d/Base.js
4

1 回答 1

0

The important thing is new dojox.charting.Chart2D.

You have to change to new Chart [More info]

Chart is come from function(Chart, Default, Lines, ready) that was required by you.

Here is an example.

于 2012-11-28T03:12:26.360 回答