Changeset 6219
- Timestamp:
- 08/21/08 12:17:58 (5 months ago)
- Location:
- trunk/centreon/www/include/reporting/dashboard/imagesGenerations
- Files:
-
- 1 removed
- 1 modified
-
pie-charts.php (modified) (1 diff)
-
pie-svc.php (deleted)
Legend:
- Unmodified
- Added
- Removed
-
trunk/centreon/www/include/reporting/dashboard/imagesGenerations/pie-charts.php
r5995 r6219 16 16 */ 17 17 18 include_once("@CENTREON_ETC@/centreon.conf.php"); 19 20 require_once ($centreon_path."www/class/Session.class.php"); 21 require_once ($centreon_path."www/class/Oreon.class.php"); 18 /** 19 * This script drawing pie chart of host or service on the reporting interface. 20 * 21 * PHP version 5 22 * 23 * @package pie-charts.php 24 * @author Damien Duponchelle dduponchelle@merethis.com 25 * @version $Id: $ 26 * @copyright (c) 2007-2008 Centreon 27 * @license http://opensource.org/licenses/gpl-license.php GNU Public License 28 */ 22 29 30 // Including files and dependences 31 include_once '@CENTREON_ETC@/centreon.conf.php'; 32 require_once $centreon_path.'www/class/Session.class.php'; 33 require_once $centreon_path.'www/class/Oreon.class.php'; 34 35 // Session Variables 23 36 Session::start(); 24 37 $oreon =& $_SESSION["oreon"]; 38 $value =& $_GET["value"]; 39 40 if(isset($value) == true) { 41 foreach ($value as $key => $val) { 42 if (isset($val) == true) { 43 if (isset($oreon->optGen["color_".strtolower($key)]) == false) { 44 $color[] = $oreon->optGen["color_unknown"]; 45 $data[] = $val; 46 $legend[] = "Undetermined"; 47 } else { 48 $color[] = $oreon->optGen["color_".strtolower($key)]; 49 $data[] = $val; 50 $legend[] = $key; 51 } 52 } 53 } 54 } 25 55 56 include_once($centreon_path . '/www/lib/ofc-library/open-flash-chart.php' ); 26 57 27 // ----------------------------------------------------- 28 $value =& $_GET["value"]; 29 30 foreach ($value as $key => $val) { 31 if ($val) 32 if (!isset($oreon->optGen["color_".strtolower($key)])) { 33 $color[] = $oreon->optGen["color_unknown"]; 34 $data[] = $val; 35 $legend[] = "Undetermined"; 36 } else { 37 $color[] = $oreon->optGen["color_".strtolower($key)]; 38 $data[] = $val; 39 $legend[] =$key; 40 } 41 } 42 include_once($centreon_path . '/www/lib/ofc-library/open-flash-chart.php' ); 58 // Declaring a new pie chart with a white background 43 59 $g = new graph(); 44 $g->bg_colour = '#F3F6F6'; 45 // 46 // PIE chart, 60% alpha 47 // 48 $g->pie(60,'#505050','#000000'); 49 // 50 // pass in two arrays, one of data, the other data labels 51 // 52 53 $g->pie_values( $data, $legend ); 54 // 60 $g->bg_colour = '#F3F6F6'; // Declaring white background for the pie chart. 61 $g->pie(60,'#505050','#000000'); // Initializing properties with a grey color and 60% (alpha) 62 63 // Insert datas on the pie chart 64 if(isset($data) == true && isset($legend) == true) { 65 $g->pie_values($data,$legend); 66 } 67 55 68 // Colours for each slice, in this case some of the colours 56 69 // will be re-used (3 colurs for 5 slices means the last two 57 70 // slices will have colours colour[0] and colour[1]): 58 // 71 $g->pie_slice_colours($color); 72 $g->set_tool_tip( '#val#%' ); 59 73 60 $g->pie_slice_colours($color); 61 62 $g->set_tool_tip( '#val#%' ); 63 if (isset($_GET["service_name"]) && isset($_GET["host_name"])) 74 // Initializing title of pie chart. 75 if (isset($_GET["service_name"]) == true && isset($_GET["host_name"]) == true) { 76 // Title for a service displayed like "Service on Host". 64 77 $g->title( $_GET["service_name"] . " on " . $_GET["host_name"], '{font-size:15px; color: #424242}' ); 65 else if (isset($_GET["host_name"])) 78 } else if (isset($_GET["host_name"]) == true) { 79 // Title for a host. 66 80 $g->title( $_GET["host_name"], '{font-size:18px; color: #424242}' ); 81 } 82 83 // Apply the current pie chart 67 84 echo $g->render(); 68 69 85 ?>
