angularhighchartsangular2-highcharts

Highchart - The expected type comes from property 'dashStyle' which is declared here on type 'XAxisPlotLinesOptions'


I have added the below code in the xAxis in the highchart.

plotLines: [
    {
      color: 'grey',
      width: 2,
      dashStyle: 'line'
    }
],

I am getting the below chart, previously I used the dashStyle in other work, here only I am getting the below issue.

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'

What I am doing wrong here?


Solution

  • There is no such possible dash style as line.
    In the API reference, you might find the available one.

    API: https://api.highcharts.com/class-reference/Highcharts#.DashStyleValue
    Demo: https://stackblitz.com/edit/highcharts-angular-basic-line-dztepl