0

flot を使用して、特定の月の予定された請求書の支払いをプロットしています。現在の日に対してプロットされた折れ線グラフの色を区別するにはどうすればよいですか。つまり、過去の日付には 1 つの色を使用し、将来の日付には別の色を使用する必要があります。

次のコードを使用しています。

$.plot($("#placeholder1"),  [current_d1,current_d2],options_current);

current_d1current_d2は私の 2 つの配列options_currentで、プレースホルダー用に定義されたオプションです。

var options_current= {

    series: {
      //dashes: { show: true,   shadowSize: 0, steps:true},
    lines: { show: true,lineWidth:5,steps:true},
        points: { show: true,radius:4 },
        color: ('#0000ff'),
        threshold: {below:0, color: "#DF0101"}  
      },
     xaxis:  {min:1,max :max_value_current, tickFormatter: dayFormatter,tickColor: "rgba(255, 255, 255, 0)", tickDecimals:0,ticks:max_value} ,
     yaxis:  {min:1,tickFormatter: dollarFormatter} ,

      grid: { hoverable: true, clickable: true, 

             borderWidth: 0,

              markings: [ 
                  {xaxis: {from:temp_day, to: temp_day}, color: '#A4A4A4'},
                  {xaxis: {from:1, to: 1}, color: '#000000'},
                  {yaxis: {from:1, to: 1}, color: '#000000'}                      

                           ]

            },

              legend: { position: 'se'}

  };
4

1 に答える 1

2

すべての行にグローバルな「色」オプションを提供しているため、すべての行が同じ色 (青) になります。そのオプションを省略するだけで、Flot はシリーズごとに異なる色を選択します。

特定の色を強制したい場合は、ドキュメントを参照してください。上部の[データ形式]の下で、系列は生データまたはプロパティを持つオブジェクトのいずれかであることに注意してください。後者の形式を使用する場合は、数段落下で説明しますが、シリーズごとに異なる行オプション、つまり異なる色を指定できます。

于 2013-01-18T12:05:55.970 に答える