2012-12-27 45 views
0

我正在使用jqplot,并且看到一些奇怪的系列标签行为。 如果值太大,则不显示标签。我无法找到保留标签画布区域的设置。有什么想法吗?在jqPlot中切断数据标签

[例如拨弄] http://jsfiddle.net/abenrob/nDcPB/11/

$(document).ready(function(){   
    optionsObj = { 
     grid: { 
      background: "rgba(0,0,0,0.0)", 
      drawBorder: false, 
      shadow: false 
     }, 
     seriesColors: ["#6699FF"], 
     seriesDefaults:{ 
      shadow:false, 
      renderer:$.jqplot.BarRenderer, 
      rendererOptions: { 
       barDirection: 'horizontal', 
       barWidth:15, 
       barMargin: 5 
      } 
     }, 
     series:[ 
      {pointLabels:{ 
       show: true 
      }}], 
     axesDefaults: { 
      rendererOptions: { 
      drawBaseline: false 
      } 
     }, 
     axes: { 
      yaxis: { 
       renderer: $.jqplot.CategoryAxisRenderer, 
       tickOptions:{ 
        showGridline:false, 
        markSize:0 
       } 
      }, 
      xaxis:{ 
       tickOptions:{ 
        show: false, 
        showGridline:false, 
        markSize:0 
       } 
      } 
     } 
    }; 
    // labels not shown 
    plot = $.jqplot('chart1', [[[507740000000,'Budget'],[496740000000,'Forecast'],[506740000000,'Expended']]], optionsObj) 
    // labels shown 
    plot2 = $.jqplot('chart2', [[[50774000,'Budget'],[49674000,'Forecast'],[50674000,'Expended']]], optionsObj) 
}); 

回答

1

似乎并不像jqPlot会使他们,如果没有足够的空间在酒吧的权利。您可以使用x轴垫的选择提供更大的空间,但我也不得不抛出一个min: 0在那里得到自动缩放的行为有点理智的:

... 
     xaxis:{ 
      tickOptions:{ 
       show: false, 
       showGridline:false, 
       markSize:0 
      }, 
      min: 0, 
      pad:1.8 
     } 
... 

enter image description here

更新小提琴here

+0

完美!谢谢您的帮助。我最终格式化为#K,#M等,但这样好多了。 – abenrob