jqplot条形图中最后一个条形图的标签未显示


label of the last bar in jqplot bar chart not displaying

我在jqplot条形图中有一个奇怪的问题。最后一栏的条形图标签有时显示,有时消失。我已经添加了一个屏幕截图和我的脚本。

这是我使用的脚本。

  plot1 = $.jqplot('chart1', [s1], {
                    // Only animate if we're not using excanvas (not in IE 7 or IE 8)..
                    animate: !$.jqplot.use_excanvas,
                    seriesColors:<?php echo json_encode($barColor ); ?>,
                    <?php if(isset($_POST['additionalSubmit'])){ ?>
                    negativeSeriesColors: ["#792A86"],
                    <?php } else { ?>
                    negativeSeriesColors: <?php echo json_encode($barColornegative ); ?>,
                    <?php } ?>
                    seriesDefaults:{
                        renderer:$.jqplot.BarRenderer,
                        rendererOptions: { 
                            fillToZero: true,
                            barWidth: 30,
                            varyBarColor :true
                        },
                        pointLabels: { 
                            show: true,
                            formatString :"&#8364; %'s",
                            escapeHTML: false
                            }
                    },
                    canvasOverlay: {
                        show: true,
                        objects: [
                           {horizontalLine: {
                                name: 'zeroline',
                                y: 0,
                                lineWidth: 2,
                                xOffset: 0,
                                color: '#BBCCDD',
                                shadow: false
                            }}
                        ]
                        },
                    axes: {
                        xaxis: {
                            autoscale:true,
                            renderer: $.jqplot.CategoryAxisRenderer,
                            ticks: ticks,
                            tickRenderer: $.jqplot.CanvasAxisTickRenderer,
                            tickOptions: {
                                fontSize: '8pt',
                                fontWeight: 'normal',
                                angle:-20,
                            },  
                            borderColor: "#BBCCDD",
                            borderWidth:5
                        },
                        yaxis: {
                            autoscale:true,
                            tickOptions:{ prefix: '&#8364;' , formatString: "%'d",} ,
                            borderColor: "#BBCCDD",
                            borderWidth:5,
                            label: 'resultant in EURO',
                            labelRenderer: $.jqplot.CanvasAxisLabelRenderer
                        }
                    },
                    legend: {
                        show: true,
                        placement: 'outside',
                        noColumns: 1
                    },
                    series: [
                             {
                                 fill: true,
                                 label: '<?php echo $_POST['scenario']; ?>'
                             }
                         ],
                    highlighter: { show: false }
                });

标签碰到边缘时不会显示。为了避免这种检测,像这样设置pointLabels的edgeTolerance:

pointLabels: { 
    show: true,
    formatString :"&#8364; %'s",
    escapeHTML: false,
    edgeTolerance: -100
}