首页 > 解决方案 > 使用 plotOptions highchart (BAR) 在栏下添加文本

问题描述

嗨,我尝试plotOptions datalabels为每个栏添加额外的文本。我得到了我想要的值,但我不能把它放在栏下。

我的代码

    plotOptions: {
           series: {
               dataLabels: {

                 useHTML: true,
                  formatter:function() {
                     var pcnt = (this.y / dataSum) * 100;
                        return '<span  class="" style="color:' + this.point.color + '">' + Highcharts.numberFormat(pcnt) + '%' + '</span> <span  class="">' + this.point.name + ' this i want put under the bar' + '</span>';
                 }}
           }
    }

我尽量不使用datalabelsfromxasix因为我也想展示它。如何使额外的文本位于每个栏的下方?

如果有人除了使用plotoptionsim 之外还有其他建议。谢谢你。

这是链接

标签: jqueryhighcharts

解决方案


如果不破解 Highcharts,您将无法使用数据标签来做到这一点。

我建议你看看Annotations 模块。您可以将标签放置在图表上的任何位置并自定义它们的外观。

问候


推荐阅读