When I use the first code sample, for some reason console.log()
gives me the processed HighData variable. As if the console.log()
were at the end of the script.
console.log( "data", this.data['diagram'] );
var HighData = this.data['diagram'];
minSerieHeight = getMin( HighData[3] );
HighData[0] = mkSerie( HighData[0] );
HighData[1] = mkSerie( HighData[1] );
HighData[2] = mkSerie( HighData[2] );
HighData[3] = mkSerie( HighData[3] );
Whats even more strange is, when I use array.map()
(which does exactly the same thing as the code above) it returns the this.data['diagram']
variable correctly as expected.
console.log( "data", this.data['diagram'] );
var HighData = this.data['diagram'];
minSerieHeight = getMin( HighData[ HighData.length - 1 ] );
HighData = HighData.map( e => {
return mkSerie( e );
});
The code is in a Vue component in the mounted()
function. The getMin()
and mkSerie()
are also in the mounted()
function.