Highcharts - change font size of text on chart

只愿长相守 提交于 2020-01-03 01:59:25

问题


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?

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:


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

you can specify the font size as fontSize

.css({
    'width': '150px',
    'color' : 'grey',
    'fontSize':'20px'
})


来源:https://stackoverflow.com/questions/19038326/highcharts-change-font-size-of-text-on-chart

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!