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 に答える