[英]High Charts Column Chart - Y axis Label Formatting
I am using high-charts column chart. 我正在使用高图表柱形图。 Here is my chart options ( y axis portion ). 这是我的图表选项(y轴部分)。
yAxis: {
allowDecimals: false,
min: 0,
max: 100,
tickInterval: 25,
title: {
text: ''
}
// labels: {
// formatter: function () {
//
// }
// }
},
Currently, it is displaying y axis label from 0 to 100. But, I would like to append '%' symbol to only '0' and leave rest of the labels as is. 当前,它显示的y轴标签为0到100。但是,我想仅将'%'符号附加到'0'并保留其余标签。 I tried sing label formatter, couldn't figure which values to use. 我尝试使用标签格式化程序,无法确定要使用的值。 Can any one suggest me any idea ? 有人可以建议我任何想法吗?
Thanks 谢谢
You can try: 你可以试试:
labels: {
formatter: function() {
return this.value === 0 ? '0%' : this.value;
}
}
Figured it. 想通了。
labels: {
formatter: function () {
if (this.value == 0)
return this.value + "%";
else
return this.value;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.