diff options
author | Piotr Przybylski <piotrprz@gmail.com> | 2011-08-25 15:16:28 +0400 |
---|---|---|
committer | Piotr Przybylski <piotrprz@gmail.com> | 2011-08-25 15:16:28 +0400 |
commit | f45a79a6511edbf2e32124b7918b6f5a473bf0e2 (patch) | |
tree | b47a60d44c9680f0f4615778be59276144b52e07 /libraries | |
parent | bd3b7d28d45d432a1262e66392364ec22703368d (diff) |
Whitespace cleanup, code formatting
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/svg_plot/pma_scatter_plot.php | 66 |
1 files changed, 31 insertions, 35 deletions
diff --git a/libraries/svg_plot/pma_scatter_plot.php b/libraries/svg_plot/pma_scatter_plot.php index 10c0aea343..c7e8cfad15 100644 --- a/libraries/svg_plot/pma_scatter_plot.php +++ b/libraries/svg_plot/pma_scatter_plot.php @@ -119,12 +119,12 @@ class PMA_Scatter_Plot $this->_dataPoints = array(); if (! is_null($this->_userSpecifiedSettings)) { foreach (array_keys($this->_userSpecifiedSettings) as $key){ - $this->_settings[$key] = $this->_userSpecifiedSettings[$key]; - } + $this->_settings[$key] = $this->_userSpecifiedSettings[$key]; + } } if ($this->_settings['dataLabel'] == '') { - $labels = array_keys($this->_data[0]); - $this->_settings['dataLabel'] = $labels[0]; + $labels = array_keys($this->_data[0]); + $this->_settings['dataLabel'] = $labels[0]; } } @@ -143,7 +143,7 @@ class PMA_Scatter_Plot . ' height="' . $this->_settings['height'] . '">'; $output .= '<g id="groupPanel">'; $output .= '<defs> - <path id="myTextPath1" + <path id="myTextPath1" d="M10,190 L10,50"/> <path id="myTextPath2" d="M250,10 L370,10"/> @@ -194,41 +194,38 @@ class PMA_Scatter_Plot // Currently assuming only numeric fields are selected $coordinates = array(); foreach ($data as $row) { - $coordinates[0][] = $row[$xField]; - $coordinates[1][] = $row[$yField]; - } + $coordinates[0][] = $row[$xField]; + $coordinates[1][] = $row[$yField]; + } for ($i = 0 ; $i < 2 ; $i++) { - $maxC = ($i == 0) ? 500 : 320; - if( !is_numeric($coordinates[$i][0])) { + if ( !is_numeric($coordinates[$i][0])) { $uniqueC = array_unique($coordinates[$i]); $countC = count(array_unique($coordinates[$i])); - $map = $tmp = array(); + $map = $tmp = array(); foreach ($uniqueC as $uc) { - $tmp[] = $uc; - } + $tmp[] = $uc; + } for ($j = 0 ; $j < $countC ; $j++) { $map[$tmp[$j]] = 20 + $j * $maxC / $countC; - } - for($j = 0 ; $j < count($coordinates[$i]) ; $j++) { - $coordinates[$i][$j] = $map[$coordinates[$i][$j]]; - } - - } - elseif (is_numeric($coordinates[$i][0])) { - - $maxC = max($coordinates[$i]); - for($j = 0 ; $j < count($coordinates[$i]) ; $j++) { - - if ($i == 0) - $coordinates[$i][$j] = 20 + 500 * $coordinates[$i][$j] / $maxC; - else - $coordinates[$i][$j] = 20 + 320 * (1 - $coordinates[$i][$j] / $maxC); - } - } - } - return $coordinates; + } + for ($j = 0 ; $j < count($coordinates[$i]) ; $j++) { + $coordinates[$i][$j] = $map[$coordinates[$i][$j]]; + } + } + else if (is_numeric($coordinates[$i][0])) { + $maxC = max($coordinates[$i]); + for ($j = 0 ; $j < count($coordinates[$i]) ; $j++) { + if ($i == 0) { + $coordinates[$i][$j] = 20 + 500 * $coordinates[$i][$j] / $maxC; + } else { + $coordinates[$i][$j] = 20 + 320 * (1 - $coordinates[$i][$j] / $maxC); + } + } + } + } + return $coordinates; } /** @@ -246,7 +243,7 @@ class PMA_Scatter_Plot { $result = ''; // loop through the rows - for($i = 0 ; $i < count($data) ; $i++) { + for ($i = 0 ; $i < count($data) ; $i++) { $index = $color_number % sizeof($this->_settings['colors']); @@ -255,11 +252,10 @@ class PMA_Scatter_Plot $options = array('color' => $this->_settings['colors'][$index], 'id' => $i); $this->_dataPoints[] = $data_element; - $result .= $data_element->prepareRowAsSVG($options); + $result .= $data_element->prepareRowAsSVG($options); $color_number++; } - return $result; } } |