2012-03-19 30 views
0

私は下の画像のようにレンダリングされるjqPlotチャートを持っています。jqプロット - 線形x軸ティックを得る

Iamは、x軸にLinearAxisRendererを使用しています。

しかし、x軸の値は..など0、1,1,2,2、と来ている

は0など、1,2,3などの値を取得する方法はあります。..

ありがとうございます。

enter image description here

コード:

$.jqplot(ctrlId, [graphPt], { 
     title: chartTitle, 
     seriesDefaults: { 
      renderer: $.jqplot.BarRenderer, 
      pointLabels: { show: true, location: 'e', edgeTolerance: -15, formatString: '%s' }, 
      shadow: false, 
      rendererOptions: { 
       barDirection: 'horizontal', 
       barMargin: 2 
      } 
     }, 
     axesDefaults: { 
      renderer: $.jqplot.canvasAxisTickRenderer, 
      min: 0,  // minimum numerical value of the axis. Determined automatically. 
      pad: 1.3,  // a factor multiplied by the data range on the axis to give the 
      // axis range so that data points don't fall on the edges of the axis. 

      tickOptions: { 
       mark: 'outside', // Where to put the tick mark on the axis 'outside', 'inside' or 'cross', 
       markSize: 95,     // 
       showGridline: false, // wether to draw a gridline (across the whole grid) at this tick, 
       show: true,   // wether to show the tick (mark and label), 
       showLabel: true, // wether to show the text label at the tick, 
       formatString: '%d' // format string to use with the axis tick formatter 
      }, 
      showTicks: true,  // wether or not to show the tick labels, 
      showTickMarks: true // wether or not to show the tick marks 
     }, 

     axes: { 
      yaxis: { 
       renderer: $.jqplot.CategoryAxisRenderer 
      }, 
      xaxis: { 
       renderer: $.jqplot.LinearAxisRenderer, 
       tickOptions: { 
        mark: 'cross', 
        markSize: 2 
       } 
      } 
     } 
    }); 

答えて

6

は、あなたのxaxis設定にtickintervalプロパティを追加します。 jqplot documentationから

xaxis: { 
      renderer: $.jqplot.LinearAxisRenderer, 
      tickOptions: { 
       mark: 'cross', 
       markSize: 2, 
      }, 
      tickInterval: 1 //ADD THIS 
     } 

tickInterval - ティック間の単位の数。 numberTicksと排他的です。

0

'max'と 'min'プロパティを追加しないでください。あなたがxaxisを個別に操作している場合。私はそれに多くの時間を失ってしまった。

xaxis: { 
      renderer: $.jqplot.LinearAxisRenderer, 
      tickOptions: { 
       mark: 'cross', 
       markSize: 2, 
      }, 
      tickInterval: 1 
      max :0, 
      min :100 
     } 
関連する問題