将数据标签调整到特定位置(HIGHCHARTS) [英] Adjust datalabel to specific position (HIGHCHARTS)

查看:3940
本文介绍了将数据标签调整到特定位置(HIGHCHARTS)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为该栏的VALUE到RIGHT以及总是位于栏左侧的SERIES(在我的例子中为bar1,bar2,bar3)的值设置一个数据标签。如图所示。

I want to set a datalabel for the VALUE to RIGHT of the bar, and the value of the SERIES (in my case "bar1, bar2, bar3") that are always at the LEFT of the bar. as it is in the picture.

这是我的代码

http://jsfiddle.net/pb1q9wzk/

plotOptions: {
 bar: {
   dataLabels: {
   padding: 0,
   allowOverlap: true,
   enabled: true,
   align: 'left',
   color: '#FFFFFF',
   inside: true,
   crop: false,
   overflow: "none",
   formatter: function() {            
    return this.series.name + " " + this.y;                       
  },
  style: {
    width:100
  }                       
.
.
.


推荐答案

我希望这将解决您的问题。

I hope this will solve your problem.

 plotOptions: {
            bar: {
                dataLabels: {
                padding:0,
                allowOverlap:true,
                    enabled: true,
                    align: 'right',
                    color: '#FFFFFF',
                    inside: true,
                    crop: false,
                    overflow:"none",
                        formatter: function() {

                    return this.series.name+ " "+ this.y;

                    console.log(this.series.name);
                },

这篇关于将数据标签调整到特定位置(HIGHCHARTS)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆