2012-12-25 4 views
1

날짜별로 사용자 수를 표시하는 jqplot 선 그래프가 있습니다.jqplot으로 특정 데이터 표시

응용 프로그램을 변경 한 날짜를 볼 수 있도록 응용 프로그램을 업데이트 한 날짜를 나타내는 특정 날짜에 마크 라인을 추가하고 싶습니다. 어떤 아이디어?

This은 예입니다. 상단 그래프를보십시오.

레이블이 x = 3 인 세로선을 추가하고 싶습니다. 내가 어떻게 해?

답변

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) 

})​ 

는 생산 :

enter image description here

here을 .

관련 문제