Highchart - 预期类型来自 属性 'dashStyle' ,它在此处声明为类型 'XAxisPlotLinesOptions'
Highchart - The expected type comes from property 'dashStyle' which is declared here on type 'XAxisPlotLinesOptions'
我在 highchart 的 xAxis
添加了下面的代码。
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, callback?: ChartCallbackFunction): Chart', 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
我在 highchart 的 xAxis
添加了下面的代码。
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, callback?: ChartCallbackFunction): Chart', 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