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) {
                 return $a['c'][4]['v'] - $b['c'][4]['v'];
             });
             $data = array('cols' => array(array('id' => '', 'label' => JText::_('COM_COSTBENEFITPROJECTION_CAUSERISK_FACTOR'), 'type' => 'string'), array('id' => '', 'label' => JText::_('COM_COSTBENEFITPROJECTION_COST_OF_PROBLEM'), 'type' => 'number'), array('id' => '', 'label' => JText::_('COM_COSTBENEFITPROJECTION_COST_OF_INTERVENTION'), 'type' => 'number'), array('id' => '', 'label' => JText::_('COM_COSTBENEFITPROJECTION_BENEFIT'), 'type' => 'number'), array('id' => '', 'label' => JText::_('COM_COSTBENEFITPROJECTION_NET_BENEFIT'), 'type' => 'number')), 'rows' => $rowArray);
             $height = $i * 80 + 100;
             $chart->load(json_encode($data));
             $options = array();
             $main_title = JText::sprintf("COM_COSTBENEFITPROJECTION_INTERVENTIONS_NAME_S", $intervention->name);
             $title = '';
             if ($intervention->duration > 1) {
                 $title .= JText::sprintf('COM_COSTBENEFITPROJECTION_DURATION_S_YEARS', $intervention->duration);
             } else {
                 $title .= JText::sprintf('COM_COSTBENEFITPROJECTION_DURATION_S_YEAR', $intervention->duration);
             }
             $title .= ' | ' . JText::sprintf('COM_COSTBENEFITPROJECTION_COVERAGE_S', round($intervention->coverage)) . '%';
             $options = array('title' => $main_title, 'colors' => array('#cc0000', '#ff9933', '#0070c0', '#70ad47'), 'backgroundColor' => $this->Chart['backgroundColor'], 'width' => $this->Chart['width'], 'height' => $height, 'chartArea' => $this->Chart['chartArea'], 'legend' => $this->Chart['legend'], 'vAxis' => $this->Chart['vAxis'], 'hAxis' => array('textStyle' => $this->Chart['hAxis']['textStyle'], 'title' => $title, 'titleTextStyle' => $this->Chart['hAxis']['titleTextStyle']));
             echo $chart->draw('icb_' . $intervention_number . '_' . $scale, $options);
             $intervention_number++;
         }
     }
 }
コード例 #2
0
                }
                if ($percent) {
                    $rowArray[$nr]['c'][] = array('v' => (int) $val);
                    // set the table values
                    $rowArray_numbers[$nr] .= '<td data-value="' . $val . '">' . $val . '%</td>';
                } else {
                    $rowArray[$nr]['c'][] = array('v' => $val, 'f' => JText::_('COM_COSTBENEFITPROJECTION_AGE') . ' ' . $val);
                    // set the table values
                    $rowArray_numbers[$nr] .= '<td>' . JText::_('COM_COSTBENEFITPROJECTION_AGE') . ' ' . $val . '</td>';
                }
            }
            $i++;
        }
        $data['rows'] = $rowArray;
        $string = json_encode($data);
        $chart->load($string);
        $title = $gender == 'male' ? JText::_('COM_COSTBENEFITPROJECTION_MALES') : JText::_('COM_COSTBENEFITPROJECTION_FEMALES');
        $options = array('backgroundColor' => '#fafafa', 'title' => $title, 'height' => '500', 'width' => '500', 'is3D' => 'true', 'tabclickdraw' => 'charttab');
        echo $chart->draw('age_' . $gender . '_' . $displayData->id, $options);
        // set chart array
        $age[] = '<div id="age_' . $gender . '_' . $displayData->id . '" style="width: 100%;"></div>';
        $gen[$title] = '<tr>' . implode('</tr><tr>', $rowArray_numbers) . '</tr>';
        $both++;
    }
}
// now set the group percentages to the view
if ($both) {
    // setup the chart
    $agepercents = '<div data-uk-grid-margin="" class="uk-grid" data-uk-grid-match="{target:\'.uk-panel\'}">';
    foreach ($age as $gender) {
        $agepercents .= '<div class="uk-width-medium-1-' . $both . '">';