AsparagusFactory
AsparagusFactory

Reputation: 31

How do I change the font characteristics of a Chartist html axis label?

Based on a post by one of the Chartist authors, I've implemented the ability to put an html anchor element into a Y-axis label. As suggested, I added the code to my Javascript source for a plug-in as such:

// HTML Label plugin
Chartist.plugins = Chartist.plugins || {};
Chartist.plugins.ctHtmlLabels = function(options) {
  return function(chart) {
    chart.on('draw', function(context) {
      if (context.type === 'label') {
        // Best to combine with something like sanitize-html
        context.element.empty()._node.innerHTML = context.text;
      }
    });
  }
}

This successfully allows setting of a navigable <a> element into the axis label. However, I would like to modify the font characteristics of the displayed text link to something besides the default Times Roman 12 pt appearance. How to do this?

Upvotes: 0

Views: 123

Answers (0)

Related Questions