I need to create an array which will read 4 values of type string and after that it will pass in a graph to create its columns.
This is my array bellow (poo: []) :
data() {
return {
graphicData: {
type: 'bar',
data: {
labels: [],
datasets: [],
},
options: {
responsive: true,
lineTension: 1,
scales: {
yAxes: [
{
ticks: {
beginAtZero: true,
padding: 25,
},
},
],
},
},
},
average: 0,
stepsGrade: [],
poo: [], //This is my array
I pass the values to it in this computed switch case
case 'P4':
if (this.stepsGrade[0].step_grade > 92) {
this.stepGradeIcon.push({ icon: 'mdi-emoticon-happy', color: 'green' });
this.poo.push('green');;
} else {
this.stepGradeIcon.push({ icon: 'mdi-emoticon-sad', color: 'red' });
this.poo.push('red');
}
if (this.stepsGrade[1].step_grade > 88) {
this.stepGradeIcon.push({ icon: 'mdi-emoticon-happy', color: 'green' });
this.poo.push('green');;
} else {
this.stepGradeIcon.push({ icon: 'mdi-emoticon-sad', color: 'red' });
this.poo.push('red');
}
if (this.stepsGrade[2].step_grade > 84) {
this.stepGradeIcon.push({ icon: 'mdi-emoticon-happy', color: 'green' });
this.poo.push('green');;
} else {
this.stepGradeIcon.push({ icon: 'mdi-emoticon-sad', color: 'red' });
this.poo.push('red');
}
if (this.stepsGrade[3].step_grade > 80) {
this.stepGradeIcon.push({ icon: 'mdi-emoticon-happy', color: 'green' });
this.poo.push('green');;
} else {
this.stepGradeIcon.push({ icon: 'mdi-emoticon-sad', color: 'red' });
this.poo.push('red');
}
break;
}
return this.stepGradeIcon;
In my console log I have the data as follows
[__ob__: Observer]
0: "red"
1: "green"
2: "green"
3: "green"
length: 4
__ob__: Observer {value: Array(4), dep: Dep, vmCount: 0}
[[Prototype]]: Array
How can I read these 4 values ?
I try to use
var parsedobj = JSON.parse(JSON.stringify(this.poo));
console.log(parsedobj);
Basically my array is only observated but never change and save the new value