要将不同的字体样式应用于Highcharts wordcloud中的某些单词?

时间:2018-03-30 09:51:22

标签: css highcharts word-cloud

以下JS Fiddle显示应用于某些单词的字体样式。 示例:https://jsfiddle.net/amrutaJgtp/7evd8tgo/5/

recurrence(100)

我在Highcharts中试过这个。但它没有用。 示例:https://jsfiddle.net/amrutaJgtp/7evd8tgo/6/

    {
      "text": "UNKNOWN",
      "count": 584,
      "color": 'green', 
      "style": {
        fontFamily: 'Harrington',
        fontWeight: 1200    //font weight has no effect
      }
    }, {
      "text": "OTHER",
      "count": 138,
      "color": 'red',
      "style": {
        fontFamily: 'sans - serif',
        fontWeight: 1200    //font weight has no effect
      }
    }

有没有办法对某些单词应用不同的字体样式?

1 个答案:

答案 0 :(得分:0)

API 没有说明 wordcloud系列style属性点:IFileProvider.GetFileInfo documentation

您可以改为使用className

<强> JS:

var data = [{
  "name": "LANDING",
  "weight": 18022,
  className: 'custom-point'
}, 
(...)]

<强> CSS:

.custom-point {
  font-family: Harrington !important
}

现场演示: https://api.highcharts.com/highcharts/series.wordcloud.data