X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=tests%2Fdygraph-many-points-benchmark.html;h=3525e93317be8af25f144fa2cccddd5c083656fc;hb=c1f22b5a5d4ffbf25a75fc567232e65381c1938b;hp=38995520b0f512efb96ab6a790781212346849d4;hpb=a058247dbb5f8a765119e2abba3fb25d90d1ab4f;p=dygraphs.git diff --git a/tests/dygraph-many-points-benchmark.html b/tests/dygraph-many-points-benchmark.html index 3899552..3525e93 100644 --- a/tests/dygraph-many-points-benchmark.html +++ b/tests/dygraph-many-points-benchmark.html @@ -17,14 +17,16 @@

Plot which can be easily generated with different numbers of points for benchmarking/profiling and improving performance of dygraphs.

Data to plot: - sinusoid function - random points

+ sinusoid function + random points

Number of points: -

+

Number of series: -

+

Roll period (in points): -

+

Repetitions:

@@ -46,9 +48,9 @@ var plotDiv = document.getElementById('plot'); plotDiv.innerHTML = 'Redrawing...'; var numPoints = - parseInt(document.getElementById('num_points_input').value); + parseInt(document.getElementById('points').value); var numSeries = - parseInt(document.getElementById('num_series_input').value); + parseInt(document.getElementById('series').value); var repetitions = parseInt(document.getElementById('repetitions').value); @@ -64,7 +66,7 @@ for (var j = 0; j < numSeries; j++) { var y; if (dataType == "rand") { - y = Math.random() * 2 - 1; + y = Math.pow(Math.random() - Math.random(), 7); } else { y = Math.sin(x + (j * adj)); } @@ -74,11 +76,11 @@ } var labels = [ "x" ]; for (var j = 0; j < numSeries; j++) { - labels.push("sin(x + " + (j*adj) + ")"); + labels.push("data-set-" + j); } var rollPeriod = parseInt( - document.getElementById('roll_period_input').value); - var opts = {labels: labels, rollPeriod: rollPeriod}; + document.getElementById('rollPeriod').value); + var opts = {labels: labels, rollPeriod: rollPeriod, timingName: "x"}; var millisecondss = []; for (var i = 0; i < repetitions; i++) { var start = new Date(); @@ -118,12 +120,48 @@ clickedRadioButton = function(radiobutton) { dataType = radiobutton.value; }; - - document.getElementById('num_points_input').value = '100'; - document.getElementById('num_series_input').value = '1'; - document.getElementById('roll_period_input').value = '1'; - document.getElementById('repetitions').value = '1'; + var values = { + points: 100, + series: 1, + rollPeriod: 1, + repetitions: 1, + type: 'sine' + }; + + // Parse the URL for parameters. Use it to override the values hash. + var href = window.location.href; + var qmindex = href.indexOf('?'); + if (qmindex > 0) { + var entries = href.substr(qmindex + 1).split('&'); + for (var idx = 0; idx < entries.length; idx++) { + var entry = entries[idx]; + var eindex = entry.indexOf('='); + if (eindex > 0) { + values[entry.substr(0, eindex)] = entry.substr(eindex + 1); + } + } + } + + var populate = function(name) { + document.getElementById(name).value = values[name]; + } + + var populateRadio = function(name) { + var val = values[name]; + var elem = document.getElementById(val); + elem.checked = true; + elem.onclick(); + } + + populate('points'); + populate('series'); + populate('rollPeriod'); + populate('repetitions'); + populateRadio('type'); + if (values["go"]) { + updatePlot(); + }