mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 01:05:39 +02:00
2014-06-13 Sergio Martin <sergio.martin@artica.es>
* godmode/reporting/visual_console_builder.editor.js include/graphs/fgraph.php include/graphs/functions_pchart.php include/graphs/pChart/pImage.class.php include/functions_visual_map.php include/ajax/visual_console_builder.ajax.php include/functions_visual_map_editor.php include/functions_custom_graphs.php include/functions_graph.php: Added option to cusomize the background of the graphs in visual consoles for ticket: #886 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10181 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
b10e018c2a
commit
e2a8e90b2a
@ -1,3 +1,16 @@
|
|||||||
|
2014-06-13 Sergio Martin <sergio.martin@artica.es>
|
||||||
|
|
||||||
|
* godmode/reporting/visual_console_builder.editor.js
|
||||||
|
include/graphs/fgraph.php
|
||||||
|
include/graphs/functions_pchart.php
|
||||||
|
include/graphs/pChart/pImage.class.php
|
||||||
|
include/functions_visual_map.php
|
||||||
|
include/ajax/visual_console_builder.ajax.php
|
||||||
|
include/functions_visual_map_editor.php
|
||||||
|
include/functions_custom_graphs.php
|
||||||
|
include/functions_graph.php: Added option to cusomize the
|
||||||
|
background of the graphs in visual consoles for ticket: #886
|
||||||
|
|
||||||
2014-06-13 Vanessa Gil <vanessa.gil@artica.es>
|
2014-06-13 Vanessa Gil <vanessa.gil@artica.es>
|
||||||
|
|
||||||
* include/languages/ca.mo
|
* include/languages/ca.mo
|
||||||
|
@ -221,6 +221,7 @@ function readFields() {
|
|||||||
values['label'] = text;
|
values['label'] = text;
|
||||||
|
|
||||||
values['image'] = $("select[name=image]").val();
|
values['image'] = $("select[name=image]").val();
|
||||||
|
values['background_color'] = $("select[name=background_color]").val();
|
||||||
values['left'] = $("input[name=left]").val();
|
values['left'] = $("input[name=left]").val();
|
||||||
values['top'] = $("input[name=top]").val();
|
values['top'] = $("input[name=top]").val();
|
||||||
values['agent'] = $("input[name=agent]").val();
|
values['agent'] = $("input[name=agent]").val();
|
||||||
@ -472,7 +473,7 @@ function loadFieldsFromDB(item) {
|
|||||||
var moduleId = 0;
|
var moduleId = 0;
|
||||||
|
|
||||||
fill_parent_select(idItem);
|
fill_parent_select(idItem);
|
||||||
console.log(data);
|
|
||||||
jQuery.each(data, function(key, val) {
|
jQuery.each(data, function(key, val) {
|
||||||
if (key == 'background')
|
if (key == 'background')
|
||||||
$("#background_image").val(val);
|
$("#background_image").val(val);
|
||||||
@ -503,8 +504,10 @@ function loadFieldsFromDB(item) {
|
|||||||
if (key == 'image') {
|
if (key == 'image') {
|
||||||
//Load image preview
|
//Load image preview
|
||||||
$("select[name=image]").val(val);
|
$("select[name=image]").val(val);
|
||||||
|
$("select[name=background_color]").val(val);
|
||||||
showPreview(val);
|
showPreview(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key == 'pos_x') $("input[name=left]").val(val);
|
if (key == 'pos_x') $("input[name=left]").val(val);
|
||||||
if (key == 'pos_y') $("input[name=top]").val(val);
|
if (key == 'pos_y') $("input[name=top]").val(val);
|
||||||
if (key == 'agent_name') {
|
if (key == 'agent_name') {
|
||||||
@ -740,6 +743,9 @@ function hiddenFields(item) {
|
|||||||
$("#module_graph_size_row").css('display', 'none');
|
$("#module_graph_size_row").css('display', 'none');
|
||||||
$("#module_graph_size_row." + item).css('display', '');
|
$("#module_graph_size_row." + item).css('display', '');
|
||||||
|
|
||||||
|
$("#background_color").css('display', 'none');
|
||||||
|
$("#background_color." + item).css('display', '');
|
||||||
|
|
||||||
$("#radio_choice_graph").css('display', 'none');
|
$("#radio_choice_graph").css('display', 'none');
|
||||||
$("#radio_choice_graph." + item).css('display', '');
|
$("#radio_choice_graph." + item).css('display', '');
|
||||||
|
|
||||||
@ -827,6 +833,8 @@ function getModuleGraph(id_data) {
|
|||||||
height = data['height'];
|
height = data['height'];
|
||||||
width = data['width'];
|
width = data['width'];
|
||||||
period = data['period'];
|
period = data['period'];
|
||||||
|
background_color = data['image'];
|
||||||
|
|
||||||
if (metaconsole != 0) {
|
if (metaconsole != 0) {
|
||||||
id_metaconsole = data['id_metaconsole'];
|
id_metaconsole = data['id_metaconsole'];
|
||||||
}
|
}
|
||||||
@ -847,6 +855,7 @@ function getModuleGraph(id_data) {
|
|||||||
parameter.push ({name: "height", value: height});
|
parameter.push ({name: "height", value: height});
|
||||||
parameter.push ({name: "width", value: width});
|
parameter.push ({name: "width", value: width});
|
||||||
parameter.push ({name: "period", value: period});
|
parameter.push ({name: "period", value: period});
|
||||||
|
parameter.push ({name: "background_color", value: background_color});
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
async: false,
|
async: false,
|
||||||
url: url_ajax,
|
url: url_ajax,
|
||||||
|
@ -45,6 +45,7 @@ $id_element = get_parameter('id_element', null);
|
|||||||
|
|
||||||
$image = get_parameter('image', null);
|
$image = get_parameter('image', null);
|
||||||
$background = get_parameter('background', null);
|
$background = get_parameter('background', null);
|
||||||
|
$background_color = get_parameter('background_color', null);
|
||||||
$label = get_parameter('label', '');
|
$label = get_parameter('label', '');
|
||||||
$left = get_parameter('left', null);
|
$left = get_parameter('left', null);
|
||||||
$top = get_parameter('top', null);
|
$top = get_parameter('top', null);
|
||||||
@ -100,12 +101,13 @@ switch ($action) {
|
|||||||
if ($id_custom_graph != 0) {
|
if ($id_custom_graph != 0) {
|
||||||
$img = custom_graphs_print(
|
$img = custom_graphs_print(
|
||||||
$id_custom_graph, $height, $width, $period,
|
$id_custom_graph, $height, $width, $period,
|
||||||
true, true, 0, true);
|
true, true, 0, true, $background_color);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$img = grafico_modulo_sparse($id_agent_module,
|
$img = grafico_modulo_sparse($id_agent_module,
|
||||||
$period, false, $width, $height, '', null, false, 1,
|
$period, false, $width, $height, '', null, false, 1,
|
||||||
false, 0, '', 0, 0, true, true);
|
false, 0, '', 0, 0, true, true, '', 1, false, '',
|
||||||
|
false, false, true, $background_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Restore db connection
|
//Restore db connection
|
||||||
@ -304,6 +306,12 @@ switch ($action) {
|
|||||||
case 'update':
|
case 'update':
|
||||||
case 'move':
|
case 'move':
|
||||||
$values = array();
|
$values = array();
|
||||||
|
|
||||||
|
// In Graphs, background color is stored in column image (sorry)
|
||||||
|
if ($type == 'module_graph') {
|
||||||
|
$values['image'] = $background_color;
|
||||||
|
}
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'background':
|
case 'background':
|
||||||
if ($background !== null)
|
if ($background !== null)
|
||||||
@ -440,6 +448,10 @@ switch ($action) {
|
|||||||
if ($action == 'move') {
|
if ($action == 'move') {
|
||||||
// Don't change the label because only change the positions
|
// Don't change the label because only change the positions
|
||||||
unset($values['label']);
|
unset($values['label']);
|
||||||
|
// Don't change background color in graphs when move
|
||||||
|
if ($type == 'module_graph') {
|
||||||
|
unset($values['image']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = db_process_sql_update('tlayout_data', $values, array('id' => $id_element));
|
$result = db_process_sql_update('tlayout_data', $values, array('id' => $id_element));
|
||||||
|
@ -93,7 +93,8 @@ function custom_graphs_get_user ($id_user = 0, $only_names = false, $returnAllGr
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function custom_graphs_print($id_graph, $height, $width, $period,
|
function custom_graphs_print($id_graph, $height, $width, $period,
|
||||||
$stacked = null, $return = false, $date = 0, $only_image = false) {
|
$stacked = null, $return = false, $date = 0, $only_image = false,
|
||||||
|
$background_color = 'white') {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$graph_conf = db_get_row('tgraph', 'id_graph', $id_graph);
|
$graph_conf = db_get_row('tgraph', 'id_graph', $id_graph);
|
||||||
@ -118,7 +119,8 @@ function custom_graphs_print($id_graph, $height, $width, $period,
|
|||||||
}
|
}
|
||||||
|
|
||||||
$output = graphic_combined_module($modules, $weights, $period,
|
$output = graphic_combined_module($modules, $weights, $period,
|
||||||
$width, $height, '', '', 0, 0, 0, $stacked, $date, $only_image);
|
$width, $height, '', '', 0, 0, 0, $stacked, $date, $only_image,
|
||||||
|
'', 1, false, false, $background_color);
|
||||||
|
|
||||||
if ($return)
|
if ($return)
|
||||||
return $output;
|
return $output;
|
||||||
|
@ -710,7 +710,7 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
|||||||
$date = 0, $unit = '', $baseline = 0, $return_data = 0,
|
$date = 0, $unit = '', $baseline = 0, $return_data = 0,
|
||||||
$show_title = true, $only_image = false, $homeurl = '', $ttl = 1,
|
$show_title = true, $only_image = false, $homeurl = '', $ttl = 1,
|
||||||
$projection = false, $adapt_key = '', $compare = false, $show_unknown = false,
|
$projection = false, $adapt_key = '', $compare = false, $show_unknown = false,
|
||||||
$menu = true) {
|
$menu = true, $backgroundColor = 'white') {
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
global $graphic_type;
|
global $graphic_type;
|
||||||
@ -801,19 +801,22 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
|||||||
return area_graph($flash_chart, $chart, $width, $height/2, $color, $legend,
|
return area_graph($flash_chart, $chart, $width, $height/2, $color, $legend,
|
||||||
$long_index, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl,
|
$long_index, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl,
|
||||||
$water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl,
|
$water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl,
|
||||||
$series_type, $chart_extra_data, $warning_min, $critical_min, $adapt_key, false, $series_suffix_str, $menu).
|
$series_type, $chart_extra_data, $warning_min, $critical_min, $adapt_key, false,
|
||||||
|
$series_suffix_str, $menu, $backgroundColor).
|
||||||
'<br>'.
|
'<br>'.
|
||||||
area_graph($flash_chart, $chart_prev, $width, $height/2, $color_prev, $legend_prev,
|
area_graph($flash_chart, $chart_prev, $width, $height/2, $color_prev, $legend_prev,
|
||||||
$long_index_prev, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl,
|
$long_index_prev, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl,
|
||||||
$water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl,
|
$water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl,
|
||||||
$series_type_prev, $chart_extra_data, $warning_min, $critical_min, $adapt_key, false, $series_suffix_str, $menu);
|
$series_type_prev, $chart_extra_data, $warning_min, $critical_min, $adapt_key, false,
|
||||||
|
$series_suffix_str, $menu, $backgroundColor);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Color commented not to restrict serie colors
|
// Color commented not to restrict serie colors
|
||||||
return area_graph($flash_chart, $chart, $width, $height, $color, $legend,
|
return area_graph($flash_chart, $chart, $width, $height, $color, $legend,
|
||||||
$long_index, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl,
|
$long_index, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl,
|
||||||
$water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl,
|
$water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl,
|
||||||
$series_type, $chart_extra_data, $warning_min, $critical_min, $adapt_key, false, $series_suffix_str, $menu);
|
$series_type, $chart_extra_data, $warning_min, $critical_min, $adapt_key, false,
|
||||||
|
$series_suffix_str, $menu, $backgroundColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -856,7 +859,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
$width, $height, $title, $unit_name, $show_events = 0,
|
$width, $height, $title, $unit_name, $show_events = 0,
|
||||||
$show_alerts = 0, $pure = 0, $stacked = 0, $date = 0,
|
$show_alerts = 0, $pure = 0, $stacked = 0, $date = 0,
|
||||||
$only_image = false, $homeurl = '', $ttl = 1, $projection = false,
|
$only_image = false, $homeurl = '', $ttl = 1, $projection = false,
|
||||||
$prediction_period = false) {
|
$prediction_period = false, $background_color = 'white') {
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
global $graphic_type;
|
global $graphic_type;
|
||||||
@ -1292,7 +1295,8 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
$height, $color, $module_name_list, $long_index,
|
$height, $color, $module_name_list, $long_index,
|
||||||
ui_get_full_url("images/image_problem.opaque.png"), "",
|
ui_get_full_url("images/image_problem.opaque.png"), "",
|
||||||
"", $homeurl, $water_mark, $config['fontpath'],
|
"", $homeurl, $water_mark, $config['fontpath'],
|
||||||
$fixed_font_size, "", $ttl);
|
$fixed_font_size, "", $ttl, array(), array(), 0, 0, '',
|
||||||
|
false, '', true, $background_color);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case CUSTOM_GRAPH_STACKED_AREA:
|
case CUSTOM_GRAPH_STACKED_AREA:
|
||||||
@ -1300,21 +1304,21 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
$width, $height, $color, $module_name_list, $long_index,
|
$width, $height, $color, $module_name_list, $long_index,
|
||||||
ui_get_full_url("images/image_problem.opaque.png"), "",
|
ui_get_full_url("images/image_problem.opaque.png"), "",
|
||||||
"", $water_mark, $config['fontpath'], $fixed_font_size,
|
"", $water_mark, $config['fontpath'], $fixed_font_size,
|
||||||
"", $ttl, $homeurl);
|
"", $ttl, $homeurl, $background_color);
|
||||||
break;
|
break;
|
||||||
case CUSTOM_GRAPH_LINE:
|
case CUSTOM_GRAPH_LINE:
|
||||||
return line_graph($flash_charts, $graph_values, $width,
|
return line_graph($flash_charts, $graph_values, $width,
|
||||||
$height, $color, $module_name_list, $long_index,
|
$height, $color, $module_name_list, $long_index,
|
||||||
ui_get_full_url("images/image_problem.opaque.png"), "",
|
ui_get_full_url("images/image_problem.opaque.png"), "",
|
||||||
"", $water_mark, $config['fontpath'], $fixed_font_size,
|
"", $water_mark, $config['fontpath'], $fixed_font_size,
|
||||||
"", $ttl, $homeurl);
|
"", $ttl, $homeurl, $background_color);
|
||||||
break;
|
break;
|
||||||
case CUSTOM_GRAPH_STACKED_LINE:
|
case CUSTOM_GRAPH_STACKED_LINE:
|
||||||
return stacked_line_graph($flash_charts, $graph_values,
|
return stacked_line_graph($flash_charts, $graph_values,
|
||||||
$width, $height, $color, $module_name_list, $long_index,
|
$width, $height, $color, $module_name_list, $long_index,
|
||||||
ui_get_full_url("images/image_problem.opaque.png"), "",
|
ui_get_full_url("images/image_problem.opaque.png"), "",
|
||||||
"", $water_mark, $config['fontpath'], $fixed_font_size,
|
"", $water_mark, $config['fontpath'], $fixed_font_size,
|
||||||
"", $ttl, $homeurl);
|
"", $ttl, $homeurl, $background_color);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -219,11 +219,12 @@ function visual_map_print_item($layoutData) {
|
|||||||
if ($layoutData['id_custom_graph'] != 0) {
|
if ($layoutData['id_custom_graph'] != 0) {
|
||||||
$img = custom_graphs_print(
|
$img = custom_graphs_print(
|
||||||
$layoutData['id_custom_graph'], $height, $width,
|
$layoutData['id_custom_graph'], $height, $width,
|
||||||
$period, null, true, 0, true);
|
$period, null, true, 0, true, $layoutData['image']);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$img = grafico_modulo_sparse($id_module, $period, 0, $width,
|
$img = grafico_modulo_sparse($id_module, $period, 0, $width,
|
||||||
$height, '', null, false, 1, false, 0, '', 0, 0, true, true);
|
$height, '', null, false, 1, false, 0, '', 0, 0, true, true,
|
||||||
|
'', 1, false, '', false, false, true, $layoutData['image']);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Restore db connection
|
//Restore db connection
|
||||||
@ -1984,13 +1985,14 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
|
|||||||
$layout_data['id_custom_graph'],
|
$layout_data['id_custom_graph'],
|
||||||
$layout_data['height'],
|
$layout_data['height'],
|
||||||
$layout_data['width'],
|
$layout_data['width'],
|
||||||
$layout_data['period'], null, false, 0, true);
|
$layout_data['period'], null, false,
|
||||||
|
0, true, $layout_data['image']);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
echo grafico_modulo_sparse ($layout_data['id_agente_modulo'], $layout_data['period'],
|
echo grafico_modulo_sparse ($layout_data['id_agente_modulo'], $layout_data['period'],
|
||||||
false, $layout_data['width'], $layout_data['height'],
|
false, $layout_data['width'], $layout_data['height'],
|
||||||
'', null, false, 1, false, 0, '', 0, 0, true, true, $home_url, 1);
|
'', null, false, 1, false, 0, '', 0, 0, true, true, $home_url, 1, false, '', false,
|
||||||
|
false, true, $layout_data['image']);
|
||||||
}
|
}
|
||||||
//Restore db connection
|
//Restore db connection
|
||||||
if ($layout_data['id_metaconsole'] != 0) {
|
if ($layout_data['id_metaconsole'] != 0) {
|
||||||
|
@ -128,6 +128,17 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||||||
'<td align="left" colspan="2" style="text-align: right;">' .
|
'<td align="left" colspan="2" style="text-align: right;">' .
|
||||||
'<div id="preview" style="text-align: right;"></div></td>';
|
'<div id="preview" style="text-align: right;"></div></td>';
|
||||||
|
|
||||||
|
$form_items['background_color'] = array();
|
||||||
|
$form_items['background_color']['items'] = array(
|
||||||
|
'module_graph',
|
||||||
|
'datos');
|
||||||
|
$form_items['background_color']['html'] = '<td align="left"><span>' .
|
||||||
|
__('Background color') . '</span></td>
|
||||||
|
<td align="left">'. html_print_select (
|
||||||
|
array ('white' => __('White'),
|
||||||
|
'black' => __('Black'),
|
||||||
|
'transparent' => __('Transparent')),
|
||||||
|
'background_color', '', '', 0, 'white', true, false, false) . '</td>';
|
||||||
|
|
||||||
$form_items['radio_choice_graph'] = array();
|
$form_items['radio_choice_graph'] = array();
|
||||||
$form_items['radio_choice_graph']['items'] = array(
|
$form_items['radio_choice_graph']['items'] = array(
|
||||||
|
@ -200,7 +200,7 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color, $legend,
|
|||||||
$long_index, $no_data_image, $xaxisname = "", $yaxisname = "", $homeurl="",
|
$long_index, $no_data_image, $xaxisname = "", $yaxisname = "", $homeurl="",
|
||||||
$water_mark = "", $font = '', $font_size = '', $unit = '', $ttl = 1, $series_type = array(),
|
$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,
|
$chart_extra_data = array(), $yellow_threshold = 0, $red_threshold = 0, $adapt_key = '', $force_integer = false,
|
||||||
$series_suffix_str = '', $menu = true) {
|
$series_suffix_str = '', $menu = true, $backgroundColor = 'white') {
|
||||||
|
|
||||||
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
||||||
|
|
||||||
@ -250,6 +250,7 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color, $legend,
|
|||||||
$graph['water_mark'] = $water_mark_file;
|
$graph['water_mark'] = $water_mark_file;
|
||||||
$graph['font'] = $font;
|
$graph['font'] = $font;
|
||||||
$graph['font_size'] = $font_size;
|
$graph['font_size'] = $font_size;
|
||||||
|
$graph['backgroundColor'] = $backgroundColor;
|
||||||
|
|
||||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
$id_graph = serialize_in_temp($graph, null, $ttl);
|
||||||
|
|
||||||
@ -260,7 +261,8 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color, $legend,
|
|||||||
|
|
||||||
function stacked_area_graph($flash_chart, $chart_data, $width, $height, $color,
|
function stacked_area_graph($flash_chart, $chart_data, $width, $height, $color,
|
||||||
$legend, $long_index, $no_data_image, $xaxisname = "", $yaxisname = "",
|
$legend, $long_index, $no_data_image, $xaxisname = "", $yaxisname = "",
|
||||||
$water_mark = "", $font = '', $font_size = '', $unit = '', $ttl = 1, $homeurl = '') {
|
$water_mark = "", $font = '', $font_size = '', $unit = '', $ttl = 1, $homeurl = '',
|
||||||
|
$backgroundColor = 'white') {
|
||||||
|
|
||||||
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
||||||
|
|
||||||
@ -286,6 +288,7 @@ function stacked_area_graph($flash_chart, $chart_data, $width, $height, $color,
|
|||||||
$graph['water_mark'] = $water_mark_file;
|
$graph['water_mark'] = $water_mark_file;
|
||||||
$graph['font'] = $font;
|
$graph['font'] = $font;
|
||||||
$graph['font_size'] = $font_size;
|
$graph['font_size'] = $font_size;
|
||||||
|
$graph['backgroundColor'] = $backgroundColor;
|
||||||
|
|
||||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
$id_graph = serialize_in_temp($graph, null, $ttl);
|
||||||
|
|
||||||
@ -295,7 +298,8 @@ function stacked_area_graph($flash_chart, $chart_data, $width, $height, $color,
|
|||||||
|
|
||||||
function stacked_line_graph($flash_chart, $chart_data, $width, $height, $color,
|
function stacked_line_graph($flash_chart, $chart_data, $width, $height, $color,
|
||||||
$legend, $long_index, $no_data_image, $xaxisname = "", $yaxisname = "",
|
$legend, $long_index, $no_data_image, $xaxisname = "", $yaxisname = "",
|
||||||
$water_mark = "", $font = '', $font_size = '', $unit = '', $ttl = 1, $homeurl = '') {
|
$water_mark = "", $font = '', $font_size = '', $unit = '', $ttl = 1, $homeurl = '',
|
||||||
|
$backgroundColor = 'white') {
|
||||||
|
|
||||||
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
||||||
|
|
||||||
@ -322,6 +326,7 @@ function stacked_line_graph($flash_chart, $chart_data, $width, $height, $color,
|
|||||||
$graph['water_mark'] = $water_mark_file;
|
$graph['water_mark'] = $water_mark_file;
|
||||||
$graph['font'] = $font;
|
$graph['font'] = $font;
|
||||||
$graph['font_size'] = $font_size;
|
$graph['font_size'] = $font_size;
|
||||||
|
$graph['backgroundColor'] = $backgroundColor;
|
||||||
|
|
||||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
$id_graph = serialize_in_temp($graph, null, $ttl);
|
||||||
|
|
||||||
@ -331,7 +336,8 @@ function stacked_line_graph($flash_chart, $chart_data, $width, $height, $color,
|
|||||||
|
|
||||||
function line_graph($flash_chart, $chart_data, $width, $height, $color, $legend,
|
function line_graph($flash_chart, $chart_data, $width, $height, $color, $legend,
|
||||||
$long_index, $no_data_image, $xaxisname = "", $yaxisname = "",
|
$long_index, $no_data_image, $xaxisname = "", $yaxisname = "",
|
||||||
$water_mark = "", $font = '', $font_size = '', $unit = '', $ttl = 1, $homeurl = '') {
|
$water_mark = "", $font = '', $font_size = '', $unit = '', $ttl = 1, $homeurl = '',
|
||||||
|
$backgroundColor = 'white') {
|
||||||
|
|
||||||
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
||||||
|
|
||||||
@ -354,6 +360,7 @@ function line_graph($flash_chart, $chart_data, $width, $height, $color, $legend,
|
|||||||
$graph['water_mark'] = $water_mark_file;
|
$graph['water_mark'] = $water_mark_file;
|
||||||
$graph['font'] = $font;
|
$graph['font'] = $font;
|
||||||
$graph['font_size'] = $font_size;
|
$graph['font_size'] = $font_size;
|
||||||
|
$graph['backgroundColor'] = $backgroundColor;
|
||||||
|
|
||||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
$id_graph = serialize_in_temp($graph, null, $ttl);
|
||||||
|
|
||||||
|
@ -96,6 +96,11 @@ if (isset($graph['font_size'])) {
|
|||||||
$font_size = $graph['font_size'];
|
$font_size = $graph['font_size'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (isset($graph['backgroundColor'])) {
|
||||||
|
if (!empty($graph['backgroundColor'])) {
|
||||||
|
$backgroundColor = $graph['backgroundColor'];
|
||||||
|
}
|
||||||
|
}
|
||||||
if (isset($graph['antialiasing'])) {
|
if (isset($graph['antialiasing'])) {
|
||||||
$antialiasing = $graph['antialiasing'];
|
$antialiasing = $graph['antialiasing'];
|
||||||
}
|
}
|
||||||
@ -302,7 +307,7 @@ switch($graph_type) {
|
|||||||
case 'line':
|
case 'line':
|
||||||
pch_vertical_graph($graph_type, $data_keys, $data_values, $width,
|
pch_vertical_graph($graph_type, $data_keys, $data_values, $width,
|
||||||
$height, $rgb_color, $xaxisname, $yaxisname, false, $legend,
|
$height, $rgb_color, $xaxisname, $yaxisname, false, $legend,
|
||||||
$font, $antialiasing, $water_mark, $font_size);
|
$font, $antialiasing, $water_mark, $font_size, $backgroundColor);
|
||||||
break;
|
break;
|
||||||
case 'threshold':
|
case 'threshold':
|
||||||
pch_threshold_graph($graph_type, $data_keys, $data_values, $width,
|
pch_threshold_graph($graph_type, $data_keys, $data_values, $width,
|
||||||
@ -619,7 +624,8 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font,
|
|||||||
|
|
||||||
function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
|
function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
|
||||||
$rgb_color = false, $xaxisname = "", $yaxisname = "", $show_values = false,
|
$rgb_color = false, $xaxisname = "", $yaxisname = "", $show_values = false,
|
||||||
$legend = array(), $font, $antialiasing, $water_mark = '', $font_size) {
|
$legend = array(), $font, $antialiasing, $water_mark = '', $font_size,
|
||||||
|
$backgroundColor = 'white') {
|
||||||
|
|
||||||
/* CAT:Vertical Charts */
|
/* CAT:Vertical Charts */
|
||||||
if (!is_array($legend) || empty($legend)) {
|
if (!is_array($legend) || empty($legend)) {
|
||||||
@ -693,8 +699,23 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
|
|||||||
$MyData->setSerieDescription("Xaxis", $xaxisname);
|
$MyData->setSerieDescription("Xaxis", $xaxisname);
|
||||||
$MyData->setAbscissa("Xaxis");
|
$MyData->setAbscissa("Xaxis");
|
||||||
|
|
||||||
|
switch($backgroundColor) {
|
||||||
|
case 'white':
|
||||||
|
$transparent = false;
|
||||||
|
$fontColor = array('R' => 0, 'G' => 0, 'B' => 0);
|
||||||
|
break;
|
||||||
|
case 'black':
|
||||||
|
$transparent = false;
|
||||||
|
$fontColor = array('R' => 200, 'G' => 200, 'B' => 200);
|
||||||
|
break;
|
||||||
|
case 'transparent':
|
||||||
|
$transparent = true;
|
||||||
|
$fontColor = array('R' => 0, 'G' => 0, 'B' => 0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
/* Create the pChart object */
|
/* Create the pChart object */
|
||||||
$myPicture = new pImage($width,$height,$MyData);
|
$myPicture = new pImage($width,$height,$MyData,$transparent,$backgroundColor,$fontColor);
|
||||||
|
|
||||||
/* Turn of Antialiasing */
|
/* Turn of Antialiasing */
|
||||||
$myPicture->Antialias = $antialiasing;
|
$myPicture->Antialias = $antialiasing;
|
||||||
@ -817,6 +838,15 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
|
|||||||
"XMargin" => 0,
|
"XMargin" => 0,
|
||||||
"MinDivHeight" => 20,
|
"MinDivHeight" => 20,
|
||||||
"TicksFontSize" => $font_size - 1);
|
"TicksFontSize" => $font_size - 1);
|
||||||
|
|
||||||
|
if (true) {
|
||||||
|
$scaleSettings['AxisR'] = '200';
|
||||||
|
$scaleSettings['AxisG'] = '200';
|
||||||
|
$scaleSettings['AxisB'] = '200';
|
||||||
|
$scaleSettings['TickR'] = '200';
|
||||||
|
$scaleSettings['TickG'] = '200';
|
||||||
|
$scaleSettings['TickB'] = '200';
|
||||||
|
}
|
||||||
$myPicture->drawScale($scaleSettings);
|
$myPicture->drawScale($scaleSettings);
|
||||||
|
|
||||||
/* Turn on shadow computing */
|
/* Turn on shadow computing */
|
||||||
|
@ -62,9 +62,12 @@
|
|||||||
var $DataSet = NULL; // Attached dataset
|
var $DataSet = NULL; // Attached dataset
|
||||||
|
|
||||||
/* Class constructor */
|
/* Class constructor */
|
||||||
function pImage($XSize,$YSize,$DataSet=NULL,$TransparentBackground=FALSE)
|
function pImage($XSize,$YSize,$DataSet=NULL,$TransparentBackground=FALSE, $ColorBackground = 'white', $FontColor = array('R' => 0, 'G' => 0, 'B' => 0))
|
||||||
{
|
{
|
||||||
$this->TransparentBackground = $TransparentBackground;
|
$this->TransparentBackground = $TransparentBackground;
|
||||||
|
$this->FontColorR = $FontColor['R'];
|
||||||
|
$this->FontColorG = $FontColor['G'];
|
||||||
|
$this->FontColorB = $FontColor['B'];
|
||||||
|
|
||||||
if ( $DataSet != NULL ) { $this->DataSet = $DataSet; }
|
if ( $DataSet != NULL ) { $this->DataSet = $DataSet; }
|
||||||
|
|
||||||
@ -81,8 +84,16 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$C_White = $this->AllocateColor($this->Picture,255,255,255);
|
switch($ColorBackground) {
|
||||||
imagefilledrectangle($this->Picture,0,0,$XSize,$YSize,$C_White);
|
case 'black':
|
||||||
|
$C = $this->AllocateColor($this->Picture,0,0,0);
|
||||||
|
break;
|
||||||
|
case 'white':
|
||||||
|
default:
|
||||||
|
$C = $this->AllocateColor($this->Picture,255,255,255);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
imagefilledrectangle($this->Picture,0,0,$XSize,$YSize,$C);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user