How to change series legend text color in HighChart chart?

13,484

Here we go:

You need to specify itemStyle. e.g.

itemStyle:{'font-size':'30px'}

Depending on the css you want to use, you may also have to set 'useHTML'. From the documentation:

Using HTML allows for advanced formatting, images and reliable bi-directional text rendering.

Here is an example: http://jsfiddle.net/kHzr9/

Hope it helps;)

Share:
13,484
Leon Gaban
Author by

Leon Gaban

Investor, Powerlifter, Crypto investor and global citizen You can also find me here: @leongaban | github | panga.ventures

Updated on June 15, 2022

Comments

  • Leon Gaban
    Leon Gaban almost 2 years

    http://jsfiddle.net/n0mq739a/

    enter image description here

    I'm trying to change the series legend text color from black, to anything besides black:

    $(function () {
    $('#container').highcharts({
    
        legend: {
            color: '#FF0000',
            backgroundColor: '#FCFFC5'
        },
    
        xAxis: {
            categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
        },
    
        series: [{
            data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
        }]
    });
    

    });

    This is all I found on the legend in the HighCharts docs, is there another way to change that color?

    http://api.highcharts.com/highcharts#legend

  • Leon Gaban
    Leon Gaban about 8 years
    Thanks! So just adding here for others, how I changed it in my actual app: vm.config.options.legend.itemStyle.color = '#fff';