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

后端 未结 3 1262
滥情空心
滥情空心 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:01

    @arcseldon, it is true that showEnabled = false breaks if both min and max are also set. A possible workaround in this case is to set floor and max instead

    0 讨论(0)
  • 2021-01-18 10:06

    you can use yAxis.setTitle() and set/remove the title when needed.

    here is the api documentation link

    0 讨论(0)
  • 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

    0 讨论(0)
提交回复
热议问题