javascript - Changing fontFamily on ChartJS bar chart -


i've partially implemented chartjs in project, can't figure out how change font that's displayed on x , y axes of bar chart.

i've read chartjs documentation, searched examples on github, etc. i'm not sure i'm doing wrong, rest assured knowing solution involve line of code , startlingly stupid oversight on part.

this code draws chart want, default font:

var barchartlanguage = chart.bar(mycanvas, {     data: datalanguages,     options: options,     defaults: defaults }); 

i tried changing font in defaults without success:

var defaults = {     global: {         // example font         defaultfontfamily: "'raleway'"     } }; 

and tried changing on axis options:

var options = {     animation: {         duration: 2000     },     scales: {         yaxes: [{             display: true,             ticks: {                 suggestedmin: 0,    // minimum 0, unless there lower value.                 // or //                 beginatzero: true,   // minimum value 0.                 suggestedmax: 10             },             gridlines: {                 display: false             },             pointlabels: {                 fontfamily: "'raleway'"             }         }],         xaxes: [{             gridlines: {                 display: false             }         }],     }, }; 

add ticks.fontfamily xaxes this:

xaxes: [{   gridlines: {     display: false   },   ticks: {     fontfamily: "verdana",   } }], 

documentation: http://www.chartjs.org/docs/#scales

example on jsfiddle: http://jsfiddle.net/4aslpwd5/


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -