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-05-12 13:38:14 +02:00
|
|
|
$ttl = 1;
|
|
|
|
$homeurl = '';
|
2011-04-18 16:05:54 +02:00
|
|
|
|
2011-05-12 13:38:14 +02:00
|
|
|
if (isset($_GET['homeurl'])) {
|
2012-06-11 12:24:02 +02:00
|
|
|
$homeurl = $_GET['homeurl'];
|
2011-05-12 13:38:14 +02:00
|
|
|
}
|
|
|
|
else $homeurl = '';
|
|
|
|
|
2015-11-26 17:59:09 +01:00
|
|
|
$homeurl = ((bool)filter_var($homeurl, FILTER_VALIDATE_URL) == 1) ? '' : $homeurl;
|
|
|
|
|
2011-05-12 13:38:14 +02:00
|
|
|
if (isset($_GET['ttl'])) {
|
2012-06-11 12:24:02 +02:00
|
|
|
$ttl = $_GET['ttl'];
|
2011-05-12 13:38:14 +02:00
|
|
|
}
|
|
|
|
else $ttl_param = 1;
|
|
|
|
|
|
|
|
if (isset($_GET['graph_type'])) {
|
2012-06-11 12:24:02 +02:00
|
|
|
$graph_type = $_GET['graph_type'];
|
2011-05-12 13:38:14 +02:00
|
|
|
}
|
|
|
|
else $graph_type = '';
|
2011-04-13 17:11:51 +02:00
|
|
|
|
2011-05-12 13:38:14 +02:00
|
|
|
//$graph_type = get_parameter('graph_type', '');
|
|
|
|
//$ttl_param = get_parameter('ttl', 1);
|
|
|
|
//$homeurl_param = get_parameter('homeurl', '');
|
|
|
|
|
2012-06-08 14:18:03 +02:00
|
|
|
// Turn on output buffering.
|
|
|
|
// The entire buffer will be discarded later so that any accidental output
|
|
|
|
// does not corrupt images generated by fgraph.
|
|
|
|
ob_start ();
|
|
|
|
|
2011-05-12 13:38:14 +02:00
|
|
|
if (!empty($graph_type)) {
|
|
|
|
include_once($homeurl . 'include/functions.php');
|
|
|
|
include_once($homeurl . 'include/functions_html.php');
|
|
|
|
|
|
|
|
include_once($homeurl . 'include/graphs/functions_gd.php');
|
|
|
|
include_once($homeurl . 'include/graphs/functions_utils.php');
|
2015-11-04 17:42:45 +01:00
|
|
|
include_once($homeurl . 'include/graphs/functions_d3.php');
|
2016-04-13 18:24:07 +02:00
|
|
|
include_once($homeurl . 'include/graphs/functions_flot.php');
|
2011-05-12 13:38:14 +02:00
|
|
|
}
|
2011-04-12 12:04:41 +02:00
|
|
|
|
2012-06-08 14:18:03 +02:00
|
|
|
// Clean the output buffer and turn off output buffering
|
|
|
|
ob_end_clean ();
|
|
|
|
|
2011-04-12 12:04:41 +02:00
|
|
|
switch($graph_type) {
|
|
|
|
case 'histogram':
|
2011-05-12 13:38:14 +02:00
|
|
|
$width = get_parameter('width');
|
|
|
|
$height = get_parameter('height');
|
|
|
|
$font = get_parameter('font');
|
|
|
|
$data = json_decode(io_safe_output(get_parameter('data')), true);
|
2012-03-05 Miguel de Dios <miguel.dedios@artica.es>
* extensions/update_manager/main.php, general/shortcut_bar.php,
godmode/reporting/reporting_builder.item_editor.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.preview.php, include/functions_api.php,
include/functions_html.php, include/htmlawed.php, include/pchart_graph.php,
operation/events/events_list.php, operation/netflow/nf_live_view.php:
cleaned source code style.
* godmode/menu.php, godmode/agentes/manage_config_remote.php: removed the
enterprise feature that have been wrong for years.
* general/header.php: changed to load the jquery-ui and jquery javascript
library to last version.
* extensions/insert_data.php, extensions/snmp_explorer.php,
godmode/agentes/agent_manager.php, include/ajax/agent.php,
include/javascript/pandora.js, operation/agentes/exportdata.php,
operation/events/events.php: changed the unknow plugin autocomplete for
the autocomple from jquery-ui.
* include/functions_ui.php: cleaned source code style and into the function
"ui_process_page_head" added the blacklist hardwrote for to use old jquery.
* include/styles/jquery-ui-1.8.17.custom.css,
include/javascript/jquery-1.7.1.min.js,
include/javascript/jquery.jquery-ui-1.8.17.custom.min.js: added the last
version of Jquery and Jquery-ui.
Merge from the branch "pandora_4.0"
* godmode/reporting/visual_console_builder.constans.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.editor.php,
include/functions_visual_map.php,
include/ajax/visual_console_builder.ajax.php,
include/javascript/pandora_visual_console.js: changed the unknow
plugin autocomplete for the autocomple from jquery-ui and added function to
paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart) with the
name "progress_bubble".
* images/percentile_item.disabled.png, images/percentile_item.png: added
images for button of percentile item (new item in visual map).
* include/styles/pandora.css: added the style for the new button percentile
item.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/functions_gd.php: cleaned source code style, and added the
params to set text and color in the function "progress_bar" and added
function to paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart)
with the name "progress_bubble".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5693 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-03-05 18:56:56 +01:00
|
|
|
|
2011-05-12 13:38:14 +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;
|
2011-04-12 12:04:41 +02:00
|
|
|
case 'progressbar':
|
2011-05-12 13:38:14 +02:00
|
|
|
$width = get_parameter('width');
|
|
|
|
$height = get_parameter('height');
|
|
|
|
$progress = get_parameter('progress');
|
|
|
|
|
2013-08-02 12:53:50 +02:00
|
|
|
$out_of_lim_str = io_safe_output(get_parameter('out_of_lim_str', false));
|
2011-05-12 13:38:14 +02:00
|
|
|
$out_of_lim_image = get_parameter('out_of_lim_image', false);
|
2012-03-05 Miguel de Dios <miguel.dedios@artica.es>
* extensions/update_manager/main.php, general/shortcut_bar.php,
godmode/reporting/reporting_builder.item_editor.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.preview.php, include/functions_api.php,
include/functions_html.php, include/htmlawed.php, include/pchart_graph.php,
operation/events/events_list.php, operation/netflow/nf_live_view.php:
cleaned source code style.
* godmode/menu.php, godmode/agentes/manage_config_remote.php: removed the
enterprise feature that have been wrong for years.
* general/header.php: changed to load the jquery-ui and jquery javascript
library to last version.
* extensions/insert_data.php, extensions/snmp_explorer.php,
godmode/agentes/agent_manager.php, include/ajax/agent.php,
include/javascript/pandora.js, operation/agentes/exportdata.php,
operation/events/events.php: changed the unknow plugin autocomplete for
the autocomple from jquery-ui.
* include/functions_ui.php: cleaned source code style and into the function
"ui_process_page_head" added the blacklist hardwrote for to use old jquery.
* include/styles/jquery-ui-1.8.17.custom.css,
include/javascript/jquery-1.7.1.min.js,
include/javascript/jquery.jquery-ui-1.8.17.custom.min.js: added the last
version of Jquery and Jquery-ui.
Merge from the branch "pandora_4.0"
* godmode/reporting/visual_console_builder.constans.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.editor.php,
include/functions_visual_map.php,
include/ajax/visual_console_builder.ajax.php,
include/javascript/pandora_visual_console.js: changed the unknow
plugin autocomplete for the autocomple from jquery-ui and added function to
paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart) with the
name "progress_bubble".
* images/percentile_item.disabled.png, images/percentile_item.png: added
images for button of percentile item (new item in visual map).
* include/styles/pandora.css: added the style for the new button percentile
item.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/functions_gd.php: cleaned source code style, and added the
params to set text and color in the function "progress_bar" and added
function to paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart)
with the name "progress_bubble".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5693 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-03-05 18:56:56 +01:00
|
|
|
|
2011-05-12 13:38:14 +02:00
|
|
|
$font = get_parameter('font');
|
|
|
|
$title = get_parameter('title');
|
|
|
|
|
|
|
|
$mode = get_parameter('mode', 1);
|
|
|
|
|
2012-03-05 Miguel de Dios <miguel.dedios@artica.es>
* extensions/update_manager/main.php, general/shortcut_bar.php,
godmode/reporting/reporting_builder.item_editor.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.preview.php, include/functions_api.php,
include/functions_html.php, include/htmlawed.php, include/pchart_graph.php,
operation/events/events_list.php, operation/netflow/nf_live_view.php:
cleaned source code style.
* godmode/menu.php, godmode/agentes/manage_config_remote.php: removed the
enterprise feature that have been wrong for years.
* general/header.php: changed to load the jquery-ui and jquery javascript
library to last version.
* extensions/insert_data.php, extensions/snmp_explorer.php,
godmode/agentes/agent_manager.php, include/ajax/agent.php,
include/javascript/pandora.js, operation/agentes/exportdata.php,
operation/events/events.php: changed the unknow plugin autocomplete for
the autocomple from jquery-ui.
* include/functions_ui.php: cleaned source code style and into the function
"ui_process_page_head" added the blacklist hardwrote for to use old jquery.
* include/styles/jquery-ui-1.8.17.custom.css,
include/javascript/jquery-1.7.1.min.js,
include/javascript/jquery.jquery-ui-1.8.17.custom.min.js: added the last
version of Jquery and Jquery-ui.
Merge from the branch "pandora_4.0"
* godmode/reporting/visual_console_builder.constans.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.editor.php,
include/functions_visual_map.php,
include/ajax/visual_console_builder.ajax.php,
include/javascript/pandora_visual_console.js: changed the unknow
plugin autocomplete for the autocomple from jquery-ui and added function to
paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart) with the
name "progress_bubble".
* images/percentile_item.disabled.png, images/percentile_item.png: added
images for button of percentile item (new item in visual map).
* include/styles/pandora.css: added the style for the new button percentile
item.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/functions_gd.php: cleaned source code style, and added the
params to set text and color in the function "progress_bar" and added
function to paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart)
with the name "progress_bubble".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5693 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-03-05 18:56:56 +01:00
|
|
|
$fontsize = get_parameter('fontsize', 10);
|
|
|
|
|
|
|
|
$value_text = get_parameter('value_text', '');
|
|
|
|
$colorRGB = get_parameter('colorRGB', '');
|
|
|
|
|
|
|
|
gd_progress_bar ($width, $height, $progress, $title, $font,
|
2014-09-23 13:02:49 +02:00
|
|
|
$out_of_lim_str, $out_of_lim_image, $mode, $fontsize,
|
|
|
|
$value_text, $colorRGB);
|
2012-03-05 Miguel de Dios <miguel.dedios@artica.es>
* extensions/update_manager/main.php, general/shortcut_bar.php,
godmode/reporting/reporting_builder.item_editor.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.preview.php, include/functions_api.php,
include/functions_html.php, include/htmlawed.php, include/pchart_graph.php,
operation/events/events_list.php, operation/netflow/nf_live_view.php:
cleaned source code style.
* godmode/menu.php, godmode/agentes/manage_config_remote.php: removed the
enterprise feature that have been wrong for years.
* general/header.php: changed to load the jquery-ui and jquery javascript
library to last version.
* extensions/insert_data.php, extensions/snmp_explorer.php,
godmode/agentes/agent_manager.php, include/ajax/agent.php,
include/javascript/pandora.js, operation/agentes/exportdata.php,
operation/events/events.php: changed the unknow plugin autocomplete for
the autocomple from jquery-ui.
* include/functions_ui.php: cleaned source code style and into the function
"ui_process_page_head" added the blacklist hardwrote for to use old jquery.
* include/styles/jquery-ui-1.8.17.custom.css,
include/javascript/jquery-1.7.1.min.js,
include/javascript/jquery.jquery-ui-1.8.17.custom.min.js: added the last
version of Jquery and Jquery-ui.
Merge from the branch "pandora_4.0"
* godmode/reporting/visual_console_builder.constans.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.editor.php,
include/functions_visual_map.php,
include/ajax/visual_console_builder.ajax.php,
include/javascript/pandora_visual_console.js: changed the unknow
plugin autocomplete for the autocomple from jquery-ui and added function to
paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart) with the
name "progress_bubble".
* images/percentile_item.disabled.png, images/percentile_item.png: added
images for button of percentile item (new item in visual map).
* include/styles/pandora.css: added the style for the new button percentile
item.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/functions_gd.php: cleaned source code style, and added the
params to set text and color in the function "progress_bar" and added
function to paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart)
with the name "progress_bubble".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5693 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-03-05 18:56:56 +01:00
|
|
|
break;
|
|
|
|
case 'progressbubble':
|
|
|
|
$width = get_parameter('width');
|
|
|
|
$height = get_parameter('height');
|
|
|
|
$progress = get_parameter('progress');
|
|
|
|
|
2013-08-02 12:53:50 +02:00
|
|
|
$out_of_lim_str = io_safe_output(get_parameter('out_of_lim_str', false));
|
2012-03-05 Miguel de Dios <miguel.dedios@artica.es>
* extensions/update_manager/main.php, general/shortcut_bar.php,
godmode/reporting/reporting_builder.item_editor.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.preview.php, include/functions_api.php,
include/functions_html.php, include/htmlawed.php, include/pchart_graph.php,
operation/events/events_list.php, operation/netflow/nf_live_view.php:
cleaned source code style.
* godmode/menu.php, godmode/agentes/manage_config_remote.php: removed the
enterprise feature that have been wrong for years.
* general/header.php: changed to load the jquery-ui and jquery javascript
library to last version.
* extensions/insert_data.php, extensions/snmp_explorer.php,
godmode/agentes/agent_manager.php, include/ajax/agent.php,
include/javascript/pandora.js, operation/agentes/exportdata.php,
operation/events/events.php: changed the unknow plugin autocomplete for
the autocomple from jquery-ui.
* include/functions_ui.php: cleaned source code style and into the function
"ui_process_page_head" added the blacklist hardwrote for to use old jquery.
* include/styles/jquery-ui-1.8.17.custom.css,
include/javascript/jquery-1.7.1.min.js,
include/javascript/jquery.jquery-ui-1.8.17.custom.min.js: added the last
version of Jquery and Jquery-ui.
Merge from the branch "pandora_4.0"
* godmode/reporting/visual_console_builder.constans.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.editor.php,
include/functions_visual_map.php,
include/ajax/visual_console_builder.ajax.php,
include/javascript/pandora_visual_console.js: changed the unknow
plugin autocomplete for the autocomple from jquery-ui and added function to
paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart) with the
name "progress_bubble".
* images/percentile_item.disabled.png, images/percentile_item.png: added
images for button of percentile item (new item in visual map).
* include/styles/pandora.css: added the style for the new button percentile
item.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/functions_gd.php: cleaned source code style, and added the
params to set text and color in the function "progress_bar" and added
function to paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart)
with the name "progress_bubble".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5693 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-03-05 18:56:56 +01:00
|
|
|
$out_of_lim_image = get_parameter('out_of_lim_image', false);
|
|
|
|
|
|
|
|
$font = get_parameter('font');
|
|
|
|
$title = get_parameter('title');
|
|
|
|
|
|
|
|
$mode = get_parameter('mode', 1);
|
|
|
|
|
|
|
|
$fontsize = get_parameter('fontsize', 7);
|
|
|
|
|
|
|
|
$value_text = get_parameter('value_text', '');
|
|
|
|
$colorRGB = get_parameter('colorRGB', '');
|
|
|
|
|
|
|
|
gd_progress_bubble ($width, $height, $progress, $title, $font,
|
2014-09-23 13:02:49 +02:00
|
|
|
$out_of_lim_str, $out_of_lim_image, $mode, $fontsize,
|
|
|
|
$value_text, $colorRGB);
|
2011-05-12 13:38:14 +02:00
|
|
|
break;
|
2011-04-12 12:04:41 +02:00
|
|
|
}
|
2011-03-30 14:34:25 +02:00
|
|
|
|
2014-09-23 13:02:49 +02:00
|
|
|
function histogram($chart_data, $width, $height, $font, $max, $title,
|
|
|
|
$mode, $ttl = 1) {
|
|
|
|
|
2011-04-14 10:25:41 +02:00
|
|
|
$graph = array();
|
|
|
|
$graph['data'] = $chart_data;
|
|
|
|
$graph['width'] = $width;
|
|
|
|
$graph['height'] = $height;
|
|
|
|
$graph['font'] = $font;
|
|
|
|
$graph['max'] = $max;
|
|
|
|
$graph['title'] = $title;
|
|
|
|
$graph['mode'] = $mode;
|
2012-06-11 12:24:02 +02:00
|
|
|
|
2011-06-14 10:46:57 +02:00
|
|
|
$id_graph = serialize_in_temp($graph, null, $ttl);
|
2012-06-11 12:24:02 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
return "<img src='include/graphs/functions_gd.php?static_graph=1&graph_type=histogram&ttl=".$ttl."&id_graph=".$id_graph."'>";
|
2011-04-14 10:25:41 +02:00
|
|
|
}
|
|
|
|
|
2014-09-23 13:02:49 +02:00
|
|
|
function progressbar($progress, $width, $height, $title, $font,
|
|
|
|
$mode = 1, $out_of_lim_str = false, $out_of_lim_image = false,
|
|
|
|
$ttl = 1) {
|
2012-09-06 Miguel de Dios <miguel.dedios@artica.es>
* general/header.php, general/login_page.php,
godmode/setup/setup.php, include/functions_ui.php,
include/functions_graph.php, include/functions_html.php,
include/graphs/fgraph.php, include/graphs/functions_pchart.php,
include/graphs/functions_flot.php, include/functions_reporting.php,
include/functions_visual_map.php, include/functions_config.php,
operation/reporting/reporting_viewer.php,
operation/visual_console/render_view.php,
operation/agentes/tactical.php, operation/menu.php,
operation/events/events.php: added the feature to set a
public url for inverse proxy or for example mod_proxy of Apache.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6936 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-06 19:01:22 +02:00
|
|
|
|
2011-04-14 10:25:41 +02:00
|
|
|
$graph = array();
|
2012-06-11 12:24:02 +02:00
|
|
|
|
2011-04-14 10:25:41 +02:00
|
|
|
$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;
|
2012-06-11 12:24:02 +02:00
|
|
|
|
2011-06-14 10:46:57 +02:00
|
|
|
$id_graph = serialize_in_temp($graph, null, $ttl);
|
2012-06-11 12:24:02 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
return "<img src='include/graphs/functions_gd.php?static_graph=1&graph_type=progressbar&ttl=".$ttl."&id_graph=".$id_graph."'>";
|
2011-04-14 10:25:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-09-23 13:02:49 +02:00
|
|
|
function slicesbar_graph($chart_data, $period, $width, $height, $colors,
|
|
|
|
$font, $round_corner, $home_url = '', $ttl = 1) {
|
2012-09-06 Miguel de Dios <miguel.dedios@artica.es>
* general/header.php, general/login_page.php,
godmode/setup/setup.php, include/functions_ui.php,
include/functions_graph.php, include/functions_html.php,
include/graphs/fgraph.php, include/graphs/functions_pchart.php,
include/graphs/functions_flot.php, include/functions_reporting.php,
include/functions_visual_map.php, include/functions_config.php,
operation/reporting/reporting_viewer.php,
operation/visual_console/render_view.php,
operation/agentes/tactical.php, operation/menu.php,
operation/events/events.php: added the feature to set a
public url for inverse proxy or for example mod_proxy of Apache.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6936 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-06 19:01:22 +02:00
|
|
|
|
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;
|
2012-06-11 12:24:02 +02:00
|
|
|
|
2011-06-14 10:46:57 +02:00
|
|
|
$id_graph = serialize_in_temp($graph, null, $ttl);
|
2012-06-11 12:24:02 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
return "<img src='".$home_url."include/graphs/functions_pchart.php?static_graph=1&graph_type=slicebar&ttl=".$ttl."&id_graph=".$id_graph."'>";
|
2011-04-13 15:01:37 +02:00
|
|
|
}
|
|
|
|
|
2014-09-23 13:02:49 +02:00
|
|
|
function vbar_graph($flash_chart, $chart_data, $width, $height,
|
2015-11-25 14:25:19 +01:00
|
|
|
$color, $legend, $long_index, $no_data_image, $xaxisname = "",
|
|
|
|
$yaxisname = "", $water_mark = "", $font = '', $font_size = '',
|
|
|
|
$unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white') {
|
2012-09-06 Miguel de Dios <miguel.dedios@artica.es>
* general/header.php, general/login_page.php,
godmode/setup/setup.php, include/functions_ui.php,
include/functions_graph.php, include/functions_html.php,
include/graphs/fgraph.php, include/graphs/functions_pchart.php,
include/graphs/functions_flot.php, include/functions_reporting.php,
include/functions_visual_map.php, include/functions_config.php,
operation/reporting/reporting_viewer.php,
operation/visual_console/render_view.php,
operation/agentes/tactical.php, operation/menu.php,
operation/events/events.php: added the feature to set a
public url for inverse proxy or for example mod_proxy of Apache.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6936 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-06 19:01:22 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
2012-09-06 Miguel de Dios <miguel.dedios@artica.es>
* general/header.php, general/login_page.php,
godmode/setup/setup.php, include/functions_ui.php,
include/functions_graph.php, include/functions_html.php,
include/graphs/fgraph.php, include/graphs/functions_pchart.php,
include/graphs/functions_flot.php, include/functions_reporting.php,
include/functions_visual_map.php, include/functions_config.php,
operation/reporting/reporting_viewer.php,
operation/visual_console/render_view.php,
operation/agentes/tactical.php, operation/menu.php,
operation/events/events.php: added the feature to set a
public url for inverse proxy or for example mod_proxy of Apache.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6936 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-06 19:01:22 +02:00
|
|
|
|
2015-11-25 14:25:19 +01:00
|
|
|
if (empty($chart_data)) {
|
|
|
|
return '<img src="' . $no_data_image . '" />';
|
|
|
|
}
|
|
|
|
|
2013-07-16 Miguel de Dios <miguel.dedios@artica.es>
* include/functions.php,
include/javascript/jquery.pandora.controls.js: improved the
functions to pass the php vars to js, now it supports json.
* include/javascript/d3.v3.js: added this library for to make
beautiful things.
* include/functions_ui.php, include/graphs/fgraph.php,
include/javascript/pandora_events.js, include/javascript/pandora.js,
include/functions_treeview.php,
include/include_graph_dependencies.php,
include/functions_categories.php, include/db/postgresql.php,
include/db/oracle.php, include/db/mysql.php: cleaned source code
style.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8528 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-07-16 16:13:23 +02:00
|
|
|
if ($flash_chart) {
|
2014-09-23 13:02:49 +02:00
|
|
|
return flot_vcolumn_chart ($chart_data, $width, $height, $color,
|
|
|
|
$legend, $long_index, $homeurl, $unit, $water_mark_url,
|
2015-11-25 14:25:19 +01:00
|
|
|
$homedir);
|
2011-03-30 14:34:25 +02:00
|
|
|
}
|
|
|
|
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;
|
2012-03-01 17:41:02 +01:00
|
|
|
$graph['water_mark'] = $water_mark_file;
|
2011-04-20 17:54:31 +02:00
|
|
|
$graph['font'] = $font;
|
|
|
|
$graph['font_size'] = $font_size;
|
2012-06-11 12:24:02 +02:00
|
|
|
|
2011-06-14 10:46:57 +02:00
|
|
|
$id_graph = serialize_in_temp($graph, null, $ttl);
|
2012-06-11 12:24:02 +02:00
|
|
|
|
2016-01-25 09:53:05 +01:00
|
|
|
return "<img src='" . $homeurl . "include/graphs/functions_pchart.php?static_graph=1&graph_type=vbar&ttl=".$ttl."&id_graph=".$id_graph."'>";
|
2011-03-30 14:34:25 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-08 13:32:59 +01:00
|
|
|
// NOT USED ACTUALLY
|
2014-09-23 13:02:49 +02:00
|
|
|
function threshold_graph($flash_chart, $chart_data, $width, $height,
|
|
|
|
$ttl = 1) {
|
|
|
|
|
2012-09-06 Miguel de Dios <miguel.dedios@artica.es>
* general/header.php, general/login_page.php,
godmode/setup/setup.php, include/functions_ui.php,
include/functions_graph.php, include/functions_html.php,
include/graphs/fgraph.php, include/graphs/functions_pchart.php,
include/graphs/functions_flot.php, include/functions_reporting.php,
include/functions_visual_map.php, include/functions_config.php,
operation/reporting/reporting_viewer.php,
operation/visual_console/render_view.php,
operation/agentes/tactical.php, operation/menu.php,
operation/events/events.php: added the feature to set a
public url for inverse proxy or for example mod_proxy of Apache.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6936 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-06 19:01:22 +02:00
|
|
|
if ($flash_chart) {
|
2012-03-05 11:26:34 +01:00
|
|
|
return flot_area_simple_graph($chart_data, $width, $height);
|
2011-03-30 14:34:25 +02:00
|
|
|
}
|
|
|
|
else {
|
2012-03-01 17:41:02 +01:00
|
|
|
echo "<img src='include/graphs/functions_pchart.php?static_graph=1&graph_type=threshold&ttl=".$ttl."&data=".json_encode($chart_data)."&width=".$width."&height=".$height."'>";
|
2011-03-30 14:34:25 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-23 13:02:49 +02:00
|
|
|
function area_graph($flash_chart, $chart_data, $width, $height, $color,
|
|
|
|
$legend, $long_index, $no_data_image, $xaxisname = "",
|
|
|
|
$yaxisname = "", $homeurl="", $water_mark = "", $font = '',
|
|
|
|
$font_size = '', $unit = '', $ttl = 1, $series_type = array(),
|
|
|
|
$chart_extra_data = array(), $yellow_threshold = 0,
|
|
|
|
$red_threshold = 0, $adapt_key = '', $force_integer = false,
|
2015-11-04 17:42:45 +01:00
|
|
|
$series_suffix_str = '', $menu = true, $backgroundColor = 'white',
|
2016-04-04 10:06:34 +02:00
|
|
|
$dashboard = false, $vconsole = false, $agent_module_id = 0) {
|
2013-07-03 13:01:53 +02:00
|
|
|
|
2016-04-18 14:18:44 +02:00
|
|
|
include_once('functions_flot.php');
|
2015-08-20 17:55:10 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
2012-09-06 Miguel de Dios <miguel.dedios@artica.es>
* general/header.php, general/login_page.php,
godmode/setup/setup.php, include/functions_ui.php,
include/functions_graph.php, include/functions_html.php,
include/graphs/fgraph.php, include/graphs/functions_pchart.php,
include/graphs/functions_flot.php, include/functions_reporting.php,
include/functions_visual_map.php, include/functions_config.php,
operation/reporting/reporting_viewer.php,
operation/visual_console/render_view.php,
operation/agentes/tactical.php, operation/menu.php,
operation/events/events.php: added the feature to set a
public url for inverse proxy or for example mod_proxy of Apache.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6936 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-06 19:01:22 +02:00
|
|
|
|
2015-06-11 20:45:40 +02:00
|
|
|
// ATTENTION: The min size is in constants.php
|
2012-04-16 17:34:54 +02:00
|
|
|
// It's not the same minsize for all graphs, but we are choosed a prudent minsize for all
|
2015-06-11 20:45:40 +02:00
|
|
|
if ($height <= CHART_DEFAULT_HEIGHT) {
|
|
|
|
$height = CHART_DEFAULT_HEIGHT;
|
2012-04-16 17:34:54 +02:00
|
|
|
}
|
2015-06-11 20:45:40 +02:00
|
|
|
if ($width < CHART_DEFAULT_WIDTH) {
|
|
|
|
$width = CHART_DEFAULT_WIDTH;
|
2012-02-13 14:25:29 +01:00
|
|
|
}
|
|
|
|
|
2011-04-11 18:45:03 +02:00
|
|
|
if (empty($chart_data)) {
|
2013-05-23 17:42:32 +02:00
|
|
|
return graph_nodata_image($width, $height);
|
2013-01-03 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php,
extensions/resource_exportation.php,
operation/events/event_statistics.php,
operation/events/events_list.php,
operation/reporting/reporting_viewer.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_alerts.php, include/functions_reports.php,
include/functions_events.php, include/graphs/fgraph.php,
include/functions_graph.php, include/styles/pandora.css,
include/functions_reporting.php, include/functions_agents.php: a lot
of changes and fixes from the branch for the reports.
MERGED FROM PANDORA_4.0
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7351 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-01-03 19:52:21 +01:00
|
|
|
return '<img src="' . $no_data_image . '" />';
|
2011-04-11 18:45:03 +02:00
|
|
|
}
|
2016-05-30 15:24:51 +02:00
|
|
|
|
2016-06-01 15:02:10 +02:00
|
|
|
if ($dashboard || $vconsole) $menu = false;
|
2011-04-11 18:45:03 +02:00
|
|
|
|
2012-09-06 Miguel de Dios <miguel.dedios@artica.es>
* general/header.php, general/login_page.php,
godmode/setup/setup.php, include/functions_ui.php,
include/functions_graph.php, include/functions_html.php,
include/graphs/fgraph.php, include/graphs/functions_pchart.php,
include/graphs/functions_flot.php, include/functions_reporting.php,
include/functions_visual_map.php, include/functions_config.php,
operation/reporting/reporting_viewer.php,
operation/visual_console/render_view.php,
operation/agentes/tactical.php, operation/menu.php,
operation/events/events.php: added the feature to set a
public url for inverse proxy or for example mod_proxy of Apache.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6936 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-06 19:01:22 +02:00
|
|
|
if ($flash_chart) {
|
2014-03-10 16:59:36 +01:00
|
|
|
return flot_area_simple_graph(
|
|
|
|
$chart_data,
|
|
|
|
$width,
|
|
|
|
$height,
|
|
|
|
$color,
|
|
|
|
$legend,
|
|
|
|
$long_index,
|
|
|
|
$homeurl,
|
|
|
|
$unit,
|
|
|
|
$water_mark_url,
|
|
|
|
$series_type,
|
|
|
|
$chart_extra_data,
|
|
|
|
$yellow_threshold,
|
|
|
|
$red_threshold,
|
|
|
|
$adapt_key,
|
|
|
|
$force_integer,
|
|
|
|
$series_suffix_str,
|
2014-09-23 13:02:49 +02:00
|
|
|
$menu,
|
2015-11-04 17:42:45 +01:00
|
|
|
$backgroundColor,
|
2016-04-04 10:06:34 +02:00
|
|
|
$dashboard,
|
2016-05-30 15:24:51 +02:00
|
|
|
$vconsole,
|
2016-04-04 10:06:34 +02:00
|
|
|
$agent_module_id);
|
2011-03-30 14:34:25 +02:00
|
|
|
}
|
|
|
|
else {
|
2016-05-30 15:24:51 +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;
|
|
|
|
$graph['water_mark'] = $water_mark_file;
|
|
|
|
$graph['font'] = $font;
|
|
|
|
$graph['font_size'] = $font_size;
|
|
|
|
$graph['backgroundColor'] = $backgroundColor;
|
|
|
|
$graph['unit'] = $unit;
|
|
|
|
$graph['series_type'] = $series_type;
|
|
|
|
|
|
|
|
$id_graph = serialize_in_temp($graph, null, $ttl);
|
|
|
|
// Warning: This string is used in the function "api_get_module_graph" from 'functions_api.php' with the regec patern "/<img src='(.+)'>/"
|
|
|
|
return "<img src='" .
|
|
|
|
ui_get_full_url (false, false, false, false) .
|
|
|
|
"include/graphs/functions_pchart.php?" .
|
|
|
|
"static_graph=1&" .
|
|
|
|
"graph_type=area&" .
|
|
|
|
"ttl=" . $ttl . "&" .
|
|
|
|
"id_graph=" . $id_graph . "'>";
|
2012-06-11 12:24:02 +02:00
|
|
|
}
|
2011-04-07 19:36:08 +02:00
|
|
|
}
|
|
|
|
|
2014-09-23 13:02:49 +02:00
|
|
|
function stacked_area_graph($flash_chart, $chart_data, $width, $height,
|
|
|
|
$color, $legend, $long_index, $no_data_image, $xaxisname = "",
|
|
|
|
$yaxisname = "", $water_mark = "", $font = '', $font_size = '',
|
2015-11-04 17:42:45 +01:00
|
|
|
$unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white',
|
2016-04-04 10:06:34 +02:00
|
|
|
$dashboard = false, $vconsole = false, $agent_module_id) {
|
2012-06-11 12:24:02 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
2012-09-06 Miguel de Dios <miguel.dedios@artica.es>
* general/header.php, general/login_page.php,
godmode/setup/setup.php, include/functions_ui.php,
include/functions_graph.php, include/functions_html.php,
include/graphs/fgraph.php, include/graphs/functions_pchart.php,
include/graphs/functions_flot.php, include/functions_reporting.php,
include/functions_visual_map.php, include/functions_config.php,
operation/reporting/reporting_viewer.php,
operation/visual_console/render_view.php,
operation/agentes/tactical.php, operation/menu.php,
operation/events/events.php: added the feature to set a
public url for inverse proxy or for example mod_proxy of Apache.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6936 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-06 19:01:22 +02:00
|
|
|
|
2011-04-11 18:45:03 +02:00
|
|
|
if (empty($chart_data)) {
|
2013-01-03 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php,
extensions/resource_exportation.php,
operation/events/event_statistics.php,
operation/events/events_list.php,
operation/reporting/reporting_viewer.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_alerts.php, include/functions_reports.php,
include/functions_events.php, include/graphs/fgraph.php,
include/functions_graph.php, include/styles/pandora.css,
include/functions_reporting.php, include/functions_agents.php: a lot
of changes and fixes from the branch for the reports.
MERGED FROM PANDORA_4.0
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7351 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-01-03 19:52:21 +01:00
|
|
|
return '<img src="' . $no_data_image . '" />';
|
2011-04-11 18:45:03 +02:00
|
|
|
}
|
2016-05-30 15:24:51 +02:00
|
|
|
|
|
|
|
$menu = (!$dashboard && !$vconsole);
|
2011-04-07 19:36:08 +02:00
|
|
|
|
2013-07-16 Miguel de Dios <miguel.dedios@artica.es>
* include/functions.php,
include/javascript/jquery.pandora.controls.js: improved the
functions to pass the php vars to js, now it supports json.
* include/javascript/d3.v3.js: added this library for to make
beautiful things.
* include/functions_ui.php, include/graphs/fgraph.php,
include/javascript/pandora_events.js, include/javascript/pandora.js,
include/functions_treeview.php,
include/include_graph_dependencies.php,
include/functions_categories.php, include/db/postgresql.php,
include/db/oracle.php, include/db/mysql.php: cleaned source code
style.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8528 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-07-16 16:13:23 +02:00
|
|
|
if ($flash_chart) {
|
2014-09-23 13:02:49 +02:00
|
|
|
return flot_area_stacked_graph(
|
|
|
|
$chart_data,
|
|
|
|
$width,
|
|
|
|
$height,
|
|
|
|
$color,
|
|
|
|
$legend,
|
|
|
|
$long_index,
|
|
|
|
$homeurl,
|
|
|
|
$unit,
|
|
|
|
$water_mark_url,
|
|
|
|
array(),
|
|
|
|
array(),
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
'',
|
|
|
|
false,
|
|
|
|
'',
|
2016-05-30 15:24:51 +02:00
|
|
|
$menu,
|
2015-11-04 17:42:45 +01:00
|
|
|
$backgroundColor,
|
2016-05-30 15:24:51 +02:00
|
|
|
$dashboard,
|
|
|
|
$vconsole,
|
|
|
|
$agent_module_id);
|
2011-04-07 19:36:08 +02:00
|
|
|
}
|
|
|
|
else {
|
2016-05-30 15:24:51 +02:00
|
|
|
//Stack the data
|
|
|
|
stack_data($chart_data, $legend, $color);
|
|
|
|
|
|
|
|
$graph = array();
|
|
|
|
$graph['data'] = $chart_data;
|
|
|
|
$graph['width'] = $width;
|
|
|
|
$graph['height'] = $height;
|
|
|
|
$graph['color'] = $color;
|
|
|
|
$graph['legend'] = $legend;
|
|
|
|
$graph['xaxisname'] = $xaxisname;
|
|
|
|
$graph['yaxisname'] = $yaxisname;
|
|
|
|
$graph['water_mark'] = $water_mark_file;
|
|
|
|
$graph['font'] = $font;
|
|
|
|
$graph['font_size'] = $font_size;
|
|
|
|
$graph['backgroundColor'] = $backgroundColor;
|
|
|
|
|
|
|
|
$id_graph = serialize_in_temp($graph, null, $ttl);
|
|
|
|
|
|
|
|
return "<img src='" . ui_get_full_url (false, false, false, false) .
|
|
|
|
"include/graphs/functions_pchart.php?static_graph=1&graph_type=stacked_area&ttl=".$ttl."&id_graph=" . $id_graph . "' />";
|
2012-06-11 12:24:02 +02:00
|
|
|
}
|
2011-04-07 19:36:08 +02:00
|
|
|
}
|
|
|
|
|
2014-09-23 13:02:49 +02:00
|
|
|
function stacked_line_graph($flash_chart, $chart_data, $width, $height,
|
|
|
|
$color, $legend, $long_index, $no_data_image, $xaxisname = "",
|
|
|
|
$yaxisname = "", $water_mark = "", $font = '', $font_size = '',
|
2015-11-04 17:42:45 +01:00
|
|
|
$unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white',
|
2016-03-15 09:25:48 +01:00
|
|
|
$dashboard = false, $vconsole = false) {
|
2012-06-11 12:24:02 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
2012-09-06 Miguel de Dios <miguel.dedios@artica.es>
* general/header.php, general/login_page.php,
godmode/setup/setup.php, include/functions_ui.php,
include/functions_graph.php, include/functions_html.php,
include/graphs/fgraph.php, include/graphs/functions_pchart.php,
include/graphs/functions_flot.php, include/functions_reporting.php,
include/functions_visual_map.php, include/functions_config.php,
operation/reporting/reporting_viewer.php,
operation/visual_console/render_view.php,
operation/agentes/tactical.php, operation/menu.php,
operation/events/events.php: added the feature to set a
public url for inverse proxy or for example mod_proxy of Apache.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6936 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-06 19:01:22 +02:00
|
|
|
|
2011-04-11 18:45:03 +02:00
|
|
|
if (empty($chart_data)) {
|
2013-01-03 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php,
extensions/resource_exportation.php,
operation/events/event_statistics.php,
operation/events/events_list.php,
operation/reporting/reporting_viewer.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_alerts.php, include/functions_reports.php,
include/functions_events.php, include/graphs/fgraph.php,
include/functions_graph.php, include/styles/pandora.css,
include/functions_reporting.php, include/functions_agents.php: a lot
of changes and fixes from the branch for the reports.
MERGED FROM PANDORA_4.0
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7351 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-01-03 19:52:21 +01:00
|
|
|
return '<img src="' . $no_data_image . '" />';
|
2011-04-11 18:45:03 +02:00
|
|
|
}
|
2012-06-11 12:24:02 +02:00
|
|
|
|
2016-05-30 15:24:51 +02:00
|
|
|
$menu = (!$dashboard && !$vconsole);
|
2013-07-03 13:01:53 +02:00
|
|
|
|
2013-07-16 Miguel de Dios <miguel.dedios@artica.es>
* include/functions.php,
include/javascript/jquery.pandora.controls.js: improved the
functions to pass the php vars to js, now it supports json.
* include/javascript/d3.v3.js: added this library for to make
beautiful things.
* include/functions_ui.php, include/graphs/fgraph.php,
include/javascript/pandora_events.js, include/javascript/pandora.js,
include/functions_treeview.php,
include/include_graph_dependencies.php,
include/functions_categories.php, include/db/postgresql.php,
include/db/oracle.php, include/db/mysql.php: cleaned source code
style.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8528 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-07-16 16:13:23 +02:00
|
|
|
if ($flash_chart) {
|
2014-09-23 13:02:49 +02:00
|
|
|
return flot_line_stacked_graph(
|
|
|
|
$chart_data,
|
|
|
|
$width,
|
|
|
|
$height,
|
|
|
|
$color,
|
|
|
|
$legend,
|
|
|
|
$long_index,
|
|
|
|
$homeurl,
|
|
|
|
$unit,
|
|
|
|
$water_mark_url,
|
|
|
|
array(),
|
|
|
|
array(),
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
'',
|
|
|
|
false,
|
|
|
|
'',
|
2016-05-30 15:24:51 +02:00
|
|
|
$menu,
|
2015-11-04 17:42:45 +01:00
|
|
|
$background_color,
|
2016-05-30 15:24:51 +02:00
|
|
|
$dashboard,
|
|
|
|
$vconsole);
|
2011-04-11 18:45:03 +02:00
|
|
|
}
|
2012-06-11 12:24:02 +02:00
|
|
|
else {
|
2016-05-30 15:24:51 +02:00
|
|
|
//Stack the data
|
|
|
|
stack_data($chart_data, $legend, $color);
|
|
|
|
|
|
|
|
$graph = array();
|
|
|
|
$graph['data'] = $chart_data;
|
|
|
|
$graph['width'] = $width;
|
|
|
|
$graph['height'] = $height;
|
|
|
|
$graph['color'] = $color;
|
|
|
|
$graph['legend'] = $legend;
|
|
|
|
$graph['xaxisname'] = $xaxisname;
|
|
|
|
$graph['yaxisname'] = $yaxisname;
|
|
|
|
$graph['water_mark'] = $water_mark_file;
|
|
|
|
$graph['font'] = $font;
|
|
|
|
$graph['font_size'] = $font_size;
|
|
|
|
$graph['backgroundColor'] = $backgroundColor;
|
|
|
|
|
|
|
|
$id_graph = serialize_in_temp($graph, null, $ttl);
|
|
|
|
|
|
|
|
return "<img src='" . $homeurl . "include/graphs/functions_pchart.php?static_graph=1&graph_type=line&ttl=".$ttl."&id_graph=" . $id_graph . "' />";
|
2011-04-11 18:45:03 +02:00
|
|
|
}
|
|
|
|
}
|
2011-04-07 19:36:08 +02:00
|
|
|
|
2015-11-04 17:42:45 +01:00
|
|
|
function stacked_bullet_chart($flash_chart, $chart_data, $width, $height,
|
|
|
|
$color, $legend, $long_index, $no_data_image, $xaxisname = "",
|
|
|
|
$yaxisname = "", $water_mark = "", $font = '', $font_size = '',
|
|
|
|
$unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white') {
|
|
|
|
|
|
|
|
include_once('functions_d3.php');
|
|
|
|
|
|
|
|
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
|
|
|
|
|
|
|
if (empty($chart_data)) {
|
|
|
|
return '<img src="' . $no_data_image . '" />';
|
|
|
|
}
|
2016-06-10 11:11:11 +02:00
|
|
|
if ($flash_chart) {
|
|
|
|
return d3_bullet_chart(
|
|
|
|
$chart_data,
|
|
|
|
$width,
|
|
|
|
$height,
|
|
|
|
$color,
|
|
|
|
$legend,
|
|
|
|
$homeurl,
|
|
|
|
$unit,
|
|
|
|
$font,
|
|
|
|
$font_size
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$legend = array();
|
|
|
|
$new_data = array();
|
|
|
|
foreach($chart_data as $key => $data) {
|
|
|
|
$temp[] = ($data['min'] != false) ? $data['min'] : 0;
|
|
|
|
$temp[] = ($data['value'] != false) ? $data['value'] : 0;
|
|
|
|
$temp[] = ($data['max'] != false) ? $data['max'] : 0;
|
|
|
|
|
|
|
|
$legend[] = $data['label'];
|
|
|
|
array_push($new_data, $temp);
|
|
|
|
$temp = array();
|
|
|
|
}
|
|
|
|
$graph = array();
|
|
|
|
$graph['data'] = $new_data;
|
|
|
|
$graph['width'] = $width;
|
|
|
|
$graph['height'] = $height;
|
|
|
|
$graph['color'] = $color;
|
|
|
|
$graph['legend'] = $legend;
|
|
|
|
$graph['xaxisname'] = $xaxisname;
|
|
|
|
$graph['yaxisname'] = $yaxisname;
|
|
|
|
$graph['water_mark'] = $water_mark_file;
|
|
|
|
$graph['font'] = $font;
|
|
|
|
$graph['font_size'] = $font_size;
|
|
|
|
$graph['backgroundColor'] = $backgroundColor;
|
|
|
|
|
|
|
|
$id_graph = serialize_in_temp($graph, null, $ttl);
|
|
|
|
|
|
|
|
return "<img src='" . $homeurl . "include/graphs/functions_pchart.php?static_graph=1&graph_type=bullet_chart&ttl=".$ttl."&id_graph=" . $id_graph . "' />";
|
|
|
|
}
|
2015-11-04 17:42:45 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function stacked_gauge($flash_chart, $chart_data, $width, $height,
|
|
|
|
$color, $legend, $long_index, $no_data_image, $xaxisname = "",
|
|
|
|
$yaxisname = "", $water_mark = "", $font = '', $font_size = '',
|
|
|
|
$unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white') {
|
|
|
|
|
|
|
|
include_once('functions_d3.php');
|
|
|
|
|
|
|
|
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
|
|
|
|
|
|
|
if (empty($chart_data)) {
|
|
|
|
return '<img src="' . $no_data_image . '" />';
|
|
|
|
}
|
|
|
|
|
|
|
|
return d3_gauges(
|
|
|
|
$chart_data,
|
|
|
|
$width,
|
|
|
|
$height,
|
|
|
|
$color,
|
|
|
|
$legend,
|
|
|
|
$homeurl,
|
|
|
|
$unit,
|
|
|
|
$font,
|
2015-11-25 14:25:19 +01:00
|
|
|
$font_size + 2,
|
|
|
|
$no_data_image
|
2015-11-04 17:42:45 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2014-09-23 13:02:49 +02:00
|
|
|
function line_graph($flash_chart, $chart_data, $width, $height, $color,
|
|
|
|
$legend, $long_index, $no_data_image, $xaxisname = "",
|
|
|
|
$yaxisname = "", $water_mark = "", $font = '', $font_size = '',
|
2015-11-04 17:42:45 +01:00
|
|
|
$unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white',
|
2016-03-15 09:25:48 +01:00
|
|
|
$dashboard = false, $vconsole = false) {
|
2011-11-29 17:07:44 +01:00
|
|
|
|
2016-04-13 18:24:07 +02:00
|
|
|
include_once("functions_flot.php");
|
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
2013-07-03 13:01:53 +02:00
|
|
|
|
2011-04-11 18:45:03 +02:00
|
|
|
if (empty($chart_data)) {
|
2013-01-03 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php,
extensions/resource_exportation.php,
operation/events/event_statistics.php,
operation/events/events_list.php,
operation/reporting/reporting_viewer.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_alerts.php, include/functions_reports.php,
include/functions_events.php, include/graphs/fgraph.php,
include/functions_graph.php, include/styles/pandora.css,
include/functions_reporting.php, include/functions_agents.php: a lot
of changes and fixes from the branch for the reports.
MERGED FROM PANDORA_4.0
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7351 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-01-03 19:52:21 +01:00
|
|
|
return '<img src="' . $no_data_image . '" />';
|
2011-04-11 18:45:03 +02:00
|
|
|
}
|
2016-05-30 15:24:51 +02:00
|
|
|
|
|
|
|
$menu = (!$dashboard && !$vconsole);
|
2011-04-07 19:36:08 +02:00
|
|
|
|
2013-07-16 Miguel de Dios <miguel.dedios@artica.es>
* include/functions.php,
include/javascript/jquery.pandora.controls.js: improved the
functions to pass the php vars to js, now it supports json.
* include/javascript/d3.v3.js: added this library for to make
beautiful things.
* include/functions_ui.php, include/graphs/fgraph.php,
include/javascript/pandora_events.js, include/javascript/pandora.js,
include/functions_treeview.php,
include/include_graph_dependencies.php,
include/functions_categories.php, include/db/postgresql.php,
include/db/oracle.php, include/db/mysql.php: cleaned source code
style.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8528 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-07-16 16:13:23 +02:00
|
|
|
if ($flash_chart) {
|
2014-09-23 13:02:49 +02:00
|
|
|
return flot_line_simple_graph(
|
|
|
|
$chart_data,
|
|
|
|
$width,
|
|
|
|
$height,
|
|
|
|
$color,
|
|
|
|
$legend,
|
|
|
|
$long_index,
|
|
|
|
$homeurl,
|
|
|
|
$unit,
|
|
|
|
$water_mark_url,
|
|
|
|
array(),
|
|
|
|
array(),
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
'',
|
|
|
|
false,
|
|
|
|
'',
|
2016-05-30 15:24:51 +02:00
|
|
|
$menu,
|
2015-11-04 17:42:45 +01:00
|
|
|
$backgroundColor,
|
2016-05-30 15:24:51 +02:00
|
|
|
$dashboard,
|
|
|
|
$vconsole);
|
2011-04-07 19:36:08 +02:00
|
|
|
}
|
|
|
|
else {
|
2016-05-30 15:24:51 +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;
|
|
|
|
$graph['water_mark'] = $water_mark_file;
|
|
|
|
$graph['font'] = $font;
|
|
|
|
$graph['font_size'] = $font_size;
|
|
|
|
$graph['backgroundColor'] = $backgroundColor;
|
|
|
|
|
|
|
|
$id_graph = serialize_in_temp($graph, null, $ttl);
|
|
|
|
|
|
|
|
return "<img src='" . $homeurl . "include/graphs/functions_pchart.php?static_graph=1&graph_type=line&ttl=".$ttl."&id_graph=" . $id_graph . "' />";
|
2012-06-11 12:24:02 +02:00
|
|
|
}
|
2011-03-30 14:34:25 +02:00
|
|
|
}
|
|
|
|
|
2014-09-23 13:02:49 +02:00
|
|
|
function kiviat_graph($graph_type, $flash_chart, $chart_data, $width,
|
|
|
|
$height, $no_data_image, $ttl = 1, $homedir="") {
|
|
|
|
|
2011-04-13 10:49:18 +02:00
|
|
|
if (empty($chart_data)) {
|
2013-01-03 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php,
extensions/resource_exportation.php,
operation/events/event_statistics.php,
operation/events/events_list.php,
operation/reporting/reporting_viewer.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_alerts.php, include/functions_reports.php,
include/functions_events.php, include/graphs/fgraph.php,
include/functions_graph.php, include/styles/pandora.css,
include/functions_reporting.php, include/functions_agents.php: a lot
of changes and fixes from the branch for the reports.
MERGED FROM PANDORA_4.0
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7351 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-01-03 19:52:21 +01:00
|
|
|
return '<img src="' . $no_data_image . '" />';
|
2011-04-13 10:49:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$graph = array();
|
|
|
|
$graph['data'] = $chart_data;
|
|
|
|
$graph['width'] = $width;
|
|
|
|
$graph['height'] = $height;
|
2012-06-11 12:24:02 +02:00
|
|
|
|
2011-06-14 10:46:57 +02:00
|
|
|
$id_graph = serialize_in_temp($graph, null, $ttl);
|
2012-06-11 12:24:02 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
return "<img src='".$homedir."include/graphs/functions_pchart.php?static_graph=1&graph_type=".$graph_type."&ttl=".$ttl."&id_graph=" . $id_graph . "' />";
|
2011-04-13 10:49:18 +02:00
|
|
|
}
|
|
|
|
|
2014-09-23 13:02:49 +02:00
|
|
|
function radar_graph($flash_chart, $chart_data, $width, $height,
|
|
|
|
$no_data_image, $ttl = 1, $homedir="") {
|
|
|
|
|
|
|
|
return kiviat_graph('radar', $flash_chart, $chart_data, $width,
|
|
|
|
$height, $no_data_image, $ttl, $homedir);
|
2011-04-13 10:49:18 +02:00
|
|
|
}
|
|
|
|
|
2014-09-23 13:02:49 +02:00
|
|
|
function polar_graph($flash_chart, $chart_data, $width, $height,
|
|
|
|
$no_data_image, $ttl = 1, $homedir="") {
|
|
|
|
|
|
|
|
return kiviat_graph('polar', $flash_chart, $chart_data, $width,
|
|
|
|
$height, $no_data_image, $ttl, $homedir="");
|
2011-04-13 10:49:18 +02:00
|
|
|
}
|
|
|
|
|
2015-11-25 14:25:19 +01:00
|
|
|
|
2014-09-23 13:02:49 +02:00
|
|
|
function hbar_graph($flash_chart, $chart_data, $width, $height,
|
2015-11-25 14:25:19 +01:00
|
|
|
$color, $legend, $long_index, $no_data_image, $xaxisname = "",
|
|
|
|
$yaxisname = "", $water_mark = "", $font = '', $font_size = '',
|
|
|
|
$unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white') {
|
2012-03-01 17:41:02 +01:00
|
|
|
|
|
|
|
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
|
|
|
|
2015-11-25 14:25:19 +01:00
|
|
|
if (empty($chart_data)) {
|
|
|
|
return '<img src="' . $no_data_image . '" />';
|
|
|
|
}
|
|
|
|
|
2013-07-16 Miguel de Dios <miguel.dedios@artica.es>
* include/functions.php,
include/javascript/jquery.pandora.controls.js: improved the
functions to pass the php vars to js, now it supports json.
* include/javascript/d3.v3.js: added this library for to make
beautiful things.
* include/functions_ui.php, include/graphs/fgraph.php,
include/javascript/pandora_events.js, include/javascript/pandora.js,
include/functions_treeview.php,
include/include_graph_dependencies.php,
include/functions_categories.php, include/db/postgresql.php,
include/db/oracle.php, include/db/mysql.php: cleaned source code
style.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8528 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-07-16 16:13:23 +02:00
|
|
|
if ($flash_chart) {
|
2016-01-08 10:47:04 +01:00
|
|
|
return flot_hcolumn_chart(
|
|
|
|
$chart_data, $width, $height, $water_mark_url);
|
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;
|
2012-03-01 17:41:02 +01:00
|
|
|
$graph['water_mark'] = $water_mark_file;
|
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;
|
2012-06-11 12:24:02 +02:00
|
|
|
|
2011-06-14 10:46:57 +02:00
|
|
|
$id_graph = serialize_in_temp($graph, null, $ttl);
|
2012-06-11 12:24:02 +02:00
|
|
|
|
2016-01-13 10:34:01 +01:00
|
|
|
return "<img src='" . $homeurl . "include/graphs/functions_pchart.php?static_graph=1&graph_type=hbar&ttl=".$ttl."&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,
|
2013-06-10 13:13:38 +02:00
|
|
|
$others_str = "other", $homedir = "", $water_mark = "", $font = '',
|
2016-05-26 13:47:45 +02:00
|
|
|
$font_size = '', $ttl = 1, $legend_position = false, $colors = '',
|
|
|
|
$hide_labels = false) {
|
2013-02-19 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_api.php, include/functions_agents.php,
include/functions_config.php, include/ajax/reporting.ajax.php,
include/functions_snmp_browser.php,
operation/agentes/status_monitor.php: improved code style.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/flot/jquery.flot.pie.js,
include/graphs/flot/jquery.flot.pie.min.js,
include/graphs/flot/pandora.flot.js,
include/graphs/functions_flot.php: fixed the pie graphs, added the
expanded version of flot pie js file with some changes for the
last version of jQuery.
Fixes: #3604555
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7675 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-02-19 11:35:04 +01:00
|
|
|
|
2011-04-20 17:54:31 +02:00
|
|
|
return pie_graph('3d', $flash_chart, $chart_data, $width, $height,
|
2013-02-19 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_api.php, include/functions_agents.php,
include/functions_config.php, include/ajax/reporting.ajax.php,
include/functions_snmp_browser.php,
operation/agentes/status_monitor.php: improved code style.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/flot/jquery.flot.pie.js,
include/graphs/flot/jquery.flot.pie.min.js,
include/graphs/flot/pandora.flot.js,
include/graphs/functions_flot.php: fixed the pie graphs, added the
expanded version of flot pie js file with some changes for the
last version of jQuery.
Fixes: #3604555
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7675 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-02-19 11:35:04 +01:00
|
|
|
$others_str, $homedir, $water_mark, $font, $font_size, $ttl,
|
2016-05-26 13:47:45 +02:00
|
|
|
$legend_position, $colors, $hide_labels);
|
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,
|
2013-01-30 17:29:49 +01:00
|
|
|
$others_str = "other", $homedir="", $water_mark = "", $font = '',
|
2016-05-26 13:47:45 +02:00
|
|
|
$font_size = '', $ttl = 1, $legend_position = false, $colors = '',
|
|
|
|
$hide_labels = false) {
|
2013-02-19 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_api.php, include/functions_agents.php,
include/functions_config.php, include/ajax/reporting.ajax.php,
include/functions_snmp_browser.php,
operation/agentes/status_monitor.php: improved code style.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/flot/jquery.flot.pie.js,
include/graphs/flot/jquery.flot.pie.min.js,
include/graphs/flot/pandora.flot.js,
include/graphs/functions_flot.php: fixed the pie graphs, added the
expanded version of flot pie js file with some changes for the
last version of jQuery.
Fixes: #3604555
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7675 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-02-19 11:35:04 +01:00
|
|
|
|
2011-04-20 17:54:31 +02:00
|
|
|
return pie_graph('2d', $flash_chart, $chart_data, $width, $height,
|
2013-02-20 18:15:38 +01:00
|
|
|
$others_str, $homedir, $water_mark, $font, $font_size, $ttl,
|
2016-05-26 13:47:45 +02:00
|
|
|
$legend_position, $colors, $hide_labels);
|
2011-03-30 14:34:25 +02:00
|
|
|
}
|
|
|
|
|
2014-09-23 13:02:49 +02:00
|
|
|
function pie_graph($graph_type, $flash_chart, $chart_data, $width,
|
|
|
|
$height, $others_str = "other", $homedir="", $water_mark = "",
|
|
|
|
$font = '', $font_size = '', $ttl = 1, $legend_position = false,
|
2016-05-26 13:47:45 +02:00
|
|
|
$colors = '', $hide_labels = false) {
|
2013-01-03 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php,
extensions/resource_exportation.php,
operation/events/event_statistics.php,
operation/events/events_list.php,
operation/reporting/reporting_viewer.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_alerts.php, include/functions_reports.php,
include/functions_events.php, include/graphs/fgraph.php,
include/functions_graph.php, include/styles/pandora.css,
include/functions_reporting.php, include/functions_agents.php: a lot
of changes and fixes from the branch for the reports.
MERGED FROM PANDORA_4.0
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7351 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-01-03 19:52:21 +01:00
|
|
|
|
2013-06-10 13:13:38 +02:00
|
|
|
if (empty($chart_data)) {
|
2013-05-23 17:42:32 +02:00
|
|
|
return graph_nodata_image($width, $height, 'pie');
|
|
|
|
}
|
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
|
|
|
|
2011-04-14 14:02:45 +02:00
|
|
|
// This library allows only 8 colors
|
2013-06-20 13:17:14 +02:00
|
|
|
$max_values = 5;
|
2012-06-11 12:24:02 +02:00
|
|
|
|
2013-06-20 10:20:11 +02:00
|
|
|
//Remove the html_entities
|
|
|
|
$temp = array();
|
|
|
|
foreach ($chart_data as $key => $value) {
|
|
|
|
$temp[io_safe_output($key)] = $value;
|
|
|
|
}
|
|
|
|
$chart_data = $temp;
|
|
|
|
|
2013-01-30 17:29:49 +01:00
|
|
|
if (count($chart_data) > $max_values) {
|
2011-03-30 14:34:25 +02:00
|
|
|
$chart_data_trunc = array();
|
|
|
|
$n = 1;
|
2013-02-19 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_api.php, include/functions_agents.php,
include/functions_config.php, include/ajax/reporting.ajax.php,
include/functions_snmp_browser.php,
operation/agentes/status_monitor.php: improved code style.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/flot/jquery.flot.pie.js,
include/graphs/flot/jquery.flot.pie.min.js,
include/graphs/flot/pandora.flot.js,
include/graphs/functions_flot.php: fixed the pie graphs, added the
expanded version of flot pie js file with some changes for the
last version of jQuery.
Fixes: #3604555
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7675 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-02-19 11:35:04 +01:00
|
|
|
foreach ($chart_data as $key => $value) {
|
|
|
|
if ($n < $max_values) {
|
2011-03-30 14:34:25 +02:00
|
|
|
$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;
|
|
|
|
}
|
|
|
|
|
2013-01-03 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php,
extensions/resource_exportation.php,
operation/events/event_statistics.php,
operation/events/events_list.php,
operation/reporting/reporting_viewer.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_alerts.php, include/functions_reports.php,
include/functions_events.php, include/graphs/fgraph.php,
include/functions_graph.php, include/styles/pandora.css,
include/functions_reporting.php, include/functions_agents.php: a lot
of changes and fixes from the branch for the reports.
MERGED FROM PANDORA_4.0
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7351 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-01-03 19:52:21 +01:00
|
|
|
if ($flash_chart) {
|
2013-01-30 17:29:49 +01:00
|
|
|
return flot_pie_chart(array_values($chart_data),
|
|
|
|
array_keys($chart_data), $width, $height, $water_mark_url,
|
2016-05-26 13:47:45 +02:00
|
|
|
$font, $font_size, $legend_position, $colors, $hide_labels);
|
2011-04-11 14:29:09 +02:00
|
|
|
}
|
|
|
|
else {
|
2013-01-30 17:29:49 +01:00
|
|
|
//TODO SET THE LEGEND POSITION
|
|
|
|
|
2011-04-11 14:29:09 +02:00
|
|
|
$graph = array();
|
|
|
|
$graph['data'] = $chart_data;
|
|
|
|
$graph['width'] = $width;
|
|
|
|
$graph['height'] = $height;
|
2012-03-01 17:41:02 +01:00
|
|
|
$graph['water_mark'] = $water_mark_file;
|
2011-04-20 17:54:31 +02:00
|
|
|
$graph['font'] = $font;
|
|
|
|
$graph['font_size'] = $font_size;
|
2013-02-20 18:15:38 +01:00
|
|
|
$graph['legend_position'] = $legend_position;
|
|
|
|
$graph['color'] = $colors;
|
2013-03-15 15:35:52 +01:00
|
|
|
|
2011-06-14 10:46:57 +02:00
|
|
|
$id_graph = serialize_in_temp($graph, null, $ttl);
|
2011-04-14 14:02:45 +02:00
|
|
|
|
2013-03-15 15:35:52 +01:00
|
|
|
switch ($graph_type) {
|
2011-04-11 14:29:09 +02:00
|
|
|
case "2d":
|
2013-03-15 15:35:52 +01:00
|
|
|
return "<img src='" . $homedir . "include/graphs/functions_pchart.php?static_graph=1&graph_type=pie2d&ttl=".$ttl."&id_graph=".$id_graph."'>";
|
2011-04-11 14:29:09 +02:00
|
|
|
break;
|
2013-01-03 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php,
extensions/resource_exportation.php,
operation/events/event_statistics.php,
operation/events/events_list.php,
operation/reporting/reporting_viewer.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_alerts.php, include/functions_reports.php,
include/functions_events.php, include/graphs/fgraph.php,
include/functions_graph.php, include/styles/pandora.css,
include/functions_reporting.php, include/functions_agents.php: a lot
of changes and fixes from the branch for the reports.
MERGED FROM PANDORA_4.0
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7351 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-01-03 19:52:21 +01:00
|
|
|
case "3d":
|
2013-03-15 15:35:52 +01:00
|
|
|
return "<img src='" . $homedir . "include/graphs/functions_pchart.php?static_graph=1&graph_type=pie3d&ttl=".$ttl."&id_graph=".$id_graph."'>";
|
2011-04-11 14:29:09 +02:00
|
|
|
break;
|
|
|
|
}
|
2011-03-30 14:34:25 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-10 11:11:11 +02:00
|
|
|
function ring_graph($flash_chart, $chart_data, $width,
|
|
|
|
$height, $others_str = "other", $homedir="", $water_mark = "",
|
|
|
|
$font = '', $font_size = '', $ttl = 1, $legend_position = false,
|
|
|
|
$colors = '', $hide_labels = false) {
|
|
|
|
|
|
|
|
if (empty($chart_data)) {
|
|
|
|
return graph_nodata_image($width, $height, 'pie');
|
|
|
|
}
|
|
|
|
|
|
|
|
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
|
|
|
|
|
|
|
// This library allows only 8 colors
|
|
|
|
$max_values = 18;
|
|
|
|
|
|
|
|
|
|
|
|
if ($flash_chart) {
|
|
|
|
return flot_custom_pie_chart ($flash_chart, $chart_data,
|
|
|
|
$width, $height, $colors, $module_name_list, $long_index,
|
|
|
|
$no_data, false, '', $water_mark, $font, $font_size,
|
|
|
|
$unit, $ttl, $homeurl, $background_color, $legend_position);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$total_modules = $chart_data['total_modules'];
|
|
|
|
unset($chart_data['total_modules']);
|
|
|
|
|
2016-06-13 09:00:11 +02:00
|
|
|
$max_values = 9;
|
2016-06-10 11:11:11 +02:00
|
|
|
//Remove the html_entities
|
|
|
|
$n = 0;
|
|
|
|
$temp = array();
|
|
|
|
$coloretes = array();
|
|
|
|
foreach ($chart_data as $key => $value) {
|
2016-06-13 09:00:11 +02:00
|
|
|
if ($n < $max_values) {
|
|
|
|
$temp[io_safe_output($key)] = $value['value'];
|
|
|
|
$legend[] = io_safe_output($key) .": " . $value['value'] . " " .$value['unit'];
|
|
|
|
}
|
|
|
|
$n++;
|
2016-06-10 11:11:11 +02:00
|
|
|
}
|
|
|
|
$chart_data = $temp;
|
|
|
|
|
|
|
|
$chart_data_trunc = array();
|
|
|
|
$coloretes = array();
|
|
|
|
$n = 1;
|
2016-06-13 09:00:11 +02:00
|
|
|
//~ foreach ($chart_data as $key => $value) {
|
|
|
|
//~ if ($n < $max_values) {
|
2016-06-10 11:11:11 +02:00
|
|
|
|
2016-06-13 09:00:11 +02:00
|
|
|
//~ $chart_data_trunc[$key] = $value;
|
|
|
|
//~ }
|
2016-06-10 11:11:11 +02:00
|
|
|
//~ else {
|
|
|
|
//~ if (!isset($chart_data_trunc[$others_str])) {
|
|
|
|
//~ $chart_data_trunc[$others_str] = 0;
|
|
|
|
//~ }
|
|
|
|
//~ $chart_data_trunc[$others_str] += $value;
|
|
|
|
//~ }
|
2016-06-13 09:00:11 +02:00
|
|
|
//~ $n++;
|
|
|
|
//~ }
|
|
|
|
//~ $chart_data = $chart_data_trunc;
|
2016-06-10 11:11:11 +02:00
|
|
|
|
|
|
|
//TODO SET THE LEGEND POSITION
|
|
|
|
|
|
|
|
$graph = array();
|
|
|
|
$graph['data'] = $chart_data;
|
|
|
|
$graph['width'] = $width;
|
|
|
|
$graph['height'] = $height;
|
|
|
|
$graph['water_mark'] = $water_mark_file;
|
|
|
|
$graph['font'] = $font;
|
|
|
|
$graph['font_size'] = $font_size;
|
|
|
|
$graph['legend_position'] = $legend_position;
|
|
|
|
$graph['legend'] = $legend;
|
|
|
|
|
|
|
|
$id_graph = serialize_in_temp($graph, null, $ttl);
|
|
|
|
|
|
|
|
return "<img src='" . $homedir . "include/graphs/functions_pchart.php?static_graph=1&graph_type=ring3d&ttl=".$ttl."&id_graph=".$id_graph."'>";
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-30 14:34:25 +02:00
|
|
|
?>
|