首页 > 解决方案 > 如何更改 Chartist html 轴标签的字体特征?

问题描述

根据 Chartist 作者之一的帖子,我实现了将 html 锚元素放入 Y 轴标签的功能。正如建议的那样,我将代码添加到我的 Javascript 源代码中以获取插件,如下所示:

// 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;
      }
    });
  }
}

这成功地允许将可导航的 <a> 元素设置到轴标签中。但是,我想将显示的文本链接的字体特征修改为默认的 Times Roman 12 pt 外观。这个怎么做?

标签: javascripthtmlcsschartist.js

解决方案


推荐阅读