Highchart 未在 heroku 中显示,但在本地环境中工作

Highchart is not showing in heroku, but works in local environment

我在我的应用程序中使用 ember-highcharts。我在我的本地主机上测试过,它工作正常,图形显示在屏幕上。

我在 heroku 中部署了我的应用程序,并尝试显示图形但出现以下错误:

Uncaught TypeError: Cannot read property 'parentGroup' of undefined
at object.setState (highcharts.src.js:33606)
at SVGGElement. (highcharts.src.js:33080)

这是我的代码:

{{#if question.chartData}}
  {{high-charts content=question.chartData chartOptions=chartOptions}}
 {{else}}
  <div class="modal__warning">Dados insuficientes</div>
{{/if}}

chartOptions: {
chart: {
  plotBackgroundColor: null,
  plotBorderWidth: 0,
  plotShadow: false
},
title: {
  text: null
},
tooltip: {
  pointFormat: '<b>{point.percentage:.1f}%</b>'
},
plotOptions: {
  pie: {
    colors: [
      '#60E0A1',
      '#F19692',
      '#d5d5d5',
      '#68599D',
      '#A69BC5'
    ],
    dataLabels: {
      enabled: false
    },
    size: '100%',
    showInLegend: true,
    startAngle: -90,
    endAngle: 90,
    center: ['50%', '100%']
  }
},
yAxis: {
  title: {
    text: null
  }
 }
}

有人知道问题出在哪里吗?只是 remember 在我的本地机器上工作正常!

提前致谢:)

我发现了这个问题。发生的事情是我发送到 Highcharts 的数据使用了错误的格式。

我正在绘制饼图,数据格式如下:

[ ["test", 10.0], ["test2", 85.0], ["test3", 5.0] ]

我发送的数据是这样的:

{ {"test", 10.0}, {"test2", 85.0}, {"test3", 5.0} }

由于某种原因,这导致了所提到的问题。