Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/402.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何更改图表html轴标签的字体特征?_Javascript_Html_Css_Chartist.js - Fatal编程技术网

Javascript 如何更改图表html轴标签的字体特征?

Javascript 如何更改图表html轴标签的字体特征?,javascript,html,css,chartist.js,Javascript,Html,Css,Chartist.js,基于一位图表作者的帖子,我实现了将html锚元素放入Y轴标签的功能。正如建议的那样,我在Javascript源代码中添加了插件代码,如下所示: // HTML Label plugin Chartist.plugins = Chartist.plugins || {}; Chartist.plugins.ctHtmlLabels = function(options) { return function(chart) { chart.on('draw', function(conte

基于一位图表作者的帖子,我实现了将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;
      }
    });
  }
}

这将成功地将可导航元素设置到轴标签中。但是,我想将显示的文本链接的字体特征修改为默认的Times Roman 12 pt外观之外的内容。如何做到这一点?

你不能给元素分配一个类,然后用css来设计类的样式吗?谢谢。很明显,我不知道为什么我没有想到。