Necesito crear una matriz que leerá 4 valores de tipo cadena y luego pasará en un gráfico para crear sus columnas.
Esta es mi matriz a continuación (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 arrayLe paso los valores en este caso de interruptor calculado
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;En el registro de mi consola tengo los datos de la siguiente manera
[__ob__: Observer] 0: "red" 1: "green" 2: "green" 3: "green" length: 4 __ob__: Observer {value: Array(4), dep: Dep, vmCount: 0} [[Prototype]]: Array¿Cómo puedo leer estos 4 valores?
trato de usar
var parsedobj = JSON.parse(JSON.stringify(this.poo)); console.log(parsedobj);Básicamente, mi matriz solo se observa pero nunca cambia y guarda el nuevo valor