S
S
seredaes2015-10-27 13:46:05
JavaScript
seredaes, 2015-10-27 13:46:05

Two-dimensional JavaScript array or how to drive data?

In a loop, I pull data from JSON
for( ...) {
mas_days[i] = json_parse[i]. date;
mas_res[i] = "{meta:'1', val:1"}";
}
After that, they need to be inserted into the chart
var chart = new Chartist.Line('.ct-chart1', {
labels: mas_days,
series: [
[
{meta: 'Date 1', value: 1},
{meta: 'Date 2', value: 5},
{meta: 'Date 3', value: 3}

]
]
}, {
plugins: [ Chartist.plugins .tooltip() ],
height:200
});
And instead
of series: [
[
{meta: 'date 1', value: 1},
{meta: '
{meta: 'Date 3', value: 3}

]
]
I need to insert a two-dimensional array, but I can't figure out how to do it :(

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Scribblex, 2015-10-27
@Scribblex

varmas_res = [];
for( ...) {
mas_days[i] = json_parse[i]. date;
mas_res.push({meta: 1, val: 1});
}
...
series: mas_res
Won't help? Share the code on codepen, we'll figure it out)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question