示例#1
0
文件: os.php 项目: Doluci/tomatocart
 function renderData()
 {
     global $osC_Language;
     include 'includes/classes/piwik.php';
     include 'includes/classes/flash_pie.php';
     $end_date = date("Y-m-d");
     $start_date = date("Y-m-d", strtotime('-2 weeks'));
     $toC_Piwik = new toC_Piwik();
     $os_data = $toC_Piwik->getOS($start_date, $end_date, 'day');
     $pie_chart = new toC_Flash_Pie('', '80', '');
     $pie_chart->setData($os_data);
     $pie_chart->render();
 }
示例#2
0
 function renderData()
 {
     global $osC_Language;
     include 'includes/classes/piwik.php';
     include 'includes/classes/flash_pie.php';
     $end_date = date("Y-m-d");
     $start_date = date("Y-m-d", strtotime('-2 weeks'));
     $toC_Piwik = new toC_Piwik();
     $country_data = $toC_Piwik->getUserCountry($start_date, $end_date, 'day');
     $data = array();
     foreach ($country_data as $key => $value) {
         $data += array($value['nb_label'] => $value['nb_visits']);
     }
     arsort($data);
     $pie_chart = new toC_Flash_Pie('', '80', '');
     $pie_chart->setData($data);
     $pie_chart->render();
 }
示例#3
0
 function renderContinentPieChartData()
 {
     $start_date = isset($_REQUEST['start_date']) && !empty($_REQUEST['start_date']) ? $_REQUEST['start_date'] : null;
     $end_date = isset($_REQUEST['end_date']) && !empty($_REQUEST['end_date']) ? $_REQUEST['end_date'] : null;
     $period = isset($_REQUEST['period']) && !empty($_REQUEST['period']) ? $_REQUEST['period'] : 'week';
     $toC_Piwik = new toC_Piwik();
     $continents = $toC_Piwik->getData('continent', $start_date, $end_date, $period);
     $sum = 0;
     foreach ($continents as $key => $continent) {
         $sum += $continent['nb_visits'];
     }
     $others = 0;
     $data = array();
     foreach ($continents as $key => $continent) {
         if ($continent['nb_visits'] * 100 / $sum <= 5) {
             $others = $others + $continent['nb_visits'];
         } else {
             $data = $data + array($continent['nb_label'] => $continent['nb_visits']);
         }
     }
     if ($others > 0) {
         $data = $data + array('Others' => $others);
     }
     arsort($data);
     $chart = new toC_Flash_Pie();
     $chart->setData($data);
     $chart->render();
     //      var_dump($data);
 }
 function render()
 {
     global $osC_Language;
     $pie_chart = new toC_Flash_Pie('', null, null, '{display:none}');
     $pie_chart->setData($this->data);
     $pie_chart->setWidth(120);
     $pie_chart->setHeight(120);
     if (is_array($this->data) && sizeof($this->data) > 0) {
         echo '<span style="float:left;">';
         echo $pie_chart->render();
         echo '</span>';
         echo '<span style="float:left;padding-left:20px;padding-top:10px;line-height:30px">';
         $i = 0;
         foreach ($this->data as $label => $value) {
             echo '<font style="background-color:' . $pie_chart->pie_slice_colours[$i % 12] . '">&nbsp;&nbsp;</font>&nbsp;' . $label . '<br/>';
             $i++;
         }
         echo '</span>';
     }
 }