/**
  * load jsapi
  */
 private function initChart()
 {
     self::$_first = false;
     $output = '';
     // start a code block
     /*$output .= '<script type="text/javascript" src="https://www.google.com/jsapi"></script>'."\n";*/
     $output .= '<script type="text/javascript">google.load(\'visualization\', \'1.0\', {\'packages\':[\'corechart\']});</script>' . "\n";
     return $output;
 }
	@build			16th August, 2016
	@created		15th June, 2012
	@package		Cost Benefit Projection
	@subpackage		default_chart_intervention_cost_benefit.php
	@author			Llewellyn van der Merwe <http://www.vdm.io>	
	@owner			Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb
	@copyright		Copyright (C) 2015. All Rights Reserved
	@license		GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
	
/-------------------------------------------------------------------------------------------------------/
	Cost Benefit Projection Tool.
/------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// load chart builder
$chart = new Chartbuilder('BarChart');
$scaled = array('unscaled', 'scaled');
if (isset($this->results->interventions) && CostbenefitprojectionHelper::checkArray($this->results->interventions)) {
    $intervention_number = 0;
    foreach ($this->results->interventions as $intervention) {
        if (isset($intervention->items)) {
            foreach ($scaled as $scale) {
                $i = 0;
                $rowArray = array();
                if (is_array($intervention->items) || is_object($intervention->items)) {
                    foreach ($intervention->items as $key => &$item) {
                        $rowArray[] = array('c' => array(array('v' => $item->name), array('v' => round($item->{'cost_of_problem_' . $scale}), 'f' => $item->{'costmoney_of_problem_' . $scale}), array('v' => $item->cost, 'f' => $item->costmoney), array('v' => $item->{'benefit_' . $scale}, 'f' => $item->{'benefitmoney_' . $scale}), array('v' => $item->{'net_benefit_' . $scale}, 'f' => $item->{'net_benefitmoney_' . $scale})));
                        $i++;
                    }
                }
                usort($rowArray, function ($b, $a) {
	@build			16th August, 2016
	@created		15th June, 2012
	@package		Cost Benefit Projection
	@subpackage		default_chart_intervention_cost_benefit_public.php
	@author			Llewellyn van der Merwe <http://www.vdm.io>	
	@owner			Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb
	@copyright		Copyright (C) 2015. All Rights Reserved
	@license		GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
	
/-------------------------------------------------------------------------------------------------------/
	Cost Benefit Projection Tool.
/------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// load chart builder
$chart = new Chartbuilder('BarChart');
if (isset($this->results->interventions) && CostbenefitprojectionHelper::checkArray($this->results->interventions)) {
    $intervention_number = 0;
    foreach ($this->results->interventions as $intervention) {
        if (isset($intervention->items)) {
            $i = 0;
            $rowArray = array();
            if (is_array($intervention->items) || is_object($intervention->items)) {
                foreach ($intervention->items as $key => &$item) {
                    $rowArray[] = array('c' => array(array('v' => $item->name), array('v' => round($item->cost_of_problem_unscaled), 'f' => $item->costmoney_of_problem_unscaled), array('v' => $item->cost, 'f' => $item->costmoney), array('v' => $item->benefit_unscaled, 'f' => $item->benefitmoney_unscaled), array('v' => $item->net_benefit_unscaled, 'f' => $item->net_benefitmoney_unscaled)));
                    $i++;
                }
            }
            usort($rowArray, function ($b, $a) {
                return $a['c'][3]['v'] - $b['c'][3]['v'];
            });
        }
        $head .= '>' . $header . '</th>';
    }
    $causesrisks .= '<table class="footable metro-blue toggle-circle" data-page-size="10"><thead><tr>' . $head . '</li></tr></thead><tbody>' . $body . '</tbody><tfoot class="hide-if-no-paging"><tr><td colspan="4"><div class="pagination pagination-centered"></div></td></tr></tfoot></table>';
}
// setup the age groups display
$agepercents = '<div class="uk-panel uk-width-1-1"><div class="uk-alert">' . JText::_('COM_COSTBENEFITPROJECTION_NO_AGE_GROUPS_HAS_BEEN_SET') . '</div></div>';
$agepercents_numbers = '<div class="uk-panel uk-width-1-1"><div class="uk-alert">' . JText::_('COM_COSTBENEFITPROJECTION_NO_AGE_GROUPS_HAS_BEEN_SET') . '</div></div>';
$genderArray = array('male', 'female');
// loading option var
$both = 0;
foreach ($genderArray as $gender) {
    // setup the related gender age groups
    if (isset($displayData->{'percent' . $gender}) && CostbenefitprojectionHelper::checkString($displayData->{'percent' . $gender})) {
        // load chart builder
        $chart = new Chartbuilder('PieChart');
        $i = 0;
        $data = array();
        $rowArray = array();
        $rowArray_numbers = array();
        $dataset = json_decode($displayData->{'percent' . $gender});
        foreach ($dataset as $key => &$set) {
            if ('age' == $key) {
                $type = 'string';
                $percent = false;
            } else {
                $type = 'number';
                $percent = true;
            }
            // set header
            $data['cols'][$i] = array('id' => '', 'lable' => CostbenefitprojectionHelper::safeString($key, 'Ww'), 'type' => $type);
	@build			16th August, 2016
	@created		15th June, 2012
	@package		Cost Benefit Projection
	@subpackage		default_chart_cost_percent.php
	@author			Llewellyn van der Merwe <http://www.vdm.io>	
	@owner			Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb
	@copyright		Copyright (C) 2015. All Rights Reserved
	@license		GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
	
/-------------------------------------------------------------------------------------------------------/
	Cost Benefit Projection Tool.
/------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// load chart builder
$chart = new Chartbuilder('BarChart');
// set scaled array
$scaled = array('unscaled', 'scaled');
// check if items are set
if (isset($this->results->items) && CostbenefitprojectionHelper::checkObject($this->results->items)) {
    foreach ($scaled as $scale) {
        $i = 0;
        $rowArray = array();
        foreach ($this->results->items as $key => &$item) {
            $rowArray[] = array('c' => array(array('v' => $item->details->name), array('v' => round($item->{'subtotal_cost_' . $scale} / $this->results->totals->{'total_cost_' . $scale} * 100), 'f' => (double) round($item->{'subtotal_cost_' . $scale} / $this->results->totals->{'total_cost_' . $scale} * 100, 3) . '%')));
            $i++;
        }
        usort($rowArray, function ($b, $a) {
            return $a['c'][1]['v'] - $b['c'][1]['v'];
        });
        $data = array('cols' => array(array('id' => '', 'label' => JText::_('COM_COSTBENEFITPROJECTION_CAUSERISK_FACTOR'), 'type' => 'string'), array('id' => '', 'label' => JText::_('COM_COSTBENEFITPROJECTION_PERCENT_OF_TOTAL_COST'), 'type' => 'number')), 'rows' => $rowArray);
	@build			16th August, 2016
	@created		15th June, 2012
	@package		Cost Benefit Projection
	@subpackage		default_chart_cost_public.php
	@author			Llewellyn van der Merwe <http://www.vdm.io>	
	@owner			Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb
	@copyright		Copyright (C) 2015. All Rights Reserved
	@license		GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
	
/-------------------------------------------------------------------------------------------------------/
	Cost Benefit Projection Tool.
/------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// load chart builder
$chart = new Chartbuilder('BarChart');
// check if items are set
if (isset($this->results->items) && CostbenefitprojectionHelper::checkObject($this->results->items)) {
    $i = 0;
    $rowArray = array();
    foreach ($this->results->items as $key => &$item) {
        $rowArray[] = array('c' => array(array('v' => $item->details->name), array('v' => $item->{'subtotal_cost_unscaled'}, 'f' => $item->{'subtotal_costmoney_unscaled'})));
        $i++;
    }
    usort($rowArray, function ($b, $a) {
        return $a['c'][1]['v'] - $b['c'][1]['v'];
    });
    $data = array('cols' => array(array('id' => '', 'label' => JText::_('COM_COSTBENEFITPROJECTION_CAUSERISK_FACTOR_NAME'), 'type' => 'string'), array('id' => '', 'label' => JText::_('COM_COSTBENEFITPROJECTION_TOTAL_COST'), 'type' => 'number')), 'rows' => $rowArray);
    $height = $i * 55 + 10;
    $title = JText::sprintf('COM_COSTBENEFITPROJECTION_COST_IN_S', $this->item->currency_name);
    $chart->load(json_encode($data));