diff --git a/libraries/chart.lib.php b/libraries/chart.lib.php index 758b1953b..043d394a2 100644 --- a/libraries/chart.lib.php +++ b/libraries/chart.lib.php @@ -7,9 +7,12 @@ * @package phpMyAdmin */ -function PMA_chart_pie($data) +function PMA_chart_pie($titleText, $data) { - return "pie chart placeholder"; + require_once('./libraries/chart/pma_ofc_pie.php'); + + $chart = new PMA_OFC_Pie($titleText, $data); + echo $chart->toString(); } ?> diff --git a/libraries/chart/pma_chart.php b/libraries/chart/pma_chart.php new file mode 100644 index 000000000..57fde5844 --- /dev/null +++ b/libraries/chart/pma_chart.php @@ -0,0 +1,58 @@ +colors); + } +} + +?> \ No newline at end of file diff --git a/libraries/chart/pma_ofc_chart.php b/libraries/chart/pma_ofc_chart.php new file mode 100644 index 000000000..c04bb2068 --- /dev/null +++ b/libraries/chart/pma_ofc_chart.php @@ -0,0 +1,89 @@ +'; + $out[] = 'function '.$data_func_name.'()'; + $out[] = '{'; + $out[] = "return '".str_replace("\n", '', $data)."';"; + $out[] = '}'; + $out[] = ''; + + $out[] = 'width.'" height="'.$this->height.'" id="'.$obj_id.'" align="middle">'; + $out[] = ''; + $out[] = ''; + $out[] = ''; + $out[] = ''; + $out[] = ''; + $out[] = ''; + + return implode("\n", $out); + } + + function toString() + { + return $this->get_embed_code($this->chart->toPrettyString()); + } +} + +?> \ No newline at end of file diff --git a/libraries/chart/pma_ofc_pie.php b/libraries/chart/pma_ofc_pie.php new file mode 100644 index 000000000..f213a2248 --- /dev/null +++ b/libraries/chart/pma_ofc_pie.php @@ -0,0 +1,46 @@ +set_style($this->titleStyle); + + // create the main chart element - pie + $pie = new pie(); + $pie->set_alpha(1); + $pie->set_start_angle(35); + $pie->add_animation(new pie_fade()); + $pie->add_animation(new pie_bounce(10)); + $pie->set_tooltip('#val# '._('of').' #total#
#percent# '._('of').' 100%'); + $pie->set_colours($this->colors); + + $values = array(); + foreach($data as $key => $value) { + $values[] = new pie_value($value, $key); + } + + $pie->set_values($values); + $pie->gradient_fill(); + + // create chart + $this->chart = new open_flash_chart(); + $this->chart->x_axis = null; + $this->chart->set_bg_colour($this->bgColor); + $this->chart->set_title($title); + $this->chart->add_element($pie); + } +} + +?> \ No newline at end of file diff --git a/server_status.php b/server_status.php index 2981ed776..b6e8b148f 100644 --- a/server_status.php +++ b/server_status.php @@ -587,9 +587,22 @@ foreach ($used_queries as $name => $value) { ?> -
- -
+ + +
+ + +
+ $value) { + $key = str_replace(array('Com_', '_'), array('', ' '), $key); + $chart_data[ucwords($key)] = (int)$value; + } + echo PMA_chart_pie(__('Query type'), $chart_data); + ?> +