From: Dan Vanderkam Date: Fri, 31 Oct 2014 17:00:17 +0000 (-0400) Subject: add date/time axis option to benchmark X-Git-Tag: v1.1.0~37 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=4c9d65daaebf789ad643a085b754b026cef05ac4;p=dygraphs.git add date/time axis option to benchmark --- diff --git a/tests/dygraph-many-points-benchmark.html b/tests/dygraph-many-points-benchmark.html index 17dadcd..9fc0f81 100644 --- a/tests/dygraph-many-points-benchmark.html +++ b/tests/dygraph-many-points-benchmark.html @@ -23,10 +23,12 @@ random points

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) {