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; }
$linechart->yAxis->min = 0; $linechart->yAxis->maxPadding = 0.2; $linechart->yAxis->endOnTick = true; $linechart->yAxis->minorGridLineWidth = 0; $linechart->yAxis->minorTickInterval = 'auto'; $linechart->yAxis->minorTickLength = 1; $linechart->yAxis->tickLength = 2; $linechart->yAxis->minorTickWidth = 1; $linechart->yAxis->title->text = 'Pageviews'; $linechart->yAxis->title->align = 'high'; $linechart->yAxis->title->style->font = '14px Metrophobic, Arial, sans-serif'; $linechart->yAxis->title->rotation = 0; $linechart->yAxis->title->x = 60; $linechart->yAxis->title->y = -10; $linechart->yAxis->plotLines = array(array('color' => '#808080', 'width' => 1, 'value' => 0)); $linechart->addSeries($series1); $linechart->addSeries($series2); $linechart->addSeries($series3); $linechart->enableAutoStep(); ?> <head> <!-- jQuery 1.6.1 --> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script> <!-- HighRoller: set the location of Highcharts library --> <?php echo HighRoller::setHighChartsLocation("_assets/highcharts/highcharts.js"); echo HighRoller::setHighChartsThemeLocation("_assets/highcharts/themes/highroller.js"); ?> </head>
// HighRoller: include class files require_once '_assets/HighRoller/HighRoller.php'; require_once '_assets/HighRoller/HighRollerSeriesData.php'; require_once '_assets/HighRoller/HighRollerLineChart.php'; // HighRoller: sample data $chartData = array(5324, 7534, 6234, 7234, 8251, 10324); // HighRoller: create a new line chart object and modify some basic properties $linechart = new HighRollerLineChart(); $linechart->chart->renderTo = 'linechart'; $linechart->title->text = 'Line Chart'; $linechart->yAxis->title->text = 'Total'; // HighRoller: create new series data object and hydrate with precious data $series1 = new HighRollerSeriesData(); $series1->addName('myData')->addData($chartData); // HighRoller: add series data object to chart object $linechart->addSeries($series1); ?> <head> <!-- jQuery 1.6.1 --> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script> <!-- HighRoller: set the location of Highcharts library --> <?php echo HighRoller::setHighChartsLocation("_assets/highcharts/highcharts.js"); ?> </head> <body> <!-- HighRoller: linechart div container -->
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; }