簡體   English   中英

高圖表柱狀圖-Y軸標簽格式

[英]High Charts Column Chart - Y axis Label Formatting

我正在使用高圖表柱形圖。 這是我的圖表選項(y軸部分)。

        yAxis: {
            allowDecimals: false,
            min: 0,
            max: 100,
            tickInterval: 25,
            title: {
                text: ''
            }
//                labels: {
//                    formatter: function () {
//                        
//                    }
//                }
        },

當前,它顯示的y軸標簽為0到100。但是,我想僅將'%'符號附加到'0'並保留其余標簽。 我嘗試使用標簽格式化程序,無法確定要使用的值。 有人可以建議我任何想法嗎?

謝謝

你可以試試:

       labels: {
            formatter: function() {
                return this.value === 0 ? '0%' : this.value;
            }
        }

http://jsfiddle.net/6huhbqhj/

想通了。

                 labels: {
                formatter: function () {
                    if (this.value == 0)
                        return this.value + "%";
                    else
                        return this.value;
                }
            }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM