X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=tests%2Fdygraph-many-points-benchmark.html;h=5f98755a45ab288b519bfbb2ce6ac92fa5b4d3fe;hb=cf61aeb77cda5e2638b1f00588dcd90394afd24c;hp=7aadb191bfc2f2b67f689b1d5fd5d3ac2257830f;hpb=2996a18eb00729b2624d8d75e8d24b056c5732bc;p=dygraphs.git
diff --git a/tests/dygraph-many-points-benchmark.html b/tests/dygraph-many-points-benchmark.html
index 7aadb19..5f98755 100644
--- a/tests/dygraph-many-points-benchmark.html
+++ b/tests/dygraph-many-points-benchmark.html
@@ -1,16 +1,13 @@
-
@@ -43,12 +48,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 +65,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 +83,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 +101,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 +110,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 +123,7 @@
}
avg/=millisecondss.length;
document.getElementById('message').innerHTML =
- "Durations: " + millisecondss + " Average: " + avg;
+ "Durations: " + millisecondss + "