2016-09-29 5 views
0

나는 다음과 같은 데이터 jqPlot 최소 눈금 간격

[[[7,4]],[[4,2],[5,1],[6,1],[7,1],[8,1]],[[5,2],[6,10],[7,6],[8,1]]] 

enter image description here

내가 원하는 결과로 얻는으로 플롯을 공급하는 다음 jqlot

$.jqplot('chartdiv', JSON.parse(response.occnum), { 
     title: 'Occurrences',   
     legend: { 
      show: true, 
      renderer: $.jqplot.EnhancedLegendRenderer, 
      placement: "outsideGrid", 
      labels: response.labels, 
      location: "ne", 
      rowSpacing: "0px", 
      rendererOptions: { 
       // set to true to replot when toggling series on/off 
       // set to an options object to pass in replot options. 
       seriesToggle: 'normal', 
       seriesToggleReplot: {resetAxes: true} 
      } 
     }, 
     seriesDefaults: {renderer:$.jqplot.BarRenderer}, 
     axes: { 
      xaxis:{ 
      label: 'Months', 
      tickOptions : { 
       tickInterval: 1} 
      },    
      yaxis: { 
            labelRenderer: $.jqplot.CanvasAxisLabelRenderer, 
            labelOptions:{ 
                fontFamily:'Helvetica' 
                //fontSize: '14pt' 
            },     
      label: 'Occurrences number' 
      } 
     }   
    }); 

을 만드는거야 0, 1, 2, 3이 아닌 0.0, 0.5, 0.1 등의 정수 값만을 ​​얻기 위해 x 축에서 모자 지금 가고있어.

답변

0

formatString 옵션을 사용하면 xaxis 틱을 정수로 포맷 할 수 있습니다. 당신은 진드기의 반복 얻을 것이다 경우

tickOptions : { 
      formatString:'%d', 
      tickInterval: 1} 
     }, 

(1, 1, 2, 2, ...) 당신은 추가로 표시됩니다 진드기의 정확한 수를 설정 numberTicks 옵션을 추가 할 수 있습니다. Read about it here

관련 문제