2009-03-12 10:29:42 +01:00
|
|
|
<?php
|
2009-06-08 20:26:14 +02:00
|
|
|
|
|
|
|
// Pandora FMS - http://pandorafms.com
|
|
|
|
// ==================================================
|
|
|
|
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
|
|
|
|
// Please see http://pandorafms.org for full contribution list
|
2009-03-12 10:29:42 +01:00
|
|
|
|
|
|
|
// 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.
|
2009-06-08 20:26:14 +02:00
|
|
|
|
2009-08-24 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_menu.php, include/functions_html.php,
include/functions_events.php, include/functions_messages.php,
include/functions_modules.php, include/functions_exportserver.php,
include/functions_reporting.php, include/functions_filemanager.php,
include/pchart_graph.php, include/pandora_graph.php, include/auth/dev.php,
include/auth/ldap.php, include/auth/mysql.php, include/config.inc.php,
include/functions_networkmap.php, include/functions_servers.php,
include/FusionCharts/FusionCharts_Gen.php,
include/FusionCharts/FusionCharts.php,
include/functions_network_profiles.php, include/gettext.php,
include/functions_network_components.php, include/functions_visual_map.php,
include/fgraph2.php, include/Image/image_functions.php,
include/functions_config.php, include/help/en/help_plugin_parameters.php,
include/help/en/help_snmpcommunity.php, include/help/en/help_wmiquery.php,
include/help/en/help_postprocess.php,
include/help/en/help_prediction_source_module.php,
include/help/en/help_date_format.php, include/help/en/help_recontask.php,
include/help/en/help_alert-matches.php, include/help/en/help_tcp_send.php,
include/help/en/help_wmifield.php, include/help/en/help_duplicateconfig.php,
include/help/en/help_agent_status.php,
include/help/en/help_manage_alerts.php, include/help/en/help_wmikey.php,
include/help/en/help_alert_type.php,
include/help/en/help_network_component.php,
include/help/en/help_time_stamp-comparation.php,
include/help/en/help_eventview.php, include/help/en/help_timesource.php,
include/help/en/help_alert_validation.php,
include/help/en/help_map_builder.php,
include/help/en/help_alert_recovery.php,
include/help/en/help_module_type.php,
include/help/en/help_planned_downtime.php,
include/help/en/help_serverlag.php, include/help/en/help_alerts.php,
include/help/en/help_snmpwalk.php,
include/help/en/help_module_definition.php,
include/help/en/help_plugin_definition.php,
include/help/en/help_wminamespace.php, include/help/en/help_snmpoid.php
include/help/en/help_manageconfig.php,
include/help/es/help_alert_validation.php,
include/help/es/help_plugin_parameters.php,
include/help/es/help_snmpcommunity.php, include/help/es/help_wmiquery.php,
include/help/es/help_map_builder.php, include/help/es/help_postprocess.php,
include/help/es/help_date_format.php,
include/help/es/help_alert_recovery.php,
include/help/es/help_prediction_source_module.php,
include/help/es/help_module_type.php,
include/help/es/help_planned_downtime.php,
include/help/es/help_alert-matches.php, include/help/es/help_recontask.php,
include/help/es/help_alerts.php, include/help/es/help_serverlag.php,
include/help/es/help_snmpwalk.php,
include/help/es/help_module_definition.php,
include/help/es/help_tcp_send.php, include/help/es/help_duplicateconfig.php,
include/help/es/help_wmifield.php, include/help/es/help_manage_alerts.php,
include/help/es/help_wmikey.php, include/help/es/help_plugin_definition.php,
include/help/es/help_alert_type.php, include/help/es/help_snmpoid.php,
include/help/es/help_wminamespace.php,
include/help/es/help_network_component.php,
include/help/es/help_time_stamp-comparation.php,
include/help/es/help_manageconfig.php, include/help/es/help_timesource.php,
include/config_process.php, include/functions_ui.php, include/htmlawed.php,
include/functions_custom_graphs.php, include/fgraph.php,
include/functions_incidents.php, include/functions.php,
include/functions_agents.php, include/functions_db.php,
include/functions_themes.php, include/streams.php,
include/functions_fsgraph.php, include/functions_alerts.php,
include/functions_reports.php, include/functions_extensions.php,
include/functions_ui_renders.php: change comments blocks for delete the
warnings to construct phpDoc Files, give a struct and order in the
phpDoc files.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-08-25 19:39:28 +02:00
|
|
|
/**
|
|
|
|
* @package Include
|
2009-08-24 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_menu.php, include/functions_html.php,
include/functions_events.php, include/functions_messages.php,
include/functions_modules.php, include/functions_exportserver.php,
include/functions_reporting.php, include/functions_filemanager.php,
include/pchart_graph.php, include/pandora_graph.php, include/auth/ldap.php,
include/auth/mysql.php, include/config.inc.php,
include/functions_networkmap.php, include/functions_servers.php,
include/functions_network_profiles.php, include/gettext.php,
include/functions_network_components.php, include/functions_visual_map.php,
include/fgraph2.php, include/Image/image_functions.php,
include/functions_config.php, include/config_process.php,
include/functions_ui.php, include/htmlawed.php,
include/functions_custom_graphs.php, include/fgraph.php,
include/functions_incidents.php, include/functions.php,
include/functions_agents.php, include/functions_db.php,
include/functions_themes.php, include/streams.php,
include/functions_fsgraph.php, include/functions_alerts.php,
include/functions_reports.php, include/functions_extensions.php,
include/functions_ui_renders.php: change or add the subpackage in phpdoc
comment blocks for to organize more the result phpdoc files. Start to
document undocument functions.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1882 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-08-26 17:37:47 +02:00
|
|
|
* @subpackage Graphs
|
2009-08-24 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_menu.php, include/functions_html.php,
include/functions_events.php, include/functions_messages.php,
include/functions_modules.php, include/functions_exportserver.php,
include/functions_reporting.php, include/functions_filemanager.php,
include/pchart_graph.php, include/pandora_graph.php, include/auth/dev.php,
include/auth/ldap.php, include/auth/mysql.php, include/config.inc.php,
include/functions_networkmap.php, include/functions_servers.php,
include/FusionCharts/FusionCharts_Gen.php,
include/FusionCharts/FusionCharts.php,
include/functions_network_profiles.php, include/gettext.php,
include/functions_network_components.php, include/functions_visual_map.php,
include/fgraph2.php, include/Image/image_functions.php,
include/functions_config.php, include/help/en/help_plugin_parameters.php,
include/help/en/help_snmpcommunity.php, include/help/en/help_wmiquery.php,
include/help/en/help_postprocess.php,
include/help/en/help_prediction_source_module.php,
include/help/en/help_date_format.php, include/help/en/help_recontask.php,
include/help/en/help_alert-matches.php, include/help/en/help_tcp_send.php,
include/help/en/help_wmifield.php, include/help/en/help_duplicateconfig.php,
include/help/en/help_agent_status.php,
include/help/en/help_manage_alerts.php, include/help/en/help_wmikey.php,
include/help/en/help_alert_type.php,
include/help/en/help_network_component.php,
include/help/en/help_time_stamp-comparation.php,
include/help/en/help_eventview.php, include/help/en/help_timesource.php,
include/help/en/help_alert_validation.php,
include/help/en/help_map_builder.php,
include/help/en/help_alert_recovery.php,
include/help/en/help_module_type.php,
include/help/en/help_planned_downtime.php,
include/help/en/help_serverlag.php, include/help/en/help_alerts.php,
include/help/en/help_snmpwalk.php,
include/help/en/help_module_definition.php,
include/help/en/help_plugin_definition.php,
include/help/en/help_wminamespace.php, include/help/en/help_snmpoid.php
include/help/en/help_manageconfig.php,
include/help/es/help_alert_validation.php,
include/help/es/help_plugin_parameters.php,
include/help/es/help_snmpcommunity.php, include/help/es/help_wmiquery.php,
include/help/es/help_map_builder.php, include/help/es/help_postprocess.php,
include/help/es/help_date_format.php,
include/help/es/help_alert_recovery.php,
include/help/es/help_prediction_source_module.php,
include/help/es/help_module_type.php,
include/help/es/help_planned_downtime.php,
include/help/es/help_alert-matches.php, include/help/es/help_recontask.php,
include/help/es/help_alerts.php, include/help/es/help_serverlag.php,
include/help/es/help_snmpwalk.php,
include/help/es/help_module_definition.php,
include/help/es/help_tcp_send.php, include/help/es/help_duplicateconfig.php,
include/help/es/help_wmifield.php, include/help/es/help_manage_alerts.php,
include/help/es/help_wmikey.php, include/help/es/help_plugin_definition.php,
include/help/es/help_alert_type.php, include/help/es/help_snmpoid.php,
include/help/es/help_wminamespace.php,
include/help/es/help_network_component.php,
include/help/es/help_time_stamp-comparation.php,
include/help/es/help_manageconfig.php, include/help/es/help_timesource.php,
include/config_process.php, include/functions_ui.php, include/htmlawed.php,
include/functions_custom_graphs.php, include/fgraph.php,
include/functions_incidents.php, include/functions.php,
include/functions_agents.php, include/functions_db.php,
include/functions_themes.php, include/streams.php,
include/functions_fsgraph.php, include/functions_alerts.php,
include/functions_reports.php, include/functions_extensions.php,
include/functions_ui_renders.php: change comments blocks for delete the
warnings to construct phpDoc Files, give a struct and order in the
phpDoc files.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-08-25 19:39:28 +02:00
|
|
|
*/
|
2009-06-08 20:26:14 +02:00
|
|
|
|
2009-08-24 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_menu.php, include/functions_html.php,
include/functions_events.php, include/functions_messages.php,
include/functions_modules.php, include/functions_exportserver.php,
include/functions_reporting.php, include/functions_filemanager.php,
include/pchart_graph.php, include/pandora_graph.php, include/auth/dev.php,
include/auth/ldap.php, include/auth/mysql.php, include/config.inc.php,
include/functions_networkmap.php, include/functions_servers.php,
include/FusionCharts/FusionCharts_Gen.php,
include/FusionCharts/FusionCharts.php,
include/functions_network_profiles.php, include/gettext.php,
include/functions_network_components.php, include/functions_visual_map.php,
include/fgraph2.php, include/Image/image_functions.php,
include/functions_config.php, include/help/en/help_plugin_parameters.php,
include/help/en/help_snmpcommunity.php, include/help/en/help_wmiquery.php,
include/help/en/help_postprocess.php,
include/help/en/help_prediction_source_module.php,
include/help/en/help_date_format.php, include/help/en/help_recontask.php,
include/help/en/help_alert-matches.php, include/help/en/help_tcp_send.php,
include/help/en/help_wmifield.php, include/help/en/help_duplicateconfig.php,
include/help/en/help_agent_status.php,
include/help/en/help_manage_alerts.php, include/help/en/help_wmikey.php,
include/help/en/help_alert_type.php,
include/help/en/help_network_component.php,
include/help/en/help_time_stamp-comparation.php,
include/help/en/help_eventview.php, include/help/en/help_timesource.php,
include/help/en/help_alert_validation.php,
include/help/en/help_map_builder.php,
include/help/en/help_alert_recovery.php,
include/help/en/help_module_type.php,
include/help/en/help_planned_downtime.php,
include/help/en/help_serverlag.php, include/help/en/help_alerts.php,
include/help/en/help_snmpwalk.php,
include/help/en/help_module_definition.php,
include/help/en/help_plugin_definition.php,
include/help/en/help_wminamespace.php, include/help/en/help_snmpoid.php
include/help/en/help_manageconfig.php,
include/help/es/help_alert_validation.php,
include/help/es/help_plugin_parameters.php,
include/help/es/help_snmpcommunity.php, include/help/es/help_wmiquery.php,
include/help/es/help_map_builder.php, include/help/es/help_postprocess.php,
include/help/es/help_date_format.php,
include/help/es/help_alert_recovery.php,
include/help/es/help_prediction_source_module.php,
include/help/es/help_module_type.php,
include/help/es/help_planned_downtime.php,
include/help/es/help_alert-matches.php, include/help/es/help_recontask.php,
include/help/es/help_alerts.php, include/help/es/help_serverlag.php,
include/help/es/help_snmpwalk.php,
include/help/es/help_module_definition.php,
include/help/es/help_tcp_send.php, include/help/es/help_duplicateconfig.php,
include/help/es/help_wmifield.php, include/help/es/help_manage_alerts.php,
include/help/es/help_wmikey.php, include/help/es/help_plugin_definition.php,
include/help/es/help_alert_type.php, include/help/es/help_snmpoid.php,
include/help/es/help_wminamespace.php,
include/help/es/help_network_component.php,
include/help/es/help_time_stamp-comparation.php,
include/help/es/help_manageconfig.php, include/help/es/help_timesource.php,
include/config_process.php, include/functions_ui.php, include/htmlawed.php,
include/functions_custom_graphs.php, include/fgraph.php,
include/functions_incidents.php, include/functions.php,
include/functions_agents.php, include/functions_db.php,
include/functions_themes.php, include/streams.php,
include/functions_fsgraph.php, include/functions_alerts.php,
include/functions_reports.php, include/functions_extensions.php,
include/functions_ui_renders.php: change comments blocks for delete the
warnings to construct phpDoc Files, give a struct and order in the
phpDoc files.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-08-25 19:39:28 +02:00
|
|
|
/**#@+
|
|
|
|
* Include the pChart class.
|
|
|
|
*/
|
2009-03-17 16:15:55 +01:00
|
|
|
require_once ('pChart/pData.class');
|
2009-03-12 10:29:42 +01:00
|
|
|
require_once ('pChart/pChart.class');
|
2009-08-24 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_menu.php, include/functions_html.php,
include/functions_events.php, include/functions_messages.php,
include/functions_modules.php, include/functions_exportserver.php,
include/functions_reporting.php, include/functions_filemanager.php,
include/pchart_graph.php, include/pandora_graph.php, include/auth/dev.php,
include/auth/ldap.php, include/auth/mysql.php, include/config.inc.php,
include/functions_networkmap.php, include/functions_servers.php,
include/FusionCharts/FusionCharts_Gen.php,
include/FusionCharts/FusionCharts.php,
include/functions_network_profiles.php, include/gettext.php,
include/functions_network_components.php, include/functions_visual_map.php,
include/fgraph2.php, include/Image/image_functions.php,
include/functions_config.php, include/help/en/help_plugin_parameters.php,
include/help/en/help_snmpcommunity.php, include/help/en/help_wmiquery.php,
include/help/en/help_postprocess.php,
include/help/en/help_prediction_source_module.php,
include/help/en/help_date_format.php, include/help/en/help_recontask.php,
include/help/en/help_alert-matches.php, include/help/en/help_tcp_send.php,
include/help/en/help_wmifield.php, include/help/en/help_duplicateconfig.php,
include/help/en/help_agent_status.php,
include/help/en/help_manage_alerts.php, include/help/en/help_wmikey.php,
include/help/en/help_alert_type.php,
include/help/en/help_network_component.php,
include/help/en/help_time_stamp-comparation.php,
include/help/en/help_eventview.php, include/help/en/help_timesource.php,
include/help/en/help_alert_validation.php,
include/help/en/help_map_builder.php,
include/help/en/help_alert_recovery.php,
include/help/en/help_module_type.php,
include/help/en/help_planned_downtime.php,
include/help/en/help_serverlag.php, include/help/en/help_alerts.php,
include/help/en/help_snmpwalk.php,
include/help/en/help_module_definition.php,
include/help/en/help_plugin_definition.php,
include/help/en/help_wminamespace.php, include/help/en/help_snmpoid.php
include/help/en/help_manageconfig.php,
include/help/es/help_alert_validation.php,
include/help/es/help_plugin_parameters.php,
include/help/es/help_snmpcommunity.php, include/help/es/help_wmiquery.php,
include/help/es/help_map_builder.php, include/help/es/help_postprocess.php,
include/help/es/help_date_format.php,
include/help/es/help_alert_recovery.php,
include/help/es/help_prediction_source_module.php,
include/help/es/help_module_type.php,
include/help/es/help_planned_downtime.php,
include/help/es/help_alert-matches.php, include/help/es/help_recontask.php,
include/help/es/help_alerts.php, include/help/es/help_serverlag.php,
include/help/es/help_snmpwalk.php,
include/help/es/help_module_definition.php,
include/help/es/help_tcp_send.php, include/help/es/help_duplicateconfig.php,
include/help/es/help_wmifield.php, include/help/es/help_manage_alerts.php,
include/help/es/help_wmikey.php, include/help/es/help_plugin_definition.php,
include/help/es/help_alert_type.php, include/help/es/help_snmpoid.php,
include/help/es/help_wminamespace.php,
include/help/es/help_network_component.php,
include/help/es/help_time_stamp-comparation.php,
include/help/es/help_manageconfig.php, include/help/es/help_timesource.php,
include/config_process.php, include/functions_ui.php, include/htmlawed.php,
include/functions_custom_graphs.php, include/fgraph.php,
include/functions_incidents.php, include/functions.php,
include/functions_agents.php, include/functions_db.php,
include/functions_themes.php, include/streams.php,
include/functions_fsgraph.php, include/functions_alerts.php,
include/functions_reports.php, include/functions_extensions.php,
include/functions_ui_renders.php: change comments blocks for delete the
warnings to construct phpDoc Files, give a struct and order in the
phpDoc files.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-08-25 19:39:28 +02:00
|
|
|
/**#@-*/
|
2009-03-12 10:29:42 +01:00
|
|
|
|
2009-08-24 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_menu.php, include/functions_html.php,
include/functions_events.php, include/functions_messages.php,
include/functions_modules.php, include/functions_exportserver.php,
include/functions_reporting.php, include/functions_filemanager.php,
include/pchart_graph.php, include/pandora_graph.php, include/auth/dev.php,
include/auth/ldap.php, include/auth/mysql.php, include/config.inc.php,
include/functions_networkmap.php, include/functions_servers.php,
include/FusionCharts/FusionCharts_Gen.php,
include/FusionCharts/FusionCharts.php,
include/functions_network_profiles.php, include/gettext.php,
include/functions_network_components.php, include/functions_visual_map.php,
include/fgraph2.php, include/Image/image_functions.php,
include/functions_config.php, include/help/en/help_plugin_parameters.php,
include/help/en/help_snmpcommunity.php, include/help/en/help_wmiquery.php,
include/help/en/help_postprocess.php,
include/help/en/help_prediction_source_module.php,
include/help/en/help_date_format.php, include/help/en/help_recontask.php,
include/help/en/help_alert-matches.php, include/help/en/help_tcp_send.php,
include/help/en/help_wmifield.php, include/help/en/help_duplicateconfig.php,
include/help/en/help_agent_status.php,
include/help/en/help_manage_alerts.php, include/help/en/help_wmikey.php,
include/help/en/help_alert_type.php,
include/help/en/help_network_component.php,
include/help/en/help_time_stamp-comparation.php,
include/help/en/help_eventview.php, include/help/en/help_timesource.php,
include/help/en/help_alert_validation.php,
include/help/en/help_map_builder.php,
include/help/en/help_alert_recovery.php,
include/help/en/help_module_type.php,
include/help/en/help_planned_downtime.php,
include/help/en/help_serverlag.php, include/help/en/help_alerts.php,
include/help/en/help_snmpwalk.php,
include/help/en/help_module_definition.php,
include/help/en/help_plugin_definition.php,
include/help/en/help_wminamespace.php, include/help/en/help_snmpoid.php
include/help/en/help_manageconfig.php,
include/help/es/help_alert_validation.php,
include/help/es/help_plugin_parameters.php,
include/help/es/help_snmpcommunity.php, include/help/es/help_wmiquery.php,
include/help/es/help_map_builder.php, include/help/es/help_postprocess.php,
include/help/es/help_date_format.php,
include/help/es/help_alert_recovery.php,
include/help/es/help_prediction_source_module.php,
include/help/es/help_module_type.php,
include/help/es/help_planned_downtime.php,
include/help/es/help_alert-matches.php, include/help/es/help_recontask.php,
include/help/es/help_alerts.php, include/help/es/help_serverlag.php,
include/help/es/help_snmpwalk.php,
include/help/es/help_module_definition.php,
include/help/es/help_tcp_send.php, include/help/es/help_duplicateconfig.php,
include/help/es/help_wmifield.php, include/help/es/help_manage_alerts.php,
include/help/es/help_wmikey.php, include/help/es/help_plugin_definition.php,
include/help/es/help_alert_type.php, include/help/es/help_snmpoid.php,
include/help/es/help_wminamespace.php,
include/help/es/help_network_component.php,
include/help/es/help_time_stamp-comparation.php,
include/help/es/help_manageconfig.php, include/help/es/help_timesource.php,
include/config_process.php, include/functions_ui.php, include/htmlawed.php,
include/functions_custom_graphs.php, include/fgraph.php,
include/functions_incidents.php, include/functions.php,
include/functions_agents.php, include/functions_db.php,
include/functions_themes.php, include/streams.php,
include/functions_fsgraph.php, include/functions_alerts.php,
include/functions_reports.php, include/functions_extensions.php,
include/functions_ui_renders.php: change comments blocks for delete the
warnings to construct phpDoc Files, give a struct and order in the
phpDoc files.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-08-25 19:39:28 +02:00
|
|
|
/**
|
|
|
|
* @package Include
|
|
|
|
*/
|
2009-03-12 10:29:42 +01:00
|
|
|
class PchartGraph extends PandoraGraphAbstract {
|
|
|
|
public $palette_path = false;
|
|
|
|
private $graph = NULL;
|
|
|
|
private $dataset = NULL;
|
|
|
|
private $x1;
|
|
|
|
private $x2;
|
|
|
|
private $y1;
|
|
|
|
private $y2;
|
|
|
|
|
|
|
|
public function load_palette ($palette_path) {
|
|
|
|
$this->palette_path = $palette_path;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function pie_graph () {
|
2009-03-17 16:15:55 +01:00
|
|
|
// dataset definition
|
|
|
|
$this->dataset = new pData;
|
|
|
|
$this->dataset->AddPoint ($this->data, "Serie1", $this->legend);
|
|
|
|
$this->dataset->AddPoint ($this->legend, "Serie2");
|
|
|
|
$this->dataset->AddAllSeries ();
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->dataset->SetAbsciseLabelSerie ("Serie2");
|
2009-03-17 16:15:55 +01:00
|
|
|
|
|
|
|
// Initialise the graph
|
|
|
|
$this->graph = new pChart ($this->width, $this->height);
|
|
|
|
$this->graph->setFontProperties ($this->fontpath, 8);
|
2009-03-12 10:29:42 +01:00
|
|
|
if ($this->palette_path) {
|
|
|
|
$this->graph->loadColorPalette ($this->palette_path);
|
2009-03-17 16:15:55 +01:00
|
|
|
}
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->add_background ();
|
2009-03-17 16:15:55 +01:00
|
|
|
|
2009-03-12 10:29:42 +01:00
|
|
|
// Draw the pie chart
|
2009-03-17 16:15:55 +01:00
|
|
|
if ($this->three_dimensions) {
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->graph->drawPieGraph ($this->dataset->GetData (),
|
|
|
|
$this->dataset->GetDataDescription (),
|
|
|
|
$this->width / 2,
|
|
|
|
$this->height / 2 - 15, $this->zoom,
|
|
|
|
PIE_PERCENTAGE_LABEL, 5, 70, 20, 5);
|
|
|
|
} else {
|
|
|
|
$this->graph->drawFlatPieGraph ($this->dataset->GetData (),
|
|
|
|
$this->dataset->GetDataDescription (),
|
|
|
|
$this->width / 2,
|
|
|
|
$this->height / 2, $this->zoom,
|
|
|
|
PIE_PERCENTAGE_LABEL, 5);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($this->show_legend) {
|
|
|
|
$this->graph->drawPieLegend (10, 10, $this->dataset->GetData (),
|
|
|
|
$this->dataset->GetDataDescription (), 255, 255, 255);
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->graph->Stroke ();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function horizontal_bar_graph () {
|
|
|
|
// dataset definition
|
|
|
|
$this->dataset = new pData;
|
|
|
|
foreach ($this->data as $x => $y) {
|
|
|
|
$this->dataset->AddPoint ($y, "Serie1", $x);
|
2009-03-17 16:15:55 +01:00
|
|
|
}
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->dataset->AddAllSeries ();
|
|
|
|
$this->dataset->SetXAxisFormat ("label");
|
2009-03-17 16:15:55 +01:00
|
|
|
$this->dataset->SetYAxisFormat ($this->yaxis_format);
|
|
|
|
|
|
|
|
// Initialise the graph
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->graph = new pChart ($this->width, $this->height);
|
|
|
|
if ($this->palette_path) {
|
|
|
|
$this->graph->loadColorPalette ($this->palette_path);
|
2009-03-17 16:15:55 +01:00
|
|
|
}
|
|
|
|
$this->graph->setFontProperties ($this->fontpath, 8);
|
|
|
|
$this->add_background ();
|
|
|
|
$this->graph->drawGraphArea (255, 255, 255, true);
|
2009-04-01 10:04:49 +02:00
|
|
|
if ($this->show_grid)
|
|
|
|
$this->graph->drawGrid (4, true, 230, 230, 230, 50);
|
2009-03-17 16:15:55 +01:00
|
|
|
|
2009-03-12 10:29:42 +01:00
|
|
|
// Draw the bar graph
|
|
|
|
$this->graph->setFontProperties ($this->fontpath, 8);
|
2009-03-17 16:15:55 +01:00
|
|
|
$this->graph->setFixedScale (0, max ($this->data));
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->graph->drawOverlayBarGraphH ($this->dataset->GetData (),
|
2009-03-17 16:15:55 +01:00
|
|
|
$this->dataset->GetDataDescription (), 50);
|
|
|
|
|
|
|
|
// Finish the graph
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->add_legend ();
|
2009-03-17 16:15:55 +01:00
|
|
|
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->graph->Stroke ();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function single_graph () {
|
2009-03-17 16:15:55 +01:00
|
|
|
// Dataset definition
|
|
|
|
$this->dataset = new pData;
|
2009-08-06 20:55:54 +02:00
|
|
|
$this->graph = new pChart ($this->width, $this->height+2);
|
2009-03-12 10:29:42 +01:00
|
|
|
|
|
|
|
foreach ($this->data as $x => $y) {
|
|
|
|
$this->dataset->AddPoint ($y, "Serie1", $x);
|
|
|
|
}
|
|
|
|
$color = $this->get_rgb_values ($this->graph_color[2]);
|
2009-03-17 16:15:55 +01:00
|
|
|
$this->graph->setColorPalette (0, $color['r'], $color['g'], $color['b']);
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->dataset->AddAllSeries ();
|
2009-04-01 10:04:49 +02:00
|
|
|
if ($this->legend !== false)
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->dataset->SetSerieName ($this->legend[0], "Serie1");
|
|
|
|
|
2009-04-01 10:04:49 +02:00
|
|
|
if ($this->palette_path)
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->graph->loadColorPalette ($this->palette_path);
|
2009-04-01 10:04:49 +02:00
|
|
|
|
2009-03-17 16:15:55 +01:00
|
|
|
$this->graph->setFontProperties ($this->fontpath, 8);
|
2009-08-06 20:55:54 +02:00
|
|
|
|
|
|
|
// White background
|
|
|
|
$this->graph->drawFilledRoundedRectangle(1,1,$this->width,$this->height,0,254,254,254);
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->add_background ();
|
|
|
|
$this->dataset->SetXAxisFormat ($this->xaxis_format);
|
2009-03-17 16:15:55 +01:00
|
|
|
$this->dataset->SetYAxisFormat ($this->yaxis_format);
|
2009-08-06 20:55:54 +02:00
|
|
|
$this->graph->drawGraphArea (254, 254, 254, true);
|
2009-03-12 10:29:42 +01:00
|
|
|
|
|
|
|
if ($this->max_value == 0 || $this->max_value == 1)
|
|
|
|
$this->graph->setFixedScale (0, 1, 1);
|
2009-03-17 16:15:55 +01:00
|
|
|
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->graph->drawScale ($this->dataset->GetData (),
|
|
|
|
$this->dataset->GetDataDescription (),
|
2009-04-01 10:04:49 +02:00
|
|
|
SCALE_START0, 80, 80, 80, $this->show_axis,
|
2009-03-12 10:29:42 +01:00
|
|
|
0, 0, false,
|
|
|
|
$this->xaxis_interval);
|
|
|
|
|
2009-04-01 10:04:49 +02:00
|
|
|
if ($this->show_grid)
|
2009-08-06 20:55:54 +02:00
|
|
|
$this->graph->drawGrid (1, false, 200, 200, 200);
|
2009-03-17 16:15:55 +01:00
|
|
|
if ($this->max_value > 0) {
|
|
|
|
// Draw the graph
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->graph->drawFilledLineGraph ($this->dataset->GetData (),
|
|
|
|
$this->dataset->GetDataDescription (),
|
|
|
|
50, true);
|
|
|
|
}
|
2009-03-17 16:15:55 +01:00
|
|
|
|
|
|
|
// Finish the graph
|
2009-08-06 20:55:54 +02:00
|
|
|
// $this->add_legend ();
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->add_events ();
|
|
|
|
$this->add_alert_levels ();
|
2009-03-17 16:15:55 +01:00
|
|
|
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->graph->Stroke ();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function sparse_graph ($period, $avg_only, $min_value, $max_value, $unit_name) {
|
2009-03-17 16:15:55 +01:00
|
|
|
// Dataset definition
|
|
|
|
$this->dataset = new pData;
|
2009-08-06 20:55:54 +02:00
|
|
|
$this->graph = new pChart ($this->width, $this->height+5);
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->graph->setFontProperties ($this->fontpath, 8);
|
|
|
|
$this->legend = array ();
|
|
|
|
|
|
|
|
if ($avg_only) {
|
|
|
|
foreach ($this->data as $data) {
|
|
|
|
$this->dataset->AddPoint ($data['sum'], "AVG", $data['timestamp_bottom']);
|
|
|
|
}
|
2009-03-18 16:42:15 +01:00
|
|
|
$color = $this->get_rgb_values ($this->graph_color[2]);
|
|
|
|
$this->graph->setColorPalette (0, $color['r'], $color['g'], $color['b']);
|
2009-03-12 10:29:42 +01:00
|
|
|
} else {
|
|
|
|
foreach ($this->data as $data) {
|
|
|
|
$this->dataset->AddPoint ($data['sum'], "AVG", $data['timestamp_bottom']);
|
|
|
|
$this->dataset->AddPoint ($data['min'], "MIN");
|
|
|
|
$this->dataset->AddPoint ($data['max'], "MAX");
|
|
|
|
}
|
2010-08-30 13:52:13 +02:00
|
|
|
$this->legend[1] = __("Min");
|
|
|
|
$this->legend[0] = __("Avg");
|
|
|
|
$this->legend[2] = __("Max");
|
|
|
|
$this->dataset->SetSerieName (__("Min"), "MIN");
|
|
|
|
$this->dataset->SetSerieName (__("Avg"), "AVG");
|
|
|
|
$this->dataset->SetSerieName (__("Max"), "MAX");
|
2009-03-18 16:42:15 +01:00
|
|
|
$this->set_colors ();
|
2009-03-12 10:29:42 +01:00
|
|
|
}
|
2009-08-06 20:55:54 +02:00
|
|
|
$this->dataset->SetXAxisFormat ('datetime');
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->graph->setDateFormat ("Y");
|
2009-03-17 16:15:55 +01:00
|
|
|
$this->dataset->SetYAxisFormat ('metric');
|
|
|
|
$this->dataset->AddAllSeries ();
|
2010-08-30 13:52:13 +02:00
|
|
|
|
|
|
|
$this->dataset->SetSerieName (__("Avg"), "AVG");
|
|
|
|
$this->legend[0] = __("Avg");
|
2009-03-12 10:29:42 +01:00
|
|
|
|
|
|
|
if ($this->palette_path) {
|
|
|
|
$this->graph->loadColorPalette ($this->palette_path);
|
|
|
|
}
|
2009-08-06 20:55:54 +02:00
|
|
|
|
|
|
|
// White background
|
|
|
|
$this->graph->drawFilledRoundedRectangle(1,1,$this->width,$this->height,0,254,254,254);
|
2009-03-17 16:15:55 +01:00
|
|
|
|
2009-08-06 20:55:54 +02:00
|
|
|
// Graph border
|
|
|
|
$this->graph->drawRoundedRectangle(1,1,$this->width-1,$this->height+4,5,230,230,230);
|
|
|
|
|
|
|
|
|
|
|
|
$this->add_background ();
|
|
|
|
$this->graph->drawGraphArea (254, 254, 254, false);
|
|
|
|
|
2009-03-17 16:15:55 +01:00
|
|
|
$this->xaxis_interval = ($this->xaxis_interval / 7 >= 1) ? ($this->xaxis_interval / 7) : 10;
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->graph->drawScale ($this->dataset->GetData (),
|
|
|
|
$this->dataset->GetDataDescription (), SCALE_START0,
|
2009-08-06 20:55:54 +02:00
|
|
|
80, 80, 80, $this->show_axis, 0, 50, false,
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->xaxis_interval);
|
2009-08-06 20:55:54 +02:00
|
|
|
|
2009-03-17 16:15:55 +01:00
|
|
|
/* NOTICE: The final "false" is a Pandora modificaton of pChart to avoid showing vertical lines. */
|
2009-04-01 10:04:49 +02:00
|
|
|
if ($this->show_grid)
|
|
|
|
$this->graph->drawGrid (1, true, 225, 225, 225, 100, false);
|
2009-08-06 20:55:54 +02:00
|
|
|
|
2009-03-17 16:15:55 +01:00
|
|
|
// Draw the graph
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->graph->drawFilledLineGraph ($this->dataset->GetData(), $this->dataset->GetDataDescription(), 50, true);
|
2009-08-06 20:55:54 +02:00
|
|
|
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->add_legend ();
|
|
|
|
$this->add_events ("AVG");
|
|
|
|
$this->add_alert_levels ();
|
2009-03-17 16:15:55 +01:00
|
|
|
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->graph->Stroke ();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function vertical_bar_graph () {
|
|
|
|
// dataset definition
|
|
|
|
$this->dataset = new pData;
|
|
|
|
foreach ($this->data as $x => $y) {
|
|
|
|
$this->dataset->AddPoint ($y, "Serie1", $x);
|
2009-03-17 16:15:55 +01:00
|
|
|
}
|
|
|
|
$this->dataset->AddAllSeries ();
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->dataset->SetAbsciseLabelSerie ();
|
|
|
|
$this->dataset->SetXAxisFormat ($this->xaxis_format);
|
|
|
|
$this->dataset->SetYAxisFormat ($this->yaxis_format);
|
2009-03-17 16:15:55 +01:00
|
|
|
|
|
|
|
// Initialise the graph
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->graph = new pChart ($this->width, $this->height);
|
|
|
|
if ($this->palette_path) {
|
|
|
|
$this->graph->loadColorPalette ($this->palette_path);
|
2009-03-17 16:15:55 +01:00
|
|
|
}
|
|
|
|
$this->graph->setFontProperties ($this->fontpath, 8);
|
|
|
|
$this->add_background ();
|
|
|
|
$this->graph->drawGraphArea (255, 255, 255, true);
|
2009-04-01 10:04:49 +02:00
|
|
|
if ($this->show_grid)
|
|
|
|
$this->graph->drawGrid (4, true, 230, 230, 230, 50);
|
2009-03-17 16:15:55 +01:00
|
|
|
|
2009-03-12 10:29:42 +01:00
|
|
|
// Draw the bar graph
|
|
|
|
$this->graph->setFontProperties ($this->fontpath, 8);
|
|
|
|
$this->graph->drawScale ($this->dataset->GetData (),
|
|
|
|
$this->dataset->GetDataDescription (),
|
|
|
|
SCALE_START0, 80, 80, 80,
|
2009-04-01 10:04:49 +02:00
|
|
|
$this->show_axis, 0, 0, false,
|
2009-03-17 16:15:55 +01:00
|
|
|
$this->xaxis_interval);
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->graph->drawOverlayBarGraph ($this->dataset->GetData (),
|
|
|
|
$this->dataset->GetDataDescription (),
|
2009-03-17 16:15:55 +01:00
|
|
|
50);
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->add_events ("Serie1");
|
|
|
|
$this->add_alert_levels ();
|
2009-03-17 16:15:55 +01:00
|
|
|
|
|
|
|
// Finish the graph
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->graph->Stroke ();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function combined_graph ($values, $events, $alerts, $unit_name, $max_value, $stacked) {
|
|
|
|
set_time_limit (0);
|
2009-03-17 16:15:55 +01:00
|
|
|
// Dataset definition
|
|
|
|
$this->dataset = new pData;
|
2009-08-06 20:55:54 +02:00
|
|
|
$this->graph = new pChart ($this->width, $this->height+5);
|
|
|
|
|
2010-08-30 13:52:13 +02:00
|
|
|
$graph_items = 0;
|
2009-08-06 20:55:54 +02:00
|
|
|
// $previo stores values from last series to made the stacked graph
|
2009-03-12 10:29:42 +01:00
|
|
|
foreach ($this->data as $i => $data) {
|
2010-08-30 13:52:13 +02:00
|
|
|
$graph_items++;
|
|
|
|
$max = 0;
|
|
|
|
$min = 10000000000000;
|
|
|
|
$avg = 0;
|
|
|
|
$count = 0;
|
2009-03-12 10:29:42 +01:00
|
|
|
foreach ($data as $j => $value) {
|
2010-08-30 13:52:13 +02:00
|
|
|
$count ++;
|
|
|
|
$avg += $value;
|
|
|
|
if ($value > $max )
|
|
|
|
$max = $value;
|
|
|
|
if ($value < $min )
|
|
|
|
$min = $value;
|
|
|
|
|
2009-08-06 20:55:54 +02:00
|
|
|
// New code for stacked. Due pchart doesnt not support stacked
|
|
|
|
// area graph, we "made it", adding to a series the values of the
|
|
|
|
// previous one consecutive sum.
|
|
|
|
if ((($stacked == 1) OR ($stacked==3)) AND ($i >0)){
|
|
|
|
$this->dataset->AddPoint ($value+$previo[$j], $this->legend[$i],
|
2009-03-12 10:29:42 +01:00
|
|
|
$values[$j]['timestamp_bottom']);
|
2009-08-06 20:55:54 +02:00
|
|
|
} else {
|
|
|
|
$this->dataset->AddPoint ($value, $this->legend[$i],
|
|
|
|
$values[$j]['timestamp_bottom']);
|
|
|
|
}
|
|
|
|
if ($i == 0)
|
|
|
|
$previo[$j] = $value;
|
|
|
|
else
|
|
|
|
$previo[$j] = $previo[$j] + $value;
|
|
|
|
|
2010-08-30 13:52:13 +02:00
|
|
|
}
|
|
|
|
if ($count > 0)
|
|
|
|
$avgdata[$i] = $avg / $count;
|
|
|
|
else
|
|
|
|
$avgdata[$i] = 0;
|
|
|
|
$maxdata[$i] = format_for_graph($max);
|
|
|
|
$mindata[$i] = format_for_graph($min);
|
|
|
|
$avgdata[$i] = format_for_graph($avgdata[$i]);
|
2009-03-12 10:29:42 +01:00
|
|
|
}
|
2010-08-30 13:52:13 +02:00
|
|
|
|
|
|
|
$i = 0;
|
2009-05-27 12:06:33 +02:00
|
|
|
foreach ($this->legend as $name) {
|
2010-08-30 13:52:13 +02:00
|
|
|
$legend = $name . " (".__("Max"). ":$maxdata[$i], ".__("Min"). ":$mindata[$i], ". __("Avg"). ": $avgdata[$i])";
|
|
|
|
$this->dataset->setSerieName ($legend, $name);
|
2009-05-27 12:06:33 +02:00
|
|
|
$this->dataset->AddSerie ($name);
|
2010-08-30 13:52:13 +02:00
|
|
|
$i++;
|
2009-05-27 12:06:33 +02:00
|
|
|
}
|
2009-03-12 10:29:42 +01:00
|
|
|
|
2009-08-06 20:55:54 +02:00
|
|
|
// Set different colors for combined graphs because need to be
|
|
|
|
// very different.
|
|
|
|
|
|
|
|
$this->graph_color[1] = "#FF0000"; // Red
|
|
|
|
$this->graph_color[2] = "#00FF00"; // Green
|
|
|
|
$this->graph_color[3] = "#0000FF"; // Blue
|
|
|
|
|
|
|
|
// White background
|
|
|
|
$this->graph->drawFilledRoundedRectangle(1,1,$this->width,$this->height,0,254,254,254);
|
|
|
|
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->set_colors ();
|
|
|
|
$this->graph->setFontProperties ($this->fontpath, 8);
|
2009-08-06 20:55:54 +02:00
|
|
|
$this->dataset->SetXAxisFormat ('datetime');
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->dataset->SetYAxisFormat ('metric');
|
|
|
|
$this->dataset->AddAllSeries ();
|
2009-03-17 16:15:55 +01:00
|
|
|
$this->add_background ();
|
2010-08-30 13:52:13 +02:00
|
|
|
|
|
|
|
|
|
|
|
$legend_offset = $this->height - 21 - ($graph_items*15);
|
|
|
|
|
|
|
|
$this->graph->setGraphArea (35,10,$this->width-10, $legend_offset);
|
2009-08-06 20:55:54 +02:00
|
|
|
$this->graph->drawGraphArea (254, 254, 254, false);
|
|
|
|
|
|
|
|
|
|
|
|
// Fixed missing X-labels (6Ago09)
|
|
|
|
$this->xaxis_interval = ($this->xaxis_interval / 7 >= 1) ? ($this->xaxis_interval / 7) : 10;
|
|
|
|
$this->graph->drawScale ($this->dataset->GetData (),
|
|
|
|
$this->dataset->GetDataDescription (), SCALE_START0,
|
|
|
|
80, 80, 80, $this->show_axis, 0, 50, false,
|
|
|
|
$this->xaxis_interval);
|
|
|
|
|
|
|
|
$this->graph->drawGrid (1, true, 225, 225, 225, 100, false);
|
2009-03-17 16:15:55 +01:00
|
|
|
|
2009-03-12 10:29:42 +01:00
|
|
|
// Draw the graph
|
2009-08-06 20:55:54 +02:00
|
|
|
if ($stacked == 1) { // Stacked solid
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->graph->drawScale ($this->dataset->GetData (),
|
|
|
|
$this->dataset->GetDataDescription (),
|
2009-08-06 20:55:54 +02:00
|
|
|
SCALE_START0, 80, 80, 80, $this->show_axis, 0, 0, false,
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->xaxis_interval);
|
2009-08-06 20:55:54 +02:00
|
|
|
$this->graph->drawFilledCubicCurve ($this->dataset->GetData(),
|
|
|
|
$this->dataset->GetDataDescription(), 1, 30, true);
|
|
|
|
}
|
|
|
|
elseif ($stacked == 3) { // Stacked wired
|
|
|
|
$this->graph->drawScale ($this->dataset->GetData (),
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->dataset->GetDataDescription (),
|
2009-08-06 20:55:54 +02:00
|
|
|
SCALE_START0, 80, 80, 80, $this->show_axis, 0, 0, false,
|
|
|
|
$this->xaxis_interval);
|
|
|
|
$this->graph->drawFilledCubicCurve ($this->dataset->GetData(),
|
|
|
|
$this->dataset->GetDataDescription(), 1, 0, true);
|
|
|
|
|
|
|
|
} else if ($stacked == 2) { // Wired mode
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->graph->drawScale ($this->dataset->GetData (),
|
|
|
|
$this->dataset->GetDataDescription (),
|
2009-04-01 10:04:49 +02:00
|
|
|
SCALE_START0, 80, 80, 80, $this->show_axis, 0, 0, false,
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->xaxis_interval);
|
|
|
|
$this->graph->drawLineGraph ($this->dataset->GetData (),
|
|
|
|
$this->dataset->GetDataDescription ());
|
2009-08-06 20:55:54 +02:00
|
|
|
} else { // Non-stacked, area overlapped
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->graph->drawScale ($this->dataset->GetData (),
|
|
|
|
$this->dataset->GetDataDescription (),
|
2009-04-01 10:04:49 +02:00
|
|
|
SCALE_START0, 80, 80, 80, $this->show_axis, 0, 0, false,
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->xaxis_interval);
|
|
|
|
$this->graph->drawFilledCubicCurve ($this->dataset->GetData(),
|
2009-08-06 20:55:54 +02:00
|
|
|
$this->dataset->GetDataDescription(), 1, 30, true);
|
2009-03-12 10:29:42 +01:00
|
|
|
}
|
2010-08-30 13:52:13 +02:00
|
|
|
|
|
|
|
$this->graph->setFontProperties($this->fontpath,7);
|
|
|
|
$this->graph->drawLegend(15,$legend_offset+29,$this->dataset->GetDataDescription(),92,92,92,50,50,50,45,45,45,0);
|
|
|
|
|
|
|
|
// Legend line separator
|
|
|
|
// $this->graph->drawFilledRoundedRectangle(35, $legend_offset + 30 ,$this->width-35,$legend_offset+30,0,220,220,220);
|
|
|
|
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->add_events ($this->legend[0]);
|
|
|
|
$this->add_alert_levels ();
|
|
|
|
|
|
|
|
$this->graph->Stroke ();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function progress_bar ($value, $color) {
|
|
|
|
set_time_limit (0);
|
2009-03-17 16:15:55 +01:00
|
|
|
// Dataset definition
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->graph = new pChart ($this->width, $this->height);
|
|
|
|
$this->graph->setFontProperties ($this->fontpath, 8);
|
2009-03-31 16:32:58 +02:00
|
|
|
|
|
|
|
// Round corners defined in global setup
|
2009-03-31 20:42:36 +02:00
|
|
|
|
2009-03-31 16:32:58 +02:00
|
|
|
global $config;
|
2009-04-01 10:04:49 +02:00
|
|
|
if ($config["round_corner"] != 0)
|
2009-03-31 20:42:36 +02:00
|
|
|
$radius = ($this->height > 18) ? 8 : 0;
|
2009-03-31 16:32:58 +02:00
|
|
|
else
|
|
|
|
$radius = 0;
|
|
|
|
|
2009-03-12 10:29:42 +01:00
|
|
|
$ratio = (int) $value / 100 * $this->width;
|
|
|
|
|
|
|
|
/* Color stuff */
|
2009-03-18 16:42:15 +01:00
|
|
|
$bgcolor = $this->get_rgb_values ($this->background_color);
|
2009-03-12 10:29:42 +01:00
|
|
|
$r = hexdec (substr ($this->background_color, 1, 2));
|
|
|
|
$g = hexdec (substr ($this->background_color, 3, 2));
|
|
|
|
$b = hexdec (substr ($this->background_color, 5, 2));
|
|
|
|
|
|
|
|
/* Actual percentage */
|
2009-04-01 10:04:49 +02:00
|
|
|
if (! $this->show_title || $value > 0) {
|
|
|
|
$color = $this->get_rgb_values ($color);
|
|
|
|
$this->graph->drawFilledRoundedRectangle (0, 0, $ratio,
|
|
|
|
$this->height, $radius, $color['r'], $color['g'], $color['b']);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($config["round_corner"]) {
|
2009-03-31 20:42:36 +02:00
|
|
|
/* 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);
|
|
|
|
}
|
2009-03-12 10:29:42 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-02 Sancho Lerena <slerena@artica.es>
* pandoradb.sql: Final DB changes proposed for closing this month the DB
scheme. tagente-> new server_name field to assign server (old fields will
be removed). talert_templates has two new types (warning, critical).
tevento has "user_comment" new field. Tserver has three new fields,
server_type (so some old fields will be deleted), threads and queued_modules
this last two are for statistical options. Tusuario add language type to
override global language.
* update_manager/main.php: Minor changes for correct ACL usage. Non PM
users could see in what revision it the system, but only that.
* pandoradb_migrate_v2.x_to_v3.0.sql: Updated script for new DB changes.
* general/noaccess.php: Added footer and ending div. Page was very ugly
when showing noaccess errors, nobody see it ???.
* godmode/menu.php: A LOT of ACL fixes on several options.
* godmode/agentes/agent_manager.php: Fixed a crazy floating icon.
* godmode/agentes/manage_config_remote.php: A LOT of changes, rewriting
stuff, because was not working. This also adds a lot of ACL checks.
* godmode/agentes/massive_config.php, massive*: ACL changes.
* godmode/agentes/modificar_agente.php: Fixed ACL problems.
* godmode/agentes/module_manager_editor.php: Fixed bad module categories for
some types (data, plugin and prediction).
* godmode/alerts/alert_list.php: Fixed ACL problem.
* godmode/reporting/graph_builder.php: Added ACl restriction for
non-viewable agents for current user. Seems to be a problem with data
with more than 2 sources.
* godmode/reporting/map_builder.php: ACL checks improved.
* godmode/reporting/reporting_builder.php: ACL checks added (was missing),
some code ported from 2.1, other is new. New fields shown in list.
* include/functions.php: Fixed the annoying bug of "bad counters" in
function human_time_description_raw(). Function used,format_numeric() should
not be used never to calculate nothing, only to print formatted strings.
* include/functions_db.php: Added function user_access_to_agent() to know
if a given user has access to a given agent.
* include/functioins_report.php: get_report() should let admin to watch any
report. Fixed.
* agentes/alerts_status.php: Fixed ACL problem for view alert.
* operation/incidents/incident.php: Bad call for pagination() was giving
problems to pagination call. Somebody changes pagination() interface and
make this broken. Please if you change any interface, be sure that is compatible
with old code or make a post in the list about this !
* godmode/users/user_edit.php: Additional ACL check to do not let anybody
to watch non accesible users. Even for see the username or description.
* reporting/pchart_graph.php:Progress bar shown text in white when > 60%.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1594 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-02 21:16:59 +02:00
|
|
|
if ($ratio <= 60) {
|
|
|
|
if ($this->show_title) {
|
|
|
|
$this->graph->drawTextBox (0, 0, $this->width, $this->height,
|
|
|
|
$this->title, 0, 0, 0, 0, ALIGN_CENTER, false);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if ($this->show_title) {
|
|
|
|
$this->graph->drawTextBox (0, 0, $this->width, $this->height,
|
|
|
|
$this->title, 0, 255, 255, 255, ALIGN_CENTER, false);
|
|
|
|
}
|
2009-03-12 10:29:42 +01:00
|
|
|
}
|
2009-04-02 Sancho Lerena <slerena@artica.es>
* pandoradb.sql: Final DB changes proposed for closing this month the DB
scheme. tagente-> new server_name field to assign server (old fields will
be removed). talert_templates has two new types (warning, critical).
tevento has "user_comment" new field. Tserver has three new fields,
server_type (so some old fields will be deleted), threads and queued_modules
this last two are for statistical options. Tusuario add language type to
override global language.
* update_manager/main.php: Minor changes for correct ACL usage. Non PM
users could see in what revision it the system, but only that.
* pandoradb_migrate_v2.x_to_v3.0.sql: Updated script for new DB changes.
* general/noaccess.php: Added footer and ending div. Page was very ugly
when showing noaccess errors, nobody see it ???.
* godmode/menu.php: A LOT of ACL fixes on several options.
* godmode/agentes/agent_manager.php: Fixed a crazy floating icon.
* godmode/agentes/manage_config_remote.php: A LOT of changes, rewriting
stuff, because was not working. This also adds a lot of ACL checks.
* godmode/agentes/massive_config.php, massive*: ACL changes.
* godmode/agentes/modificar_agente.php: Fixed ACL problems.
* godmode/agentes/module_manager_editor.php: Fixed bad module categories for
some types (data, plugin and prediction).
* godmode/alerts/alert_list.php: Fixed ACL problem.
* godmode/reporting/graph_builder.php: Added ACl restriction for
non-viewable agents for current user. Seems to be a problem with data
with more than 2 sources.
* godmode/reporting/map_builder.php: ACL checks improved.
* godmode/reporting/reporting_builder.php: ACL checks added (was missing),
some code ported from 2.1, other is new. New fields shown in list.
* include/functions.php: Fixed the annoying bug of "bad counters" in
function human_time_description_raw(). Function used,format_numeric() should
not be used never to calculate nothing, only to print formatted strings.
* include/functions_db.php: Added function user_access_to_agent() to know
if a given user has access to a given agent.
* include/functioins_report.php: get_report() should let admin to watch any
report. Fixed.
* agentes/alerts_status.php: Fixed ACL problem for view alert.
* operation/incidents/incident.php: Bad call for pagination() was giving
problems to pagination call. Somebody changes pagination() interface and
make this broken. Please if you change any interface, be sure that is compatible
with old code or make a post in the list about this !
* godmode/users/user_edit.php: Additional ACL check to do not let anybody
to watch non accesible users. Even for see the username or description.
* reporting/pchart_graph.php:Progress bar shown text in white when > 60%.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1594 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-02 21:16:59 +02:00
|
|
|
|
2009-03-12 10:29:42 +01:00
|
|
|
if ($this->border) {
|
2009-04-01 10:04:49 +02:00
|
|
|
$this->graph->drawRoundedRectangle (0, 0, $this->width - 1,
|
|
|
|
$this->height - 1,
|
2009-03-31 16:32:58 +02:00
|
|
|
$radius, 157, 157, 157);
|
2009-03-12 10:29:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$this->graph->Stroke ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Gets an array with each the components of a RGB string */
|
|
|
|
private static function get_rgb_values ($rgb_string) {
|
|
|
|
$color = array ('r' => 0, 'g' => 0, 'b' => 0);
|
|
|
|
$offset = 0;
|
|
|
|
if ($rgb_string[0] == '#')
|
|
|
|
$offset = 1;
|
|
|
|
$color['r'] = hexdec (substr ($rgb_string, $offset, 2));
|
|
|
|
$color['g'] = hexdec (substr ($rgb_string, $offset + 2, 2));
|
|
|
|
$color['b'] = hexdec (substr ($rgb_string, $offset + 4, 2));
|
|
|
|
return $color;
|
|
|
|
}
|
|
|
|
|
|
|
|
private function add_alert_levels () {
|
|
|
|
if ($this->alert_top !== false) {
|
|
|
|
$this->graph->drawTreshold ($this->alert_top, 57,
|
2009-04-01 10:04:49 +02:00
|
|
|
96, 255, true, true, 4,
|
|
|
|
"Alert top");
|
2009-03-12 10:29:42 +01:00
|
|
|
}
|
|
|
|
if ($this->alert_bottom !== false) {
|
|
|
|
$this->graph->drawTreshold ($this->alert_bottom, 7,
|
2009-04-01 10:04:49 +02:00
|
|
|
96, 255, true, true, 4,
|
|
|
|
"Alert bottom");
|
2009-03-12 10:29:42 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private function add_events ($serie = "Serie1") {
|
|
|
|
if (! $this->events)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Unfortunatelly, the events must be draw manually */
|
|
|
|
|
|
|
|
$first = $this->dataset->Data[0]["Name"];
|
|
|
|
$len = count ($this->dataset->Data) - 1;
|
|
|
|
|
|
|
|
$last = $this->dataset->Data[$len]["Name"];
|
|
|
|
$ylen = $this->y2 - $this->y1;
|
|
|
|
|
|
|
|
foreach ($this->data as $i => $data) {
|
|
|
|
/* Finally, check if there were events */
|
|
|
|
if (! $data['events'])
|
|
|
|
continue;
|
|
|
|
|
2010-09-21 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_html.php: fixed the width by default in the function
"print_table", now there isn't a default width (before it was 80%).
* include/pchart_graph.php: fixed in the function "add_events" when tryed
to add a event out the data.
* include/fgraph.php: check the user with the mobile methods.
* include/functions_db.php: in function "check_login" check the user with
the mobile methods.
* images/status_sets/default/severity_warning_pixel.png,
images/status_sets/default/severity_normal_pixel.png,
images/status_sets/default/severity_informational_pixel.png,
images/status_sets/default/severity_maintenance_pixel.png,
images/status_sets/default/severity_critical_pixel.png: added the image
files for to show in the event mobile's page.
* mobile/operation/agents/view_agents.php,
mobile/operation/agents/tactical.php,
mobile/operation/agents/view_alerts.php, mobile/operation/events/events.php,
mobile/operation/servers/view_servers.php, mobile/include/user.class.php,
mobile/include/system.class.php: changed the style the some pages to show
more clearly the pages in old m$-mobiles.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3265 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-09-21 10:59:01 +02:00
|
|
|
if (!isset($this->dataset->Data[$i]))
|
|
|
|
continue;
|
|
|
|
|
2009-03-12 10:29:42 +01:00
|
|
|
$x1 = (int) ($this->x1 + $i * $this->graph->DivisionWidth);
|
|
|
|
$y1 = (int) ($this->y2 - ($this->dataset->Data[$i][$serie] * $this->graph->DivisionRatio));
|
|
|
|
$this->graph->drawFilledCircle ($x1, $y1, 1.5, 255, 0, 0);
|
|
|
|
if ($y1 == $this->y2)
|
|
|
|
/* Lines in the same dot fails */
|
|
|
|
continue;
|
|
|
|
|
|
|
|
$this->graph->drawDottedLine ($x1 - 1, $y1,
|
|
|
|
$x1 - 1, $this->y2,
|
|
|
|
5, 255, 150, 150);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private function add_background () {
|
|
|
|
if ($this->graph == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
$this->graph->setDateFormat ($this->date_format);
|
|
|
|
|
|
|
|
$this->x1 = ($this->width > 300) ? 30 : 35;
|
2009-08-06 20:55:54 +02:00
|
|
|
// $this->y1 = ($this->height > 200) ? 25 : 10;
|
|
|
|
$this->x2 = ($this->width > 300) ? $this->width - 15 : $this->width - 15;
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->y2 = ($this->height > 200) ? $this->height - 25 : $this->height - 25;
|
|
|
|
|
2009-04-01 10:04:49 +02:00
|
|
|
if ($this->max_value > 10000 && $this->show_axis)
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->x1 += 20;
|
2009-08-06 20:55:54 +02:00
|
|
|
|
|
|
|
$this->graph->drawGraphArea (255, 255, 255, true);
|
|
|
|
|
|
|
|
$this->graph->setFontProperties ($this->fontpath, 7);
|
2009-03-12 10:29:42 +01:00
|
|
|
$size = $this->graph->getLegendBoxSize ($this->dataset->GetDataDescription ());
|
2009-08-06 20:55:54 +02:00
|
|
|
|
|
|
|
/* Old resize code for graph area, discard, we need all area in pure mode
|
2009-03-12 10:29:42 +01:00
|
|
|
if (is_array ($size)) {
|
|
|
|
while ($size[1] > $this->y1)
|
|
|
|
$this->y1 += (int) $size[1] / 2;
|
2009-04-01 10:04:49 +02:00
|
|
|
if ($this->y1 > $this->y2)
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->y1 = $this->y2;
|
|
|
|
}
|
2009-08-06 20:55:54 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
if ($this->show_title == 1){
|
|
|
|
$this->y1=40;
|
|
|
|
} else {
|
|
|
|
$this->y1=10;
|
|
|
|
}
|
|
|
|
|
|
|
|
// No title for combined
|
|
|
|
if ($this->stacked !== false){
|
|
|
|
$this->y1=10;
|
|
|
|
}
|
|
|
|
|
2009-03-12 10:29:42 +01:00
|
|
|
|
|
|
|
$this->graph->setGraphArea ($this->x1, $this->y1, $this->x2, $this->y2);
|
|
|
|
|
|
|
|
if ($this->show_title) {
|
2009-08-06 20:55:54 +02:00
|
|
|
$this->graph->setFontProperties ($this->fontpath, 12);
|
|
|
|
$this->graph->drawTextBox (2, 7, $this->width, 20, $this->title, 0, 0, 0, 0, ALIGN_LEFT, false);
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->graph->setFontProperties ($this->fontpath, 9);
|
2010-08-02 16:38:52 +02:00
|
|
|
$this->graph->drawTextBox (0, 10, $this->width, 20, $this->subtitle,
|
|
|
|
0, 0, 0, 0, ALIGN_CENTER, false);
|
2009-08-06 20:55:54 +02:00
|
|
|
|
|
|
|
$this->graph->setFontProperties ($this->fontpath, 6);
|
2009-03-12 10:29:42 +01:00
|
|
|
}
|
|
|
|
|
2009-08-06 20:55:54 +02:00
|
|
|
/* This is a tiny watermark */
|
2009-04-01 10:04:49 +02:00
|
|
|
if ($this->watermark) {
|
2009-08-06 20:55:54 +02:00
|
|
|
if ($this->show_title){
|
2010-08-30 13:52:13 +02:00
|
|
|
$this->graph->setFontProperties ($this->fontpath, 7);
|
|
|
|
$this->graph->drawTextBox ($this->width - 8, 40,
|
|
|
|
$this->width - 240, 90, 'PANDORA FMS', 90,
|
|
|
|
174, 214, 174, ALIGN_BOTTOM_LEFT, false);
|
2009-08-06 20:55:54 +02:00
|
|
|
} else {
|
2010-08-30 13:52:13 +02:00
|
|
|
$this->graph->setFontProperties ($this->fontpath, 7);
|
|
|
|
$this->graph->drawTextBox ($this->width - 8, 50,
|
|
|
|
$this->width - 240, 60, 'PANDORA FMS', 90,
|
|
|
|
174, 214, 174, ALIGN_BOTTOM_LEFT, false);
|
2009-08-06 20:55:54 +02:00
|
|
|
}
|
2009-04-01 10:04:49 +02:00
|
|
|
}
|
2009-03-12 10:29:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private function add_legend () {
|
2009-08-06 20:55:54 +02:00
|
|
|
if ((! $this->show_title || $this->legend === false) && ($this->stacked === false)) {
|
2009-03-12 10:29:42 +01:00
|
|
|
return;
|
|
|
|
}
|
2009-08-06 20:55:54 +02:00
|
|
|
|
2009-03-12 10:29:42 +01:00
|
|
|
/* Add legend */
|
|
|
|
$this->graph->setFontProperties ($this->fontpath, 6);
|
2009-03-17 16:15:55 +01:00
|
|
|
$size = $this->graph->getLegendBoxSize ($this->dataset->GetDataDescription ());
|
2009-08-06 20:55:54 +02:00
|
|
|
|
|
|
|
// No title for combined, so legends goes up
|
|
|
|
if ($this->stacked !== false)
|
|
|
|
$this->graph->drawLegend ( 35, 12,
|
|
|
|
$this->dataset->GetDataDescription (),
|
|
|
|
245, 245, 245);
|
|
|
|
else
|
|
|
|
$this->graph->drawLegend ( 35, 52,
|
2009-03-12 10:29:42 +01:00
|
|
|
$this->dataset->GetDataDescription (),
|
2009-08-06 20:55:54 +02:00
|
|
|
245, 245, 245);
|
2009-03-12 10:29:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private function set_colors () {
|
|
|
|
if ($this->graph == NULL)
|
|
|
|
return;
|
|
|
|
|
2009-08-06 20:55:54 +02:00
|
|
|
for ($a = 0; $a<9; $a++){
|
|
|
|
$color = $this->get_rgb_values ($this->graph_color[$a+1]);
|
|
|
|
$this->graph->setColorPalette ($a, $color['r'], $color['g'], $color['b']);
|
|
|
|
}
|
2009-03-12 10:29:42 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|