简体   繁体   English

条形图中的HighChart数据标签问题

[英]HighChart Data label issue in bar chart

I want the label outside the bar stack. 我希望标签在条形堆栈之外。 I've used below code but it doesn't work everytime. 我使用了下面的代码,但并非每次都能使用。

在此处输入图片说明

 dataLabels: {
              enabled: true,
              color: '#333',
              inside:false
          }, 

JSFiddle 的jsfiddle

There are different ways to position your data labels, you can set their x & y positions and you can also set position for each data point individually but as you have both negative and positive values and even if you don't it will be quite a headache. 放置数据标签的方法有多种,可以设置它们的x和y位置,也可以分别设置每个数据点的位置,但是因为您同时具有负值和正值,即使没有,也将头痛。 inside: false doesn't seem to be doing anything but i managed to find another easier solution for you which is the use of rotation property of the data label.. setting to even '1' takes the labels outside. inside: false似乎没有做任何事情,但我设法为您找到了另一个更简单的解决方案,即使用数据标签的rotation属性。设置为偶数“ 1”会将标签带到外面。

dataLabels: {
     rotation: 1,
     enabled: true,
     color: '#333',
},  

See the DEMO here 在这里查看演示

Now you can play around with different angles and width heights to see what suits you best. 现在,您可以在不同的角度和宽度的高度上玩耍,看看最适合您的。

Here you go: 干得好:

dataLabels: {
          enabled: true,
          color: '#333',
          inside: false,
          crop: false,
          overflow: "none"
      }, 

http://jsfiddle.net/kq2xgwhg/ http://jsfiddle.net/kq2xgwhg/

Documented here: http://api.highcharts.com/highcharts#plotOptions.series.dataLabels under "overflow". 此处记录:“溢出”下的http://api.highcharts.com/highcharts#plotOptions.series.dataLabels

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM