2013-01-05 1 views
1

나는 차트이 코드는 내가 일하고 있습니다두 번째 이후의 막대가 x 축에서 앞으로 이동하는 이유는 무엇입니까?

plot = $.jqplot('SalesChart2', 
      [ 
       [[1,5]], 
       [[1,10]], 
       [[1,15]], 
       [[1,20]], 
       [[2,25]], 
       [[3,10]], 
       [[4,10]], 
       [[5, 6]] 
      ] 
      , { 
       // Tell the plot to stack the bars. 
       stackSeries: true, 
       series: [ 
           { label: 'Cash' }, 
           { label: 'CreditCard' }, 
           { label: 'DebitCard' }, 
           { label: 'StoreCredit' }, 
           { label: 'Discount', disableStack: true }, 
           { label: 'AverageTransaction', xaxis: 'xaxis', yaxis: 'y2axis', disableStack: true }, 
           { xaxis: 'xaxis', yaxis: 'y2axis', label: 'ItemsPerTransaction', disableStack: true }, 
           { xaxis: 'xaxis', yaxis: 'y2axis', label: 'CustomerCount', disableStack: true } 
          ], 
       animate: !$.jqplot.use_excanvas, 
       seriesDefaults: { 
        renderer: $.jqplot.BarRenderer, 
        rendererOptions: { 
         highlightMouseDown: true, 
         barWidth: 50 
        }, 
        pointLabels: { show: true } 
       }, 
       axes: { 
        xaxis: { 
         renderer: $.jqplot.CategoryAxisRenderer, 
         ticks: [1,2,3,4,5] 
        }, 
        yaxis: { 
         tickOptions: { 
          formatString: "$%'d" 
         } 
        }, 
        y2axis: { 
         autoscale: true, 
         min: 0 
        } 
       }, 
       legend: { 
        show: true, 
        location: 'e', 
        placement: 'outside' 
       }, 
       grid: { 
        drawGridlines: false 
       } 
      }); 

이 아래와 같이 렌더링 :

여기 Chart for sales data

막대는 x 축에 지점 2에서 앞으로 조금 이동하고 있습니다 . 이러한 이유로 '고객 수'에 대한 마지막 막대가 표시되지 않습니다.

누군가 여기서 나에게 무슨 일이 일어나는지 안내 해줄 수 있습니까?

+0

JQPlot의 마지막 버전을 사용하고 있습니까? – sdespont

+0

'barWidth' 속성을 낮춰 보셨습니까? – jbabey

+0

예, 작동하지 않습니다. – teenup

답변

0

자동으로 계산 된 너비를 갖기 위해 너비를 null로 시도해야합니다. 그리고 나는 너비가 50 너비에 가까워서 바 마진의 기본값 (10)이 너무 높다고 생각합니다.

+0

barwidth를 null로 설정하면 결과가 매우 좋음 – teenup

+0

및 여백/패딩 ?? – GameAlchemist