Ejemplo n.º 1
0
 /**
  * @param Response $response
  * @param ProfilerLog $result
  * @throws Exception
  */
 protected function plot_charts(Response $response, ProfilerLog $result)
 {
     CanvasJS::init_canvasJS_header($response);
     $chart = new TimeFractionChart();
     $chart->set_title("Fractions of Time");
     $chart->set_canvas_css_style("height: 300px; width: 450px; float: left; clear: both");
     $chart->load_data($result->getFractionsData());
     $chart->write($response);
     $chart = new ProgressChart();
     $script_data = $result->getScriptData();
     $chart->set_title("Processes over Time");
     $chart->set_canvas_css_style("height: 300px; width: 100%; float: right;");
     $chart->append_properties(['axisX' => ['maximum' => $script_data['duration']]]);
     $chart->load_data($result->getProcData());
     $chart->write($response);
     $chart = new StackedBarChartDup();
     $duplicate_proc_data = $result->getDuplicateProcData();
     if (count($duplicate_proc_data) > 0) {
         $height = 20 * (6 + count($duplicate_proc_data->getAllValuesX()));
         $maxY = $duplicate_proc_data->getAllDataPoints()->getMaxY();
         $chart->set_title("Redundant Processes");
         $chart->set_canvas_css_style("height: {$height}px; min-width: 100%; float: left;");
         $chart->append_properties(['axisY2' => ['maximum' => 1.1 * $maxY]]);
         $chart->load_data($duplicate_proc_data);
         $chart->write($response);
     }
     $chart = new StackedBarChart();
     $sql_data = $result->getSqlData();
     $height = 20 * (6 + count($sql_data->getAllValuesX()));
     $maxY = $sql_data->getAllDataPoints()->getMaxY();
     $chart->set_title("SQL-Selects by Table and Row Count");
     $chart->set_canvas_css_style("height: {$height}px; min-width: 100%; float: left;");
     $chart->append_properties(['axisY2' => ['maximum' => 1.1 * $maxY]]);
     $chart->load_data($sql_data);
     $chart->write($response);
 }