我有一个堆积的柱状图。我可以将长字符串作为x轴上的标签,因此我使用了格式化程序,该格式化程序会修剪字符串并在工具提示上显示完整的字符串。问题是当我将鼠标悬停在列上时,x轴标签和工具提示内容重叠,看起来很难看。我希望工具提示背景完全不透明。当我做useHTML false
标签时,它可以正常工作,但是这样做不能将html标签用于标签。请使用提出一些解决方案useHTML true
。
这是小提琴,显示问题jsfiddle
您可以简单地增加高度图的高度,并将工具提示的backgroundColor设置为透明。
小提琴:http : //jsfiddle.net/4mznaybs/11/
chart: {
type: 'column',
height : 300
},
tooltip: {
borderWidth: 0,
backgroundColor: "rgba(255,255,255,0)",
borderRadius: 05,
shadow: false,
useHTML: true,
percentageDecimals: 2,
backgroundColor: "rgba(255,255,255,1)",
formatter: function () {
return '<b>' + this.x + '</b><br/>' +
this.series.name + ': ' + this.y + '<br/>' +
'Total: ' + this.point.stackTotal;
},
},
和CSS为:
.label {
z-index: 1 !important;
}
.highcharts-tooltip span {
background-color:white;
border:1px solid green;
opacity:1;
z-index:9999 !important;
}
.tooltip {
padding:5px;
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句