要对 Highcharts 词云中的某些词应用不同的字体样式?
To apply different font styles to certain words in a Highcharts wordcloud?
以下 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"
}
}
有没有办法对某些单词应用不同的字体样式?
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
}
以下 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"
}
}
有没有办法对某些单词应用不同的字体样式?
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
}