diff --git a/js/tbl_zoom_plot.js b/js/tbl_zoom_plot.js index 48b1cafa8e..c7b6968e00 100644 --- a/js/tbl_zoom_plot.js +++ b/js/tbl_zoom_plot.js @@ -516,7 +516,7 @@ $(document).ready(function() { title: PMA_messages['strDataPointContent'], modal: true, buttons: buttonOptions, - width: $('#dataDisplay').width() + 24, + width: $('#dataDisplay').width() + 80, open: function () { $(this).find('input[type=checkbox]').css('margin', '0.5em'); } diff --git a/libraries/svg_plot/pma_scatter_plot.php b/libraries/svg_plot/pma_scatter_plot.php deleted file mode 100644 index 857a21c81c..0000000000 --- a/libraries/svg_plot/pma_scatter_plot.php +++ /dev/null @@ -1,260 +0,0 @@ - array( - '#BCE02E', - '#E0642E', - '#E0D62E', - '#2E97E0', - '#B02EE0', - '#E02E75', - '#5CE02E', - '#E0B02E', - '#000000', - '#0022E0', - '#726CB1', - '#481A36', - '#BAC658', - '#127224', - '#825119', - '#238C74', - '#4C489B', - '#87C9BF', - ), - // Plot background color. - 'bgColor' => '#84AD83', - - // The width of the plot. - 'width' => 520, - - // The height of the plot. - 'height' => 325, - - // Default X Axis label. If empty, label will be taken from the data. - 'xLabel' => '', - - // Default Y Axis label. If empty, label will be taken from the data. - 'yLabel' => '', - - // Data point label. If empty, label will be taken from the data. - 'dataLabel' => '', - - ); - - /** - * @var array Options that the user has specified. - */ - private $_userSpecifiedSettings = null; - - /** - * Returns the settings array - * - * @return the settings array. - */ - public function getSettings() - { - return $this->_settings; - } - - /** - * Returns the data array - * - * @return the data array. - */ - public function getData() - { - return $this->_data; - } - - /** - * Constructor. Stores user specified options. - * - * @param array $data Data for the visualization - * @param array $options Users specified options - */ - public function __construct($data, $options) - { - $this->_userSpecifiedSettings = $options; - $this->_data = $data; - } - - /** - * All the variable initialization, options handling has to be done here. - */ - protected function init() - { - $this->_handleOptions(); - } - - /** - * A function which handles passed parameters. Useful if desired - * chart needs to be a little bit different from the default one. - */ - private function _handleOptions() - { - $this->_dataPoints = array(); - if (! is_null($this->_userSpecifiedSettings)) { - foreach (array_keys($this->_userSpecifiedSettings) as $key) { - $this->_settings[$key] = $this->_userSpecifiedSettings[$key]; - } - } - if ($this->_settings['dataLabel'] == '') { - $labels = array_keys($this->_data[0]); - $this->_settings['dataLabel'] = $labels[0]; - } - } - - /** - * Generate the visualization in SVG format. - * - * @return the generated image resource - */ - private function _svg() - { - $this->init(); - - $output = '' . "\n"; - $output .= ''; - $output .= ''; - $output .= ' - - - '; - $output .= ' - '; - $output .= $this->_settings['yLabel']; - $output .= ' - '; - - $output .= ' - '; - $output .= $this->_settings['xLabel']; - $output .= ' - '; - - - $scale_data = $this->_scaleDataSet($this->_data, $this->_settings['xLabel'], $this->_settings['yLabel']); - $output .= $this->_prepareDataSet($this->_data, 0, $scale_data, $this->_settings['dataLabel']); - - $output .= ''; - $output .= ''; - - return $output; - } - - /** - * Get the visualization as a SVG. - * - * @return the visualization as a SVG - */ - public function asSVG() - { - $output = $this->_svg(); - return $output; - } - - /** - * Calculates the scale, horizontal and vertical offset that should be used. - * - * @param array $data Row data - * - * @return an array containing the scale, x and y offsets - */ - private function _scaleDataSet($data, $xField, $yField) - { - - // Currently assuming only numeric fields are selected - $coordinates = array(); - foreach ($data as $row) { - $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])) { - $uniqueC = array_unique($coordinates[$i]); - $countC = count(array_unique($coordinates[$i])); - $map = $tmp = array(); - foreach ($uniqueC as $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]]; - } - } 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; - } - - /** - * Prepares and return the dataset as needed by the visualization. - * - * @param array $data Raw data - * @param int $color_number Start index to the color array - * @param array $scale_data Data related to scaling - * @param string $label Label for the data points - * @return string the formatted array of data. - */ - private function _prepareDataSet($data, $color_number, $scale_data, $label) - { - $result = ''; - // loop through the rows - for ($i = 0 ; $i < count($data) ; $i++) { - - $index = $color_number % sizeof($this->_settings['colors']); - - $data_element = new PMA_SVG_Data_Point($scale_data[0][$i], $scale_data[1][$i], $data[$i][$label], $data[$i]); - - $options = array('color' => $this->_settings['colors'][$index], 'id' => $i); - $this->_dataPoints[] = $data_element; - - $result .= $data_element->prepareRowAsSVG($options); - $color_number++; - } - - return $result; - } -} -?> - diff --git a/libraries/svg_plot/pma_svg_data_element.php b/libraries/svg_plot/pma_svg_data_element.php deleted file mode 100644 index 25e8fafd6c..0000000000 --- a/libraries/svg_plot/pma_svg_data_element.php +++ /dev/null @@ -1,50 +0,0 @@ -label = $label; - $this->dataRow = $dataRow; - } - - /** - * Handles the generation of each Data Row/Element as a SVG element - * @return the code related to a row in the GIS dataset - */ - public abstract function prepareRowAsSVG($options); - - public function getLabel() - { - return $this->label; - } - - public function setLabel($label) - { - $this->label = $label; - } - - public function getDataRow() - { - return $this->dataRow; - } - - public function setDataRow($dataRow) - { - $this->dataRow = $dataRow; - } -} -?> diff --git a/libraries/svg_plot/pma_svg_data_point.php b/libraries/svg_plot/pma_svg_data_point.php deleted file mode 100644 index 6ba36ee8a1..0000000000 --- a/libraries/svg_plot/pma_svg_data_point.php +++ /dev/null @@ -1,83 +0,0 @@ -cx = $cx; - $this->cy = $cy; - } - - public function prepareRowAsSVG($options) - { - return $this->prepareSvg($options); - } - - /** - * Prepares and returns the code related to a row in the query result as SVG. - * - * @param array $options Array containing options related to properties of the point - * @return the code related to a row in the query result. - */ - protected function prepareSvg($options) - { - $point_options = array( - 'name' => $this->label . '_' .$options['id'], - 'id' => $this->label . 'id' . '_' . $options['id'], - 'class' => 'point', - 'fill' => 'white', - 'stroke' => $options['color'], - 'stroke-width'=> 2, - ); - - $row = ' $val) { - $row .= ' ' . $option . '="' . trim($val) . '"'; - } - $row .= '/>'; - - return $row; - } - - public function getCx() - { - return $this->cx; - } - - public function setCx($cx) - { - $this->cx = $cx; - } - - public function getCy() - { - return $this->cy; - } - - public function setCy($cy) - { - $this->cy = $cy; - } -} -?> diff --git a/libraries/tbl_select.lib.php b/libraries/tbl_select.lib.php index b1108facf9..14adf13d94 100644 --- a/libraries/tbl_select.lib.php +++ b/libraries/tbl_select.lib.php @@ -129,7 +129,7 @@ function PMA_tbl_getSubTabs() * @param int $foreignMaxLimit Max limit of displaying foreign elements * @param array $fields Array of search criteria inputs * @param bool $in_fbs Whether we are in 'function based search' - * @param bool $in_zoom_search_edit Whether we are in zoom search edit + * @param bool $in_zoom_search_edit Whether we are in zoom search edit * * @return string HTML content for viewing foreing data and elements * for search criteria input. @@ -382,33 +382,4 @@ function PMA_tbl_search_getWhereClause($fields, $names, $types, $collations, $fu return $w; } - -/** - * Formats a SVG plot for the query results. - * - * @param array $data Data for the status chart - * @param array &$settings Settings used to generate the chart - * - * @return string HTML and JS code for the SVG plot - */ -function PMA_SVG_scatter_plot($data, &$settings) -{ - include_once './libraries/svg_plot/pma_scatter_plot.php'; - - if (empty($data)) { - // empty data - return ''; - } else { - $scatter_plot = new PMA_Scatter_Plot($data, $settings); - - if ($settings != null) { - foreach ($scatter_plot->getSettings() as $setting => $val) { - if (! isset($settings[$setting])) { - $settings[$setting] = $val; - } - } - } - return $scatter_plot->asSVG(); - } -} ?>