Javascript Highcharts v3.0.5 - How to hide Y Axis Title when using multiple Y Axis

后端 未结 3 1300
滥情空心
滥情空心 2021-01-18 09:22

When using Highcharts (v.3.0.5), I have multiple Y Axis displayed in the same chart. Using the legend, a user can choose to hide or show any of the Y Axis as they want. All

3条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-18 10:07

    This actually turns out to be a much sought after question/answer. Since Highcharts V2.2, it is possible to assign "showEmpty: false" to y axis definitions and this will ensure that when hidden, the Y-axis text label is also hidden. Example snippet of config below:

                     yAxis: [{
                    min: 0,
                    showEmpty: false,
                    labels: {
                        formatter: function() {
                            return this.value;
                        },
                        style: {
                            color: '#3366CC'
                        }
                    },
                    title: {
                        text: 'Clicks',
                        style: {
                            color: '#3366CC'
                        }
                    },
                    id: 'Clicks'
                }, 
                     ...
    

    I have read reports where this showEnabled = false breaks if both min and max are also set. In the case above, where only min is set, it worked well for me using Highcharts V3.0.5

提交回复
热议问题