-1
如何做到這一點?在highchart ..高圖漸變顏色負向正向橫槓
horizontal bar with gradient.. red to gray for negative to positive values
如何做到這一點?在highchart ..高圖漸變顏色負向正向橫槓
horizontal bar with gradient.. red to gray for negative to positive values
,如果使用已經它採用了彩色軸Highcharts模塊,你可以使用它的tweenColors功能找到的中間色。
如前所述,您必須遍歷數據並設置點的顏色。如果你不想使用任何其他模塊,你需要找到中間顏色 - 答案可以找到here。
var data = [100, 50, 20, -10],
min = Math.min.apply(null, data),
max = Math.max.apply(null, data),
total = max - min,
colorMin = new Highcharts.Color('rgb(255, 0, 0)'),
colorMax = new Highcharts.Color('white'),
tweenColors = Highcharts.ColorAxis.prototype.tweenColors;
coloredData = data.map(value => {
var pos = (value - min)/total;
return {
y: value,
color: tweenColors(colorMin, colorMax, pos)
};
});
您可以根據預處理的值設置個別酒吧的顏色。不知道更多細節,很難說你應該做什麼。 – wergeld