jqplot不显示条形图上的值标签

时间:2013-08-11 16:53:02

标签: php jquery jqplot

我尝试使用jqplot绘制条形图,我发现图中的第一个条有问题,它不是显示点标签。如何解决这个问题呢?感谢您的帮助和建议。

Lohkaeo enter image description here

对不起,我忘了。

<script type="text/javascript">
$(document).ready(function() {
        var s1 = [32100,0,0,990000,0,0,0,0,0,0,0,0];
        var s2 = [36000,0,0,1800,0,4980,0,0,0,0,0,0];
        var s3 = [0,0,0,0,0,0,0,0,0,0,0,0];
        var ticks = ['1 2013','2 2013','3 2013','4 2013','5 2013','6 2013','7 2013','8 2013','9 2013','10 2013','11 2013','12 2013'];
            $('#show-graph').css('height', '699px').jqplot([s1, s2, s3], {
                title:'รายจ่าย',
                seriesDefaults:{
                    renderer:$.jqplot.BarRenderer,
                    rendererOptions: {
                        barWidth: 20,
                        barMargin: 10
                    },
                    pointLabels: {
                        show: true, 
                        formatString: "%#.2f", 
                        hideZeros: true
                    }
                },
                axes:{
                    xaxis:{
                        renderer: $.jqplot.CategoryAxisRenderer,
                        tickRenderer: $.jqplot.CanvasAxisTickRenderer ,
                        tickOptions: {
                           fontFamily: 'Georgia',
                           fontSize: '10pt',
                           angle: -30,
                           labelPosition: 'middle'
                        },
                        ticks: ticks
                    },
                    yaxis: {
                        min: 0
                    }
                },
                legend: {
                    show: true,
                    location: 'ne',
                    placement: 'insideGrid'
                },
                series:[
                    {label: 'beverage'},
                    {label: 'equipment'},
                    {label: 'another'}
                ]
            });
});

1 个答案:

答案 0 :(得分:0)

这是因为最左边的条太靠近边缘所以jqPlot不会渲染它。尽量增加宽度。

$jqplot('show-graph', [s1, s2, s3], {
    title: 'xxxx',
    width: 1000,
    ....
}