0

我在 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 }
                });

提前致谢。

4

1 回答 1

1

标签在“碰到”边缘时不会显示。为避免这种检测,请为您的 pointLabels 设置 edgeTolerance,如下所示:

pointLabels: { 
    show: true,
    formatString :"&#8364; %'s",
    escapeHTML: false,
    edgeTolerance: -100
}
于 2013-08-15T13:13:34.247 回答