0

フロート棒グラフを実装しようとしていますが、いくつか問題があります

1 つ目は、yaxsis の最小値と最大値の設定がうまくいかないようで、グラフはまだ 0 ~ 14 しか表示されません。

次に、各バーに個々の色と名前を設定する方法がわかりません。

これは私が持っているものです

var d2 = [{
     "label": "Face",
     "data": [[0 , "3"], [5, "13"]]
 },
 {
     "label": "Telephone",
     "data": [[1, "400"], [6, "337"]]
 },
 {
     "label": "Web",
     "data": [[2, "1304"], [7, "843"]]

 }];





var options = {

    yaxes: {min: 0, max: 25000},

     xaxis: {
         tickSize: [1],
         autoscaleMargin: .10,
         show: false
     },


    series: {
        lines: { show: false},
        bars: {
            show: true,
            barWidth: 0.9,
            align: 'center',
             multiplebars:true,             
            },

        points: {
            show: true
        }
    }


};



$.plot($('#graph1'), d2, options);

これらを修正する方法を知っている人はいますか?

ありがとう

4

1 に答える 1

4

バーごとに異なる名前と色が必要な場合は、バーの設定をデータ セットの一部として構成する必要があります。

var data1 = [
        {
            label: "Face",
            data: [[0 , 3], [5, 13]],
            bars: {
                show: true,
                barWidth: 0.9,
                fill: true,
                lineWidth: 1,
                order: 1,
                fillColor:  "#AA4643"
            },
            color: "#AA4643"
        },
        {
            label: "Telephone",
            data: [[1, "400"], [6, "337"]],
            bars: {
                show: true,
                barWidth: 0.9,
                fill: true,
                lineWidth: 1,
                order: 2,
                fillColor:  "#89A54E"
            },
            color: "#89A54E"
        }]

次に、次のようにグラフ化します。

$.plot($("#placeholder"), data1, options);

minand not workingについてmaxは、設定しないとどうなりますか? 軸はデータに正しく適合していますか?

于 2012-04-29T21:26:38.413 に答える