X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=tests%2Fdygraph-many-points-benchmark.html;h=9fc0f81a89fc92d569286983599962f62e7f646b;hb=e03f3a93d45459a9748050d1d38149494975b3d9;hp=7aadb191bfc2f2b67f689b1d5fd5d3ac2257830f;hpb=e26b71566419e1c051f3fbd1f4f8f64b063a04c9;p=dygraphs.git diff --git a/tests/dygraph-many-points-benchmark.html b/tests/dygraph-many-points-benchmark.html index 7aadb19..9fc0f81 100644 --- a/tests/dygraph-many-points-benchmark.html +++ b/tests/dygraph-many-points-benchmark.html @@ -19,16 +19,23 @@

Data to plot: sinusoid function + onclick="setDataType(this);" checked> sinusoid function random points

-

Number of points: + onclick="setDataType(this);"> random points

+

Timestamps: + aligned + unaligned +

+

x-axis type: + numeric + date/time +

Number of points per series (points):

-

Number of series: +

Number of series (series):

-

Roll period (in points): +

Roll period (in points, rollPeriod):

-

Repetitions: +

Repetitions (repititions):

@@ -43,12 +50,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 +67,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 +85,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++) { @@ -91,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) { @@ -104,7 +124,7 @@ } avg/=millisecondss.length; document.getElementById('message').innerHTML = - "Durations: " + millisecondss + " Average: " + avg; + "Durations: " + millisecondss + "
Average: " + avg; } if (durations.length > 0) { @@ -124,18 +144,23 @@ document.getElementById("metaperformance").innerHTML = "completed in " + (end2 - start2) + " milliseconds."; } + + return millisecondss; }; - clickedRadioButton = function(radiobutton) { + setDataType = function(radiobutton) { dataType = radiobutton.value; }; + setTimestampType = function(radiobutton) { + timestamps = radiobutton.value; + }; var values = { points: 100, series: 1, rollPeriod: 1, repetitions: 1, - type: 'sine', + type: 'sine' }; // Parse the URL for parameters. Use it to override the values hash.