$(function() {
var updateInterval = 1000;
var data = [
[1, 10],
[2, 20],
[3, 30]
];
var dataset = [{
label: "line1",
data: data
}];
var options = {
series: {
shadowSize: 0 // Drawing is faster without shadows
},
yaxis: {
min: -50,
max: 50
},
xaxis: {
show: false
}
};
var plot = $.plot("#placeholder", dataset, options);
function update() {
plot.setData(dataset);
plot.draw();
setTimeout(update, updateInterval);
}
update();
});
$(function() {
var updateInterval = 1000;
var dataset = [{
label: "line1",
data: data
}];
var options = {
series: {
shadowSize: 0 // Drawing is faster without shadows
},
yaxis: {
min: -50,
max: 50
},
xaxis: {
show: false
}
};
var plot = $.plot("#placeholder", dataset, options);
function update() {
var ajax_data = null;
$.ajax({
url: "test.html",
success: function(data){
ajax_data = data;
}
});
dataset = [{
label: "line1",
data: ajax_data
}];
plot.setData(dataset);
plot.draw();
setTimeout(update, updateInterval);
}
update();
});