Sha256: a77607f607d94856faafb7b69b49e39c3a77c028fa3b50c850a8a94af0972cae

Contents?: true

Size: 1.95 KB

Versions: 7

Compression:

Stored size: 1.95 KB

Contents

<?php
  $allBenchmarks = $GLOBALS["current_benchmarks"];
  $b = $allBenchmarks[0];

  $xaxes = implode(array("Old","New"),"|");
  $yaxes = implode(array("Fast","Average","Slow"),"|");

  $allAxes = array();
  if ($b->getXaxesNames() != null)
  {
    $allAxes[] = "0:|". implode($b->getXaxesNames(),"|");  
  }
  if ($b->getYaxesNames() != null)
  {
    $allAxes[] = "2:|" . implode($b->getYaxesNames(),"|");  
  }
  $axes_param = implode($allAxes,'|');
  
  $graph_lines = implode($b->getGraphLines(),",");
  $allColours = Benchmark::nextColours(count($allBenchmarks));
  $colours_param = implode($allColours,",");
  
  $legends = implode(array_map(function($b) { return $b->getLegend(); }, $allBenchmarks),"|");
  $lineWidths = implode(array_map(function($b) { return $b->getLineWidth(); }, $allBenchmarks),"|");
  $points = "t:" . implode(array_map(function($b) { return implode($b->getPoints(),","); }, $allBenchmarks),"|");
  // $points = "e:" . implode(array_map(function($b) { return $b->googleChartPoints(); }, $allBenchmarks),",");
  $points_size = array_map(function($b) { return $b->numberOfPoints(); }, $allBenchmarks);
  
  $allMarkers = array();
  foreach ($allBenchmarks as $index => $bench)
  {
    $allMarkers[] = "o,{$allColours[$index]},$index,-1,{$bench->numberOfPoints()}";
  }
  $marker_param = implode($allMarkers,"|");
  $max = Benchmark::maxWithBuffer($allBenchmarks,0.1);
  
  $data = array(
      "chxl={$axes_param}"
    , "chxr=1,0,$max"
    , "chds=0,$max"
    , "chxt=x,y,y"
    , "chs={$b->getWidth()}x{$b->getHeight()}"
    , "cht=lc"
    , "chco={$colours_param}"
    , "chg={$graph_lines}"
    , "chd={$points}"
    , "chdl={$legends}"
    , "chls={$lineWidths}"
    , "chm={$marker_param}"
    , "chtt={$b->getTitle()}"
  );
  
  $output = implode($data,"&");   
?>  
  <img class="graph" src="http://chart.apis.google.com/chart?<?php echo $output ?>" width="<?php echo $b->getWidth() ?>" height="<?php echo $b->getHeight() ?>" alt="<?php echo $b->getTitle() ?>" />

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
appstats-0.25.1 doc/benchmarks/show.html.php
appstats-0.25.0 doc/benchmarks/show.html.php
appstats-0.24.0 doc/benchmarks/show.html.php
appstats-0.23.5 doc/benchmarks/show.html.php
appstats-0.23.4 doc/benchmarks/show.html.php
appstats-0.23.3 doc/benchmarks/show.html.php
appstats-0.23.2 doc/benchmarks/show.html.php