2009-03-31 Sancho Lerena <slerena@artica.es>

* include/functions_visual_map.php,
         godmode/reporting/map_builder.php: Two new types of items for map graphs:
        Simple value and progress bar. Progress bar uses height to set the higher
        possible limit of the value to calculage the percentile.

        * reporting/pchart_graph.php: Progress bars now have percentile text without
        shadow (more readable). Fixed round cut of prev. commit.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1581 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2009-03-31 18:42:36 +00:00
parent 5181998d1a
commit ca463b4868
4 changed files with 56 additions and 12 deletions

View File

@ -1,3 +1,13 @@
2009-03-31 Sancho Lerena <slerena@artica.es>
* include/functions_visual_map.php,
godmode/reporting/map_builder.php: Two new types of items for map graphs:
Simple value and progress bar. Progress bar uses height to set the higher
possible limit of the value to calculage the percentile.
* reporting/pchart_graph.php: Progress bars now have percentile text without
shadow (more readable). Fixed round cut of prev. commit.
2009-03-31 Sancho Lerena <slerena@artica.es>
* include/styles/menu.css: Added icons for dashboard option (enterprise).

View File

@ -144,7 +144,7 @@ if ($get_layout_data) {
}
if ($create_layout_data) {
$layout_data_type = (string) get_parameter ("type");
$layout_data_type = (int) get_parameter ("type");
$layout_data_label = (string) get_parameter ("label");
$layout_data_image = (string) get_parameter ("image");
$layout_data_id_agent = (int) get_parameter ("agent");

View File

@ -152,6 +152,33 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines =
echo "</div>";
}
// SIMPLE DATA VALIE (type = 2)
if ($layout_data['type'] == 2){
echo '<div style="z-index: 1; color: '.$layout_data['label_color'].'; position: absolute; margin-left: '.$layout_data['pos_x'].'px; margin-top:'.$layout_data['pos_y'].'px;" id="layout-data-'.$layout_data['id'].'" class="layout-data">';
echo '<b>'.$layout_data['label']. ' ';
echo get_db_sql ('SELECT datos FROM tagente_estado WHERE id_agente_modulo = '.$layout_data['id_agente_modulo']);
echo '</b></div>';
}
// Percentile bar (type = 3)
if ($layout_data['type'] == 3){
echo '<div style="z-index: 1; color: '.$layout_data['label_color'].'; position: absolute; margin-left: '.$layout_data['pos_x'].'px; margin-top:'.$layout_data['pos_y'].'px;" id="layout-data-'.$layout_data['id'].'" class="layout-data">';
$valor = get_db_sql ('SELECT datos FROM tagente_estado WHERE id_agente_modulo = '.$layout_data['id_agente_modulo']);
$width = $layout_data['width'];
if ( $layout_data['height'] > 0)
$percentile = $valor / $layout_data['height'] * 100;
else
$percentile = 100;
echo $layout_data['label'];
echo "<br>";
echo "<img src='".$config["homeurl"]."/reporting/fgraph.php?tipo=progress&height=15&width=$width&mode=1&percent=$percentile'>";
echo '</div>';
}
// SINGLE GRAPH (type = 1)
if ($layout_data['type'] == 1) { // single graph
@ -213,6 +240,8 @@ function get_layout_data_types () {
$types = array ();
$types[0] = __('Static graph');
$types[1] = __('Module graph');
$types[2] = __('Simple value');
$types[3] = __('Percentile bar');
return $types;
}

View File

@ -314,9 +314,10 @@ class PchartGraph extends PandoraGraphAbstract {
$this->graph->setFontProperties ($this->fontpath, 8);
// Round corners defined in global setup
global $config;
if ($config["round_corner"] != 0)
$radius = ($this->height > 18) ? 7 : 0;
$radius = ($this->height > 18) ? 8 : 0;
else
$radius = 0;
@ -337,22 +338,26 @@ class PchartGraph extends PandoraGraphAbstract {
$color = $this->get_rgb_values ($color);
$this->graph->drawFilledRoundedRectangle (0, 0, $ratio,
$this->height, $radius, $color['r'], $color['g'], $color['b']);
/* Under this value, the rounded rectangle is painted great */
if ($ratio <= 16) {
/* Clean a bit of pixels */
for ($i = 0; $i < 7; $i++) {
$this->graph->drawLine (0, $i, 6 - $i, $i, 255, 255, 255);
}
if ($config["round_corner"] != 0){
/* Under this value, the rounded rectangle is painted great */
if ($ratio <= 16) {
/* Clean a bit of pixels */
for ($i = 0; $i < 7; $i++) {
$this->graph->drawLine (0, $i, 6 - $i, $i, 255, 255, 255);
}
$end = $this->height - 1;
for ($i = 0; $i < 7; $i++) {
$this->graph->drawLine (0, $end - $i, 5 - $i, $end - $i, 255, 255, 255);
$end = $this->height - 1;
for ($i = 0; $i < 7; $i++) {
$this->graph->drawLine (0, $end - $i, 5 - $i, $end - $i, 255, 255, 255);
}
}
}
if ($this->show_title) {
$this->graph->drawTextBox (0, 0, $this->width, $this->height,
$this->title, 0, 255, 255, 255, ALIGN_CENTER, true);
$this->title, 0, 0, 0, 0, ALIGN_CENTER, false);
// Removed shadow in bars, was difficult to read, do not enable again please
}
if ($this->border) {
$this->graph->drawRoundedRectangle (0, 0, $this->width - 1 , $this->height - 1,