【问题标题】:To apply different font styles to certain words in a Highcharts wordcloud?将不同的字体样式应用于 Highcharts wordcloud 中的某些单词?
【发布时间】:2018-03-30 09:51:22
【问题描述】:

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

    {
      "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
      }
    }

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

{
  "name": "LANDING",
  "weight": 18022,
  "style":{
    "fontFamily":"Harrington"
  }
}

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

【问题讨论】:

    标签: css highcharts word-cloud


    【解决方案1】:

    API 没有说明 wordcloud 系列style 属性点:https://api.highcharts.com/highcharts/series.wordcloud.data

    您可以改用className

    JS:

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

    CSS:

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

    现场演示: https://jsfiddle.net/BlackLabel/Lpuyt1s7/

    【讨论】:

      猜你喜欢
      • 2012-03-26
      • 1970-01-01
      • 1970-01-01
      • 2016-05-18
      • 1970-01-01
      • 2015-07-10
      • 2012-08-03
      • 2016-09-07
      • 2014-07-06
      相关资源
      最近更新 更多