0

新手问题。使用 flot jquery 库,我正在尝试设置系列选项,但出现错误:“Unexpected identifier”series: {在线。

我正在尝试关注https://github.com/flot/flot/blob/master/API.md#plot-options。有什么我不明白的吗?

<!DOCTYPE html>
<html>
<head>
    <title>Flot Graph Testing</title>
    <script src="jquery-2.0.3.js"></script>
    <script src="jquery.flot.js"></script>
    <script type="text/javascript">

    $(function() {

        var options = {
            grid: {
                show: false
            }
            series: {
                bars: {
                    show:true
                }
            }
        };

        var rawdata = [[0, 3], [2, 8], [4, 5], [6, 13]];
        var data = [{data: rawdata }]
        $.plot("#placeholder", data, options);

        // Add the Flot version string to the footer

        $("#footer").prepend("Flot " + $.plot.version + " &ndash; ");
    });

    </script>
</head>

<body>
    <div id="header">
        <h2>Flot graph</h2>
    </div>

    <div id="content">
        <div class="container">
            <div id="placeholder" class="my-placeholder" style="width:600px;height:300px"></div>
        </div>
        <p>This is a flot graph</p>
    </div>
</body>
</html>
4

1 回答 1

2

您缺少逗号来分隔options对象的属性:

    var options = {
        grid: {
            show: false
        }, // <-- comma
        series: {
            bars: {
                show:true
            }
        }
    };
于 2013-10-11T17:16:09.377 回答