2011-03-17 4 views
2

jQuery.flot을 사용하여 프로젝트에서 사용자 지정 차트를 만들었지 만 Y 축 순서를 반전해야합니다. 이제 보텀 턴에서 최소값과 최대 값에서 보텀 톤의 최대 값과 맨의 최소값을 가져야합니다.jQuery.flot을 사용하여 Y 축 반대로

이 내 예입니다 http://pastehtml.com/view/1doilsa.html

그러나 inverseTransform 옵션이 작동하지 않을 것 같다.

<body> 
    script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" 
    script type="text/javascript" src="http://flot.googlecode.com/svn/trunk/jquery.flot.js" 

    <div class="plot-lines" style="width: 500px; height: 400px;"></div> 

    <script type="text/javascript"> 
    $.plot($('.plot-lines'), 
     [{ 
      data: [ [0, null], [1, 3], [2, 6], [3, 2], [4, null] ], 
      lines: { 
       show: true 
      }, 
      points: { 
       show: true 
      } 
     }], 
     { 
      xaxis: { 
       ticks: [ [0, ''], [1, 'Race 1'], [2, 'Race 2'], [3, 'Race 3'], [4, ''] ] 
      }, 
      yaxis: { 
       tickDecimals: 0, 
       inverseTransform: function (v) { return -v; } 
      } 
     } 
    ); 
    </script> 
</body> 

도와 주셔서 감사합니다 불행히도

답변

3

에 대한 많은,이 잘 FLOT 0.6 (현재 버전)에서 지원되지 않습니다.

이 당신이 개발 출시 (http://code.google.com/p/flot/source/checkout)를 사용하고자하는 경우 희망은, 비록입니다 :

Issue #263 특별히 그것에 대해이었다을하고, 고정되어 있습니다 r303

가장 좋은 방법은 최신 소스를 확인하고 작동하는 것입니다.

+0

감사합니다. 매력처럼 작동합니다! – Lito

+0

v0.7의 flot이 방금 출시되었으므로, 다음 버전으로 업데이트 할 수 있습니다. – Ryley