Exemplo n.º 1
0
 function generateAnalytics()
 {
     require_once JPATH_ROOT . DS . 'libraries/HighRoller/HighRoller.php';
     require_once JPATH_ROOT . DS . 'libraries/HighRoller/HighRollerSeriesData.php';
     require_once JPATH_ROOT . DS . 'libraries/HighRoller/HighRollerLineChart.php';
     require_once JPATH_ROOT . DS . 'libraries/HighRoller/HighRollerColumnChart.php';
     $validGroupType = JAnalytics::getGroupType();
     $analyticsGroupBy = JRequest::getVar('group_type', 'day');
     $analyticsGroupBy = !in_array($analyticsGroupBy, $validGroupType) ? 'day' : $analyticsGroupBy;
     $linechart = new HighRollerLineChart();
     $linechart->chart->renderTo = 'dashboard';
     $linechart->chart->type = 'area';
     //$linechart->tooltip->enabled = false;
     $linechart->yAxis = new StdClass();
     $linechart->xAxis = new StdClass();
     $linechart->yAxis->title = new StdClass();
     $linechart->yAxis->title->text = '';
     $linechart->yAxis->min = 0;
     $linechart->yAxis->labels = new StdClass();
     $linechart->xAxis->labels = new StdClass();
     $linechart->yAxis->labels->enabled = true;
     $linechart->xAxis->labels->enabled = true;
     $linechart->xAxis->categories = JAnalytics::getXAxisCategory($analyticsGroupBy);
     $linechart->legend = new StdClass();
     $linechart->credits = new StdClass();
     $linechart->legend->enabled = false;
     $linechart->credits->enabled = false;
     //$linechart->title->text = 'Line Chart';
     // Get the filter for log, default is all activities
     $filter = JRequest::getVar('filter', '0');
     if ($filter == '0') {
         $chartData1 = JAnalytics::get('', null, null, '', $analyticsGroupBy);
         $series1 = new HighRollerSeriesData();
         $series1->addName(JText::_('COM_ANALYTICS_LABEL_ACTIVITY'))->addData($chartData1)->addColor('#41A317');
         $linechart->addSeries($series1);
     }
     $chartData2 = JAnalytics::get(array('message.add'), null, null, '', $analyticsGroupBy);
     $series2 = new HighRollerSeriesData();
     $series2->addName(JText::_('COM_ANALYTICS_LABEL_NEW_POST'))->addData($chartData2)->addColor('#64E986');
     $linechart->addSeries($series2);
     $html = '<div id="dashboard"></div><script type="text/javascript">' . $linechart->renderChart() . '</script>';
     return $html;
 }
Exemplo n.º 2
0
 public function generateAnalytics($user)
 {
     require_once JPATH_ROOT . DS . 'libraries/HighRoller/HighRoller.php';
     require_once JPATH_ROOT . DS . 'libraries/HighRoller/HighRollerSeriesData.php';
     require_once JPATH_ROOT . DS . 'libraries/HighRoller/HighRollerLineChart.php';
     require_once JPATH_ROOT . DS . 'libraries/HighRoller/HighRollerColumnChart.php';
     $validGroupType = JAnalytics::getGroupType();
     $analyticsGroupBy = JRequest::getVar('group_type', 'day');
     $analyticsGroupBy = !in_array($analyticsGroupBy, $validGroupType) ? 'day' : $analyticsGroupBy;
     $chartData1 = JAnalytics::get('', $user->id, null, '', $analyticsGroupBy);
     $chartData2 = JAnalytics::get(array('message.like', 'comment.like'), $user->id, null, '', $analyticsGroupBy);
     $linechart = new HighRollerLineChart();
     $linechart->legend = new stdClass();
     $linechart->credits = new stdClass();
     $linechart->chart->renderTo = 'linechart';
     $linechart->chart->type = 'area';
     $linechart->yAxis = new stdClass();
     $linechart->yAxis->title = new stdClass();
     $linechart->yAxis->labels = new stdClass();
     $linechart->xAxis = new stdClass();
     $linechart->xAxis->title = new stdClass();
     $linechart->xAxis->labels = new stdClass();
     $linechart->yAxis->title->text = '';
     $linechart->yAxis->min = 0;
     $linechart->yAxis->labels->enabled = true;
     $linechart->xAxis->labels->enabled = true;
     $linechart->xAxis->categories = JAnalytics::getXAxisCategory($analyticsGroupBy);
     $linechart->legend->enabled = false;
     $linechart->credits->enabled = false;
     //$linechart->title->text = 'Line Chart';
     $series1 = new HighRollerSeriesData();
     $series1->addName('Activity')->addData($chartData1)->addColor('#82CAFA');
     $series2 = new HighRollerSeriesData();
     $series2->addName('Comments/Like')->addData($chartData2)->addColor('#6698FF');
     $linechart->addSeries($series1);
     $linechart->addSeries($series2);
     $html = '<div id="linechart" style="height:160px"></div><script type="text/javascript">' . $linechart->renderChart() . '</script>';
     return $html;
 }