如何解决Highchart - 预期类型来自属性“dashStyle”,该属性在此处声明为“XAxisPlotLinesOptions”类型
plotLines: [
{
color: 'grey',width: 2,dashStyle: 'line'
}
],
我得到了下面的图表,之前我在其他工作中使用了 dashStyle
,这里只有我得到了以下问题。
error TS2769: No overload matches this call.
Overload 1 of 2,'(options: Options,callback?: ChartCallbackFunction): Chart',gave the following error.
Type '"trgt-testcntrl"' has no properties in common with type 'Options'.
Overload 2 of 2,'(renderTo: string | HTMLElement,options: Options,gave the following error.
Type '"line"' is not assignable to type 'DashStyleValue'.
node_modules/highcharts/highcharts.d.ts:115249:5
115249 dashStyle?: DashStyleValue;
~~~~~~~~~
The expected type comes from property 'dashStyle' which is declared here on type 'XAxisPlotLinesOptions'
我在这里做错了什么?
解决方法
没有像 line
这样可能的破折号样式。
在 API 参考中,您可能会找到可用的。
API:https://api.highcharts.com/class-reference/Highcharts#.DashStyleValue
演示:https://stackblitz.com/edit/highcharts-angular-basic-line-dztepl
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。