1

日付ごとのユーザー数を示すjqplot線グラフがあります。

アプリケーションの変更が影響を与えるかどうかを確認できるように、アプリケーションを更新した日時を示すマークラインを特定の日付に追加したいと思います。何か案は?

これは例です。上のグラフを見てください。

x=3にラベル付きの縦線を追加したいと思います。どうすればいいですか?

4

1 に答える 1

4

これは非常にハックですが、「通常」以外のことをしたい場合、jqplotは非常に柔軟性がありません。

$(document).ready(function(){
    plot1 = $.jqplot ('chart1', [[3,7,9,1,4,6,8,2,5],[]], // leave an empty series at the end
    {
      series: [{ 
        showMarker:true
      },
      { 
        showMarker:false,
          pointLabels: { show:true, location: 'ne' } // do not show marker, but do show point label
      }]
  });
  plot1.series[1].data = [[2,plot1.axes.yaxis.min],[2,plot1.axes.yaxis.max]]; //dynamically add the data for the empty series, we do this so we can get the auto-scaled yaxis min/max
  plot1.redraw(); // redraw the plot with adjusted 2nd series
  $('.jqplot-point-label.jqplot-series-1.jqplot-point-0').html('x=2'); // manually adjust the label on the 2nd series (I could not find a way to do this with the builtin methods)

})​

生産:

ここに画像の説明を入力してください

ここの例。

于 2012-12-25T18:16:26.070 に答える