Example #1
0
 private function _generateBestFetchersGraph()
 {
     $graph = new Graph();
     $graph->setMargin(100);
     $query = "\n\t\t\tSELECT\n\t\t\t\tname label,\n\t\t\t\tnum_added value\n\t\t\tFROM\n\t\t\t\tlogins\n\t\t\tORDER BY\n\t\t\t\tvalue DESC\n\t\t\tLIMIT 50\n\t\t\t";
     $data = $this->_db->execute($query)->getArray();
     $graph->setData($data);
     $graph->saveTo('r/d/best-fetchers.png');
 }
Example #2
0
 public function actionBar($id = -1)
 {
     include 'jpgraph/jpgraph.php';
     include 'jpgraph/jpgraph_bar.php';
     $data = $this->analyse($id);
     $ydata = array();
     $xdata = array();
     foreach ($data as $key => $value) {
         array_push($xdata, $key);
         array_push($ydata, $value);
     }
     if (count($data) == 0) {
         echo '近一个习惯起没有相应的反馈级记录';
         die;
     }
     $graph = new Graph(500, 500, 'auto');
     $graph->setScale("textint");
     $graph->setMargin(100, 100, 100, 100);
     $graph->xaxis->SetTickLabels($xdata);
     $barplot = new BarPlot($ydata);
     // $barplot->setFillColor(array('red','blue','green'));
     $barplot->setcolor("orange");
     $graph->Add($barplot);
     $barplot->value->Show();
     $graph->Stroke();
 }