angular-highcharts icon indicating copy to clipboard operation
angular-highcharts copied to clipboard

Type '{ type: string; name: string; data: any; }[]' not assignable to type

Open Quichei opened this issue 6 years ago • 6 comments

Im getting this error and the descriptions on how to fix it make no sense. I tried as Highcharts.SeriesColumnOptions and as Highcharts.SeriesLineDataOptions

and this is my code: new Chart({ title: { text: 'Pareto' }, xAxis: { categories: ['a', 'b', 'c'], crosshair: true }, yAxis: [{ title: { text: 'r' } }], series: [{ //line 272 type: 'column', name: 'p1', data: [1,2,3] }, { type: 'line', name: 'p2', data: [3,2,1] }] })


ERROR in mycomp.component.ts(272,9): error TS2322: Type '{ type: string; name: string; data: any; }[]' is not assignable to type '(SeriesAbandsOptions | SeriesAdOptions | SeriesAoOptions | SeriesApoOptions | SeriesAreaOptions | SeriesArearangeOptions | SeriesAreasplineOptions | SeriesAreasplinerangeOptions | ... 82 more ... | SeriesZigzagOptions)[]'.
  Type '{ type: string; name: string; data: any; }' is not assignable to type 'SeriesAbandsOptions | SeriesAdOptions | SeriesAoOptions | SeriesApoOptions | SeriesAreaOptions | SeriesArearangeOptions | SeriesAreasplineOptions | SeriesAreasplinerangeOptions | ... 82 more ... | SeriesZigzagOptions'.
    Type '{ type: string; name: string; data: any; }' is not assignable to type 'SeriesZigzagOptions'.
      Types of property 'type' are incompatible.
        Type 'string' is not assignable to type '"zigzag"'.
mycomp.component.ts(288,9): error TS2322: Type '{ type: string; name: string; data: any; }[]' is not assignable to type '(SeriesAbandsOptions | SeriesAdOptions | SeriesAoOptions | SeriesApoOptions | SeriesAreaOptions | SeriesArearangeOptions | SeriesAreasplineOptions | SeriesAreasplinerangeOptions | ... 82 more ... | SeriesZigzagOptions)[]'.
mycomp.component.ts(39,9): error TS2322: Type 'string' is not assignable to type '"area" | "map" | "line" | "polygon" | "areaspline" | "bar" | "column" | "pie" | "scatter" | "spline" | "abands" | "ad" | "ao" | "apo" | "arearange" | "areasplinerange" | "aroon" | ... 73 more ... | "zigzag"'.
mysecondcomp.component.ts(60,9): error TS2322: Type 'string' is not assignable to type '"area" | "map" | "line" | "polygon" | "areaspline" | "bar" | "column" | "pie" | "scatter" | "spline" | "abands" | "ad" | "ao" | "apo" | "arearange" | "areasplinerange" | "aroon" | ... 73 more ... | "zigzag"'.


im using angular 7.1.3

Quichei avatar Feb 23 '19 15:02 Quichei

series: [ { name: "Countries", color: "#E0E0E0", enableMouseTracking: false, type: undefined, },

fixed my problem

Rolodo avatar Mar 20 '19 19:03 Rolodo

series: [ { name: "Countries", color: "#E0E0E0", enableMouseTracking: false, type: undefined, },

fixed my problem

it works for me

but before there is no need to declare type in seris so now why we need to do it?

nitinprajapati1404 avatar May 02 '19 10:05 nitinprajapati1404

The above solutions fix the problem, but can somebody please tell how to send the initial data

sunith-kumar avatar Jul 10 '19 06:07 sunith-kumar

series: [ { name: "Countries", color: "#E0E0E0", enableMouseTracking: false, type: undefined, },

fixed my problem

tks!

iurynogueira avatar Oct 31 '19 21:10 iurynogueira

series: [ { name: "Countries", color: "#E0E0E0", enableMouseTracking: false, type: undefined, },

fixed my problem

I am using Angular 8 to render a heatmap, and got an error when setting the series type to 'heatmap' in the app.component.ts file. At this point my chart type was already set to 'heatmap', and in the series, setting the type to undefined fixed by problem. My series looks like this:

series: [
          {
            type: undefined,
            name: 'Curriculum Mapping',
            turboThreshold: 30000,
            data: this.getData(),
            boostThreshold: 30000,
            borderWidth: 0,
            nullColor: '#EFEFEF',
            tooltip: {
                // headerFormat: '<span style="font-size: 10px">{point.key}</span><br/>',
                pointFormat: '<b>{point.custom.event} {point.custom.outcome} {point.value}</b>'
            }
            
          }
        ]

rmace001 avatar Nov 11 '19 23:11 rmace001

I was struggling with the same problem. Thank you for this post stating that the type needs to be defined in the series.

In my case, I had to provide the exact type (potentially, because I accepted enforce stricter type checking when creating my project).

cbtum avatar Feb 14 '21 06:02 cbtum