Javascript Highcharts v3.0.5 - How to hide the Y axis header when using multiple Y axes

When using Highcharts (v.3.0.5), I have several Y-axes displayed on the same diagram. Using the legend, the user can hide or show any of the Y axis at his discretion. All of this is built into the javascript Highcharts library. However, when the Y-axis is hidden, its name is still displayed on the chart. I would like to hide this when the rest of the Y axis is hidden. Surprised this is no longer the default behavior. Does anyone know how to do this?

You can see the behavior by looking at the example on the Highcharts example page:

http://www.highcharts.com/demo/combo-multi-axes

If you hide the rain axis, for example, the name will remain on the Precipitation graph.

I found this post (several years) where the same question was asked. However, the proposed solution does not work. Show and hide events, redraw everything.

http://forum.highcharts.com/highcharts-usage/how-to-hide-y-axis-title-multiple-axis-t6973/#p32842

+4
source share
3 answers

This is actually a very popular question / answer. Starting with Highcharts V2.2, you can assign "showEmpty: false" to define the y axis, and this ensures that when hiding, the text label of the Y axis will also be hidden. Example configuration snippet below:

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

, showEnabled = false , min, max. , min, , Highcharts V3.0.5

+9

yAxis.setTitle() / .

api

+1

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

0
source

All Articles