【发布时间】:2014-01-17 17:18:30
【问题描述】:
我有一个带有负值的工作图表。 我希望将具有正值的列设为蓝色,将具有负值的列设为红色。
这是我所拥有的:
$(function () {
// Radialize the colors
Highcharts.getOptions().colors = Highcharts.map(Highcharts.getOptions().colors, function(color) {
return {
radialGradient: { cx: 0.5, cy: 0.3, r: 0.7 },
stops: [
[0, color],
[1, Highcharts.Color(color).brighten(-0.3).get('rgb')] // darken
]
};
});
// Build the chart
$('#moda').highcharts({
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
colors: [
'blue'
],
title: {
text: ''
},
xAxis: {
categories: moda,
},
tooltip: {
pointFormat: '{series.name}: <b>{point.y}</b>',
percentageDecimals: 0
},
series: [{
type: 'column',
data: moda,
}]
});
});
【问题讨论】:
标签: javascript colors highcharts