Hi,
I am very new to Angular 7. I am facing errors in below line of code. Please someone let me know what is wrong in my code. Any help would be appreciated. Thank you in advance.
var x1 = 10, x2 = 100, x3 = datar.map(function (item) { return [ item.xmax ] })
.reduce(function(a, b) { return Math.max(a, b); });
var y1 = 10, y2 = 100, y3 = datar.map(function (item) { return [ item.ymax ] })
.reduce(function(a, b) { return Math.max(a, b); });
In above code I get error: Argument of type 'number[]' is not assignable to parameter of type 'number' at 'a, b' in code 'return Math.max(a, b)'
var data = [ [0,0,0],[0,1,4],[0,2,1],[0,3,1]
,[1,0,0],[1,1,9],[1,2,4],[1,3,1]
,[2,0,0],[2,1,9],[2,2,9],[2,3,9]
,[3,0,0],[3,1,0],[3,2,0],[3,3,0] ];
data = data.map(function (item) {
return [item[1], item[0], item[2] || '-'];
});
In above code I get error:
Type '(string | number)[][]' is not assignable to type 'number[][]'.
Type '(string | number)[]' is not assignable to type 'number[]'.
Type 'string | number' is not assignable to type 'number'.
Type 'string' is not assignable to type 'number'
at 'data'
var objseries = datar.map(function(x) {
return {
type: 'scatter',
symbol: 'diamond',
symbolSize: 10,
itemStyle:{
normal:{
color: x.color
}
},
data: x.data.map(function (item) {
return [
item[0] <= x1 ? 0 + ((item[0] - 0) / ((x1 - 0) / 100)) / 100 :
(item[0] <= x2 ? 1 + ((item[0] - x1) / ((x2 - x1) / 100)) / 100 :
(item[0] <= x3 ? 2 + ((item[0] - x2) / ((x3 - x2) / 100)) / 100 : 2)),
item[1] <= y1 ? 0 + ((item[1] - 0) / ((y1 - 0) / 100)) / 100 :
(item[1] <= y2 ? 1 + ((item[1] - y1) / ((y2 - y1) / 100)) / 100 :
(item[1] <= y3 ? 2 + ((item[1] - y2) / ((y3 - y2) / 100)) / 100 : 2)),
item[0], item[1]
];
}),
}
});
In above code I get error: Operator '<=' cannot be applied to types 'number' and 'number[]' at 'item[0] <= x3' in code 'item[0] <= x3 ? 2 + ((item[0] - x2) / ((x3 - x2) / 100)) / 100 : 2))'
<br/>
and<br/>
The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type at x3 in code '(x3-x2)'