Chart.js: [Question] Use HTML for labels. Fontello is supported?

Created on 1 Jun 2016  路  5Comments  路  Source: chartjs/Chart.js

Hi!
I comented in the closed issue and don't know if its visible now. https://github.com/chartjs/Chart.js/issues/401. (This issue was created for the version 1.0.2)

It's possible use HTML for labels in the new version 2.1.4??
I need use "fontello".
I have to do something like this:
return "<i class='icon-ok-circled2'></i>" + chart.data.labels[tooltipItem[0].index];

Thank you so much for everything

support

Most helpful comment

@etimberg How would someone go about editing the label via canvas? if you wanted to add a different background colour to each label for example..

All 5 comments

@soniaCejas html labels are not supported in v2 since everything is done on the canvas.

@etimberg How would someone go about editing the label via canvas? if you wanted to add a different background colour to each label for example..

@ewbdaniel the drawing is done here: https://github.com/chartjs/Chart.js/blob/master/src/core/core.scale.js#L590-L599

You would need to modify that

Closing since we are not able to support this. I played around quickly with Fontello and it looks like you get a wofffile. I think you can import this into your app and then set the font that Chart.js uses to 'Fontello' and it should work.

Change Chart.defaults.global.defaultFontFamily to change all of the Chart.js fonts.

@soniaCejas
I am using version ^2.7.1, can you please tell how can I add custom images now? instead of using font-awesome or something like this?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nickgoodliff picture nickgoodliff  路  3Comments

JewelsJLF picture JewelsJLF  路  3Comments

lizbanach picture lizbanach  路  3Comments

SylarRuby picture SylarRuby  路  3Comments

HeinPauwelyn picture HeinPauwelyn  路  3Comments