I want to iterate an array in javascript inside vue.
I'm using a vertex graph. I want to iterate data[] based on the number of series (Y_Data_length).
I want to change the code
data() { return { Y_Data_length: null, Options: { xaxis: { categories: [], }, }, Series_1: [{ name: "", data: [], }], Series_2: [{ name: "", data: [], }, { name: "", data: [], } ], Series_3: [{ name: "", data: [], }, { name: "", data: [], }, { name: "", data: [], } ], }; },
Form it.
data() { return { Y_Data_length: null, Options: { xaxis: { categories: [], }, }, Series: [ {name:"", data: []} ], }; },
For reference only, Y_Data_length is:
const A = this.chart[0].data this.Y_Data_length = Object.keys(A).length
I'm not sure if I understand your question correctly, but if you want to get an array of
data
from a specific series, you can use Vue "compute" to useY_Data_length
as an array The index automatically gets the correct series.data. WheneverY_Data_length
changes,this.currentSeriesData
is also updated.