Vote count:
0
I'm having trouble finding a way to insert data from an array I get from another function in my javascript file into my line graph. I just want to make sure this is supported and I don't have to switch to a different graphing package. Here is my current code, I'm guessing you have to add in a for loop into the data series, but I'm not sure how to implement this.
function displayGraph(){
//data to insert
var x =new Array(0, 1, 2, 3, 4); //array of x coordinates
var y =new Array(1, 1.8, 1.5, 2.5, 6.3);//array of y coordinates
$(function () {
$('#container').highcharts({
title: {
text: 'Glaicer Elevations',
x: -20 //center
},
xAxis: {
title: {
text: 'xAxis'
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
yAxis: {
title: {
text: 'yAxis'
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
tooltip: {
valueSuffix: 'km'
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'middle',
borderWidth: 0
},
// want to insert another data series using outside arrays
series: [{
name: 'Line1',
data: [[5, 2], [6, 3], [8, 2]]
}]
});
});
}
asked 33 secs ago
Aucun commentaire:
Enregistrer un commentaire