2011-03-30 14:34:25 +02:00
|
|
|
<?php
|
2011-04-01 14:28:50 +02:00
|
|
|
// Copyright (c) 2011-2011 Ártica Soluciones Tecnológicas
|
2011-03-30 14:34:25 +02:00
|
|
|
// http://www.artica.es <info@artica.es>
|
|
|
|
|
|
|
|
// 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; 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.
|
|
|
|
|
2011-04-18 16:05:54 +02:00
|
|
|
|
2011-04-12 12:04:41 +02:00
|
|
|
// If is called from index
|
|
|
|
if(file_exists('include/functions.php')) {
|
|
|
|
include_once('include/functions.php');
|
|
|
|
include_once('include/graphs/functions_fsgraph.php');
|
|
|
|
include_once('include/graphs/functions_utils.php');
|
|
|
|
} // If is called through url
|
|
|
|
else if(file_exists('../functions.php')) {
|
|
|
|
include_once('../functions.php');
|
|
|
|
include_once('../functions_html.php');
|
|
|
|
include_once('functions_fsgraph.php');
|
|
|
|
include_once('functions_gd.php');
|
|
|
|
include_once('functions_utils.php');
|
|
|
|
}
|
|
|
|
|
2011-04-13 17:11:51 +02:00
|
|
|
include_once('functions_fsgraph.php');
|
|
|
|
include_once('functions_utils.php');
|
|
|
|
|
2011-04-12 12:04:41 +02:00
|
|
|
$graph_type = get_parameter('graph_type', '');
|
|
|
|
|
|
|
|
switch($graph_type) {
|
|
|
|
case 'histogram':
|
|
|
|
$width = get_parameter('width');
|
|
|
|
$height = get_parameter('height');
|
|
|
|
$font = get_parameter('font');
|
2011-05-09 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_graph.php
include/functions_html.php
include/functions_menu.php
include/graphs/fgraph.php
include/functions_messages.php
include/functions_modules.php
include/functions_reporting.php
include/functions_filemanager.php
include/functions_networkmap.php
include/functions_servers.php
include/functions_network_profiles.php
include/functions_network_components.php
include/functions_visual_map.php
include/ajax/visual_console_builder.ajax.php
include/ajax/agent.php
include/ajax/alert_list.ajax.php
include/ajax/module.php
include/functions_io.php
include/functions_api.php
include/functions_ui.php
include/fgraph.php
include/functions_incidents.php
include/functions.php
include/functions_agents.php
include/functions_db.php
include/functions_alerts.php
include/functions_reports.php
include/functions_ui_renders.php
extensions/insert_data.php
extensions/agents_modules.php
extensions/resource_registration.php
extensions/resource_exportation.php
extensions/module_groups.php
extensions/plugin_registration.php
operation/incidents/incident.incident.php
operation/incidents/incident.php
operation/incidents/incident_detail.php
operation/incidents/incident.download_file.php
operation/incidents/incident.list.php
operation/search_modules.php
operation/agentes/status_monitor.php
operation/agentes/export_csv.php
operation/agentes/estado_ultimopaquete.php
operation/agentes/datos_agente.php
operation/agentes/estado_agente.php
operation/agentes/networkmap.topology.php
operation/agentes/networkmap.groups.php
operation/agentes/sla_view.php
operation/agentes/exportdata.php
operation/agentes/estado_monitores.php
operation/agentes/ver_agente.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/menu.php
operation/search_agents.php
operation/integria_incidents/incident.incident.php
operation/integria_incidents/incident.php
operation/integria_incidents/incident_detail.php
operation/integria_incidents/incident.download_file.php
operation/integria_incidents/incident.list.php
operation/events/events_rss.php
operation/events/events_list.php
operation/search_alerts.php
operation/messages/message.php
operation/reporting/reporting_xml.php
operation/reporting/reporting_viewer.php
operation/reporting/custom_reporting.php
operation/search_reports.php
operation/search_results.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/servers/view_servers.php
general/logon_ok.php
general/header.php
godmode/admin_access_logs.php
godmode/db/db_refine.php
godmode/db/db_info.php
godmode/db/db_purge.php
godmode/agentes/agent_template.php
godmode/agentes/module_manager_editor_common.php
godmode/agentes/module_manager.php
godmode/agentes/configurar_agente.php
godmode/agentes/module_manager_editor.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/menu.php
godmode/alerts/alert_list.list.php
godmode/alerts/configure_alert_compound.php
godmode/alerts/configure_alert_action.php
godmode/setup/os.list.php
godmode/setup/links.php
godmode/setup/setup.php
godmode/users/user_list.php
godmode/users/configure_user.php
godmode/massive/massive_add_alerts.php
godmode/massive/massive_delete_profiles.php
godmode/massive/massive_edit_agents.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/modules/manage_network_components_form.php
godmode/modules/manage_nc_groups_form.php
godmode/modules/manage_network_templates.php
godmode/modules/manage_network_components_form_common.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/reporting/reporting_builder.preview.php
godmode/reporting/graph_builder.graph_editor.php
godmode/reporting/reporting_builder.php
godmode/reporting/reporting_builder.item_editor.php: Functions in
functions_incidents.php, functions_io.php, functions_menu.php, functions_messages.php,
functions_modules.php, functions_network_components.php, functions_network_profiles.php,
functions_networkmap.php, functions_reporting.php, functions_reports.php,
functions_servers.php have "incidents_", "io_", "menu_", "messages_", "modules_",
"network_profiles_", "network_components_", "networkmap_", "reporting_", "reports_",
"servers_" prefixes respectively.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4326 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-05-09 19:30:55 +02:00
|
|
|
$data = json_decode(io_safe_output(get_parameter('data')), true);
|
2011-04-12 12:04:41 +02:00
|
|
|
|
|
|
|
$max = get_parameter('max');
|
|
|
|
$title = get_parameter('title');
|
|
|
|
$mode = get_parameter ('mode', 1);
|
|
|
|
gd_histogram ($width, $height, $mode, $data, $max, $font, $title);
|
|
|
|
break;
|
|
|
|
case 'progressbar':
|
|
|
|
$width = get_parameter('width');
|
|
|
|
$height = get_parameter('height');
|
|
|
|
$progress = get_parameter('progress');
|
|
|
|
|
|
|
|
$out_of_lim_str = get_parameter('out_of_lim_str', false);
|
|
|
|
$out_of_lim_image = get_parameter('out_of_lim_image', false);
|
|
|
|
|
|
|
|
$font = get_parameter('font');
|
|
|
|
$title = get_parameter('title');
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/graphs/functions_gd.php,
include/graphs/fgraph.php, include/functions_visual_map.php,
include/fgraph.php, operation/agentes/estado_generalagente.php,
operation/agentes/tactical.php. operation/agentes/stat_win.php,
operation/servers/view_server.php, operation/servers/view_server_detail.php,
mobile/operation/agents/tactical.php, general/logon_ok.php,
godmode/reporting/graph_builder.preview.php: added function "progress_bar2"
and changed in source code of Pandora.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4199 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 11:29:10 +02:00
|
|
|
|
|
|
|
$mode = get_parameter('mode', 1);
|
2011-04-14 14:02:45 +02:00
|
|
|
|
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/graphs/functions_gd.php,
include/graphs/fgraph.php, include/functions_visual_map.php,
include/fgraph.php, operation/agentes/estado_generalagente.php,
operation/agentes/tactical.php. operation/agentes/stat_win.php,
operation/servers/view_server.php, operation/servers/view_server_detail.php,
mobile/operation/agents/tactical.php, general/logon_ok.php,
godmode/reporting/graph_builder.preview.php: added function "progress_bar2"
and changed in source code of Pandora.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4199 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-13 11:29:10 +02:00
|
|
|
gd_progress_bar ($width, $height, $progress, $title, $font, $out_of_lim_str, $out_of_lim_image, $mode);
|
2011-04-12 12:04:41 +02:00
|
|
|
break;
|
|
|
|
}
|
2011-03-30 14:34:25 +02:00
|
|
|
|
2011-04-14 10:25:41 +02:00
|
|
|
function histogram($chart_data, $width, $height, $font, $max, $title, $mode) {
|
|
|
|
$graph = array();
|
|
|
|
$graph['data'] = $chart_data;
|
|
|
|
$graph['width'] = $width;
|
|
|
|
$graph['height'] = $height;
|
|
|
|
$graph['font'] = $font;
|
|
|
|
$graph['max'] = $max;
|
|
|
|
$graph['title'] = $title;
|
|
|
|
$graph['mode'] = $mode;
|
|
|
|
|
|
|
|
$id_graph = serialize_in_temp($graph);
|
|
|
|
|
|
|
|
return "<img src='include/graphs/functions_gd.php?graph_type=histogram&id_graph=".$id_graph."'>";
|
|
|
|
}
|
|
|
|
|
|
|
|
function progressbar($progress, $width, $height, $title, $font, $mode = 1, $out_of_lim_str = false, $out_of_lim_image = false) {
|
|
|
|
$graph = array();
|
|
|
|
|
|
|
|
$graph['progress'] = $progress;
|
|
|
|
$graph['width'] = $width;
|
|
|
|
$graph['height'] = $height;
|
|
|
|
$graph['out_of_lim_str'] = $out_of_lim_str;
|
|
|
|
$graph['out_of_lim_image'] = $out_of_lim_image;
|
|
|
|
$graph['title'] = $title;
|
|
|
|
$graph['font'] = $font;
|
|
|
|
$graph['mode'] = $mode;
|
|
|
|
|
|
|
|
$id_graph = serialize_in_temp($graph);
|
|
|
|
|
|
|
|
return "<img src='include/graphs/functions_gd.php?graph_type=progressbar&id_graph=".$id_graph."'>";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-05-09 17:20:58 +02:00
|
|
|
function slicesbar_graph($chart_data, $period, $width, $height, $colors, $font, $round_corner, $home_url = '') {
|
2011-04-13 15:01:37 +02:00
|
|
|
$graph = array();
|
|
|
|
$graph['data'] = $chart_data;
|
2011-05-09 17:20:58 +02:00
|
|
|
$graph['period'] = $period;
|
2011-04-13 15:01:37 +02:00
|
|
|
$graph['width'] = $width;
|
|
|
|
$graph['height'] = $height;
|
|
|
|
$graph['font'] = $font;
|
|
|
|
$graph['round_corner'] = $round_corner;
|
|
|
|
$graph['color'] = $colors;
|
|
|
|
|
|
|
|
$id_graph = serialize_in_temp($graph);
|
|
|
|
|
2011-04-29 11:13:26 +02:00
|
|
|
return "<img src='".$home_url."include/graphs/functions_pchart.php?graph_type=slicebar&id_graph=".$id_graph."'>";
|
2011-04-13 15:01:37 +02:00
|
|
|
}
|
|
|
|
|
2011-04-14 18:52:50 +02:00
|
|
|
function vbar_graph($flash_chart, $chart_data, $width, $height, $color = array(),
|
2011-04-20 17:54:31 +02:00
|
|
|
$legend = array(), $xaxisname = "", $yaxisname = "", $homedir="",
|
2011-04-25 13:48:27 +02:00
|
|
|
$water_mark = '', $font = '', $font_size = '', $force_steps = true) {
|
2011-03-30 14:34:25 +02:00
|
|
|
if($flash_chart) {
|
|
|
|
echo fs_2d_column_chart ($chart_data, $width, $height);
|
|
|
|
}
|
|
|
|
else {
|
2011-04-01 14:28:50 +02:00
|
|
|
$graph = array();
|
|
|
|
$graph['data'] = $chart_data;
|
|
|
|
$graph['width'] = $width;
|
|
|
|
$graph['height'] = $height;
|
|
|
|
$graph['color'] = $color;
|
|
|
|
$graph['legend'] = $legend;
|
2011-04-11 14:29:09 +02:00
|
|
|
$graph['xaxisname'] = $xaxisname;
|
|
|
|
$graph['yaxisname'] = $yaxisname;
|
2011-04-20 11:23:54 +02:00
|
|
|
$graph['water_mark'] = $water_mark;
|
2011-04-20 17:54:31 +02:00
|
|
|
$graph['font'] = $font;
|
|
|
|
$graph['font_size'] = $font_size;
|
2011-04-25 13:48:27 +02:00
|
|
|
$graph['force_steps'] = $force_steps;
|
2011-04-11 14:29:09 +02:00
|
|
|
|
2011-04-01 14:28:50 +02:00
|
|
|
$id_graph = serialize_in_temp($graph);
|
|
|
|
|
2011-04-14 18:52:50 +02:00
|
|
|
return "<img src='" . $homedir . "include/graphs/functions_pchart.php?graph_type=vbar&id_graph=".$id_graph."'>";
|
2011-03-30 14:34:25 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function threshold_graph($flash_chart, $chart_data, $width, $height) {
|
|
|
|
if($flash_chart) {
|
2011-04-26 19:52:25 +02:00
|
|
|
echo fs_area_chart ($chart_data, $width, $height);
|
2011-03-30 14:34:25 +02:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
echo "<img src='include/graphs/functions_pchart.php?graph_type=threshold&data=".json_encode($chart_data)."&width=".$width."&height=".$height."'>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-04-15 14:19:12 +02:00
|
|
|
function area_graph($flash_chart, $chart_data, $width, $height, $color, $legend,
|
2011-04-20 17:54:31 +02:00
|
|
|
$long_index, $no_data_image, $xaxisname = "", $yaxisname = "", $homedir="",
|
|
|
|
$water_mark = "", $font = '', $font_size = '') {
|
2011-04-11 18:45:03 +02:00
|
|
|
if (empty($chart_data)) {
|
|
|
|
return '<img src="' . $no_data_image . '" />';
|
|
|
|
}
|
|
|
|
|
2011-03-30 14:34:25 +02:00
|
|
|
if($flash_chart) {
|
2011-04-18 17:12:48 +02:00
|
|
|
return fs_area_graph($chart_data, $width, $height, $color, $legend, $long_index, $homedir);
|
2011-03-30 14:34:25 +02:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
$graph = array();
|
|
|
|
$graph['data'] = $chart_data;
|
|
|
|
$graph['width'] = $width;
|
|
|
|
$graph['height'] = $height;
|
|
|
|
$graph['color'] = $color;
|
2011-03-31 19:07:00 +02:00
|
|
|
$graph['legend'] = $legend;
|
2011-04-12 12:04:41 +02:00
|
|
|
$graph['xaxisname'] = $xaxisname;
|
|
|
|
$graph['yaxisname'] = $yaxisname;
|
2011-04-20 11:23:54 +02:00
|
|
|
$graph['water_mark'] = $water_mark;
|
2011-04-20 17:54:31 +02:00
|
|
|
$graph['font'] = $font;
|
|
|
|
$graph['font_size'] = $font_size;
|
2011-04-12 12:04:41 +02:00
|
|
|
|
2011-04-13 10:49:18 +02:00
|
|
|
$id_graph = serialize_in_temp($graph);
|
2011-04-11 14:29:09 +02:00
|
|
|
|
2011-04-15 14:19:12 +02:00
|
|
|
return "<img src='".$homedir."include/graphs/functions_pchart.php?graph_type=area&id_graph=" . $id_graph . "'>";
|
2011-03-30 14:34:25 +02:00
|
|
|
}
|
2011-04-07 19:36:08 +02:00
|
|
|
}
|
|
|
|
|
2011-04-20 11:23:54 +02:00
|
|
|
function stacked_area_graph($flash_chart, $chart_data, $width, $height, $color,
|
2011-04-20 17:54:31 +02:00
|
|
|
$legend, $long_index, $no_data_image, $xaxisname = "", $yaxisname = "",
|
|
|
|
$water_mark = "", $font = '', $font_size = '') {
|
2011-04-11 18:45:03 +02:00
|
|
|
|
|
|
|
if (empty($chart_data)) {
|
|
|
|
return '<img src="' . $no_data_image . '" />';
|
|
|
|
}
|
2011-04-07 19:36:08 +02:00
|
|
|
|
|
|
|
if($flash_chart) {
|
|
|
|
return fs_stacked_graph($chart_data, $width, $height, $color, $legend, $long_index);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
//Stack the data
|
2011-04-11 18:45:03 +02:00
|
|
|
stack_data($chart_data, $legend, $color);
|
2011-04-07 19:36:08 +02:00
|
|
|
|
|
|
|
$graph = array();
|
|
|
|
$graph['data'] = $chart_data;
|
|
|
|
$graph['width'] = $width;
|
|
|
|
$graph['height'] = $height;
|
|
|
|
$graph['color'] = $color;
|
|
|
|
$graph['legend'] = $legend;
|
2011-04-14 10:25:41 +02:00
|
|
|
$graph['xaxisname'] = $xaxisname;
|
|
|
|
$graph['yaxisname'] = $yaxisname;
|
2011-04-20 11:23:54 +02:00
|
|
|
$graph['water_mark'] = $water_mark;
|
2011-04-20 17:54:31 +02:00
|
|
|
$graph['font'] = $font;
|
|
|
|
$graph['font_size'] = $font_size;
|
2011-04-07 19:36:08 +02:00
|
|
|
|
2011-04-13 10:49:18 +02:00
|
|
|
$id_graph = serialize_in_temp($graph);
|
2011-04-07 19:36:08 +02:00
|
|
|
|
2011-04-13 10:49:18 +02:00
|
|
|
return "<img src='include/graphs/functions_pchart.php?graph_type=stacked_area&id_graph=" . $id_graph . "' />";
|
|
|
|
}
|
2011-04-07 19:36:08 +02:00
|
|
|
}
|
|
|
|
|
2011-04-20 11:23:54 +02:00
|
|
|
function stacked_line_graph($flash_chart, $chart_data, $width, $height, $color,
|
2011-04-20 17:54:31 +02:00
|
|
|
$legend, $long_index, $no_data_image, $xaxisname = "", $yaxisname = "",
|
|
|
|
$water_mark = "", $font = '', $font_size = '') {
|
2011-04-11 18:45:03 +02:00
|
|
|
if (empty($chart_data)) {
|
|
|
|
return '<img src="' . $no_data_image . '" />';
|
|
|
|
}
|
|
|
|
|
|
|
|
//Stack the data
|
|
|
|
stack_data($chart_data, $legend, $color);
|
|
|
|
|
|
|
|
if($flash_chart) {
|
|
|
|
return fs_line_graph($chart_data, $width, $height, $color, $legend, $long_index);
|
|
|
|
}
|
2011-04-13 10:49:18 +02:00
|
|
|
else {
|
2011-04-11 18:45:03 +02:00
|
|
|
$graph = array();
|
|
|
|
$graph['data'] = $chart_data;
|
|
|
|
$graph['width'] = $width;
|
|
|
|
$graph['height'] = $height;
|
|
|
|
$graph['color'] = $color;
|
|
|
|
$graph['legend'] = $legend;
|
2011-04-14 10:25:41 +02:00
|
|
|
$graph['xaxisname'] = $xaxisname;
|
|
|
|
$graph['yaxisname'] = $yaxisname;
|
2011-04-20 11:23:54 +02:00
|
|
|
$graph['water_mark'] = $water_mark;
|
2011-04-20 17:54:31 +02:00
|
|
|
$graph['font'] = $font;
|
|
|
|
$graph['font_size'] = $font_size;
|
2011-04-11 18:45:03 +02:00
|
|
|
|
2011-04-13 10:49:18 +02:00
|
|
|
$id_graph = serialize_in_temp($graph);
|
2011-04-11 18:45:03 +02:00
|
|
|
|
2011-04-13 10:49:18 +02:00
|
|
|
return "<img src='include/graphs/functions_pchart.php?graph_type=line&id_graph=" . $id_graph . "' />";
|
2011-04-11 18:45:03 +02:00
|
|
|
}
|
|
|
|
}
|
2011-04-07 19:36:08 +02:00
|
|
|
|
2011-04-20 11:23:54 +02:00
|
|
|
function line_graph($flash_chart, $chart_data, $width, $height, $color, $legend,
|
2011-04-20 17:54:31 +02:00
|
|
|
$long_index, $no_data_image, $xaxisname = "", $yaxisname = "",
|
|
|
|
$water_mark = "", $font = '', $font_size = '') {
|
2011-04-11 18:45:03 +02:00
|
|
|
if (empty($chart_data)) {
|
|
|
|
return '<img src="' . $no_data_image . '" />';
|
|
|
|
}
|
2011-04-07 19:36:08 +02:00
|
|
|
|
|
|
|
if($flash_chart) {
|
|
|
|
return fs_line_graph($chart_data, $width, $height, $color, $legend, $long_index);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$graph = array();
|
|
|
|
$graph['data'] = $chart_data;
|
|
|
|
$graph['width'] = $width;
|
|
|
|
$graph['height'] = $height;
|
|
|
|
$graph['color'] = $color;
|
|
|
|
$graph['legend'] = $legend;
|
2011-04-14 10:25:41 +02:00
|
|
|
$graph['xaxisname'] = $xaxisname;
|
|
|
|
$graph['yaxisname'] = $yaxisname;
|
2011-04-20 11:23:54 +02:00
|
|
|
$graph['water_mark'] = $water_mark;
|
2011-04-20 17:54:31 +02:00
|
|
|
$graph['font'] = $font;
|
|
|
|
$graph['font_size'] = $font_size;
|
2011-04-07 19:36:08 +02:00
|
|
|
|
2011-04-13 10:49:18 +02:00
|
|
|
$id_graph = serialize_in_temp($graph);
|
2011-04-07 19:36:08 +02:00
|
|
|
|
2011-04-13 10:49:18 +02:00
|
|
|
return "<img src='include/graphs/functions_pchart.php?graph_type=line&id_graph=" . $id_graph . "' />";
|
2011-04-07 19:36:08 +02:00
|
|
|
}
|
2011-03-30 14:34:25 +02:00
|
|
|
}
|
|
|
|
|
2011-04-13 10:49:18 +02:00
|
|
|
function kiviat_graph($graph_type, $flash_chart, $chart_data, $width, $height, $no_data_image) {
|
|
|
|
if (empty($chart_data)) {
|
|
|
|
return '<img src="' . $no_data_image . '" />';
|
|
|
|
}
|
|
|
|
|
|
|
|
$graph = array();
|
|
|
|
$graph['data'] = $chart_data;
|
|
|
|
$graph['width'] = $width;
|
|
|
|
$graph['height'] = $height;
|
|
|
|
|
|
|
|
$id_graph = serialize_in_temp($graph);
|
|
|
|
|
|
|
|
return "<img src='include/graphs/functions_pchart.php?graph_type=".$graph_type."&id_graph=" . $id_graph . "' />";
|
|
|
|
}
|
|
|
|
|
|
|
|
function radar_graph($flash_chart, $chart_data, $width, $height, $no_data_image) {
|
|
|
|
return kiviat_graph('radar', $flash_chart, $chart_data, $width, $height, $no_data_image);
|
|
|
|
}
|
|
|
|
|
|
|
|
function polar_graph($flash_chart, $chart_data, $width, $height, $no_data_image) {
|
|
|
|
return kiviat_graph('polar', $flash_chart, $chart_data, $width, $height, $no_data_image);
|
|
|
|
}
|
|
|
|
|
2011-04-14 18:52:50 +02:00
|
|
|
function hbar_graph($flash_chart, $chart_data, $width, $height, $color = array(),
|
2011-04-20 11:23:54 +02:00
|
|
|
$legend = array(), $xaxisname = "", $yaxisname = "", $force_height = true,
|
2011-04-25 13:48:27 +02:00
|
|
|
$homedir="", $water_mark = '', $font = '', $font_size = '', $force_steps = true) {
|
2011-03-30 14:34:25 +02:00
|
|
|
if($flash_chart) {
|
2011-04-18 12:30:45 +02:00
|
|
|
echo fs_2d_hcolumn_chart ($chart_data, $width, $height);
|
2011-03-30 14:34:25 +02:00
|
|
|
}
|
|
|
|
else {
|
2011-04-11 14:29:09 +02:00
|
|
|
$graph = array();
|
|
|
|
$graph['data'] = $chart_data;
|
|
|
|
$graph['width'] = $width;
|
|
|
|
$graph['height'] = $height;
|
|
|
|
$graph['color'] = $color;
|
|
|
|
$graph['legend'] = $legend;
|
|
|
|
$graph['xaxisname'] = $xaxisname;
|
|
|
|
$graph['yaxisname'] = $yaxisname;
|
2011-04-14 15:53:46 +02:00
|
|
|
$graph['force_height'] = $force_height;
|
2011-04-20 11:23:54 +02:00
|
|
|
$graph['water_mark'] = $water_mark;
|
2011-04-20 17:54:31 +02:00
|
|
|
$graph['font'] = $font;
|
|
|
|
$graph['font_size'] = $font_size;
|
2011-04-25 13:48:27 +02:00
|
|
|
$graph['force_steps'] = $force_steps;
|
2011-04-11 14:29:09 +02:00
|
|
|
|
|
|
|
$id_graph = serialize_in_temp($graph);
|
|
|
|
|
2011-04-14 18:52:50 +02:00
|
|
|
return "<img src='".$homedir."include/graphs/functions_pchart.php?graph_type=hbar&id_graph=".$id_graph."'>";
|
2011-03-30 14:34:25 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-04-20 17:54:31 +02:00
|
|
|
function pie3d_graph($flash_chart, $chart_data, $width, $height,
|
|
|
|
$others_str = "other", $homedir="", $water_mark = "", $font = '', $font_size = '') {
|
|
|
|
return pie_graph('3d', $flash_chart, $chart_data, $width, $height,
|
2011-04-25 13:48:27 +02:00
|
|
|
$others_str, $homedir, $water_mark, $font, $font_size);
|
2011-03-30 14:34:25 +02:00
|
|
|
}
|
|
|
|
|
2011-04-20 17:54:31 +02:00
|
|
|
function pie2d_graph($flash_chart, $chart_data, $width, $height,
|
|
|
|
$others_str = "other", $homedir="", $water_mark = "", $font = '', $font_size = '') {
|
|
|
|
return pie_graph('2d', $flash_chart, $chart_data, $width, $height,
|
2011-04-25 13:48:27 +02:00
|
|
|
$others_str, $homedir, $water_mark, $font, $font_size);
|
2011-03-30 14:34:25 +02:00
|
|
|
}
|
|
|
|
|
2011-04-20 17:54:31 +02:00
|
|
|
function pie_graph($graph_type, $flash_chart, $chart_data, $width, $height,
|
|
|
|
$others_str = "other", $homedir="", $water_mark = "", $font = '', $font_size = '') {
|
2011-04-14 14:02:45 +02:00
|
|
|
// This library allows only 8 colors
|
|
|
|
$max_values = 8;
|
2011-03-30 14:34:25 +02:00
|
|
|
|
|
|
|
if(count($chart_data) > $max_values) {
|
|
|
|
$chart_data_trunc = array();
|
|
|
|
$n = 1;
|
|
|
|
foreach($chart_data as $key => $value) {
|
|
|
|
if($n < $max_values) {
|
|
|
|
$chart_data_trunc[$key] = $value;
|
|
|
|
}
|
|
|
|
else {
|
2011-04-14 14:02:45 +02:00
|
|
|
if (!isset($chart_data_trunc[$others_str])) {
|
|
|
|
$chart_data_trunc[$others_str] = 0;
|
|
|
|
}
|
2011-03-30 14:34:25 +02:00
|
|
|
$chart_data_trunc[$others_str] += $value;
|
|
|
|
}
|
|
|
|
$n++;
|
|
|
|
}
|
|
|
|
$chart_data = $chart_data_trunc;
|
|
|
|
}
|
|
|
|
|
2011-04-11 14:29:09 +02:00
|
|
|
if($flash_chart) {
|
|
|
|
switch($graph_type) {
|
|
|
|
case "2d":
|
2011-03-30 14:34:25 +02:00
|
|
|
return fs_2d_pie_chart (array_values($chart_data), array_keys($chart_data), $width, $height);
|
|
|
|
break;
|
2011-04-11 14:29:09 +02:00
|
|
|
case "3d":
|
2011-04-12 18:30:24 +02:00
|
|
|
return fs_3d_pie_chart2(array_values($chart_data), array_keys($chart_data), $width, $height);
|
2011-03-30 14:34:25 +02:00
|
|
|
break;
|
2011-04-11 14:29:09 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$graph = array();
|
|
|
|
$graph['data'] = $chart_data;
|
|
|
|
$graph['width'] = $width;
|
|
|
|
$graph['height'] = $height;
|
2011-04-20 11:23:54 +02:00
|
|
|
$graph['water_mark'] = $water_mark;
|
2011-04-20 17:54:31 +02:00
|
|
|
$graph['font'] = $font;
|
|
|
|
$graph['font_size'] = $font_size;
|
2011-04-11 14:29:09 +02:00
|
|
|
|
|
|
|
$id_graph = serialize_in_temp($graph);
|
2011-04-14 14:02:45 +02:00
|
|
|
|
2011-04-11 14:29:09 +02:00
|
|
|
switch($graph_type) {
|
|
|
|
case "2d":
|
2011-04-14 18:52:50 +02:00
|
|
|
return "<img src='" . $homedir . "include/graphs/functions_pchart.php?graph_type=pie2d&id_graph=".$id_graph."'>";
|
2011-04-11 14:29:09 +02:00
|
|
|
break;
|
|
|
|
case "3d":
|
2011-04-14 18:52:50 +02:00
|
|
|
return "<img src='" . $homedir . "include/graphs/functions_pchart.php?graph_type=pie3d&id_graph=".$id_graph."'>";
|
2011-04-11 14:29:09 +02:00
|
|
|
break;
|
|
|
|
}
|
2011-03-30 14:34:25 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function gantt_graph($project_name, $from, $to, $tasks, $milestones, $width, $height) {
|
|
|
|
return fs_gantt_chart ($project_name, $from, $to, $tasks, $milestones, $width, $height);
|
|
|
|
}
|
2011-04-12 18:03:07 +02:00
|
|
|
|
2011-04-18 17:12:48 +02:00
|
|
|
function include_flash_chart_script($homeurl = '') {
|
|
|
|
echo '<script language="JavaScript" src="' . $homeurl . 'include/graphs/FusionCharts/FusionCharts.js"></script>';
|
2011-04-12 18:03:07 +02:00
|
|
|
}
|
|
|
|
|
2011-03-30 14:34:25 +02:00
|
|
|
?>
|