简体   繁体   中英

How to change series legend text color in HighChart chart?

http://jsfiddle.net/n0mq739a/

在此输入图像描述

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

Here we go:

You need to specify itemStyle. eg

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;)

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