0

我无法让这个 jquery FLOT 图与下面的数据集一起正常工作。不知道我做错了什么。JSON数据集和使其工作的javascript写在下面。谁能帮我让它工作。先感谢您。

这是我要使用的数据集。

var data = [
{
    "label": "Uncloaked",
    "data": [
            [10:22, 0]
                ,[10:14, 0]
                ,[09:30, 1]
                ,[09:29, 1]
                ,[09:27, 1]
                ,[09:28, 2]
                ,[09:26, 1]
                ,[09:18, 0]
                ,[09:16, 1]
                ,[09:15, 2]
                ,[09:11, 1]
                ,[09:10, 0]
                ,[09:09, 2]
                ,[09:08, 3]
                ,[09:07, 1]
                ,[09:06, 3]
                ,[09:05, 4]
                ,[09:04, 1]
                ,[09:03, 5]
                ,[09:02, 7]
                ,[09:01, 6]
                ,[09:00, 9]
                ,[08:59, 6]
                ,[08:58, 8]
                ,[08:57, 6]
                ,[08:56, 4]
                ,[08:55, 6]
                ,[08:54, 9]
                ,[08:53, 3]
                ,[08:52, 3]
                ,[08:51, 4]
                ,[08:50, 3]
                ,[08:49, 1]
                ,[08:48, 1]
                ,[08:47, 5]
                ,[08:46, 3]
                ,[08:45, 1]
                ,[08:44, 1]
                ,[08:43, 2]
                ,[08:42, 2]
                ,[08:41, 6]
                ,[08:40, 2]
                ,[08:39, 3]
                ,[08:38, 2]
                ,[08:37, 3]
                ,[08:36, 5]
                ,[08:35, 1]
                ,[08:34, 2]
                ,[08:33, 7]
                ,[08:32, 3]
                ,[08:31, 4]
                ,[08:30, 2]
                ,[08:29, 1]
                ,[08:28, 3]
                ,[08:27, 4]
                ,[08:26, 2]
                ,[08:25, 7]
                ,[08:24, 5]
                ,[08:23, 4]
                ,[08:22, 7]
                ,[08:21, 5]
                ,[08:20, 4]
            ]
},
{
    "label": "Cloaked",
    "data": [
            [10:22, 1]
                ,[10:14, 1]
                ,[09:30, 0]
                ,[09:29, 1]
                ,[09:27, 1]
                ,[09:28, 0]
                ,[09:26, 0]
                ,[09:18, 1]
                ,[09:16, 0]
                ,[09:15, 0]
                ,[09:11, 0]
                ,[09:10, 2]
                ,[09:09, 0]
                ,[09:08, 0]
                ,[09:07, 0]
                ,[09:06, 4]
                ,[09:05, 1]
                ,[09:04, 2]
                ,[09:03, 5]
                ,[09:02, 4]
                ,[09:01, 2]
                ,[09:00, 2]
                ,[08:59, 2]
                ,[08:58, 1]
                ,[08:57, 3]
                ,[08:56, 3]
                ,[08:55, 2]
                ,[08:54, 1]
                ,[08:53, 2]
                ,[08:52, 2]
                ,[08:51, 0]
                ,[08:50, 4]
                ,[08:49, 2]
                ,[08:48, 1]
                ,[08:47, 0]
                ,[08:46, 2]
                ,[08:45, 1]
                ,[08:44, 1]
                ,[08:43, 1]
                ,[08:42, 2]
                ,[08:41, 2]
                ,[08:40, 2]
                ,[08:39, 4]
                ,[08:38, 2]
                ,[08:37, 1]
                ,[08:36, 0]
                ,[08:35, 2]
                ,[08:34, 2]
                ,[08:33, 1]
                ,[08:32, 2]
                ,[08:31, 2]
                ,[08:30, 1]
                ,[08:29, 3]
                ,[08:28, 5]
                ,[08:27, 5]
                ,[08:26, 0]
                ,[08:25, 1]
                ,[08:24, 2]
                ,[08:23, 1]
                ,[08:22, 1]
                ,[08:21, 0]
                ,[08:20, 1]
            ]
}
]

下面是我的 JS 代码。

$.plot("#site_statistics", data, {
    series: {
        lines: {
            show: true,
            lineWidth: 2,
            fill: true,
            fillColor: {
                colors: [{
                        opacity: 0.05
                    }, {
                        opacity: 0.01
                    }
                ]
            }
        },
        points: {
            show: true
        },
        shadowSize: 2
    },
    grid: {
        hoverable: true,
        clickable: true,
        tickColor: "#eee",
        borderWidth: 0
    },
    colors: ["#d12610", "#37b7f3", "#52e136"],
    xaxis: {
        mode: "categories",
        tickLength: 0
    }
});

我不知道为什么它不起作用。我一直在挠头来完成这项工作。在这方面的任何帮助将不胜感激。

4

1 回答 1

0

试试这个: $.plot($(

注意 $ 和括号

并记得添加额外的右括号

于 2013-03-28T17:41:01.430 回答