X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FOpenFlashChart.php;h=63173bae52e50a2543f916a90a40acfd5b40c2d9;hb=2d927f030a59e04c773be70ea411fd9aee7a746a;hp=b96562b58190249be3eb4a3ea873f2ab7fb9faef;hpb=1fa961e3e8412c4e81d66bc3b8a8b0a850c39f0d;p=civicrm-core.git diff --git a/CRM/Utils/OpenFlashChart.php b/CRM/Utils/OpenFlashChart.php index b96562b581..63173bae52 100644 --- a/CRM/Utils/OpenFlashChart.php +++ b/CRM/Utils/OpenFlashChart.php @@ -1,7 +1,7 @@ set_values($yValues); if ($barCount > 0) { // FIXME: for bars > 2, we'll need to come out with other colors - $bars[$barCount]->colour( '#BF3B69'); + $bars[$barCount]->colour('#BF3B69'); } if ($barKey = CRM_Utils_Array::value($barCount, CRM_Utils_Array::value('barKeys', $params))) { - $bars[$barCount]->key($barKey,12); + $bars[$barCount]->key($barKey, 12); } // call user define function to handle on click event. @@ -125,9 +134,9 @@ class CRM_Utils_OpenFlashChart { $xLabels = new x_axis_labels(); // set_labels function requires xValues array of string or x_axis_label // so type casting array values to string values - array_walk($xValues, function(&$value, $index) { - $value = (string)$value; - }); + array_walk($xValues, function (&$value, $index) { + $value = (string) $value; + }); $xLabels->set_labels($xValues); // set angle for labels. @@ -183,12 +192,13 @@ class CRM_Utils_OpenFlashChart { /** * Build The Pie Gharph. * - * @param array $params assoc array of name/value pairs + * @param array $params + * Assoc array of name/value pairs. * - * @return object $chart object of open flash chart. - * @static + * @return object + * $chart object of open flash chart. */ - static function &pieChart(&$params) { + public static function &pieChart(&$params) { $chart = NULL; if (empty($params)) { return $chart; @@ -201,7 +211,7 @@ class CRM_Utils_OpenFlashChart { // get the required data. $values = array(); foreach ($allValues as $label => $value) { - $values[] = new pie_value((double)$value, $label); + $values[] = new pie_value((double) $value, $label); } $graphTitle = !empty($params['legend']) ? $params['legend'] : ts('Pie Chart'); @@ -246,12 +256,13 @@ class CRM_Utils_OpenFlashChart { /** * Build The 3-D Bar Gharph. * - * @param array $params assoc array of name/value pairs + * @param array $params + * Assoc array of name/value pairs. * - * @return object $chart object of open flash chart. - * @static + * @return object + * $chart object of open flash chart. */ - static function &bar_3dChart(&$params) { + public static function &bar_3dChart(&$params) { $chart = NULL; if (empty($params)) { return $chart; @@ -273,10 +284,10 @@ class CRM_Utils_OpenFlashChart { continue; } - $xValueLabels[] = (string)$xVal; + $xValueLabels[] = (string) $xVal; foreach ($criterias as $criteria) { - $xReferences[$criteria][$xVal] = (double)CRM_Utils_Array::value($criteria, $yVal, 0); - $yValues[] = (double)CRM_Utils_Array::value($criteria, $yVal, 0); + $xReferences[$criteria][$xVal] = (double) CRM_Utils_Array::value($criteria, $yVal, 0); + $yValues[] = (double) CRM_Utils_Array::value($criteria, $yVal, 0); } } @@ -306,7 +317,7 @@ class CRM_Utils_OpenFlashChart { // set colour pattel $xValues[$count]->set_colour(self::$_colours[$count]); // define colur pattel with bar criterias - $xValues[$count]->key((string)$criteria, 12); + $xValues[$count]->key((string) $criteria, 12); // define bar chart values $xValues[$count]->set_values(array_values($values)); @@ -396,7 +407,7 @@ class CRM_Utils_OpenFlashChart { * * @return array */ - static function chart($rows, $chart, $interval) { + public static function chart($rows, $chart, $interval) { $chartData = $dateKeys = array(); switch ($interval) { @@ -441,13 +452,12 @@ class CRM_Utils_OpenFlashChart { foreach ($rows['multiValue'] as $key => $val) { $graph[$key] = array_combine($dateKeys, $rows['multiValue'][$key]); } - $chartData = - array( - 'legend' => "$legend " . CRM_Utils_Array::value('legend', $rows, ts('Contribution')) . ' ' . ts('Summary'), - 'values' => $graph[0], - 'multiValues' => $graph, - 'barKeys' => CRM_Utils_Array::value('barKeys', $rows, array()), - ); + $chartData = array( + 'legend' => "$legend " . CRM_Utils_Array::value('legend', $rows, ts('Contribution')) . ' ' . ts('Summary'), + 'values' => $graph[0], + 'multiValues' => $graph, + 'barKeys' => CRM_Utils_Array::value('barKeys', $rows, array()), + ); } // rotate the x labels. @@ -462,7 +472,10 @@ class CRM_Utils_OpenFlashChart { // carry some chart params if pass. foreach (array( - 'xSize', 'ySize', 'divName') as $f) { + 'xSize', + 'ySize', + 'divName', + ) as $f) { if (!empty($rows[$f])) { $chartData[$f] = $rows[$f]; } @@ -479,7 +492,7 @@ class CRM_Utils_OpenFlashChart { * * @return array */ - static function reportChart($rows, $chart, $interval, &$chartInfo) { + public static function reportChart($rows, $chart, $interval, &$chartInfo) { foreach ($interval as $key => $val) { $graph[$val] = $rows['value'][$key]; } @@ -499,7 +512,10 @@ class CRM_Utils_OpenFlashChart { // carry some chart params if pass. foreach (array( - 'xSize', 'ySize', 'divName') as $f) { + 'xSize', + 'ySize', + 'divName', + ) as $f) { if (!empty($rows[$f])) { $chartData[$f] = $rows[$f]; } @@ -514,7 +530,7 @@ class CRM_Utils_OpenFlashChart { * * @return array */ - static function buildChart(&$params, $chart) { + public static function buildChart(&$params, $chart) { $openFlashChart = array(); if ($chart && is_array($params) && !empty($params)) { // build the chart objects. @@ -552,5 +568,5 @@ class CRM_Utils_OpenFlashChart { return $openFlashChart; } -} +}