Exemplo n.º 1
0
 /**
  * @param string $keyname
  * @param string $type
  * @param string $xtitle
  * @param string $ytitle
  */
 public function lfGetGraphBar($arrResults, $keyname, $type, $xtitle, $ytitle, $sdate, $edate)
 {
     $ret_path = '';
     // 結果が0行以上ある場合のみグラフを生成する。
     if (count($arrResults) > 0 && $this->install_GD) {
         // グラフの生成
         $arrList = Utils::sfArrKeyValue($arrResults, $keyname, 'total', GRAPH_PIE_MAX, GRAPH_LABEL_MAX);
         // 一時ファイル名の取得
         $pngname = $this->lfGetGraphPng($type);
         $path = GRAPH_REALDIR . $pngname;
         /* @var $objGraphBar BarGraph */
         $objGraphBar = Application::alias('eccube.graph.bar');
         foreach ($arrList as $key => $value) {
             $arrKey[] = preg_replace('/~/u', '-', $key);
         }
         // グラフ描画
         $objGraphBar->setXLabel($arrKey);
         $objGraphBar->setXTitle($xtitle);
         $objGraphBar->setYTitle($ytitle);
         $objGraphBar->setData($arrList);
         // メインタイトル作成
         $arrKey = array_keys($arrList);
         list($sy, $sm, $sd) = preg_split('|[/ ]|', $sdate);
         list($ey, $em, $ed) = preg_split('|[/ ]|', $edate);
         $start_date = $sy . '年' . $sm . '月' . $sd . '日';
         $end_date = $ey . '年' . $em . '月' . $ed . '日';
         $objGraphBar->drawTitle('集計期間:' . $start_date . ' - ' . $end_date);
         $objGraphBar->drawGraph();
         if (DRAW_IMAGE) {
             $objGraphBar->outputGraph();
             Application::alias('eccube.response')->actionExit();
         }
         // ファイルパスを返す
         $ret_path = GRAPH_URLPATH . $pngname;
     }
     return $ret_path;
 }