if we have a code like this
yAxis : {
title : {
text : 'Exchange rate'
},
plotLines : [{
value : 0.6738,
color : 'green',
dashStyle : 'shortdash',
width : 2,
label : {
text : 'Last quarter minimum'
}
}, {
value : 0.7419,
color : 'red',
dashStyle : 'shortdash',
width : 2,
label : {
text : 'Last quarter maximum'
}
}]
},
how can i take the plotlines json string and asign it to a variable and pass this variable to the plotline object ???
i tried something like this
var jsonObj = [];
jsonObj.push({ "value": 1256211571000, "color": '#D2691E', "width": 1, "label": { "text": 'rinse'} });
var myLines = JSON.stringify(jsonObj);
and then pass mylines to plotlines but it didn’t really work
Assuming this object is in a variable called
data, just do:This is just a JavaScript object, not JSON. JSON is a string representation of an object (or array).