Highcharts - change font size of text on chart

2019-06-03 06:28发布

I have text on a chart like below. I want to change the font size of the text "abc". I tried putting 'font-size':'8px' inside of the css, but it did not work. Does anyone have an idea about this?

enter image description here Here is the fiddle link: http://jsfiddle.net/3hGz2/

           'events': {
           'load': function () {
               var label = this['renderer']['label']('* y='+ slope +'x'+'+('+ intercept + ')<br>  R^2='+ rSquare)
               .css({
                   'width': '150px',
                   'color' : 'grey',
                   'font-size':'8px'

               })
               .attr({
                   'stroke': 'grey',
                   'stroke-width': 0,
                   'r': 5,
                   'padding': 3                      
               })
               .add();

               label.align(Highcharts.extend(['label']['getBBox()'], {
                   'align': 'right',
                   'x': -110, // offset
                   'verticalAlign': 'bottom',
                   'y': -130 // offset
               }), null, 'spacingBox');

           }
       }

1条回答
戒情不戒烟
2楼-- · 2019-06-03 07:05

See http://jsfiddle.net/3hGz2/1/

you can specify the font size as fontSize

.css({
    'width': '150px',
    'color' : 'grey',
    'fontSize':'20px'
})
查看更多
登录 后发表回答