X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=tests%2Fdygraph-many-points-benchmark.html;h=e276e06a1f9bf7e84141f09753f809edc37b7e70;hb=da2a028fc41e5573868358b3d9eda9826211d217;hp=7aadb191bfc2f2b67f689b1d5fd5d3ac2257830f;hpb=5b6d85fdd7b79dc62886a67a08fb9019c98f796c;p=dygraphs.git diff --git a/tests/dygraph-many-points-benchmark.html b/tests/dygraph-many-points-benchmark.html index 7aadb19..e276e06 100644 --- a/tests/dygraph-many-points-benchmark.html +++ b/tests/dygraph-many-points-benchmark.html @@ -1,16 +1,9 @@ - + Benchmarking for Plots with Many Points - - - + @@ -19,16 +12,24 @@

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 +44,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 +61,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 +79,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 +97,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 +106,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 +119,7 @@ } avg/=millisecondss.length; document.getElementById('message').innerHTML = - "Durations: " + millisecondss + " Average: " + avg; + "Durations: " + millisecondss + "
Average: " + avg; } if (durations.length > 0) { @@ -124,18 +139,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.