Exemple #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;
 }
    <div class="clear"></div>

    <div id="linechart" style="display: block; float: left; width:90%; margin-bottom: 20px;"></div>
    <div class="clear"></div>

    <div id="linechart2" style="display: block; float: left; width:90%; margin-bottom: 20px;"></div>
    <div class="clear"></div>

    <script type="text/javascript">
      // simplest example of rendering a highcharts chart using highroller
      <?php 
echo $linechart->renderChart();
?>
      <?php 
echo $linechart2->renderChart('mootools');
?>
      $(document).ready(function(){
        $("pre.htmlCode").snippet("html",{style: "the", showNum: false});
        $("pre.phpCode").snippet("php",{style: "the", showNum: false});
        $("pre.rawCode").snippet("php",{style: "the", showNum: true});
      })
    </script>

  </div>

  <!--  FOOTER -->
  <?php 
require_once 'footer.php';
?>
$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 -->
<div id="linechart" style="width: 64%;"></div>

<!-- HighRoller: renderChart() method generates new Highcarts object inside script tag -->
<script type="text/javascript">
  <?php 
echo $linechart->renderChart();
?>
</script>

<!--  FOOTER -->
<?php 
require_once 'footer.php';
?>

</body>
Exemple #4
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;
 }