Exemple #1
0
 public function actionShow()
 {
     $id = $_GET['id'];
     $tongjiData = new TongjiData();
     $one = $tongjiData->findByPk($id);
     if (!$one) {
         throw new CHttpException(404, '暂无数据,数据错误');
     }
     $datas = $tongjiData->getOldDatas(7, $one);
     foreach ($datas as $data) {
         $categories[] = $data['searchtime'];
         $values[] = (int) $data['ranking'];
     }
     $jsonArray = array('title' => array('text' => '七天内折线图', 'x' => -20), 'xAxis' => array('categories' => $categories), 'yAxis' => array('title' => array('text' => '应用排行'), 'plotLines' => array(array('value' => 0, 'width' => 1, 'color' => '#808080'))), 'legend' => array('layout' => 'vertical', 'align' => 'right', 'verticalAlign' => 'middle', 'borderWidth' => 0), 'series' => array(array('name' => $one['title'], 'data' => $values)));
     $this->render('show', array('jsonArray' => $jsonArray));
 }