Angular 7-Highcharts标题未更改

问题描述 投票:0回答:2

我的角度分量中有一个Highchart,如下所示:

highcharts = Highcharts;

    pieChartOptions = {
      chart: {
        type: "pie",
        title: {
          enabled: true,
          text: 'TRPs by Daypart',
          verticalAlign: 'top',
          align: 'left'
      },
     },
        xAxis: {
          title: {
            text: this.xAxis.name
          }
        },
        yAxis: {
          title: {
              text: "Reach"
          }
        },
        series: [
          {
            name: this.xAxis.name,
            data: this.xAxis.data
          }
        ]
     };

然后进入我的.html

<highcharts-chart
 [Highcharts] = "highcharts"
 [options] = "pieChartOptions"
 style="width: 100%; height: 400px; display: block;">
</highcharts-chart>

这里的问题是标题文本没有更改,我只看到“图表标题”,​​而不是我在组件上定义的标题文本。有什么我想念的吗?

还:有什么方法可以删除右下角的highcharts.com文本?

enter image description here

angular highcharts
2个回答
0
投票

当我尝试放置标题选项(与图表选项相同级别时,显示标题:]

highcharts = Highcharts;

    pieChartOptions = {
      chart: {
        type: "pie"
     },
     title: {
          enabled: true,
          text: 'TRPs by Daypart',
          verticalAlign: 'top',
          align: 'left'
      },
...

0
投票

您将title放置在错误的位置,它应该在chart之外

pieChartOptions = {
  chart: { ... },
  title: { text: 'TRPs by Daypart', ... },
}

关于删除highcharts.com,您可以通过修改credits选项将其删除:

pieChartOptions = {
  chart: { ... },
  credits: {
      enabled: false
  }
}

我建议您检查Highcharts API以获取整个文档。

© www.soinside.com 2019 - 2024. All rights reserved.