pandorafms/pandora_console/include/graphs/functions_pchart.php

802 lines
24 KiB
PHP
Raw Normal View History

<?php
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
include_once('functions_utils.php');
include_once('../functions_io.php');
include_once('../functions.php');
include_once('../functions_html.php');
/* pChart library inclusions */
include_once("pChart/pData.class.php");
include_once("pChart/pDraw.class.php");
include_once("pChart/pImage.class.php");
include_once("pChart/pPie.class.php");
include_once("pChart/pScatter.class.php");
include_once("pChart/pRadar.class.php");
// Define default fine colors
$default_fine_colors = array();
$default_fine_colors[] = "#2222FF";
$default_fine_colors[] = "#00DD00";
$default_fine_colors[] = "#CC0033";
$default_fine_colors[] = "#9900CC";
$default_fine_colors[] = "#FFCC66";
$default_fine_colors[] = "#999999";
// Default values
$antialiasing = true;
$font = '../fonts/unicode.ttf';
$xaxisname = '';
$yaxisname = '';
$legend = null;
$colors = null;
$font_size = 8;
$force_steps = true;
$graph_type = get_parameter('graph_type', '');
$id_graph = get_parameter('id_graph', false);
if (!$id_graph) {
exit;
}
$ttl = get_parameter('ttl', 1);
$graph = unserialize_in_temp($id_graph, true, $ttl);
if (!isset($graph)) {
exit;
}
$data = $graph['data'];
$width = $graph['width'];
$height = $graph['height'];
if (isset($graph['color'])) {
$colors = $graph['color'];
}
if (isset($graph['legend'])) {
$legend = $graph['legend'];
}
if(isset($graph['xaxisname'])) {
$xaxisname = $graph['xaxisname'];
}
if(isset($graph['yaxisname'])) {
$yaxisname = $graph['yaxisname'];
}
if(isset($graph['round_corner'])) {
$round_corner = $graph['round_corner'];
}
if(isset($graph['font'])) {
if (!empty($graph['font'])) {
$font = $graph['font'];
}
}
if(isset($graph['font_size'])) {
if (!empty($graph['font_size'])) {
$font_size = $graph['font_size'];
}
}
if(isset($graph['antialiasing'])) {
$antialiasing = $graph['antialiasing'];
}
$force_height = true;
if(isset($graph['force_height'])) {
$force_height = $graph['force_height'];
}
if(isset($graph['period'])) {
$period = $graph['period'];
}
if (!$force_height) {
if ($height < (count($graph['data']) * 14)) {
$height = (count($graph['data']) * 14);
}
}
$water_mark = '';
if(isset($graph['water_mark'])) {
$water_mark = $graph['water_mark']; //"/var/www/pandora_console/images/logo_vertical_water.png";
}
if (isset($graph['force_steps'])) {
$force_steps = $graph['force_steps'];
}
/*
$colors = array();
$colors['pep1'] = array('border' => '#000000', 'color' => '#000000', 'alpha' => 50);
$colors['pep2'] = array('border' => '#ff7f00', 'color' => '#ff0000', 'alpha' => 50);
$colors['pep3'] = array('border' => '#ff0000', 'color' => '#00ff00', 'alpha' => 50);
$colors['pep4'] = array('border' => '#000000', 'color' => '#0000ff', 'alpha' => 50);
*/
$step = 1;
if ($force_steps) {
$pixels_between_xdata = 50;
$max_xdata_display = round($width / $pixels_between_xdata);
$ndata = count($data);
if($max_xdata_display > $ndata) {
$xdata_display = $ndata;
}
else {
$xdata_display = $max_xdata_display;
}
$step = round($ndata/$xdata_display);
}
$c = 1;
switch($graph_type) {
case 'hbar':
case 'vbar':
foreach($data as $i => $values) {
foreach($values as $name => $val) {
$data_values[$name][] = $val;
}
if (($c % $step) == 0) {
$data_keys[] = $i;
}
else {
$data_keys[] = "";
}
$c++;
}
$fine_colors = array();
// If is set fine colors we store it or set default
if(isset($colors[reset(array_keys($data_values))]['fine'])) {
$fine = $colors[reset(array_keys($data_values))]['fine'];
if($fine === true) {
$fine = $default_fine_colors;
}
foreach($fine as $i => $fine_color) {
2011-04-27 Juan Manuel Ramon <juanmanuel.ramon@artica.es> * include/functions_graph.php include/functions_users.php include/functions_events.php include/functions_html.php include/functions_menu.php include/styles/pandora.css include/graphs/functions_pchart.php include/functions_messages.php include/functions_exportserver.php include/functions_modules.php include/functions_reporting.php include/functions_filemanager.php include/functions_groups.php include/functions_gis.php include/functions_networkmap.php include/functions_servers.php include/functions_network_components.php include/functions_visual_map.php include/ajax/skins.ajax.php include/ajax/visual_console_builder.ajax.php include/help/en/help_gis_map_builder.php include/help/en/help_agent_status.php include/help/en/help_eventview.php include/help/en/help_configure_gis_map.php include/help/en/help_cascade_protection.php include/help/en/help_setup_gis_index.php include/help/es/help_gis_map_builder.php include/help/es/help_agent_status.php include/help/es/help_eventview.php include/help/es/help_configure_gis_map.php include/help/es/help_cascade_protection.php include/help/ja/help_gis_map_builder.php include/help/ja/help_agent_status.php include/help/ja/help_eventview.php include/help/ja/help_configure_gis_map.php include/help/ja/help_cascade_protection.php include/help/ja/help_setup_gis_index.php include/functions_ui.php include/functions_incidents.php include/functions.php include/functions_agents.php include/functions_db.php include/functions_fsgraph.php include/functions_extensions.php include/functions_ui_renders.php extensions/insert_data.php extensions/system_info.php extensions/extension_uploader.php extensions/agents_modules.php extensions/dbmanager.php extensions/resource_registration.php extensions/resource_exportation.php extensions/users_connected.php extensions/module_groups.php extensions/update_manager/settings.php extensions/update_manager/main.php operation/incidents/incident.incident.php operation/incidents/incident.php operation/incidents/incident.files.php operation/incidents/incident.tracking.php operation/incidents/incident_detail.php operation/incidents/incident.workunits.php operation/incidents/incident.list.php operation/search_modules.php operation/extensions.php operation/visual_console/render_view.php operation/visual_console/index.php operation/agentes/status_monitor.php operation/agentes/estado_ultimopaquete.php operation/agentes/datos_agente.php operation/agentes/alerts_status.php operation/agentes/estado_generalagente.php operation/agentes/custom_fields.php operation/agentes/estado_agente.php operation/agentes/networkmap.topology.php operation/agentes/alerts_status.functions.php operation/agentes/networkmap.groups.php operation/agentes/sla_view.php operation/agentes/exportdata.php operation/agentes/gis_view.php operation/agentes/estado_monitores.php operation/agentes/ver_agente.php operation/agentes/graphs.php operation/agentes/tactical.php operation/agentes/group_view.php operation/agentes/networkmap.php operation/agentes/stat_win.php operation/servers/view_server.php operation/servers/view_server_detail.php operation/search_agents.php operation/search_graphs.php operation/snmpconsole/snmp_view.php operation/users/user_edit.php operation/integria_incidents/incident.incident.php operation/integria_incidents/incident.php operation/integria_incidents/incident.files.php operation/integria_incidents/incident.tracking.php operation/integria_incidents/incident_detail.php operation/integria_incidents/incident.workunits.php operation/integria_incidents/incident.list.php operation/gis_maps/render_view.php operation/gis_maps/ajax.php operation/gis_maps/index.php operation/events/export_csv.php operation/events/sound_events.php operation/events/events_validate.php operation/events/events_list.php operation/events/events.php operation/search_alerts.php operation/messages/message.php operation/reporting/reporting_xml.php operation/reporting/reporting_viewer.php operation/reporting/graph_viewer.php operation/reporting/custom_reporting.php operation/search_reports.php operation/search_maps.php operation/search_results.php operation/search_users.php mobile/operation/agents/monitor_status.php mobile/operation/agents/view_agents.php mobile/operation/agents/tactical.php mobile/operation/agents/view_alerts.php mobile/operation/agents/group_view.php mobile/operation/events/events.php mobile/operation/servers/view_servers.php mobile/include/user.class.php general/pandora_help.php general/noaccess.php general/login_page.php general/logon_ok.php general/logoff.php general/ui/agents_list.php general/header.php godmode/groups/modu_group_list.php godmode/groups/configure_group.php godmode/groups/configure_modu_group.php godmode/groups/group_list.php godmode/admin_access_logs.php godmode/extensions.php godmode/db/db_sanity.php godmode/db/db_refine.php godmode/db/db_info.php godmode/db/db_event.php godmode/db/db_purge.php godmode/agentes/agent_template.php godmode/agentes/module_manager_editor_common.php godmode/agentes/module_manager_editor_network.php godmode/agentes/fields_manager.php godmode/agentes/module_manager_editor_wmi.php godmode/agentes/module_manager_editor_plugin.php godmode/agentes/agent_conf_gis.php godmode/agentes/module_manager_editor_prediction.php godmode/agentes/module_manager.php godmode/agentes/modificar_agente.php godmode/agentes/configurar_agente.php godmode/agentes/configure_field.php godmode/agentes/module_manager_editor.php godmode/agentes/planned_downtime.php godmode/agentes/manage_config_remote.php godmode/agentes/agent_manager.php godmode/servers/recon_script.php godmode/servers/plugin.php godmode/servers/manage_recontask.php godmode/servers/modificar_server.php godmode/servers/manage_recontask_form.php godmode/alerts/alert_list.list.php godmode/alerts/configure_alert_compound.php godmode/alerts/alert_compounds.php godmode/alerts/alert_list.php godmode/alerts/configure_alert_template.php godmode/alerts/alert_templates.php godmode/alerts/configure_alert_action.php godmode/alerts/configure_alert_command.php godmode/alerts/alert_actions.php godmode/alerts/alert_list.builder.php godmode/alerts/alert_commands.php godmode/snmpconsole/snmp_alert.php godmode/snmpconsole/snmp_filters.php godmode/setup/file_manager.php godmode/setup/os.list.php godmode/setup/news.php godmode/setup/gis_step_2.php godmode/setup/links.php godmode/setup/setup.php godmode/setup/os.php godmode/setup/performance.php godmode/setup/setup_auth.php godmode/setup/gis.php godmode/setup/os.builder.php godmode/setup/setup_visuals.php godmode/users/user_list.php godmode/users/configure_user.php godmode/users/configure_profile.php godmode/gis_maps/configure_gis_map.php godmode/gis_maps/index.php godmode/massive/massive_add_alerts.php godmode/massive/massive_copy_modules.php godmode/massive/massive_delete_agents.php godmode/massive/massive_enable_disable_alerts.php godmode/massive/massive_operations.php godmode/massive/massive_delete_profiles.php godmode/massive/massive_edit_agents.php godmode/massive/massive_delete_action_alerts.php godmode/massive/massive_delete_modules.php godmode/massive/massive_add_profiles.php godmode/massive/massive_delete_alerts.php godmode/massive/massive_edit_modules.php godmode/massive/massive_standby_alerts.php godmode/massive/massive_add_action_alerts.php godmode/modules/manage_network_components_form.php godmode/modules/manage_nc_groups_form.php godmode/modules/manage_network_templates.php godmode/modules/module_list.php godmode/modules/manage_network_components_form_common.php godmode/modules/manage_network_components_form_network.php godmode/modules/manage_network_templates_form.php godmode/modules/manage_network_components_form_wmi.php godmode/modules/manage_network_components.php godmode/modules/manage_nc_groups.php godmode/modules/manage_network_components_form_plugin.php godmode/reporting/reporting_builder.list_items.php godmode/reporting/graph_builder.main.php godmode/reporting/visual_console_builder.wizard.php godmode/reporting/visual_console_builder.php godmode/reporting/reporting_builder.preview.php godmode/reporting/reporting_builder.main.php godmode/reporting/visual_console_builder.data.php godmode/reporting/visual_console_builder.elements.php godmode/reporting/graph_builder.php godmode/reporting/graph_builder.graph_editor.php godmode/reporting/reporting_builder.php godmode/reporting/visual_console_builder.editor.php godmode/reporting/reporting_builder.item_editor.php godmode/reporting/map_builder.php godmode/reporting/graphs.php godmode/reporting/graph_builder.preview.php: Now functions on functions_html.php, functions_gis.php, functions_filemanager.php, functions_exportserver.php have "html_", "gis_", "filemanager_" and "exportserver_" prefix respectively. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4281 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-27 15:43:31 +02:00
$rgb_fine = html_html2rgb($fine_color);
$fine_colors[$i]['R'] = $rgb_fine[0];
$fine_colors[$i]['G'] = $rgb_fine[1];
$fine_colors[$i]['B'] = $rgb_fine[2];
$fine_colors[$i]['Alpha'] = 100;
}
$colors = array();
}
break;
case 'progress':
case 'area':
case 'stacked_area':
case 'stacked_line':
case 'line':
case 'threshold':
case 'scatter':
foreach($data as $i => $d) {
$data_values[] = $d;
if (($c % $step) == 0) {
$data_keys[] = $i;
}
else {
$data_keys[] = "";
}
$c++;
}
break;
case 'slicebar':
case 'polar':
case 'radar':
case 'pie3d':
case 'pie2d':
break;
}
switch($graph_type) {
case 'slicebar':
case 'polar':
case 'radar':
case 'pie3d':
case 'pie2d':
break;
case 'default':
if(!is_array(reset($data_values))) {
$data_values = array($data_values);
if(is_array($colors) && !empty($colors)) {
$colors = array($colors);
}
}
break;
}
$rgb_color = array();
if (!isset($colors))
$colors = array();
foreach($colors as $i => $color) {
2011-04-27 Juan Manuel Ramon <juanmanuel.ramon@artica.es> * include/functions_graph.php include/functions_users.php include/functions_events.php include/functions_html.php include/functions_menu.php include/styles/pandora.css include/graphs/functions_pchart.php include/functions_messages.php include/functions_exportserver.php include/functions_modules.php include/functions_reporting.php include/functions_filemanager.php include/functions_groups.php include/functions_gis.php include/functions_networkmap.php include/functions_servers.php include/functions_network_components.php include/functions_visual_map.php include/ajax/skins.ajax.php include/ajax/visual_console_builder.ajax.php include/help/en/help_gis_map_builder.php include/help/en/help_agent_status.php include/help/en/help_eventview.php include/help/en/help_configure_gis_map.php include/help/en/help_cascade_protection.php include/help/en/help_setup_gis_index.php include/help/es/help_gis_map_builder.php include/help/es/help_agent_status.php include/help/es/help_eventview.php include/help/es/help_configure_gis_map.php include/help/es/help_cascade_protection.php include/help/ja/help_gis_map_builder.php include/help/ja/help_agent_status.php include/help/ja/help_eventview.php include/help/ja/help_configure_gis_map.php include/help/ja/help_cascade_protection.php include/help/ja/help_setup_gis_index.php include/functions_ui.php include/functions_incidents.php include/functions.php include/functions_agents.php include/functions_db.php include/functions_fsgraph.php include/functions_extensions.php include/functions_ui_renders.php extensions/insert_data.php extensions/system_info.php extensions/extension_uploader.php extensions/agents_modules.php extensions/dbmanager.php extensions/resource_registration.php extensions/resource_exportation.php extensions/users_connected.php extensions/module_groups.php extensions/update_manager/settings.php extensions/update_manager/main.php operation/incidents/incident.incident.php operation/incidents/incident.php operation/incidents/incident.files.php operation/incidents/incident.tracking.php operation/incidents/incident_detail.php operation/incidents/incident.workunits.php operation/incidents/incident.list.php operation/search_modules.php operation/extensions.php operation/visual_console/render_view.php operation/visual_console/index.php operation/agentes/status_monitor.php operation/agentes/estado_ultimopaquete.php operation/agentes/datos_agente.php operation/agentes/alerts_status.php operation/agentes/estado_generalagente.php operation/agentes/custom_fields.php operation/agentes/estado_agente.php operation/agentes/networkmap.topology.php operation/agentes/alerts_status.functions.php operation/agentes/networkmap.groups.php operation/agentes/sla_view.php operation/agentes/exportdata.php operation/agentes/gis_view.php operation/agentes/estado_monitores.php operation/agentes/ver_agente.php operation/agentes/graphs.php operation/agentes/tactical.php operation/agentes/group_view.php operation/agentes/networkmap.php operation/agentes/stat_win.php operation/servers/view_server.php operation/servers/view_server_detail.php operation/search_agents.php operation/search_graphs.php operation/snmpconsole/snmp_view.php operation/users/user_edit.php operation/integria_incidents/incident.incident.php operation/integria_incidents/incident.php operation/integria_incidents/incident.files.php operation/integria_incidents/incident.tracking.php operation/integria_incidents/incident_detail.php operation/integria_incidents/incident.workunits.php operation/integria_incidents/incident.list.php operation/gis_maps/render_view.php operation/gis_maps/ajax.php operation/gis_maps/index.php operation/events/export_csv.php operation/events/sound_events.php operation/events/events_validate.php operation/events/events_list.php operation/events/events.php operation/search_alerts.php operation/messages/message.php operation/reporting/reporting_xml.php operation/reporting/reporting_viewer.php operation/reporting/graph_viewer.php operation/reporting/custom_reporting.php operation/search_reports.php operation/search_maps.php operation/search_results.php operation/search_users.php mobile/operation/agents/monitor_status.php mobile/operation/agents/view_agents.php mobile/operation/agents/tactical.php mobile/operation/agents/view_alerts.php mobile/operation/agents/group_view.php mobile/operation/events/events.php mobile/operation/servers/view_servers.php mobile/include/user.class.php general/pandora_help.php general/noaccess.php general/login_page.php general/logon_ok.php general/logoff.php general/ui/agents_list.php general/header.php godmode/groups/modu_group_list.php godmode/groups/configure_group.php godmode/groups/configure_modu_group.php godmode/groups/group_list.php godmode/admin_access_logs.php godmode/extensions.php godmode/db/db_sanity.php godmode/db/db_refine.php godmode/db/db_info.php godmode/db/db_event.php godmode/db/db_purge.php godmode/agentes/agent_template.php godmode/agentes/module_manager_editor_common.php godmode/agentes/module_manager_editor_network.php godmode/agentes/fields_manager.php godmode/agentes/module_manager_editor_wmi.php godmode/agentes/module_manager_editor_plugin.php godmode/agentes/agent_conf_gis.php godmode/agentes/module_manager_editor_prediction.php godmode/agentes/module_manager.php godmode/agentes/modificar_agente.php godmode/agentes/configurar_agente.php godmode/agentes/configure_field.php godmode/agentes/module_manager_editor.php godmode/agentes/planned_downtime.php godmode/agentes/manage_config_remote.php godmode/agentes/agent_manager.php godmode/servers/recon_script.php godmode/servers/plugin.php godmode/servers/manage_recontask.php godmode/servers/modificar_server.php godmode/servers/manage_recontask_form.php godmode/alerts/alert_list.list.php godmode/alerts/configure_alert_compound.php godmode/alerts/alert_compounds.php godmode/alerts/alert_list.php godmode/alerts/configure_alert_template.php godmode/alerts/alert_templates.php godmode/alerts/configure_alert_action.php godmode/alerts/configure_alert_command.php godmode/alerts/alert_actions.php godmode/alerts/alert_list.builder.php godmode/alerts/alert_commands.php godmode/snmpconsole/snmp_alert.php godmode/snmpconsole/snmp_filters.php godmode/setup/file_manager.php godmode/setup/os.list.php godmode/setup/news.php godmode/setup/gis_step_2.php godmode/setup/links.php godmode/setup/setup.php godmode/setup/os.php godmode/setup/performance.php godmode/setup/setup_auth.php godmode/setup/gis.php godmode/setup/os.builder.php godmode/setup/setup_visuals.php godmode/users/user_list.php godmode/users/configure_user.php godmode/users/configure_profile.php godmode/gis_maps/configure_gis_map.php godmode/gis_maps/index.php godmode/massive/massive_add_alerts.php godmode/massive/massive_copy_modules.php godmode/massive/massive_delete_agents.php godmode/massive/massive_enable_disable_alerts.php godmode/massive/massive_operations.php godmode/massive/massive_delete_profiles.php godmode/massive/massive_edit_agents.php godmode/massive/massive_delete_action_alerts.php godmode/massive/massive_delete_modules.php godmode/massive/massive_add_profiles.php godmode/massive/massive_delete_alerts.php godmode/massive/massive_edit_modules.php godmode/massive/massive_standby_alerts.php godmode/massive/massive_add_action_alerts.php godmode/modules/manage_network_components_form.php godmode/modules/manage_nc_groups_form.php godmode/modules/manage_network_templates.php godmode/modules/module_list.php godmode/modules/manage_network_components_form_common.php godmode/modules/manage_network_components_form_network.php godmode/modules/manage_network_templates_form.php godmode/modules/manage_network_components_form_wmi.php godmode/modules/manage_network_components.php godmode/modules/manage_nc_groups.php godmode/modules/manage_network_components_form_plugin.php godmode/reporting/reporting_builder.list_items.php godmode/reporting/graph_builder.main.php godmode/reporting/visual_console_builder.wizard.php godmode/reporting/visual_console_builder.php godmode/reporting/reporting_builder.preview.php godmode/reporting/reporting_builder.main.php godmode/reporting/visual_console_builder.data.php godmode/reporting/visual_console_builder.elements.php godmode/reporting/graph_builder.php godmode/reporting/graph_builder.graph_editor.php godmode/reporting/reporting_builder.php godmode/reporting/visual_console_builder.editor.php godmode/reporting/reporting_builder.item_editor.php godmode/reporting/map_builder.php godmode/reporting/graphs.php godmode/reporting/graph_builder.preview.php: Now functions on functions_html.php, functions_gis.php, functions_filemanager.php, functions_exportserver.php have "html_", "gis_", "filemanager_" and "exportserver_" prefix respectively. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4281 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-27 15:43:31 +02:00
$rgb['border'] = html_html2rgb($color['border']);
$rgb_color[$i]['border']['R'] = $rgb['border'][0];
$rgb_color[$i]['border']['G'] = $rgb['border'][1];
$rgb_color[$i]['border']['B'] = $rgb['border'][2];
2011-04-27 Juan Manuel Ramon <juanmanuel.ramon@artica.es> * include/functions_graph.php include/functions_users.php include/functions_events.php include/functions_html.php include/functions_menu.php include/styles/pandora.css include/graphs/functions_pchart.php include/functions_messages.php include/functions_exportserver.php include/functions_modules.php include/functions_reporting.php include/functions_filemanager.php include/functions_groups.php include/functions_gis.php include/functions_networkmap.php include/functions_servers.php include/functions_network_components.php include/functions_visual_map.php include/ajax/skins.ajax.php include/ajax/visual_console_builder.ajax.php include/help/en/help_gis_map_builder.php include/help/en/help_agent_status.php include/help/en/help_eventview.php include/help/en/help_configure_gis_map.php include/help/en/help_cascade_protection.php include/help/en/help_setup_gis_index.php include/help/es/help_gis_map_builder.php include/help/es/help_agent_status.php include/help/es/help_eventview.php include/help/es/help_configure_gis_map.php include/help/es/help_cascade_protection.php include/help/ja/help_gis_map_builder.php include/help/ja/help_agent_status.php include/help/ja/help_eventview.php include/help/ja/help_configure_gis_map.php include/help/ja/help_cascade_protection.php include/help/ja/help_setup_gis_index.php include/functions_ui.php include/functions_incidents.php include/functions.php include/functions_agents.php include/functions_db.php include/functions_fsgraph.php include/functions_extensions.php include/functions_ui_renders.php extensions/insert_data.php extensions/system_info.php extensions/extension_uploader.php extensions/agents_modules.php extensions/dbmanager.php extensions/resource_registration.php extensions/resource_exportation.php extensions/users_connected.php extensions/module_groups.php extensions/update_manager/settings.php extensions/update_manager/main.php operation/incidents/incident.incident.php operation/incidents/incident.php operation/incidents/incident.files.php operation/incidents/incident.tracking.php operation/incidents/incident_detail.php operation/incidents/incident.workunits.php operation/incidents/incident.list.php operation/search_modules.php operation/extensions.php operation/visual_console/render_view.php operation/visual_console/index.php operation/agentes/status_monitor.php operation/agentes/estado_ultimopaquete.php operation/agentes/datos_agente.php operation/agentes/alerts_status.php operation/agentes/estado_generalagente.php operation/agentes/custom_fields.php operation/agentes/estado_agente.php operation/agentes/networkmap.topology.php operation/agentes/alerts_status.functions.php operation/agentes/networkmap.groups.php operation/agentes/sla_view.php operation/agentes/exportdata.php operation/agentes/gis_view.php operation/agentes/estado_monitores.php operation/agentes/ver_agente.php operation/agentes/graphs.php operation/agentes/tactical.php operation/agentes/group_view.php operation/agentes/networkmap.php operation/agentes/stat_win.php operation/servers/view_server.php operation/servers/view_server_detail.php operation/search_agents.php operation/search_graphs.php operation/snmpconsole/snmp_view.php operation/users/user_edit.php operation/integria_incidents/incident.incident.php operation/integria_incidents/incident.php operation/integria_incidents/incident.files.php operation/integria_incidents/incident.tracking.php operation/integria_incidents/incident_detail.php operation/integria_incidents/incident.workunits.php operation/integria_incidents/incident.list.php operation/gis_maps/render_view.php operation/gis_maps/ajax.php operation/gis_maps/index.php operation/events/export_csv.php operation/events/sound_events.php operation/events/events_validate.php operation/events/events_list.php operation/events/events.php operation/search_alerts.php operation/messages/message.php operation/reporting/reporting_xml.php operation/reporting/reporting_viewer.php operation/reporting/graph_viewer.php operation/reporting/custom_reporting.php operation/search_reports.php operation/search_maps.php operation/search_results.php operation/search_users.php mobile/operation/agents/monitor_status.php mobile/operation/agents/view_agents.php mobile/operation/agents/tactical.php mobile/operation/agents/view_alerts.php mobile/operation/agents/group_view.php mobile/operation/events/events.php mobile/operation/servers/view_servers.php mobile/include/user.class.php general/pandora_help.php general/noaccess.php general/login_page.php general/logon_ok.php general/logoff.php general/ui/agents_list.php general/header.php godmode/groups/modu_group_list.php godmode/groups/configure_group.php godmode/groups/configure_modu_group.php godmode/groups/group_list.php godmode/admin_access_logs.php godmode/extensions.php godmode/db/db_sanity.php godmode/db/db_refine.php godmode/db/db_info.php godmode/db/db_event.php godmode/db/db_purge.php godmode/agentes/agent_template.php godmode/agentes/module_manager_editor_common.php godmode/agentes/module_manager_editor_network.php godmode/agentes/fields_manager.php godmode/agentes/module_manager_editor_wmi.php godmode/agentes/module_manager_editor_plugin.php godmode/agentes/agent_conf_gis.php godmode/agentes/module_manager_editor_prediction.php godmode/agentes/module_manager.php godmode/agentes/modificar_agente.php godmode/agentes/configurar_agente.php godmode/agentes/configure_field.php godmode/agentes/module_manager_editor.php godmode/agentes/planned_downtime.php godmode/agentes/manage_config_remote.php godmode/agentes/agent_manager.php godmode/servers/recon_script.php godmode/servers/plugin.php godmode/servers/manage_recontask.php godmode/servers/modificar_server.php godmode/servers/manage_recontask_form.php godmode/alerts/alert_list.list.php godmode/alerts/configure_alert_compound.php godmode/alerts/alert_compounds.php godmode/alerts/alert_list.php godmode/alerts/configure_alert_template.php godmode/alerts/alert_templates.php godmode/alerts/configure_alert_action.php godmode/alerts/configure_alert_command.php godmode/alerts/alert_actions.php godmode/alerts/alert_list.builder.php godmode/alerts/alert_commands.php godmode/snmpconsole/snmp_alert.php godmode/snmpconsole/snmp_filters.php godmode/setup/file_manager.php godmode/setup/os.list.php godmode/setup/news.php godmode/setup/gis_step_2.php godmode/setup/links.php godmode/setup/setup.php godmode/setup/os.php godmode/setup/performance.php godmode/setup/setup_auth.php godmode/setup/gis.php godmode/setup/os.builder.php godmode/setup/setup_visuals.php godmode/users/user_list.php godmode/users/configure_user.php godmode/users/configure_profile.php godmode/gis_maps/configure_gis_map.php godmode/gis_maps/index.php godmode/massive/massive_add_alerts.php godmode/massive/massive_copy_modules.php godmode/massive/massive_delete_agents.php godmode/massive/massive_enable_disable_alerts.php godmode/massive/massive_operations.php godmode/massive/massive_delete_profiles.php godmode/massive/massive_edit_agents.php godmode/massive/massive_delete_action_alerts.php godmode/massive/massive_delete_modules.php godmode/massive/massive_add_profiles.php godmode/massive/massive_delete_alerts.php godmode/massive/massive_edit_modules.php godmode/massive/massive_standby_alerts.php godmode/massive/massive_add_action_alerts.php godmode/modules/manage_network_components_form.php godmode/modules/manage_nc_groups_form.php godmode/modules/manage_network_templates.php godmode/modules/module_list.php godmode/modules/manage_network_components_form_common.php godmode/modules/manage_network_components_form_network.php godmode/modules/manage_network_templates_form.php godmode/modules/manage_network_components_form_wmi.php godmode/modules/manage_network_components.php godmode/modules/manage_nc_groups.php godmode/modules/manage_network_components_form_plugin.php godmode/reporting/reporting_builder.list_items.php godmode/reporting/graph_builder.main.php godmode/reporting/visual_console_builder.wizard.php godmode/reporting/visual_console_builder.php godmode/reporting/reporting_builder.preview.php godmode/reporting/reporting_builder.main.php godmode/reporting/visual_console_builder.data.php godmode/reporting/visual_console_builder.elements.php godmode/reporting/graph_builder.php godmode/reporting/graph_builder.graph_editor.php godmode/reporting/reporting_builder.php godmode/reporting/visual_console_builder.editor.php godmode/reporting/reporting_builder.item_editor.php godmode/reporting/map_builder.php godmode/reporting/graphs.php godmode/reporting/graph_builder.preview.php: Now functions on functions_html.php, functions_gis.php, functions_filemanager.php, functions_exportserver.php have "html_", "gis_", "filemanager_" and "exportserver_" prefix respectively. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4281 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-27 15:43:31 +02:00
$rgb['color'] = html_html2rgb($color['color']);
$rgb_color[$i]['color']['R'] = $rgb['color'][0];
$rgb_color[$i]['color']['G'] = $rgb['color'][1];
$rgb_color[$i]['color']['B'] = $rgb['color'][2];
$rgb_color[$i]['alpha'] = $color['alpha'];
}
/*foreach($colors as $i => $color) {
if (isset($color['border'])) {
2011-04-27 Juan Manuel Ramon <juanmanuel.ramon@artica.es> * include/functions_graph.php include/functions_users.php include/functions_events.php include/functions_html.php include/functions_menu.php include/styles/pandora.css include/graphs/functions_pchart.php include/functions_messages.php include/functions_exportserver.php include/functions_modules.php include/functions_reporting.php include/functions_filemanager.php include/functions_groups.php include/functions_gis.php include/functions_networkmap.php include/functions_servers.php include/functions_network_components.php include/functions_visual_map.php include/ajax/skins.ajax.php include/ajax/visual_console_builder.ajax.php include/help/en/help_gis_map_builder.php include/help/en/help_agent_status.php include/help/en/help_eventview.php include/help/en/help_configure_gis_map.php include/help/en/help_cascade_protection.php include/help/en/help_setup_gis_index.php include/help/es/help_gis_map_builder.php include/help/es/help_agent_status.php include/help/es/help_eventview.php include/help/es/help_configure_gis_map.php include/help/es/help_cascade_protection.php include/help/ja/help_gis_map_builder.php include/help/ja/help_agent_status.php include/help/ja/help_eventview.php include/help/ja/help_configure_gis_map.php include/help/ja/help_cascade_protection.php include/help/ja/help_setup_gis_index.php include/functions_ui.php include/functions_incidents.php include/functions.php include/functions_agents.php include/functions_db.php include/functions_fsgraph.php include/functions_extensions.php include/functions_ui_renders.php extensions/insert_data.php extensions/system_info.php extensions/extension_uploader.php extensions/agents_modules.php extensions/dbmanager.php extensions/resource_registration.php extensions/resource_exportation.php extensions/users_connected.php extensions/module_groups.php extensions/update_manager/settings.php extensions/update_manager/main.php operation/incidents/incident.incident.php operation/incidents/incident.php operation/incidents/incident.files.php operation/incidents/incident.tracking.php operation/incidents/incident_detail.php operation/incidents/incident.workunits.php operation/incidents/incident.list.php operation/search_modules.php operation/extensions.php operation/visual_console/render_view.php operation/visual_console/index.php operation/agentes/status_monitor.php operation/agentes/estado_ultimopaquete.php operation/agentes/datos_agente.php operation/agentes/alerts_status.php operation/agentes/estado_generalagente.php operation/agentes/custom_fields.php operation/agentes/estado_agente.php operation/agentes/networkmap.topology.php operation/agentes/alerts_status.functions.php operation/agentes/networkmap.groups.php operation/agentes/sla_view.php operation/agentes/exportdata.php operation/agentes/gis_view.php operation/agentes/estado_monitores.php operation/agentes/ver_agente.php operation/agentes/graphs.php operation/agentes/tactical.php operation/agentes/group_view.php operation/agentes/networkmap.php operation/agentes/stat_win.php operation/servers/view_server.php operation/servers/view_server_detail.php operation/search_agents.php operation/search_graphs.php operation/snmpconsole/snmp_view.php operation/users/user_edit.php operation/integria_incidents/incident.incident.php operation/integria_incidents/incident.php operation/integria_incidents/incident.files.php operation/integria_incidents/incident.tracking.php operation/integria_incidents/incident_detail.php operation/integria_incidents/incident.workunits.php operation/integria_incidents/incident.list.php operation/gis_maps/render_view.php operation/gis_maps/ajax.php operation/gis_maps/index.php operation/events/export_csv.php operation/events/sound_events.php operation/events/events_validate.php operation/events/events_list.php operation/events/events.php operation/search_alerts.php operation/messages/message.php operation/reporting/reporting_xml.php operation/reporting/reporting_viewer.php operation/reporting/graph_viewer.php operation/reporting/custom_reporting.php operation/search_reports.php operation/search_maps.php operation/search_results.php operation/search_users.php mobile/operation/agents/monitor_status.php mobile/operation/agents/view_agents.php mobile/operation/agents/tactical.php mobile/operation/agents/view_alerts.php mobile/operation/agents/group_view.php mobile/operation/events/events.php mobile/operation/servers/view_servers.php mobile/include/user.class.php general/pandora_help.php general/noaccess.php general/login_page.php general/logon_ok.php general/logoff.php general/ui/agents_list.php general/header.php godmode/groups/modu_group_list.php godmode/groups/configure_group.php godmode/groups/configure_modu_group.php godmode/groups/group_list.php godmode/admin_access_logs.php godmode/extensions.php godmode/db/db_sanity.php godmode/db/db_refine.php godmode/db/db_info.php godmode/db/db_event.php godmode/db/db_purge.php godmode/agentes/agent_template.php godmode/agentes/module_manager_editor_common.php godmode/agentes/module_manager_editor_network.php godmode/agentes/fields_manager.php godmode/agentes/module_manager_editor_wmi.php godmode/agentes/module_manager_editor_plugin.php godmode/agentes/agent_conf_gis.php godmode/agentes/module_manager_editor_prediction.php godmode/agentes/module_manager.php godmode/agentes/modificar_agente.php godmode/agentes/configurar_agente.php godmode/agentes/configure_field.php godmode/agentes/module_manager_editor.php godmode/agentes/planned_downtime.php godmode/agentes/manage_config_remote.php godmode/agentes/agent_manager.php godmode/servers/recon_script.php godmode/servers/plugin.php godmode/servers/manage_recontask.php godmode/servers/modificar_server.php godmode/servers/manage_recontask_form.php godmode/alerts/alert_list.list.php godmode/alerts/configure_alert_compound.php godmode/alerts/alert_compounds.php godmode/alerts/alert_list.php godmode/alerts/configure_alert_template.php godmode/alerts/alert_templates.php godmode/alerts/configure_alert_action.php godmode/alerts/configure_alert_command.php godmode/alerts/alert_actions.php godmode/alerts/alert_list.builder.php godmode/alerts/alert_commands.php godmode/snmpconsole/snmp_alert.php godmode/snmpconsole/snmp_filters.php godmode/setup/file_manager.php godmode/setup/os.list.php godmode/setup/news.php godmode/setup/gis_step_2.php godmode/setup/links.php godmode/setup/setup.php godmode/setup/os.php godmode/setup/performance.php godmode/setup/setup_auth.php godmode/setup/gis.php godmode/setup/os.builder.php godmode/setup/setup_visuals.php godmode/users/user_list.php godmode/users/configure_user.php godmode/users/configure_profile.php godmode/gis_maps/configure_gis_map.php godmode/gis_maps/index.php godmode/massive/massive_add_alerts.php godmode/massive/massive_copy_modules.php godmode/massive/massive_delete_agents.php godmode/massive/massive_enable_disable_alerts.php godmode/massive/massive_operations.php godmode/massive/massive_delete_profiles.php godmode/massive/massive_edit_agents.php godmode/massive/massive_delete_action_alerts.php godmode/massive/massive_delete_modules.php godmode/massive/massive_add_profiles.php godmode/massive/massive_delete_alerts.php godmode/massive/massive_edit_modules.php godmode/massive/massive_standby_alerts.php godmode/massive/massive_add_action_alerts.php godmode/modules/manage_network_components_form.php godmode/modules/manage_nc_groups_form.php godmode/modules/manage_network_templates.php godmode/modules/module_list.php godmode/modules/manage_network_components_form_common.php godmode/modules/manage_network_components_form_network.php godmode/modules/manage_network_templates_form.php godmode/modules/manage_network_components_form_wmi.php godmode/modules/manage_network_components.php godmode/modules/manage_nc_groups.php godmode/modules/manage_network_components_form_plugin.php godmode/reporting/reporting_builder.list_items.php godmode/reporting/graph_builder.main.php godmode/reporting/visual_console_builder.wizard.php godmode/reporting/visual_console_builder.php godmode/reporting/reporting_builder.preview.php godmode/reporting/reporting_builder.main.php godmode/reporting/visual_console_builder.data.php godmode/reporting/visual_console_builder.elements.php godmode/reporting/graph_builder.php godmode/reporting/graph_builder.graph_editor.php godmode/reporting/reporting_builder.php godmode/reporting/visual_console_builder.editor.php godmode/reporting/reporting_builder.item_editor.php godmode/reporting/map_builder.php godmode/reporting/graphs.php godmode/reporting/graph_builder.preview.php: Now functions on functions_html.php, functions_gis.php, functions_filemanager.php, functions_exportserver.php have "html_", "gis_", "filemanager_" and "exportserver_" prefix respectively. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4281 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-27 15:43:31 +02:00
$rgb['border'] = html_html2rgb($color['border']);
$rgb_color[$i]['border']['R'] = $rgb['border'][0];
$rgb_color[$i]['border']['G'] = $rgb['border'][1];
$rgb_color[$i]['border']['B'] = $rgb['border'][2];
}
if (isset($color['color'])) {
2011-04-27 Juan Manuel Ramon <juanmanuel.ramon@artica.es> * include/functions_graph.php include/functions_users.php include/functions_events.php include/functions_html.php include/functions_menu.php include/styles/pandora.css include/graphs/functions_pchart.php include/functions_messages.php include/functions_exportserver.php include/functions_modules.php include/functions_reporting.php include/functions_filemanager.php include/functions_groups.php include/functions_gis.php include/functions_networkmap.php include/functions_servers.php include/functions_network_components.php include/functions_visual_map.php include/ajax/skins.ajax.php include/ajax/visual_console_builder.ajax.php include/help/en/help_gis_map_builder.php include/help/en/help_agent_status.php include/help/en/help_eventview.php include/help/en/help_configure_gis_map.php include/help/en/help_cascade_protection.php include/help/en/help_setup_gis_index.php include/help/es/help_gis_map_builder.php include/help/es/help_agent_status.php include/help/es/help_eventview.php include/help/es/help_configure_gis_map.php include/help/es/help_cascade_protection.php include/help/ja/help_gis_map_builder.php include/help/ja/help_agent_status.php include/help/ja/help_eventview.php include/help/ja/help_configure_gis_map.php include/help/ja/help_cascade_protection.php include/help/ja/help_setup_gis_index.php include/functions_ui.php include/functions_incidents.php include/functions.php include/functions_agents.php include/functions_db.php include/functions_fsgraph.php include/functions_extensions.php include/functions_ui_renders.php extensions/insert_data.php extensions/system_info.php extensions/extension_uploader.php extensions/agents_modules.php extensions/dbmanager.php extensions/resource_registration.php extensions/resource_exportation.php extensions/users_connected.php extensions/module_groups.php extensions/update_manager/settings.php extensions/update_manager/main.php operation/incidents/incident.incident.php operation/incidents/incident.php operation/incidents/incident.files.php operation/incidents/incident.tracking.php operation/incidents/incident_detail.php operation/incidents/incident.workunits.php operation/incidents/incident.list.php operation/search_modules.php operation/extensions.php operation/visual_console/render_view.php operation/visual_console/index.php operation/agentes/status_monitor.php operation/agentes/estado_ultimopaquete.php operation/agentes/datos_agente.php operation/agentes/alerts_status.php operation/agentes/estado_generalagente.php operation/agentes/custom_fields.php operation/agentes/estado_agente.php operation/agentes/networkmap.topology.php operation/agentes/alerts_status.functions.php operation/agentes/networkmap.groups.php operation/agentes/sla_view.php operation/agentes/exportdata.php operation/agentes/gis_view.php operation/agentes/estado_monitores.php operation/agentes/ver_agente.php operation/agentes/graphs.php operation/agentes/tactical.php operation/agentes/group_view.php operation/agentes/networkmap.php operation/agentes/stat_win.php operation/servers/view_server.php operation/servers/view_server_detail.php operation/search_agents.php operation/search_graphs.php operation/snmpconsole/snmp_view.php operation/users/user_edit.php operation/integria_incidents/incident.incident.php operation/integria_incidents/incident.php operation/integria_incidents/incident.files.php operation/integria_incidents/incident.tracking.php operation/integria_incidents/incident_detail.php operation/integria_incidents/incident.workunits.php operation/integria_incidents/incident.list.php operation/gis_maps/render_view.php operation/gis_maps/ajax.php operation/gis_maps/index.php operation/events/export_csv.php operation/events/sound_events.php operation/events/events_validate.php operation/events/events_list.php operation/events/events.php operation/search_alerts.php operation/messages/message.php operation/reporting/reporting_xml.php operation/reporting/reporting_viewer.php operation/reporting/graph_viewer.php operation/reporting/custom_reporting.php operation/search_reports.php operation/search_maps.php operation/search_results.php operation/search_users.php mobile/operation/agents/monitor_status.php mobile/operation/agents/view_agents.php mobile/operation/agents/tactical.php mobile/operation/agents/view_alerts.php mobile/operation/agents/group_view.php mobile/operation/events/events.php mobile/operation/servers/view_servers.php mobile/include/user.class.php general/pandora_help.php general/noaccess.php general/login_page.php general/logon_ok.php general/logoff.php general/ui/agents_list.php general/header.php godmode/groups/modu_group_list.php godmode/groups/configure_group.php godmode/groups/configure_modu_group.php godmode/groups/group_list.php godmode/admin_access_logs.php godmode/extensions.php godmode/db/db_sanity.php godmode/db/db_refine.php godmode/db/db_info.php godmode/db/db_event.php godmode/db/db_purge.php godmode/agentes/agent_template.php godmode/agentes/module_manager_editor_common.php godmode/agentes/module_manager_editor_network.php godmode/agentes/fields_manager.php godmode/agentes/module_manager_editor_wmi.php godmode/agentes/module_manager_editor_plugin.php godmode/agentes/agent_conf_gis.php godmode/agentes/module_manager_editor_prediction.php godmode/agentes/module_manager.php godmode/agentes/modificar_agente.php godmode/agentes/configurar_agente.php godmode/agentes/configure_field.php godmode/agentes/module_manager_editor.php godmode/agentes/planned_downtime.php godmode/agentes/manage_config_remote.php godmode/agentes/agent_manager.php godmode/servers/recon_script.php godmode/servers/plugin.php godmode/servers/manage_recontask.php godmode/servers/modificar_server.php godmode/servers/manage_recontask_form.php godmode/alerts/alert_list.list.php godmode/alerts/configure_alert_compound.php godmode/alerts/alert_compounds.php godmode/alerts/alert_list.php godmode/alerts/configure_alert_template.php godmode/alerts/alert_templates.php godmode/alerts/configure_alert_action.php godmode/alerts/configure_alert_command.php godmode/alerts/alert_actions.php godmode/alerts/alert_list.builder.php godmode/alerts/alert_commands.php godmode/snmpconsole/snmp_alert.php godmode/snmpconsole/snmp_filters.php godmode/setup/file_manager.php godmode/setup/os.list.php godmode/setup/news.php godmode/setup/gis_step_2.php godmode/setup/links.php godmode/setup/setup.php godmode/setup/os.php godmode/setup/performance.php godmode/setup/setup_auth.php godmode/setup/gis.php godmode/setup/os.builder.php godmode/setup/setup_visuals.php godmode/users/user_list.php godmode/users/configure_user.php godmode/users/configure_profile.php godmode/gis_maps/configure_gis_map.php godmode/gis_maps/index.php godmode/massive/massive_add_alerts.php godmode/massive/massive_copy_modules.php godmode/massive/massive_delete_agents.php godmode/massive/massive_enable_disable_alerts.php godmode/massive/massive_operations.php godmode/massive/massive_delete_profiles.php godmode/massive/massive_edit_agents.php godmode/massive/massive_delete_action_alerts.php godmode/massive/massive_delete_modules.php godmode/massive/massive_add_profiles.php godmode/massive/massive_delete_alerts.php godmode/massive/massive_edit_modules.php godmode/massive/massive_standby_alerts.php godmode/massive/massive_add_action_alerts.php godmode/modules/manage_network_components_form.php godmode/modules/manage_nc_groups_form.php godmode/modules/manage_network_templates.php godmode/modules/module_list.php godmode/modules/manage_network_components_form_common.php godmode/modules/manage_network_components_form_network.php godmode/modules/manage_network_templates_form.php godmode/modules/manage_network_components_form_wmi.php godmode/modules/manage_network_components.php godmode/modules/manage_nc_groups.php godmode/modules/manage_network_components_form_plugin.php godmode/reporting/reporting_builder.list_items.php godmode/reporting/graph_builder.main.php godmode/reporting/visual_console_builder.wizard.php godmode/reporting/visual_console_builder.php godmode/reporting/reporting_builder.preview.php godmode/reporting/reporting_builder.main.php godmode/reporting/visual_console_builder.data.php godmode/reporting/visual_console_builder.elements.php godmode/reporting/graph_builder.php godmode/reporting/graph_builder.graph_editor.php godmode/reporting/reporting_builder.php godmode/reporting/visual_console_builder.editor.php godmode/reporting/reporting_builder.item_editor.php godmode/reporting/map_builder.php godmode/reporting/graphs.php godmode/reporting/graph_builder.preview.php: Now functions on functions_html.php, functions_gis.php, functions_filemanager.php, functions_exportserver.php have "html_", "gis_", "filemanager_" and "exportserver_" prefix respectively. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4281 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-27 15:43:31 +02:00
$rgb['color'] = html_html2rgb($color['color']);
$rgb_color[$i]['color']['R'] = $rgb['color'][0];
$rgb_color[$i]['color']['G'] = $rgb['color'][1];
$rgb_color[$i]['color']['B'] = $rgb['color'][2];
}
if (isset($color['color'])) {
$rgb_color[$i]['alpha'] = $color['alpha'];
}
}*/
switch($graph_type) {
case 'pie3d':
case 'pie2d':
pch_pie_graph($graph_type, array_values($data), array_keys($data),
$width, $height, $font, $water_mark, $font_size);
break;
case 'slicebar':
pch_slicebar_graph($graph_type, $data, $period, $width, $height, $colors, $font, $round_corner, $font_size);
break;
case 'polar':
case 'radar':
pch_kiviat_graph($graph_type, array_values($data), array_keys($data),
$width, $height, $font, $font_size);
break;
case 'hbar':
case 'vbar':
pch_bar_graph($graph_type, $data_keys, $data_values, $width, $height,
$font, $antialiasing, $rgb_color, $xaxisname, $yaxisname, false,
$legend, $fine_colors, $water_mark, $font_size);
break;
case 'stacked_area':
case 'area':
case 'line':
pch_vertical_graph($graph_type, $data_keys, $data_values, $width,
$height, $rgb_color, $xaxisname, $yaxisname, false, $legend,
$font, $antialiasing, $water_mark, $font_size);
break;
case 'threshold':
pch_threshold_graph($graph_type, $data_keys, $data_values, $width,
$height, $font, $antialiasing, $xaxisname, $yaxisname, $title,
$font_size);
break;
}
function pch_slicebar_graph ($graph_type, $data, $period, $width, $height, $colors, $font, $round_corner, $font_size) {
/* CAT:Slicebar charts */
set_time_limit (0);
// Dataset definition
$myPicture = new pImage($width,$height);
/* Turn of Antialiasing */
$myPicture->Antialias = $antialiasing;
$myPicture->setFontProperties(array("FontName"=> $font, "FontSize"=>$font_size,"R"=>80,"G"=>80,"B"=>80));
// Round corners defined in global setup
if ($round_corner != 0)
$radius = ($height > 18) ? 8 : 0;
else
$radius = 0;
$thinest_slice = $width / $period;
/* Color stuff */
$colorsrgb = array();
foreach($colors as $key => $col) {
2011-04-27 Juan Manuel Ramon <juanmanuel.ramon@artica.es> * include/functions_graph.php include/functions_users.php include/functions_events.php include/functions_html.php include/functions_menu.php include/styles/pandora.css include/graphs/functions_pchart.php include/functions_messages.php include/functions_exportserver.php include/functions_modules.php include/functions_reporting.php include/functions_filemanager.php include/functions_groups.php include/functions_gis.php include/functions_networkmap.php include/functions_servers.php include/functions_network_components.php include/functions_visual_map.php include/ajax/skins.ajax.php include/ajax/visual_console_builder.ajax.php include/help/en/help_gis_map_builder.php include/help/en/help_agent_status.php include/help/en/help_eventview.php include/help/en/help_configure_gis_map.php include/help/en/help_cascade_protection.php include/help/en/help_setup_gis_index.php include/help/es/help_gis_map_builder.php include/help/es/help_agent_status.php include/help/es/help_eventview.php include/help/es/help_configure_gis_map.php include/help/es/help_cascade_protection.php include/help/ja/help_gis_map_builder.php include/help/ja/help_agent_status.php include/help/ja/help_eventview.php include/help/ja/help_configure_gis_map.php include/help/ja/help_cascade_protection.php include/help/ja/help_setup_gis_index.php include/functions_ui.php include/functions_incidents.php include/functions.php include/functions_agents.php include/functions_db.php include/functions_fsgraph.php include/functions_extensions.php include/functions_ui_renders.php extensions/insert_data.php extensions/system_info.php extensions/extension_uploader.php extensions/agents_modules.php extensions/dbmanager.php extensions/resource_registration.php extensions/resource_exportation.php extensions/users_connected.php extensions/module_groups.php extensions/update_manager/settings.php extensions/update_manager/main.php operation/incidents/incident.incident.php operation/incidents/incident.php operation/incidents/incident.files.php operation/incidents/incident.tracking.php operation/incidents/incident_detail.php operation/incidents/incident.workunits.php operation/incidents/incident.list.php operation/search_modules.php operation/extensions.php operation/visual_console/render_view.php operation/visual_console/index.php operation/agentes/status_monitor.php operation/agentes/estado_ultimopaquete.php operation/agentes/datos_agente.php operation/agentes/alerts_status.php operation/agentes/estado_generalagente.php operation/agentes/custom_fields.php operation/agentes/estado_agente.php operation/agentes/networkmap.topology.php operation/agentes/alerts_status.functions.php operation/agentes/networkmap.groups.php operation/agentes/sla_view.php operation/agentes/exportdata.php operation/agentes/gis_view.php operation/agentes/estado_monitores.php operation/agentes/ver_agente.php operation/agentes/graphs.php operation/agentes/tactical.php operation/agentes/group_view.php operation/agentes/networkmap.php operation/agentes/stat_win.php operation/servers/view_server.php operation/servers/view_server_detail.php operation/search_agents.php operation/search_graphs.php operation/snmpconsole/snmp_view.php operation/users/user_edit.php operation/integria_incidents/incident.incident.php operation/integria_incidents/incident.php operation/integria_incidents/incident.files.php operation/integria_incidents/incident.tracking.php operation/integria_incidents/incident_detail.php operation/integria_incidents/incident.workunits.php operation/integria_incidents/incident.list.php operation/gis_maps/render_view.php operation/gis_maps/ajax.php operation/gis_maps/index.php operation/events/export_csv.php operation/events/sound_events.php operation/events/events_validate.php operation/events/events_list.php operation/events/events.php operation/search_alerts.php operation/messages/message.php operation/reporting/reporting_xml.php operation/reporting/reporting_viewer.php operation/reporting/graph_viewer.php operation/reporting/custom_reporting.php operation/search_reports.php operation/search_maps.php operation/search_results.php operation/search_users.php mobile/operation/agents/monitor_status.php mobile/operation/agents/view_agents.php mobile/operation/agents/tactical.php mobile/operation/agents/view_alerts.php mobile/operation/agents/group_view.php mobile/operation/events/events.php mobile/operation/servers/view_servers.php mobile/include/user.class.php general/pandora_help.php general/noaccess.php general/login_page.php general/logon_ok.php general/logoff.php general/ui/agents_list.php general/header.php godmode/groups/modu_group_list.php godmode/groups/configure_group.php godmode/groups/configure_modu_group.php godmode/groups/group_list.php godmode/admin_access_logs.php godmode/extensions.php godmode/db/db_sanity.php godmode/db/db_refine.php godmode/db/db_info.php godmode/db/db_event.php godmode/db/db_purge.php godmode/agentes/agent_template.php godmode/agentes/module_manager_editor_common.php godmode/agentes/module_manager_editor_network.php godmode/agentes/fields_manager.php godmode/agentes/module_manager_editor_wmi.php godmode/agentes/module_manager_editor_plugin.php godmode/agentes/agent_conf_gis.php godmode/agentes/module_manager_editor_prediction.php godmode/agentes/module_manager.php godmode/agentes/modificar_agente.php godmode/agentes/configurar_agente.php godmode/agentes/configure_field.php godmode/agentes/module_manager_editor.php godmode/agentes/planned_downtime.php godmode/agentes/manage_config_remote.php godmode/agentes/agent_manager.php godmode/servers/recon_script.php godmode/servers/plugin.php godmode/servers/manage_recontask.php godmode/servers/modificar_server.php godmode/servers/manage_recontask_form.php godmode/alerts/alert_list.list.php godmode/alerts/configure_alert_compound.php godmode/alerts/alert_compounds.php godmode/alerts/alert_list.php godmode/alerts/configure_alert_template.php godmode/alerts/alert_templates.php godmode/alerts/configure_alert_action.php godmode/alerts/configure_alert_command.php godmode/alerts/alert_actions.php godmode/alerts/alert_list.builder.php godmode/alerts/alert_commands.php godmode/snmpconsole/snmp_alert.php godmode/snmpconsole/snmp_filters.php godmode/setup/file_manager.php godmode/setup/os.list.php godmode/setup/news.php godmode/setup/gis_step_2.php godmode/setup/links.php godmode/setup/setup.php godmode/setup/os.php godmode/setup/performance.php godmode/setup/setup_auth.php godmode/setup/gis.php godmode/setup/os.builder.php godmode/setup/setup_visuals.php godmode/users/user_list.php godmode/users/configure_user.php godmode/users/configure_profile.php godmode/gis_maps/configure_gis_map.php godmode/gis_maps/index.php godmode/massive/massive_add_alerts.php godmode/massive/massive_copy_modules.php godmode/massive/massive_delete_agents.php godmode/massive/massive_enable_disable_alerts.php godmode/massive/massive_operations.php godmode/massive/massive_delete_profiles.php godmode/massive/massive_edit_agents.php godmode/massive/massive_delete_action_alerts.php godmode/massive/massive_delete_modules.php godmode/massive/massive_add_profiles.php godmode/massive/massive_delete_alerts.php godmode/massive/massive_edit_modules.php godmode/massive/massive_standby_alerts.php godmode/massive/massive_add_action_alerts.php godmode/modules/manage_network_components_form.php godmode/modules/manage_nc_groups_form.php godmode/modules/manage_network_templates.php godmode/modules/module_list.php godmode/modules/manage_network_components_form_common.php godmode/modules/manage_network_components_form_network.php godmode/modules/manage_network_templates_form.php godmode/modules/manage_network_components_form_wmi.php godmode/modules/manage_network_components.php godmode/modules/manage_nc_groups.php godmode/modules/manage_network_components_form_plugin.php godmode/reporting/reporting_builder.list_items.php godmode/reporting/graph_builder.main.php godmode/reporting/visual_console_builder.wizard.php godmode/reporting/visual_console_builder.php godmode/reporting/reporting_builder.preview.php godmode/reporting/reporting_builder.main.php godmode/reporting/visual_console_builder.data.php godmode/reporting/visual_console_builder.elements.php godmode/reporting/graph_builder.php godmode/reporting/graph_builder.graph_editor.php godmode/reporting/reporting_builder.php godmode/reporting/visual_console_builder.editor.php godmode/reporting/reporting_builder.item_editor.php godmode/reporting/map_builder.php godmode/reporting/graphs.php godmode/reporting/graph_builder.preview.php: Now functions on functions_html.php, functions_gis.php, functions_filemanager.php, functions_exportserver.php have "html_", "gis_", "filemanager_" and "exportserver_" prefix respectively. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4281 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-27 15:43:31 +02:00
$rgb = html_html2rgb($col);
$colorsrgb[$key]['R'] = $rgb[0];
$colorsrgb[$key]['G'] = $rgb[1];
$colorsrgb[$key]['B'] = $rgb[2];
}
$i = 0;
foreach ($data as $d) {
$color = $d['data'];
$color = $colorsrgb[$color];
$ratio = $thinest_slice * $d['utimestamp'];
$myPicture->drawRoundedFilledRectangle ($i, 0, $ratio+$i,
$height, $radius, array('R' => $color['R'], 'G' => $color['G'], 'B' => $color['B']));
$i+=$ratio;
}
if ($round_corner) {
/* Under this value, the rounded rectangle is painted great */
if ($thinest_slice <= 16) {
/* Clean a bit of pixels */
for ($i = 0; $i < 7; $i++) {
$myPicture->drawLine (0, $i, 6 - $i, $i, array('R' => 255, 'G' => 255, 'B' => 255));
}
$end = $height - 1;
for ($i = 0; $i < 7; $i++) {
$myPicture->drawLine (0, $end - $i, 5 - $i, $end - $i, array('R' => 255, 'G' => 255, 'B' => 255));
}
}
}
$myPicture->drawRoundedRectangle (0, 0, $width,
$height - 1, $radius, array('R' => 157, 'G' => 157, 'B' => 157));
$myPicture->Stroke ();
}
function pch_pie_graph ($graph_type, $data_values, $legend_values, $width,
$height, $font, $water_mark, $font_size) {
/* CAT:Pie charts */
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints($data_values,"ScoreA");
$MyData->setSerieDescription("ScoreA","Application A");
/* Define the absissa serie */
$MyData->addPoints($legend_values,"Labels");
$MyData->setAbscissa("Labels");
/* Create the pChart object */
$myPicture = new pImage($width,$height,$MyData,TRUE);
/* Set the default font properties */
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size,"R"=>80,"G"=>80,"B"=>80));
$water_mark_height = 0;
$water_mark_width = 0;
if (!empty($water_mark)) {
$size_water_mark = getimagesize($water_mark);
$water_mark_height = $size_water_mark[1];
$water_mark_width = $size_water_mark[0];
$myPicture->drawFromPNG(($width - $water_mark_width),
($height - $water_mark_height) - 50, $water_mark);
}
/* Create the pPie object */
$PieChart = new pPie($myPicture,$MyData);
/* Draw an AA pie chart */
switch($graph_type) {
case "pie2d":
$PieChart->draw2DPie($width/4,$height/2,array("DataGapAngle"=>0,"DataGapRadius"=>0, "Border"=>FALSE, "BorderR"=>200, "BorderG"=>200, "BorderB"=>200, "Radius"=>$width/4, "ValueR"=>0, "ValueG"=>0, "ValueB"=>0, "WriteValues"=>TRUE));
break;
case "pie3d":
$PieChart->draw3DPie($width/4, $height/2,array("DataGapAngle"=>10,"DataGapRadius"=>6, "Border"=>TRUE, "Radius"=>$width/4, "ValueR"=>0, "ValueG"=>0, "ValueB"=>0, "WriteValues"=>TRUE));
break;
}
/* Write down the legend next to the 2nd chart*/
//Calculate the bottom margin from the size of string in each index
$max_chars = graph_get_max_index($legend_values);
$legend_with_aprox = 32 + (7 * $max_chars);
$PieChart->drawPieLegend($width - $legend_with_aprox, 5, array("R"=>255,"G"=>255,"B"=>255, "BoxSize"=>10));
/* Enable shadow computing */
$myPicture->setShadow(TRUE,array("X"=>3,"Y"=>3,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
/* Render the picture */
$myPicture->stroke();
}
function pch_kiviat_graph ($graph_type, $data_values, $legend_values, $width,
$height, $font, $font_size) {
/* CAT:Radar/Polar charts */
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints($data_values,"ScoreA");
$MyData->setSerieDescription("ScoreA","Application A");
/* Define the absissa serie */
$MyData->addPoints($legend_values,"Labels");
$MyData->setAbscissa("Labels");
/* Create the pChart object */
$myPicture = new pImage($width,$height,$MyData,TRUE);
/* Set the default font properties */
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size,"R"=>80,"G"=>80,"B"=>80));
/* Create the pRadar object */
$SplitChart = new pRadar();
/* Draw a radar chart */
$myPicture->setGraphArea(20,25,$width-10,$height-10);
/* Draw an AA pie chart */
switch($graph_type) {
case "radar":
$Options = array("SkipLabels"=>0,"LabelPos"=>RADAR_LABELS_HORIZONTAL,
"LabelMiddle"=>FALSE,"Layout"=>RADAR_LAYOUT_STAR,
"BackgroundGradient"=>array("StartR"=>255,"StartG"=>255,"StartB"=>255,
"StartAlpha"=>100,"EndR"=>207,"EndG"=>227,"EndB"=>125,"EndAlpha"=>50),
"FontName"=>$font,"FontSize"=>$font_size);
$SplitChart->drawRadar($myPicture,$MyData,$Options);
break;
case "polar":
$Options = array("Layout"=>RADAR_LAYOUT_CIRCLE,"BackgroundGradient"=>array("StartR"=>255,"StartG"=>255,"StartB"=>255,"StartAlpha"=>100,"EndR"=>207,"EndG"=>227,"EndB"=>125,"EndAlpha"=>50),
"FontName"=>$font,"FontSize"=>$font_size);
$SplitChart->drawRadar($myPicture,$MyData,$Options);
break;
}
/* Render the picture */
$myPicture->stroke();
}
function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font,
$antialiasing, $rgb_color = false, $xaxisname = "", $yaxisname = "",
$show_values = false, $legend = array(), $fine_colors = array(), $water_mark = '', $font_size) {
/* CAT: Vertical Bar Chart */
if(!is_array($legend) || empty($legend)) {
unset($legend);
}
/* Create and populate the pData object */
$MyData = new pData();
$overridePalette = array();
foreach($data as $i => $values) {
$MyData->addPoints($values,$i);
if(!empty($rgb_color)) {
$MyData->setPalette($i,
array("R" => $rgb_color[$i]['color']["R"],
"G" => $rgb_color[$i]['color']["G"],
"B" => $rgb_color[$i]['color']["B"],
"BorderR" => $rgb_color[$i]['border']["R"],
"BorderG" => $rgb_color[$i]['border']["G"],
"BorderB" => $rgb_color[$i]['border']["B"],
"Alpha" => $rgb_color[$i]['alpha']));
}
// Assign cyclic colors to bars if are setted
if($fine_colors) {
$c = 0;
foreach($values as $ii => $vv) {
if(!isset($fine_colors[$c])) {
$c = 0;
}
$overridePalette[$ii] = $fine_colors[$c];
$c++;
}
}
else {
$overridePalette = false;
}
}
$MyData->setAxisName(0,$yaxisname);
$MyData->addPoints($index,"Xaxis");
$MyData->setSerieDescription("Xaxis", $xaxisname);
$MyData->setAbscissa("Xaxis");
/* Create the pChart object */
$myPicture = new pImage($width,$height,$MyData);
/* Turn of Antialiasing */
$myPicture->Antialias = $antialiasing;
/* Add a border to the picture */
//$myPicture->drawRectangle(0,0,$width,$height,array("R"=>0,"G"=>0,"B"=>0));
/* Turn on shadow computing */
$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
/* Set the default font */
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size));
/* Draw the scale */
// TODO: AvoidTickWhenEmpty = FALSE When the distance between two ticks will be less than 50 px
// TODO: AvoidTickWhenEmpty = TRUE When the distance between two ticks will be greater than 50 px
//Calculate the top margin from the size of string in each index
$max_chars = graph_get_max_index($index);
$margin_top = 10 * $max_chars;
switch($graph_type) {
case "vbar":
$scaleSettings = array("AvoidTickWhenEmpty" => FALSE, "AvoidGridWhenEmpty" => FALSE,
"GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE,
"Mode"=>SCALE_MODE_START0, "LabelRotation" => 60);
$margin_left = 40;
$margin_top = 10;
$margin_bottom = 10 * $max_chars;
break;
case "hbar":
$scaleSettings = array("GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,
"CycleBackground"=>TRUE, "Mode"=>SCALE_MODE_START0, "Pos"=>SCALE_POS_TOPBOTTOM,
"LabelValuesRotation" => 60);
$margin_left = 5 * $max_chars;
$margin_top = 40;
$margin_bottom = 10;
break;
}
$water_mark_height = 0;
$water_mark_width = 0;
if (!empty($water_mark)) {
$size_water_mark = getimagesize($water_mark);
$water_mark_height = $size_water_mark[1];
$water_mark_width = $size_water_mark[0];
$myPicture->drawFromPNG(($width - $water_mark_width),
($height - $water_mark_height) - $margin_bottom, $water_mark);
}
/* Define the chart area */
$myPicture->setGraphArea($margin_left,$margin_top,$width - $water_mark_width,$height-$margin_bottom);
$myPicture->drawScale($scaleSettings);
if(isset($legend)) {
/* Write the chart legend */
$size = $myPicture->getLegendSize(array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));
$myPicture->drawLegend($width-$size['Width'],0,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL, "BoxWidth"=>10, "BoxHeight"=>10));
}
/* Turn on shadow computing */
$myPicture->setShadow(TRUE,array("X"=>0,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
/* Draw the chart */
$settings = array("ForceTransparency"=>"-1", "Gradient"=>TRUE,"GradientMode"=>GRADIENT_EFFECT_CAN,"DisplayValues"=>$show_values,"DisplayZeroValues"=>FALSE,"DisplayR"=>100,"DisplayG"=>100,"DisplayB"=>100,"DisplayShadow"=>TRUE,"Surrounding"=>5,"AroundZero"=>FALSE, "OverrideColors"=>$overridePalette);
$myPicture->drawBarChart($settings);
/* Render the picture */
$myPicture->stroke();
}
function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
$rgb_color = false, $xaxisname = "", $yaxisname = "", $show_values = false,
$legend = array(), $font, $antialiasing, $water_mark = '', $font_size) {
/* CAT:Vertical Charts */
if(!is_array($legend) || empty($legend)) {
unset($legend);
}
/*$legend=array('pep1' => 'pep1','pep2' => 'pep2','pep3' => 'pep3','pep4' => 'pep4');
$data=array(array('pep1' => 1, 'pep2' => 1, 'pep3' => 3, 'pep4' => 3), array('pep1' => 1, 'pep2' => 3, 'pep3' => 1,'pep4' => 4), array('pep1' => 3, 'pep2' => 1, 'pep3' => 1,'pep4' =>1), array('pep1' => 1, 'pep2' =>1, 'pep3' =>1,'pep4' =>0));
$index=array(1,2,3,4);
*/
if(is_array(reset($data))) {
$data2 = array();
foreach($data as $i =>$values) {
$c = 0;
foreach($values as $i2 => $value) {
$data2[$i2][$i] = $value;
$c++;
}
}
$data = $data2;
}
else {
$data = array($data);
}
/* Create and populate the pData object */
$MyData = new pData();
foreach($data as $i => $values) {
if(isset($legend)) {
$point_id = $legend[$i];
}
else {
$point_id = $i;
}
$MyData->addPoints($values,$point_id);
if (!empty($rgb_color)) {
$MyData->setPalette($point_id,
array("R" => $rgb_color[$i]['color']["R"],
"G" => $rgb_color[$i]['color']["G"],
"B" => $rgb_color[$i]['color']["B"],
"BorderR" => $rgb_color[$i]['border']["R"],
"BorderG" => $rgb_color[$i]['border']["G"],
"BorderB" => $rgb_color[$i]['border']["B"],
"Alpha" => $rgb_color[$i]['alpha']));
/*$palette_color = array();
if (isset($rgb_color[$i]['color'])) {
$palette_color["R"] = $rgb_color[$i]['color']["R"];
$palette_color["G"] = $rgb_color[$i]['color']["G"];
$palette_color["B"] = $rgb_color[$i]['color']["B"];
}
if (isset($rgb_color[$i]['color'])) {
$palette_color["BorderR"] = $rgb_color[$i]['border']["R"];
$palette_color["BorderG"] = $rgb_color[$i]['border']["G"];
$palette_color["BorderB"] = $rgb_color[$i]['border']["B"];
}
if (isset($rgb_color[$i]['color'])) {
$palette_color["Alpha"] = $rgb_color[$i]['Alpha'];
}
$MyData->setPalette($point_id, $palette_color);*/
}
$MyData->setSerieWeight($point_id, 0);
}
//$MyData->addPoints($data,"Yaxis");
$MyData->setAxisName(0,$yaxisname);
$MyData->addPoints($index,"Xaxis");
$MyData->setSerieDescription("Xaxis", $xaxisname);
$MyData->setAbscissa("Xaxis");
/* Create the pChart object */
$myPicture = new pImage($width,$height,$MyData);
/* Turn of Antialiasing */
$myPicture->Antialias = $antialiasing;
/* Add a border to the picture */
//$myPicture->drawRectangle(0,0,$width,$height,array("R"=>0,"G"=>0,"B"=>0));
/* Set the default font */
$myPicture->setFontProperties(array("FontName"=>$font, "FontSize"=>$font_size));
if(isset($legend)) {
/* Set horizontal legend if is posible */
$legend_mode = LEGEND_HORIZONTAL;
$size = $myPicture->getLegendSize(array("Style"=>LEGEND_NOBORDER,"Mode"=>$legend_mode));
if($size['Width'] > ($width - 5)) {
$legend_mode = LEGEND_VERTICAL;
$size = $myPicture->getLegendSize(array("Style"=>LEGEND_NOBORDER,"Mode"=>$legend_mode));
}
/* Write the chart legend */
$myPicture->drawLegend($width-$size['Width'], 8,array("Style"=>LEGEND_NOBORDER,"Mode"=>$legend_mode));
}
//Calculate the bottom margin from the size of string in each index
$max_chars = graph_get_max_index($index);
$margin_bottom = $font_size * $max_chars;
$water_mark_height = 0;
$water_mark_width = 0;
if (!empty($water_mark)) {
$size_water_mark = getimagesize($water_mark);
$water_mark_height = $size_water_mark[1];
$water_mark_width = $size_water_mark[0];
$myPicture->drawFromPNG(($width - $water_mark_width),
($height - $water_mark_height) - $margin_bottom, $water_mark);
}
if (isset($size['Height'])) {
/* Define the chart area */
$myPicture->setGraphArea(40,$size['Height'],$width - $water_mark_width,$height - $margin_bottom);
}
else {
/* Define the chart area */
$myPicture->setGraphArea(40, 5,$width - $water_mark_width,$height - $margin_bottom);
}
/* Draw the scale */
$scaleSettings = array("GridR"=>200,
"GridG"=>200,
"GridB"=>200,
"DrawSubTicks"=>TRUE,
"CycleBackground"=>TRUE, "Mode"=>SCALE_MODE_START0, "LabelRotation" => 60, "XMargin" => 0, "MinDivHeight" => 20);
$myPicture->drawScale($scaleSettings);
/* Turn on shadow computing */
//$myPicture->setShadow(TRUE,array("X"=>0,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
switch ($graph_type) {
case 'stacked_area':
$ForceTransparency = "-1";
break;
default:
$ForceTransparency = "50";
break;
}
/* Draw the chart */
$settings = array("ForceTransparency"=> $ForceTransparency, //
"Gradient"=>TRUE,
"GradientMode"=>GRADIENT_EFFECT_CAN,
"DisplayValues"=>$show_values,
"DisplayZeroValues"=>FALSE,
"DisplayR"=>100,
"DisplayZeros"=> FALSE,
"DisplayG"=>100,"DisplayB"=>100,"DisplayShadow"=>TRUE,"Surrounding"=>5,"AroundZero"=>FALSE);
switch($graph_type) {
case "stacked_area":
case "area":
$myPicture->drawAreaChart($settings);
break;
case "line":
$myPicture->drawLineChart($settings);
break;
}
/* Render the picture */
$myPicture->stroke();
}
function pch_threshold_graph ($graph_type, $index, $data, $width, $height, $font,
$antialiasing, $xaxisname = "", $yaxisname = "", $title = "",
$show_values = false, $show_legend = false, $font_size) {
/* CAT:Threshold Chart */
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints($data,"DEFCA");
$MyData->setAxisName(0,$yaxisname);
$MyData->setAxisDisplay(0,AXIS_FORMAT_CURRENCY);
$MyData->addPoints($index,"Labels");
$MyData->setSerieDescription("Labels",$xaxisname);
$MyData->setAbscissa("Labels");
$MyData->setPalette("DEFCA",array("R"=>55,"G"=>91,"B"=>127));
/* Create the pChart object */
$myPicture = new pImage(700,230,$MyData);
$myPicture->drawGradientArea(0,0,700,230,DIRECTION_VERTICAL,array("StartR"=>220,"StartG"=>220,"StartB"=>220,"EndR"=>255,"EndG"=>255,"EndB"=>255,"Alpha"=>100));
$myPicture->drawRectangle(0,0,699,229,array("R"=>200,"G"=>200,"B"=>200));
/* Write the picture title */
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size));
$myPicture->drawText(60,35,$title,array("FontSize"=>$font_size,"Align"=>TEXT_ALIGN_BOTTOMLEFT));
/* Do some cosmetic and draw the chart */
$myPicture->setGraphArea(60,40,670,190);
$myPicture->drawFilledRectangle(60,40,670,190,array("R"=>255,"G"=>255,"B"=>255,"Surrounding"=>-200,"Alpha"=>10));
$myPicture->drawScale(array("GridR"=>180,"GridG"=>180,"GridB"=>180, "Mode" => SCALE_MODE_START0));
$myPicture->setShadow(TRUE,array("X"=>2,"Y"=>2,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size));
$settings = array("Gradient"=>TRUE,"GradientMode"=>GRADIENT_EFFECT_CAN,"DisplayValues"=>$show_values,"DisplayZeroValues"=>FALSE,"DisplayR"=>100,"DisplayG"=>100,"DisplayB"=>100,"DisplayShadow"=>TRUE,"Surrounding"=>5,"AroundZero"=>FALSE);
$myPicture->drawSplineChart($settings);
$myPicture->setShadow(FALSE);
if($show_legend) {
/* Write the chart legend */
$myPicture->drawLegend(643,210,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));
}
/* Render the picture */
$myPicture->stroke();
}
?>