From: Dan Vanderkam
Timestamps: - aligned - unaligned
+ aligned + unaligned + +x-axis type: + numeric + date/time
Number of points per series (points):
Number of series (series):
@@ -49,12 +51,14 @@
var metrics = null;
var dataType = "sine";
var timestamps = "aligned";
+ var numRuns = 0;
var durations = [];
updatePlot = function() {
document.getElementById('message').innerHTML = "";
var plotDiv = document.getElementById('plot');
plotDiv.innerHTML = 'Redrawing...';
+ var numeric = document.getElementById('numeric').checked;
var numPoints =
parseInt(document.getElementById('points').value);
var numSeries =
@@ -63,8 +67,8 @@
parseInt(document.getElementById('repetitions').value);
var data = [];
- var xmin = 0.0;
- var xmax = 2.0 * Math.PI;
+ var xmin = numeric ? 0.0 : Date.parse("2014/01/01");
+ var xmax = numeric ? 2.0 * Math.PI : Date.parse("2014/12/31");
var adj = .5;
var delta = (xmax - xmin) / (numPoints - 1);
var unalignmentDelta = delta / numSeries;
@@ -90,6 +94,7 @@
data[i*numSeries + j] = elemCopy;
}
}
+ if (!numeric) data[i][0] = new Date(data[i][0]);
}
var labels = [ "x" ];
for (var j = 0; j < numSeries; j++) {
@@ -106,7 +111,7 @@
var start = new Date();
graph = new Dygraph(plotDiv, data, opts);
var end = new Date();
- durations.push([start, end - start]);
+ durations.push([numRuns++, end - start]);
millisecondss.push(end - start);
}
if (repetitions == 1) {
@@ -119,7 +124,7 @@
}
avg/=millisecondss.length;
document.getElementById('message').innerHTML =
- "Durations: " + millisecondss + " Average: " + avg;
+ "Durations: " + millisecondss + "
Average: " + avg;
}
if (durations.length > 0) {