X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=tests%2Fdygraph-many-points-benchmark.html;h=3dfe4bbf37fd3470a163023166b6460b9541215e;hb=3f50dabbb12935605812184bfdd4a1485b1b9530;hp=7d887b94ced90c97b1e3d0cea6834833f2f77c47;hpb=3044a6bd1d26486af684a833a1de84be9dd7c2a9;p=dygraphs.git diff --git a/tests/dygraph-many-points-benchmark.html b/tests/dygraph-many-points-benchmark.html index 7d887b9..3dfe4bb 100644 --- a/tests/dygraph-many-points-benchmark.html +++ b/tests/dygraph-many-points-benchmark.html @@ -19,10 +19,18 @@
Data to plot:
sinusoid function
+ onclick="setDataType(this);" checked> sinusoid function
random points
Number of points (points):
+ onclick="setDataType(this);"> random points
Timestamps: + aligned + unaligned +
+x-axis type: + numeric + date/time +
+Number of points per series (points):
Number of series (series):
@@ -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 + "