FLOT グラフを描画するPlugin その3

FLOTがバージョンUPされています

Flot Examplesを眺めていたら、グラフのサンプルが増えていて、もしやと思いGoogle Code Archive - Long-term storage for Google Code Project Hosting.を確認すると新しいバージョンが来ていた(0.3 -> 0.4)
かなり変更点があるけれどザッと目についたのが

Flot 0.4

              • -

中略
Added support for segmented lines (based on patch from Michael
MacDonald) and for ignoring null and bad values (suggestion from Nick
Konidaris and joshwaihi).

分割された線をサポートしました(かなり意訳)とある。
表示したくないデータはnullを指定するという事(ようは表示出来ないデータを含んでいてもエラーにならないようにしている)

ザックリとテスト用にスクリプトを書いて試す

$(function () {
    var h01 = [
                [1,37],
                [2,35],
                [3,90],
                null,   //  ignore data
                [5,20],
                [6,31],
                [7,15],
                [8, 3],
                [9,20],
                [10,76],
             ];
    
    $.plot($("#placeholder"),
        [
            {
                color: 1,
                data: h01
            },
        ],

        {
            lines:  {
                show: true
            },
            points: {
                show: true
            },
            yaxis:  {
                min: 0,
                max: 110,
                tickDecimals: 0,
            },
            xaxis:  {
                min: 0,
                max: 11,
            },
        }
    );
});


ね、簡単でしょ

残りの変更点については後日