为什么我的HTML不呈现?

时间:2014-05-30 21:35:33

标签: html google-visualization

我将以下脚本与以下网站的Google图表文档中的脚本进行了比较:

https://developers.google.com/chart/interactive/docs/gallery/scatterchart

但它没有渲染。我发现这段代码没有任何问题。还有其他我应该寻找的东西吗?

<html>
<head>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
    google.load("visualization", "1.0", {packages:["corechart"]});
        google.setOnLoadCallback(drawChart);
        function drawChart() {
            var data = google.visualization.arrayToDataTable([
                ['sepal_width', 'sepal_length'], 
                [3.5,5.1],
                [3.0,4.9],
                [3.2,4.7],
                [3.1,4.6],
                [3.6,5.0],
                [3.9,5.4],
                [3.4,4.6],
                [3.4,5.0],
                [2.9,4.4],
                [3.1,4.9],
                [3.7,5.4]
                ]);
    var options = {
        title: 'Edgar Anderson's Iris Data',
        hAxis: {title: 'Petal Length', minValue: 0, maxValue: 7},
        vAxis: {title: 'Petal Width', minValue: 0, maxValue: 3},
        legend: 'none'
    };
    var chart = new google.visualization.ScatterChart(document.getElementById('chart_div'));
    chart.draw(data, options);
    }
    </script>
</head>
<body>
    <div id="chart_div" style="width: 900px; height: 500px;"></div>
</body>
</html>

1 个答案:

答案 0 :(得分:0)

title: 'Edgar Anderson's Iris Data',

需要:

title: "Edgar Anderson's Iris Data",