[英]Set the color of the line graph when past a guide line on amcharts
我想像使用負值一樣更改線形圖的顏色-> https://www.amcharts.com/demos/date-based-line-chart/ 。
區別在於,當它經過特定參考線時,我需要更改顏色,在我的情況下,我有四個參考線,在示例中,我只能設置一個nagativebase和negativeLineColor。
謝謝!!
您發布的鏈接討論了negativeBase
,它允許您設置其他基線值以更改線條顏色。 您可以將其設置為等於指導值,以達到所需的效果。
var chart = AmCharts.makeChart( "chartdiv", {
// ...
"valueAxes": [ {
// ...
"guides": [{
"value": 20,
// ...
}],
// ...
} ],
"graphs": [ {
// ...
"negativeLineColor": "#67b7dc",
"negativeBase": 20,
// ...
} ],
// ...
});
編輯
不支持開箱即用的多個負底數,但是您可以將多個圖以不同的負基底值彼此疊加,同時禁用其氣球並將其基線lineColor
設置為transparent
:
"graphs": [{
"balloonText": "<div style='margin:5px; font-size:19px;'><span style='font-size:13px;'>[[category]]</span><br>[[value]]</div>",
"bullet": "round",
"bulletBorderAlpha": 0,
"hideBulletsCount": 50,
"lineThickness": 2,
"negativeLineColor": "#ff0000",
"negativeBase": 20,
"valueField": "visits"
},{
"showBalloon": false,
"bullet": "round",
"bulletBorderAlpha": 0,
"hideBulletsCount": 50,
"lineColor": "transparent",
"negativeLineColor": "#00ff00",
"negativeBase": 10,
"valueField": "visits"
},{
"showBalloon": false,
"lineColor": "transparent",
"bullet": "round",
"bulletBorderAlpha": 0,
"hideBulletsCount": 50,
"negativeLineColor": "#0000ff",
"negativeBase": -10,
"valueField": "visits"
},{
"showBalloon": false,
"bullet": "round",
"bulletBorderAlpha": 0,
"hideBulletsCount": 50,
"lineColor": "transparent",
"negativeLineColor": "#00ffff",
"negativeBase": -20,
"valueField": "visits"
}],
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.