Highcharts Gauge:添加图标

时间:2017-08-24 13:31:55

标签: javascript jquery html css highcharts

我尝试在dataLabels中添加图标,我成功添加了一些像这样SELECT *, (t.inbound + t.outbound) total_calls FROM (SELECT c.extension, RESPONSIBLEUSEREXTENSIONID, sum(Duration) seconds, round(sum(Duration) / 60,2) minutes, sum(if(LEGTYPE1 = 1,1,0)) outbound, sum(if(LEGTYPE1 = 2,1,0) and ANSWERED = 1) inbound, sum(if(Answered = 1,0,1)) missed, now(), b.ts FROM cdrdb.session a INNER JOIN cdrdb.callsummary b ON a.NOTABLECALLID = b.NOTABLECALLID INNER join cdrdb.mxuser c ON a.RESPONSIBLEUSEREXTENSIONID = c.EXTENSIONID WHERE b.ts BETWEEN curdate() - interval 30 day and curdate() AND c.extension IN (7276,7314,7295,7306,7357,7200,7218,7247,7331,7255,7330,7000,7215,7240,7358,7312) GROUP BY DATE(b.ts),c.extension) t; 的HTML,但现在我想添加图标,我使用** Ionicons *。这是代码:

return '<span style="color:#89891C">Partially rejected: ' + partial + '</span><br/>' +'<span style="color:#933">Rejected: ' + rejected + '</span>';

我努力做到的部分是 dataLabels ,如果有任何信息可能需要了解我想要实现的目标,请问我,提前谢谢

1 个答案:

答案 0 :(得分:1)

简单地说,获取Ionicons CSS文件(https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css)并在dataLabels.formatter函数中返回足够的图标。您需要记住,属性useHTML必须设置为true。

API参考:
http://api.highcharts.com/highcharts/plotOptions.series.dataLabels.formatter

例:
http://jsfiddle.net/h0xLzv8h/