X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=tests%2Fdygraph-many-points-benchmark.html;h=3dfe4bbf37fd3470a163023166b6460b9541215e;hb=3f50dabbb12935605812184bfdd4a1485b1b9530;hp=7aadb191bfc2f2b67f689b1d5fd5d3ac2257830f;hpb=5ecfa608e40388b085a022508282f8b1c0333f0d;p=dygraphs.git
diff --git a/tests/dygraph-many-points-benchmark.html b/tests/dygraph-many-points-benchmark.html
index 7aadb19..3dfe4bb 100644
--- a/tests/dygraph-many-points-benchmark.html
+++ b/tests/dygraph-many-points-benchmark.html
@@ -19,16 +19,24 @@
@@ -43,12 +51,15 @@
var graph = null;
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 =
@@ -57,10 +68,11 @@
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;
for (var i = 0; i < numPoints; ++i) {
var x = xmin + delta * i;
@@ -74,7 +86,16 @@
}
elem.push(y);
}
- data[i] = elem;
+ if (timestamps == "aligned") {
+ data[i] = elem;
+ } else {
+ for (var j = 0; j < numSeries; j++) {
+ var elemCopy = elem.slice(0);
+ elemCopy[0] += unalignmentDelta * j;
+ 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++) {
@@ -83,6 +104,7 @@
var rollPeriod = parseInt(
document.getElementById('rollPeriod').value);
var opts = {labels: labels, rollPeriod: rollPeriod, timingName: "x"};
+ opts['fillGraph'] = document.getElementById('fill').checked;
var millisecondss = [];
for (var i = 0; i < repetitions; i++) {
if (graph != null) {
@@ -91,7 +113,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) {
@@ -104,7 +126,7 @@
}
avg/=millisecondss.length;
document.getElementById('message').innerHTML =
- "Durations: " + millisecondss + " Average: " + avg;
+ "Durations: " + millisecondss + "