add timingName option
[dygraphs.git] / tests / dygraph-many-points-benchmark.html
index b4f7471..d1e2a58 100644 (file)
@@ -16,6 +16,9 @@
   <body>
     <p>Plot which can be easily generated with different numbers of points for
        benchmarking/profiling and improving performance of dygraphs.</p>    
+    <p>Data to plot:
+      <input type="radio" name="plot_group1" value="sine" onclick="clickedRadioButton(this);" checked> sinusoid function
+      <input type="radio" name="plot_group1" value="rand" onclick="clickedRadioButton(this);"> random points <br></p>
     <p>Number of points:
        <input type="text" id="num_points_input" size="20"></p>
     <p>Number of series:
@@ -35,6 +38,7 @@
 
     <script type="text/javascript">
       var plot;
+      var dataType = "sine";
 
       var durations = [];
       updatePlot = function() {
           var x = xmin + delta * i;
           var elem = [ x ];
           for (var j = 0; j < numSeries; j++) {
-            var y = Math.sin(x + (j * adj));
+            var y;
+            if (dataType == "rand") {
+              y = Math.pow(Math.random() - Math.random(), 7);
+            } else {
+              y = Math.sin(x + (j * adj));
+            }
             elem.push(y);
           }
           data[i] = elem;
         }
         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};
+        var opts = {labels: labels, rollPeriod: rollPeriod, timingName: "x"};
         var millisecondss = [];
         for (var i = 0; i < repetitions; i++) {
           var start = new Date();
               "completed in " + (end2 - start2) + " milliseconds.";
         }
       };
+      
+      clickedRadioButton = function(radiobutton) {
+        dataType = radiobutton.value;
+      };
+        
 
       document.getElementById('num_points_input').value = '100';
       document.getElementById('num_series_input').value = '1';