gpt4 book ai didi

highcharts - 系列 fillColor 仅用于悬停时的标记

转载 作者:行者123 更新时间:2023-12-01 11:46:42 25 4
gpt4 key购买 nike

我通过将 fillColor 设置为与背景相同来“伪造”一个清晰的圆圈作为标记。它工作得很好。现在,悬停时,我试图让圆圈填充系列颜色。我不能将它设置为 null,因为那样它仍然采用背景颜色。

有什么想法吗?

这是我的图表代码(此处为实时版本:http://jsbin.com/ukabob/2/edit):

$(function () {
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'line',
backgroundColor: '#E9E7DC'
},
colors: ['#A74B59', '#46C4B7', '#EDBA70'],
credits: {
enabled: false
},
title: {
text: null
},
xAxis: {
categories: ['2013', '2014', '2015', '2016', '2017', '2018',
'2019', '2020', '2021', '2022'],
gridLineWidth:1,
gridLineColor: '#FFFFFF',
labels: {
style: {
color: '#000000'
},
formatter: function() {
return '<div style="font-size:22px; font-family: \'Advent Pro\', sans-serif;">'+
this.value +'</div>';
},
y:25
},
lineColor: '#FFFFFF',
tickColor: '#FFFFFF',
tickLength: 30
},
yAxis: {
gridLineWidth:0,
title: {
text: null
},
labels: {
enabled: false
}
},
plotOptions: {
series: {
marker: {
radius: 6,
fillColor: '#E9E7DC',
lineWidth: 2,
lineColor: null, // inherit from series
symbol: 'circle',
states: {
hover: {
fillColor: null,
lineWidth: 2,
radius:6
}
}
},
states: {
hover: {
lineWidth:4
}
}
}
},
tooltip: {
borderWidth:0,
borderRadius: 0
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'top',
x: -10,
y: 100,
borderWidth: 0
},
series: [{
name: 'Honeywell',
data: [700,725,750,850,950,1000,1025,1050,1050,1050]
}, {
name: 'Bombardier',
data: [661,758,880,990,1065,1136,1193,1241,1289,1335]
}, {
name: 'Embraer',
data: [747,789,839,861,890,908,984,1030,1097,1156]
}]
});
});

});

最佳答案

如果您在标记上定义 fillColor: "white",在悬停或选择状态下您无法从系列中获得默认/原始颜色。

我找到了解决您问题的方法。如果您在 lineWidth (>= radius) 上定义了一个高值,这将填充整个点。

series: [{    
data: [],
marker: {
states: {
hover: {
fillColor: null,
radius: 6,
lineWidth: 6
}
}
}
}]

这里有一个例子:http://jsbin.com/majigera/1

迟到的回应。希望这可以帮助某人。

关于highcharts - 系列 fillColor 仅用于悬停时的标记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14713328/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com