Search code examples
javascriptjquerycssmorris.jsdonut-chart

change font-family Morris Donut Chart


I'm using the very lovely morris donut chart. thing is, I want to change font family for that chart text (inside donut) and cant manage to do it. I will also want to add a 3% padding for inside text...

i tries to add

$("div svg text").attr("style", "font-family: 'Assistant' !important");

but not working for me.

any one have an idea for me? Thx


Solution

  • I have no experience with morris.js, but since you're using jQuery, you can simply use the .css() method, instead of the changing the style attribute.

    $('div svg text').css({
        "font-family" : "'Assistant' !important",
        "padding" : "3%"
    });
    

    You'll have to wrap the parameters inside an object to take effect.