在HighchartTable中着色yAxis标签和图表线

时间:2015-03-23 23:42:19

标签: javascript jquery highcharts

我开始使用HighchartTable,在尝试自定义颜色和样式时,我似乎无法弄清楚如何更改yAxis(左)标签或贯穿图表的引导线的颜色。这是我到目前为止所拥有的......

$(document).ready(function() 
{
    $('table.highchart').bind('highchartTable.beforeRender', function(event, highChartConfig) 
    {
        highChartConfig.chart.backgroundColor = '#191919';
        highChartConfig.chart.borderWidth = '1';
        highChartConfig.chart.borderColor = '#000000';
        highChartConfig.chart.borderRadius = '8';
        highChartConfig.chart.style = { "fontFamily": "Arial" };
        highChartConfig.title.style = { "color": "#CCCCCC" };
        highChartConfig.tooltip.style = { "color": "#000000" };
        highChartConfig.tooltip.backgroundColor = '#CCCCCC';
        highChartConfig.tooltip.borderWidth = '1';
        highChartConfig.tooltip.borderColor = '#000000';
        highChartConfig.tooltip.borderRadius = '8';
        highChartConfig.xAxis.labels.style = { "color": "#CCCCCC" };
    }).highchartTable();
});

这是当前的JSFiddle:http://jsfiddle.net/Manvaril/cx1x1qpj

1 个答案:

答案 0 :(得分:1)

您必须为每个yAxis设置样式,因为它们可能存在multiple

for (var i = 0; i < highChartConfig.yAxis.length; i++) {
    highChartConfig.yAxis[i].labels.style = { "color": "#CCCCCC" };
}

See working fiddle here.