echart.js控制元件畫圖自定義tooltip
阿新 • • 發佈:2018-11-30
function makeSelfTooltip(_options){
_options = $.extend(_options, {
'tooltip': {
trigger: 'axis',
axisPointer: {
type: 'shadow'
},
formatter: function (params) {
var res='<div><p>'+params[0].name+'</p></div>'
for(var i=0;i<params.length;i++){
res+='<p><span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:'+params[i].color+'"></span>'+params[i].seriesName+':'+params[i].data['value']+'%</p>';
}
return res;
},
textStyle: {
fontSize: 12,
fontFamily: '宋體'
}
}
}, true);
return _options;
}
_options = $.extend(_options, {
'tooltip': {
trigger: 'axis',
axisPointer: {
type: 'shadow'
},
formatter: function (params) {
var res='<div><p>'+params[0].name+'</p></div>'
for(var i=0;i<params.length;i++){
res+='<p><span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:'+params[i].color+'"></span>'+params[i].seriesName+':'+params[i].data['value']+'%</p>';
}
return res;
},
textStyle: {
fontSize: 12,
fontFamily: '宋體'
}
}
}, true);
return _options;
}