无法读取未定义高图的属性“中心”

时间:2015-06-09 10:44:01

标签: angularjs highcharts

我想把标题放在饼图的中心。我有一个方法调用addTitle,它将标题放在饼图的中心。此方法由load事件执行。我的代码是下一个:

addTitle = (char) ->
    console.log 'entra', char
    if char.title
      char.title.destroy()

    r = char.renderer
    x = char.series[0].center[0] + char.plotLeft //Series is undefined, Why?
    y = char.series[0].center[1] + char.plotTop //Series is undefined, Why?
    char.title = r.text('Series 1', 0, 0)
    .css({
        color: '#4572A7',
        fontSize: '16px'
      }).hide()
    .add();

    bbox = char.title.getBBox();
    char.title.attr({
      x: x - (bbox.width / 2),
      y: y
    }).show();

 events: {
     load: () ->
         addTitle(this)
 }

0 个答案:

没有答案