From: Adam Vartanian Date: Tue, 7 Aug 2012 19:34:30 +0000 (-0400) Subject: Add option to many-points-benchmark that unaligns timestamps X-Git-Tag: v1.0.0~204^2 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=0a14b0f9fbe3e97e0163b4e6ad7893e49d3bf2ff;p=dygraphs.git Add option to many-points-benchmark that unaligns timestamps --- diff --git a/tests/dygraph-many-points-benchmark.html b/tests/dygraph-many-points-benchmark.html index 7d887b9..09c89a6 100644 --- a/tests/dygraph-many-points-benchmark.html +++ b/tests/dygraph-many-points-benchmark.html @@ -19,10 +19,15 @@

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

+

Number of points per series (points):

Number of series (series):

@@ -43,6 +48,7 @@ var graph = null; var metrics = null; var dataType = "sine"; + var timestamps = "aligned"; var durations = []; updatePlot = function() { @@ -61,6 +67,7 @@ var xmax = 2.0 * Math.PI; 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 +81,15 @@ } 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; + } + } } var labels = [ "x" ]; for (var j = 0; j < numSeries; j++) { @@ -128,9 +143,12 @@ return millisecondss; }; - clickedRadioButton = function(radiobutton) { + setDataType = function(radiobutton) { dataType = radiobutton.value; }; + setTimestampType = function(radiobutton) { + timestamps = radiobutton.value; + }; var values = { points: 100,