2013-04-10 127 views
0

我在jqplot条形图中有一个奇怪的问题。最后一个栏中的条形图标签有时会显示并且正在消失。我添加了屏幕截图和脚本。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 } 
       }); 

在此先感谢。

回答

1

这些标签在它们“撞击”边缘时不会显示。为避免此检测,请为您的pointLabels设置edgeTolerance,如下所示:

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

解决了我的问题。Rock Star。 – 2015-02-13 06:15:10