Javascript Highcharts-如何将工具提示放置在悬停时每个饼图切片上的图标后面?
我需要以下方面的帮助: 要在每个饼图切片上放置html标记(显示图标的元素+类),并将其放置在悬停工具提示后面吗 目前,我有以下几点:Javascript Highcharts-如何将工具提示放置在悬停时每个饼图切片上的图标后面?,javascript,jquery,html,css,highcharts,Javascript,Jquery,Html,Css,Highcharts,我需要以下方面的帮助: 要在每个饼图切片上放置html标记(显示图标的元素+类),并将其放置在悬停工具提示后面吗 目前,我有以下几点: var chart = new Highcharts.Chart({ chart: { renderTo: 'modules',
var chart = new Highcharts.Chart({
chart: {
renderTo: 'modules',
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
type: 'pie',
backgroundColor:"transparent"
},
credits:{
enabled:false
},
exporting: {
enabled: false
},
title: {
text: '',
style: {
fontSize: '20px',
color: '#999999',
fontWeight: 'bold',
fontFamily: 'Verdana'
}
},
subtitle:{
text: '',
style: {
fontSize: '15px',
color: '#999999',
fontFamily: 'Verdana'
}
},
tooltip: {
borderWidth: 0,
borderColor: null,
borderRadius: 0,
shadow: false,
shape: "callout",
pointFormat: "{series.data.name}",
backgroundColor: "rgba(0,0,0,0.8)",
style: { "color": "#ffffff", "cursor": "default", "fontSize": "12px", "pointerEvents": "none", "whiteSpace": "nowrap" }
},
plotOptions: {
pie: {
allowPointSelect: true, // on click pulls segment out
stickyTracking: false, // mouse events
cursor: 'pointer',
followPointer:true,
dataLabels: {
enabled: false, // annotation of each segment
format: '<b>{point.name}</b>',
style: {
color: "#FFFFFF"
}
}
},
series: {
animation: {
duration: 1000,
easing: 'easeOutBounce'
},
point: {
events: {
mouseOver: function(event) {
var point = this;
if (!point.selected) {
//chart.tooltip.shared = true;
timeout = setTimeout(function () {
point.firePointEvent('click');
chart.tooltip.shared = false;
chart.tooltip.refresh(point);
}, 100);
}
}
}
},
events: {
mouseOut: function() {
chart.tooltip.shared = false;
clearTimeout(timeout);
}
},
dataLabels: {
allowOverlap:false,
enabled: true,
useHTML: true,
format:'{point.icon}',
formatter: function() {
return Math.round(this.percentage*100)/100 + ' %';
},
distance: -70,
color:'#FFFFFF'
}
}
},
series: [{
type: 'pie',
name: 'Modules',
colorByPoint: true,
color:'#FFFFFF',
data: [
{
name: 'Scheduling',
y: 60,
icon: '<i class="fa fa-book" style="font-size:80px;margin:-20px;"></i>'
},
{
name: 'Budgeting',
y: 60,
icon: '<i class="fa fa-calculator" style="font-size:70px;margin:-24px -20px -20px -40px;"></i>'
},
{
name: 'Attendance',
y: 60,
icon: '<i class="fa fa-user" style="font-size:80px;margin:-40px -15px -40px -15px;"></i>'
},
{
name: 'Reporting',
y: 60,
icon: '<i class="fa fa-bar-chart" style="font-size:80px;margin:-40px -20px -40px -15px;"></i>'
},
{
name: 'Absence',
y: 60,
icon: '<i class="fa fa-bed" style="font-size:80px;margin:-30px -20px -30px 0px;"></i>'
},
{
name: 'Payroll',
y: 60,
icon: '<i class="fa fa-gbp" style="font-size:80px;margin:-10px -20px -20px 10px;"></i>'
}
]
}]
});
var图表=新的Highcharts.图表({
图表:{
renderTo:'模块',
plotBackgroundColor:null,
plotBorderWidth:null,
影子:错,
键入“pie”,
背景色:“透明”
},
学分:{
已启用:false
},
出口:{
已启用:false
},
标题:{
文本:“”,
风格:{
fontSize:'20px',
颜色:“#999999”,
fontWeight:'粗体',
fontFamily:“Verdana”
}
},
副标题:{
文本:“”,
风格:{
fontSize:'15px',
颜色:“#999999”,
fontFamily:“Verdana”
}
},
工具提示:{
边框宽度:0,
边框颜色:空,
边界半径:0,
影子:错,
形状:“标注”,
pointFormat:“{series.data.name}”,
背景色:“rgba(0,0,0,0.8)”,
样式:{“color”:“#ffffff”,“cursor”:“default”,“fontSize”:“12px”,“pointerEvents”:“none”,“whiteSpace”:“nowrap”}
},
打印选项:{
馅饼:{
allowPointSelect:true,//单击会拉出段
stickyTracking:false,//鼠标事件
光标:“指针”,
followPointer:true,
数据标签:{
enabled:false,//每个段的注释
格式:“{point.name}”,
风格:{
颜色:“FFFFFF”
}
}
},
系列:{
动画:{
持续时间:1000,
放松:“放松弹跳”
},
要点:{
活动:{
鼠标悬停:函数(事件){
var点=这个;
如果(!point.selected){
//chart.tooltip.shared=true;
超时=设置超时(函数(){
point.firePointEvent(“单击”);
chart.tooltip.shared=false;
图表。工具提示。刷新(点);
}, 100);
}
}
}
},
活动:{
mouseOut:function(){
chart.tooltip.shared=false;
clearTimeout(超时);
}
},
数据标签:{
allowOverlap:错误,
启用:对,
是的,
格式:“{point.icon}”,
格式化程序:函数(){
返回Math.round(此.percentage*100)/100+'%';
},
距离:-70,
颜色:“#FFFFFF”
}
}
},
系列:[{
键入“pie”,
名称:'模块',
colorByPoint:对,
颜色:“#FFFFFF”,
数据:[
{
名称:'计划',
y:60,
图标:“”
},
{
名称:'预算',
tooltip: {
borderWidth: 0,
borderColor: null,
borderRadius: 0,
shadow: false,
backgroundColor: "none",
useHTML: true,
.highcharts-tooltip > span {
padding: 5px;
background-color: rgba(0,0,0,0.8);
background-color: white\9;
/* < IE11 */
border: 1px solid #a8a7a5;
z-index: 9999;
}