简体   繁体   中英

Highcharts: yAxis title = current series name

How do I make the yAxis title the same as the current selected series?

yAxis: [{
    min: 0,
    title: {
        text: 'Hits', <-- this value should be based on selected series name
    },
    labels: {
        formatter: function () {
            return this.value;
        },
        style: {
            color: '#4572A7'
        }
    }

}]

Something like this should work. It sets the title of the yAxis to the name of the series, when the series is clicked. jsfiddle here

plotOptions: {
    series: {
        events: {
            click: function() {
                this.chart.yAxis[0].setTitle({text: this.name});
            }
        }
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM