当数值太小时,高图表数据标签位置需要更改 [英] high-charts datalabel position needs to change when value is too small

查看:336
本文介绍了当数值太小时,高图表数据标签位置需要更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

资料标签(在这种情况下为现金)会显示在正确的位置,大多数时间都在右侧的列中。但是,如果条的值足够低,它最终会与轴标签重叠(如紫色条所示)。



我的第一本能是设置一个max值并改变数据标签的位置。有点像,如果价值小于$ 10将标签放置在酒吧的右边。但这种方法有一个大问题。图表的大小是变量和响应,所以阈值需要是可变的。



理想情况下,条形本身应该被测量,并与数据标签的宽度进行比较确定位置。实现这个解决方案让我失去了。我没有运气从高图表,或数据标签得到的棒的物理尺寸。



先感谢!



>






更新Jugal Thakkar在Android 2.1设备上的解决方案



解决方案

UPDATED再次。 /jsfiddle.net/42dRt/5/rel =nofollow>此解决方案将满足您的需求。


Data labels (in this case cash) appear in the right place, just inside the bar on the right, most of the time. However if the value of the bar is low enough, it ends up overlapping with the axis label (as shown by the purple bar).

My first instinct was to set a max value and change the position of the data-label base on that. Something like, if value is less than $10 place the label outside just to the right of the bar. But there is a big problem with that approach. The size of the chart is variable and responsive, so that threshold needs to be variable.

Ideally the bar itself should be measured and compared with the width of the data label to determine position. Achieving that solution has me at a loss. I have had no luck in getting the phyiscal size of the bar out of high charts, or the datalabel for that matter.

Thanks in advance folks!


UPDATE for Jugal Thakkar's solution on an Android 2.1 device

解决方案

UPDATED AGAIN. Will work on all devices which Highcharts supporting.


I think that this solution will meet your needs.

这篇关于当数值太小时,高图表数据标签位置需要更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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