数据标签在jqPlot中被切断

时间:2012-12-27 19:38:15

标签: javascript 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 个答案:

答案 0 :(得分:1)

如果你的酒吧右边没有足够的空间,jqPlot似乎不会渲染它们。您可以使用xaxis pad选项来提供更多空间,但我还必须在其中抛出min: 0以使自动缩放行为更加健全:

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

enter image description here

更新了小提琴here