2011-11-04 1 views

답변

-3

내가 당신이 원하는 것을 이해한다면, Y 축 정수 값을 표시하는 것입니다

27

(너무 짧은 대답, 필러 텍스트) parseInt(y_axis)

을보십시오.

이 시도

,

axesDefaults: 
{ 
    min: 0, 
    tickInterval: 1, 
    tickOptions: { 
      formatString: '%d' 
     } 
} 
+3

"tickOptions : formatString : '% d'"을 사용하여 훌륭하게 작동했습니다. –

+0

이지만 y 축에 최대 1pt 인 경우 y 축에 o, 1,1을 표시합니다. – jbmyid

1

무시 createTicks 기능과 새로운 축 부울 속성을 소개 - integersOnly합니다.

// jqplot adding integersOnly option for an axis 
var oldCreateTicks = $.jqplot.LinearAxisRenderer.prototype.createTicks; 
$.jqplot.LinearAxisRenderer.prototype.createTicks = function (plot) { 
    if (this.integersOnly == true) { 
     var db = this._dataBounds; 
     var min = ((this.min != null) ? this.min : db.min); 
     var max = ((this.max != null) ? this.max : db.max); 
     var range = max - min; 
     if (range < 3) { 
      if (this.min == null) { 
       this.min = 0; 
      } 
      this.tickInterval = 1; 
     } 
    } 
    return oldCreateTicks.apply(this, plot); 
} 
1

맨위로 답을 작성하십시오.

axes: { 
     yaxis: { 
      min: 0, 
      tickInterval: 1, 
      tickOptions: { 
        formatString: '%d' 
      } 

      } 
     } 

그냥 yaxis에 적용합니다. 막 대형 차트 또는 다른 차트가 있고 축을 분리하려는 경우 유용합니다.