简体   繁体   English

类型“LegendOptions”上不存在 Highchart 属性“名称”

[英]Highchart property 'name' does not exist on type 'LegendOptions'

I am trying to create Highchart, where I want to format the legend.我正在尝试创建 Highchart,我想在其中设置图例格式。 Documentation says - "Callback function to format each of the series' labels. This keyword refers to the series object or the point object in case of pie charts. By default, the series or point name is printed."文档说 - “用于格式化每个系列标签的回调函数。在饼图的情况下,此关键字指的是系列对象或点对象。默认情况下,将打印系列或点名称。”

But when we try to use it it gives an error - "Highchart property 'name' does not exist on type 'LegendOptions'"但是当我们尝试使用它时,它给出了一个错误 - “类型 'LegendOptions' 上不存在 Highchart 属性 'name'”

Code -代码 -

legend: {
  itemWidth: 150,
  itemMarginTop: 20,
  symbolPadding: 20,
  symbolRadius:200,
  labelFormatter: function () {
    return (this.name + '(Click Here)');
  }

Any input on the same?任何输入相同?

So I figured it out but forgot to post here.所以我想通了,但忘了在这里发帖。 The following works for me以下对我有用

labelFormatter: function () {
return ((this as Point).name+ '(Click Here)');

} }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM