偶然的你
2023-10-20 09:19:13
我試圖讓圖表中的區(qū)域在值超過(guò)特定閾值時(shí)改變顏色。這是我的圖表:Highchart 資源有一個(gè)如何執(zhí)行此操作的示例:https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/series/color-zones-simple/然而,我的問題是,當(dāng)您的 Highchart 從文本文件導(dǎo)入數(shù)據(jù)時(shí),我無(wú)法在任何地方找到如何執(zhí)行此操作的示例。我對(duì)圖表的樣式設(shè)置得相當(dāng)嚴(yán)格,所以這是我的 highchart 代碼片段:$(function () { // Load the fontsHighcharts.createElement('link', { href: 'http://fonts.googleapis.com/css?family=Signika:400,700', rel: 'stylesheet', type: 'text/css'}, null, document.getElementsByTagName('head')[0]);// Add the background image to the containerHighcharts.wrap(Highcharts.Chart.prototype, 'getContainer', function (proceed) { proceed.call(this); this.container.style.background =null;});Highcharts.theme = { colors: ['#5B8256'], chart: { backgroundColor: null, style: { fontFamily: "Arial, Helvetica, sans-serif"}, plotBorderColor: '#606063'}, title: { style: { color: '#eeeeee', fontSize: '16px', fontWeight: ''}}, subtitle: { style: { color: '#eeeeee'}}, tooltip: { backgroundColor: 'rgba(0, 0, 0, 0.85)', style: {color: '#F0F0F0'}, borderWidth: 0}, legend: { itemStyle: { fontWeight: 'bold', fontSize: '13px'}}, xAxis: { labels: { style: { color: '#eeeeee'}}}, yAxis: { labels: { style: { color: '#eeeeee'}}}, plotOptions: { series: {shadow: true}, marker: {lineColor: '#333'}, candlestick: {lineColor: '#404048'}, map: {shadow: false}}, navigator: { xAxis: {gridLineColor: '#D0D0D8'}}, rangeSelector: { buttonTheme: {fill: '#eeeeee',stroke: '#C0C0C8','stroke-width': 1, states: { select: {fill: '#D0D0D8'}}}}, scrollbar: {trackBorderColor: '#eeeeee'}, background2: null};任何為我指明正確方向的幫助將不勝感激。
1 回答

精慕HU
TA貢獻(xiàn)1845條經(jīng)驗(yàn) 獲得超8個(gè)贊
您可以通過(guò)繪圖選項(xiàng)添加區(qū)域,例如:
plotOptions: {
series: {
zones: [{
value: 20,
color: '#7cb5ec'
}, {
color: '#90ed7d'
}],
...
}
}
現(xiàn)場(chǎng)演示: https://jsfiddle.net/BlackLabel/5w9rvonz/
API 參考: https: //api.highcharts.com/highcharts/plotOptions.series.zones
添加回答
舉報(bào)
0/150
提交
取消