Commit 61a13d10 authored by David Schnur's avatar David Schnur

Additional code & comments cleanup.

parent 492e97ea
......@@ -38,7 +38,7 @@
// Find the URL in the link right next to us, then fetch the data
var dataurl = button.siblings('a').attr('href');
var dataurl = button.siblings("a").attr("href");
function onDataReceived(series) {
......
......@@ -27,7 +27,7 @@
{ data: generate(2, 10, function (x) { return Math.tan(x);}), xaxis: 2, yaxis: 4 }
];
var plot = $.plot($("#placeholder"), data, {
var plot = $.plot("#placeholder", data, {
xaxes: [
{ position: 'bottom' },
{ position: 'top'}
......@@ -40,16 +40,17 @@
]
});
// now for each axis, create a div
// Create a div for each axis
$.each(plot.getAxes(), function (i, axis) {
if (!axis.show)
return;
var box = axis.box;
$('<div class="axisTarget" style="position:absolute;left:' + box.left + 'px;top:' + box.top + 'px;width:' + box.width + 'px;height:' + box.height + 'px"></div>')
.data('axis.direction', axis.direction)
.data('axis.n', axis.n)
$("<div class='axisTarget' style='position:absolute; left:" + box.left + "px; top:" + box.top + "px; width:" + box.width + "px; height:" + box.height + "px'></div>")
.data("axis.direction", axis.direction)
.data("axis.n", axis.n)
.css({ backgroundColor: "#f00", opacity: 0, cursor: "pointer" })
.appendTo(plot.getPlaceholder())
.hover(
......
This diff is collapsed.
This diff is collapsed.
......@@ -26,7 +26,7 @@
d3.push([i, Math.tan(i)]);
}
$.plot( $("#placeholder"), [
$.plot("#placeholder", [
{ label: "sin(x)", data: d1 },
{ label: "cos(x)", data: d2 },
{ label: "tan(x)", data: d3 }
......
......@@ -10,13 +10,16 @@
<script type="text/javascript">
$(function() {
var d1 = [];
for (var i = 0; i < 14; i += 0.5)
d1.push([i, Math.sin(i)]);
for (var i = 0; i < 14; i += 0.5) {
d1.push([i, Math.sin(i)]);
}
var d2 = [[0, 3], [4, 8], [8, 5], [9, 13]];
// a null signifies separate line segments
// A null signifies separate line segments
var d3 = [[0, 12], [7, 12], null, [7, 2.5], [12, 2.5]];
$.plot("#placeholder", [ d1, d2, d3 ]);
......
......@@ -14,7 +14,7 @@
var data = [ ["January", 10], ["February", 8], ["March", 4], ["April", 13], ["May", 17], ["June", 9] ];
$.plot($("#placeholder"), [ data ], {
$.plot("#placeholder", [ data ], {
series: {
bars: {
show: true,
......
......@@ -31,7 +31,7 @@
};
$.plot.image.loadDataImages(data, options, function () {
$.plot($("#placeholder"), data, options);
$.plot("#placeholder", data, options);
});
});
......
......@@ -19,7 +19,7 @@
cos.push([i, Math.cos(i)]);
}
var plot = $.plot($("#placeholder"), [
var plot = $.plot("#placeholder", [
{ data: sin, label: "sin(x)"},
{ data: cos, label: "cos(x)"}
], {
......
This diff is collapsed.
......@@ -64,9 +64,9 @@
}
});
var plot = $.plot($("#placeholder"), [ getRandomData() ], {
var plot = $.plot("#placeholder", [ getRandomData() ], {
series: {
shadowSize: 0 // drawing is faster without shadows
shadowSize: 0 // Drawing is faster without shadows
},
yaxis: {
min: 0,
......@@ -78,8 +78,11 @@
});
function update() {
plot.setData([ getRandomData() ]);
plot.setData([getRandomData()]);
// Since the axes don't change, we don't need to call plot.setupGrid()
plot.draw();
setTimeout(update, updateInterval);
}
......
......@@ -74,7 +74,7 @@
});
if (data.length > 0) {
$.plot($("#placeholder"), data, {
$.plot("#placeholder", data, {
yaxis: {
min: 0
},
......
......@@ -38,7 +38,7 @@
d6.push([i, Math.sqrt(2*i + Math.sin(i) + 5)]);
}
$.plot($("#placeholder"), [{
$.plot("#placeholder", [{
data: d1,
lines: { show: true, fill: true }
}, {
......
......@@ -33,7 +33,7 @@
steps = false;
function plotWithOptions() {
$.plot($("#placeholder"), [ d1, d2, d3 ], {
$.plot("#placeholder", [ d1, d2, d3 ], {
series: {
stack: stack,
lines: {
......
......@@ -33,7 +33,7 @@
{ data: generate(7, 1.1), points: { symbol: "cross" } }
];
$.plot($("#placeholder"), data, {
$.plot("#placeholder", data, {
series: {
points: {
show: true,
......
......@@ -18,7 +18,7 @@
}
function plotWithOptions(t) {
$.plot($("#placeholder"), [{
$.plot("#placeholder", [{
data: d1,
color: "rgb(30, 180, 20)",
threshold: {
......
......@@ -18,7 +18,7 @@
cos.push([i, Math.cos(i)]);
}
plot = $.plot($("#placeholder"), [
plot = $.plot("#placeholder", [
{ data: sin, label: "sin(x) = -0.00"},
{ data: cos, label: "cos(x) = -0.00" }
], {
......@@ -67,14 +67,16 @@
var series = dataset[i];
// find the nearest points, x-wise
// Find the nearest points, x-wise
for (j = 0; j < series.data.length; ++j) {
if (series.data[j][0] > pos.x) {
break;
}
}
// now interpolate
// Now Interpolate
var y,
p1 = series.data[j - 1],
p2 = series.data[j];
......
......@@ -63,9 +63,9 @@
}
};
var plot = $.plot($("#placeholder"), [d], options);
var plot = $.plot("#placeholder", [d], options);
var overview = $.plot($("#overview"), [d], {
var overview = $.plot("#overview", [d], {
series: {
lines: {
show: true,
......@@ -93,7 +93,7 @@
// do the zooming
plot = $.plot($("#placeholder"), [d], $.extend(true, {}, options, {
plot = $.plot("#placeholder", [d], $.extend(true, {}, options, {
xaxis: {
min: ranges.xaxis.from,
max: ranges.xaxis.to
......
......@@ -49,11 +49,11 @@
var startData = getData(0, 3 * Math.PI);
var plot = $.plot($("#placeholder"), startData, options);
var plot = $.plot("#placeholder", startData, options);
// setup overview
// Create the overview plot
var overview = $.plot($("#overview"), startData, {
var overview = $.plot("#overview", startData, {
legend: {
show: false
},
......@@ -96,7 +96,7 @@
// do the zooming
plot = $.plot($("#placeholder"), getData(ranges.xaxis.from, ranges.xaxis.to),
plot = $.plot("#placeholder", getData(ranges.xaxis.from, ranges.xaxis.to),
$.extend(true, {}, options, {
xaxis: { min: ranges.xaxis.from, max: ranges.xaxis.to },
yaxis: { min: ranges.yaxis.from, max: ranges.yaxis.to }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment