Javascript Highcharts添加工具提示,其中有一个指向序列的小箭头
我正在使用以下文档构建highcharts highmap: 我已经成功地按照我想要的颜色和内容来设计我的工具提示 以下是我目前拥有的: 这是我需要的(工具提示上的小箭头或胡萝卜) 通常我会使用HTML:after或:before和相对定位来创建它,但我很难在highcharts中实现这一点。我知道我可以将useHtml:true设置为true,然后将css应用于呈现工具提示的类,但我觉得必须有一种方法可以让工具提示通过highcharts中的一个道具自动完成这项操作 以下是我目前拥有的highchart代码:Javascript Highcharts添加工具提示,其中有一个指向序列的小箭头,javascript,reactjs,highcharts,highmaps,Javascript,Reactjs,Highcharts,Highmaps,我正在使用以下文档构建highcharts highmap: 我已经成功地按照我想要的颜色和内容来设计我的工具提示 以下是我目前拥有的: 这是我需要的(工具提示上的小箭头或胡萝卜) 通常我会使用HTML:after或:before和相对定位来创建它,但我很难在highcharts中实现这一点。我知道我可以将useHtml:true设置为true,然后将css应用于呈现工具提示的类,但我觉得必须有一种方法可以让工具提示通过highcharts中的一个道具自动完成这项操作 以下是我目前拥有的hi
let config = {
tooltip: {
backgroundColor: '#ff9600',
borderWidth: 1,
borderColor: '#ff9600',
borderRadius: 2,
formatter: function () {
return '<b>' +
'<span style="'+ tooltipStyle + '">' + this.point.name + ': $ 620 USD</span><br>' +
'<span style="'+ tooltipStyle + '">' + this.point.value + ' Transactions</span>';
}
},
series:[{
allAreas: true,
data: data,
mapData: mapsPathData,
joinBy: [countryCode],
dataLabels: {
enabled: false,
format: '{point.name}'
}
}]
};
let config={
工具提示:{
背景颜色:“#ff9600”,
边框宽度:1,
边框颜色:'#ff9600',
边界半径:2,
格式化程序:函数(){
返回“”+
“+this.point.name+”:$620美元
”+
''+this.point.value+'Transactions';
}
},
系列:[{
阿拉雷斯:是的,
数据:数据,
mapData:mapsPathData,
joinBy:[国家代码],
数据标签:{
启用:false,
格式:“{point.name}”
}
}]
};
要在工具提示中添加箭头,可以设置followPointer:false
const options = {
series: [{
mapData: Highcharts.maps['custom/europe'],
data: [
['is', 1],
['no', 1],
['se', 1],
['dk', 1],
['fi', 1]
]
}],
tooltip: {
followPointer: false,
backgroundColor: '#ff9600',
borderWidth: 1,
borderColor: '#ff9600',
borderRadius: 2,
formatter: function () {
return '<b>' +
'<span style="'+ 'tooltipStyle' + '">' + this.point.name + ': $ 620 USD</span><br>' +
'<span style="'+ 'tooltipStyle' + '">' + this.point.value + ' Transactions</span>';
}
}
}
const chart = Highcharts.mapChart('container', options)
const选项={
系列:[{
mapData:Highcharts.maps['custom/europe'],
数据:[
[is',1],
[no',1],
[se',1],
[dk',1],
[fi',1]
]
}],
工具提示:{
followPointer:false,
背景颜色:“#ff9600”,
边框宽度:1,
边框颜色:'#ff9600',
边界半径:2,
格式化程序:函数(){
返回“”+
“+this.point.name+”:$620美元
”+
''+this.point.value+'Transactions';
}
}
}
const chart=Highcharts.mapChart('容器',选项)
实时示例:注意:如果您有
共享:true
(用于多个系列),则此选项不起作用