Hi guys i'm trying to learn about graphs but cant figure out what i'm doing wrong this is a function that was getting random data and plotting.....you will see
//var data = [], totalPoints = 2;
function getRandomData() {
//if (data.length > 0)
// data = data.slice(1);
// do a random walk
//while (data.length < totalPoints) {
// var prev = data.length > 0 ? data[data.length - 1] : 50;
// var y = prev + Math.random() * 10 - 5;
// if (y < 0)
// y = 0;
// if (y > 200)
// y = 200;
// data.push(y);
//}
$.ajax({
url:"getprob.php",
success:function(data) {
}
});
// zip the generated y values with the x values
var res = [];
for (var i = 0; i < data.length; ++i)
res.push([i, data[i]])
return res;
}
as you can see i commented out the data variable and replaced it with a ajax call but it just dont work
Question
Craig Hopson
Hi guys i'm trying to learn about graphs but cant figure out what i'm doing wrong this is a function that was getting random data and plotting.....you will see
as you can see i commented out the data variable and replaced it with a ajax call but it just dont work
FYI
getprob.php
Link to comment
Share on other sites
1 answer to this question
Recommended Posts