Fixed graph event position in modules graph when resizes the window. Ticket#3070

This commit is contained in:
Arturo Gonzalez 2015-12-31 12:01:19 +01:00
parent a5382c2450
commit b5bff5aedc
3 changed files with 13 additions and 8 deletions

View File

@ -4191,7 +4191,7 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events,
* @param string adaptation width and margin left key (could be adapter_[something] or adapted_[something]) * @param string adaptation width and margin left key (could be adapter_[something] or adapted_[something])
* @param int date limit of the period * @param int date limit of the period
*/ */
function graphic_module_events ($id_module, $width, $height, $period = 0, $homeurl = '', $zoom = 0, $adapt_key = '', $date = false) { function graphic_module_events ($id_module, $width, $height, $period = 0, $homeurl = '', $zoom = 0, $adapt_key = '', $date = false, $stat_win = false) {
global $config; global $config;
global $graphic_type; global $graphic_type;
@ -4319,7 +4319,7 @@ function graphic_module_events ($id_module, $width, $height, $period = 0, $homeu
// Draw slicebar graph // Draw slicebar graph
if ($config['flash_charts']) { if ($config['flash_charts']) {
echo flot_slicesbar_graph($data, $period, $width, 15, $legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', $adapt_key); echo flot_slicesbar_graph($data, $period, $width, 15, $legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', $adapt_key, $stat_win);
} }
else { else {
echo slicesbar_graph($data, $period, $width, 15, $colors, $config['fontpath'], $config['round_corner'], $homeurl); echo slicesbar_graph($data, $period, $width, 15, $colors, $config['fontpath'], $config['round_corner'], $homeurl);

View File

@ -742,7 +742,7 @@ function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $lon
return $return; return $return;
} }
function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $colors, $fontpath, $round_corner, $homeurl, $watermark = '', $adapt_key = '') { function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $colors, $fontpath, $round_corner, $homeurl, $watermark = '', $adapt_key = '', $stat_win = false) {
global $config; global $config;
include_javascript_dependencies_flot_graph(); include_javascript_dependencies_flot_graph();
@ -755,7 +755,12 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $
$graph_id = uniqid('graph_'); $graph_id = uniqid('graph_');
// Set some containers to legend, graph, timestamp tooltip, etc. // Set some containers to legend, graph, timestamp tooltip, etc.
$return = "<div id='$graph_id' class='graph $adapt_key' style='width: ".$width."px; height: ".$height."px;'></div>"; if ($stat_win) {
$return = "<div id='$graph_id' class='graph $adapt_key' style='width: ".$width."px; height: ".$height."px; display: inline-block;'></div>";
}
else {
$return = "<div id='$graph_id' class='graph $adapt_key' style='width: ".$width."px; height: ".$height."px;'></div>";
}
$return .= "<div id='value_$graph_id' style='display:none; position:absolute; background:#fff; border: solid 1px #aaa; padding: 2px'></div>"; $return .= "<div id='value_$graph_id' style='display:none; position:absolute; background:#fff; border: solid 1px #aaa; padding: 2px'></div>";
// Set a weird separator to serialize and unserialize passing data from php to javascript // Set a weird separator to serialize and unserialize passing data from php to javascript

View File

@ -201,7 +201,7 @@ $id = get_parameter('id');
if ($show_events_graph) if ($show_events_graph)
echo graphic_module_events($id, $width, $height, echo graphic_module_events($id, $width, $height,
$period, $config['homeurl'], $zoom, $period, $config['homeurl'], $zoom,
'adapted_' . $graph_type, $date); 'adapted_' . $graph_type, $date, true);
break; break;
case 'sparse': case 'sparse':
echo grafico_modulo_sparse ($id, $period, $draw_events, echo grafico_modulo_sparse ($id, $period, $draw_events,
@ -215,7 +215,7 @@ $id = get_parameter('id');
if ($show_events_graph) if ($show_events_graph)
echo graphic_module_events($id, $width, $height, echo graphic_module_events($id, $width, $height,
$period, $config['homeurl'], $zoom, $period, $config['homeurl'], $zoom,
'adapted_' . $graph_type, $date); 'adapted_' . $graph_type, $date, true);
break; break;
case 'string': case 'string':
echo grafico_modulo_string ($id, $period, $draw_events, echo grafico_modulo_string ($id, $period, $draw_events,
@ -226,7 +226,7 @@ $id = get_parameter('id');
if ($show_events_graph) if ($show_events_graph)
echo graphic_module_events($id, $width, $height, echo graphic_module_events($id, $width, $height,
$period, $config['homeurl'], $zoom, $period, $config['homeurl'], $zoom,
'adapted_' . $graph_type, $date); 'adapted_' . $graph_type, $date, true);
break; break;
case 'log4x': case 'log4x':
echo grafico_modulo_log4x ($id, $period, $draw_events, echo grafico_modulo_log4x ($id, $period, $draw_events,
@ -235,7 +235,7 @@ $id = get_parameter('id');
echo '<br>'; echo '<br>';
if ($show_events_graph) if ($show_events_graph)
echo graphic_module_events($id, $width, $height, echo graphic_module_events($id, $width, $height,
$period, $config['homeurl'], $zoom, '', $date); $period, $config['homeurl'], $zoom, '', $date, true);
break; break;
default: default:
echo fs_error_image ('../images'); echo fs_error_image ('../images');