日期:2014-05-16  浏览次数:20314 次

Highcharts series中name的颜色
用Highcharts画了张曲线图,由于风格需要,将图的背景颜色设为了黑色,其他的字符颜色设为了白色,现在,title,x-title,y-title以及x轴和y轴以及曲线颜色都设置为合适的颜色了,唯独series中的那个name的颜色,没办法设置,大手们给指点下如何搞。代码如下:
JScript code

var chart2;
                        chart2 = new Highcharts.Chart({
                            chart: {
                                backgroundColor: '#3C3C3C',
                                renderTo: 'container2',
                                type: 'bar'
                            },
                            title: {
                                text: title,
                                style: {
                                    color:'#FFFFFF'
                                }
                            },
                            xAxis: {
                                categories: x_value,
                                title: {
                                    text: x_title,
                                    style: {
                                        color:'#FFFFFF'
                                    }
                                },
                                labels:{                    
                                    style: {font: 'normal 10px 宋体',
                                    color:'#FFFFFF'
                                    }
                                }
                            },
                            yAxis: {
                                min: 0,
                                title: {
                                    text: y_title,
                                    align: 'high',
                                    style: {
                                        color:'#FFFFFF'
                                    }
                                },
                                labels:{                    
                                    style: {font: 'normal 10px 宋体',
                                    color:'#FFFFFF'
                                    }
                                }
                            },
                            tooltip: {
                                enabled: false,
                                formatter: function() {
                                    return ''+
                                        this.series.name +': '+ this.y;
                                }
                            },
                            plotOptions: {
                                bar: {
                                    color:'#EA7500',
                                    dataLabels: {
                                        enabled: false
                                    }
                                }
                            },
                            credits: {
                                enabled: false
                            },
                            series: [{
                                name: kpi_name,
                                data: y_value,
                            }]
                        });



------解决方案--------------------
highcharts可以在里面加html标签的 你想改变series中那么的颜色可以这样写:
name: '<b style="color:red">北京</b>',


series: [{
name:'<b style="color:red">'+ kpi_name+'</b>',
data: y_value,
}]