mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
fixed errors in graphs
This commit is contained in:
parent
d2390528ac
commit
51f22413a8
@ -359,6 +359,7 @@ function grafico_modulo_sparse_data(
|
||||
global $color;
|
||||
global $legend;
|
||||
global $series_type;
|
||||
global $array_events_alerts;
|
||||
|
||||
if($show_elements_graph['fullscale']){
|
||||
$array_data = fullscale_data(
|
||||
@ -483,25 +484,39 @@ function grafico_modulo_sparse_data(
|
||||
$events_array = array();
|
||||
|
||||
if($events && is_array($events)){
|
||||
$i=0;
|
||||
$count_events=0;
|
||||
$count_alerts=0;
|
||||
foreach ($events as $k => $v) {
|
||||
if (strpos($v["event_type"], "alert") !== false){
|
||||
if($show_elements_graph['flag_overlapped']){
|
||||
$alerts_array['data'][$i] = array( ($v['utimestamp'] + $date_array['period'] *1000) , $max * 1.10);
|
||||
$alerts_array['data'][$count_alerts] = array(
|
||||
($v['utimestamp'] + $date_array['period'] *1000),
|
||||
$max * 1.10
|
||||
);
|
||||
}
|
||||
else{
|
||||
$alerts_array['data'][$i] = array( ($v['utimestamp']*1000) , $max * 1.10);
|
||||
$alerts_array['data'][$count_alerts] = array(
|
||||
($v['utimestamp']*1000),
|
||||
$max * 1.10
|
||||
);
|
||||
}
|
||||
$count_alerts++;
|
||||
}
|
||||
else{
|
||||
if($show_elements_graph['flag_overlapped']){
|
||||
$events_array['data'][$i] = array( ($v['utimestamp'] + $date_array['period'] *1000) , $max * 1.2);
|
||||
$events_array['data'][$count_events] = array(
|
||||
($v['utimestamp'] + $date_array['period'] *1000),
|
||||
$max * 1.2
|
||||
);
|
||||
}
|
||||
else{
|
||||
$events_array['data'][$i] = array( ($v['utimestamp']*1000) , $max * 1.2);
|
||||
$events_array['data'][$count_events] = array(
|
||||
($v['utimestamp']*1000),
|
||||
$max * 1.2
|
||||
);
|
||||
}
|
||||
$count_events++;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -532,9 +547,10 @@ function grafico_modulo_sparse_data(
|
||||
$caption = array();
|
||||
}
|
||||
|
||||
//XXX
|
||||
//$graph_stats = get_statwin_graph_statistics($chart, $series_suffix);
|
||||
$color = color_graph_array($series_suffix, $show_elements_graph['flag_overlapped']);
|
||||
$color = color_graph_array(
|
||||
$series_suffix,
|
||||
$show_elements_graph['flag_overlapped']
|
||||
);
|
||||
|
||||
foreach ($color as $k => $v) {
|
||||
if(is_array($array_data[$k])){
|
||||
@ -565,6 +581,8 @@ function grafico_modulo_sparse_data(
|
||||
break;
|
||||
}
|
||||
$series_type['percentil' . $series_suffix] = 'percentil';
|
||||
|
||||
$array_events_alerts[$series_suffix] = $events;
|
||||
}
|
||||
|
||||
function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
||||
@ -585,12 +603,15 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
||||
global $color;
|
||||
global $legend;
|
||||
global $series_type;
|
||||
global $array_events_alerts;
|
||||
|
||||
$array_data = array();
|
||||
$caption = array();
|
||||
$color = array();
|
||||
$legend = array();
|
||||
$series_type = array();
|
||||
$array_data = array();
|
||||
$caption = array();
|
||||
$color = array();
|
||||
$legend = array();
|
||||
$series_type = array();
|
||||
|
||||
$array_events_alerts = array();
|
||||
|
||||
//date start final period
|
||||
if($date == 0){
|
||||
@ -751,6 +772,7 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
||||
false
|
||||
)
|
||||
);
|
||||
|
||||
//esto la sparse
|
||||
//setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
||||
// Check available data
|
||||
@ -767,7 +789,8 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
||||
$show_elements_graph,
|
||||
$format_graph,
|
||||
$water_mark,
|
||||
$series_suffix_str
|
||||
$series_suffix_str,
|
||||
$array_events_alerts
|
||||
);
|
||||
}
|
||||
else{
|
||||
@ -786,7 +809,8 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
||||
$show_elements_graph,
|
||||
$format_graph,
|
||||
$water_mark,
|
||||
$series_suffix_str
|
||||
$series_suffix_str,
|
||||
$array_events_alerts
|
||||
);
|
||||
}
|
||||
else{
|
||||
@ -806,7 +830,8 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
||||
$show_elements_graph,
|
||||
$format_graph,
|
||||
$water_mark,
|
||||
$series_suffix_str
|
||||
$series_suffix_str,
|
||||
$array_events_alerts
|
||||
);
|
||||
}
|
||||
else{
|
||||
|
@ -206,7 +206,8 @@ function area_graph(
|
||||
$agent_module_id, $array_data, $color,
|
||||
$legend, $series_type, $date_array,
|
||||
$data_module_graph, $show_elements_graph,
|
||||
$format_graph, $water_mark, $series_suffix_str
|
||||
$format_graph, $water_mark, $series_suffix_str,
|
||||
$array_events_alerts
|
||||
) {
|
||||
global $config;
|
||||
|
||||
@ -224,7 +225,8 @@ function area_graph(
|
||||
$show_elements_graph,
|
||||
$format_graph,
|
||||
$water_mark,
|
||||
$series_suffix_str
|
||||
$series_suffix_str,
|
||||
$array_events_alerts
|
||||
);
|
||||
}
|
||||
else {
|
||||
|
@ -1129,8 +1129,10 @@ function pandoraFlotArea(
|
||||
series_type, watermark, date_array,
|
||||
data_module_graph, show_elements_graph,
|
||||
format_graph, force_integer, series_suffix_str,
|
||||
background_color, legend_color, short_data
|
||||
background_color, legend_color, short_data,
|
||||
events_array
|
||||
) {
|
||||
console.log(events_array);
|
||||
//diferents vars
|
||||
var unit = format_graph.unit ? format_graph.unit : '';
|
||||
var homeurl = format_graph.homeurl;
|
||||
@ -1190,12 +1192,20 @@ function pandoraFlotArea(
|
||||
i=0;
|
||||
$.each(values, function (index, value) {
|
||||
if (typeof value.data !== "undefined") {
|
||||
if(index == 'alert') {
|
||||
fill_color = '#ffff00';
|
||||
}
|
||||
else if(index == 'events') {
|
||||
fill_color = '#ff66cc';
|
||||
}
|
||||
switch (series_type[index]) {
|
||||
case 'area':
|
||||
line_show = true;
|
||||
points_show = false; // XXX - false
|
||||
filled = 0.2;
|
||||
steps_chart = false;
|
||||
radius = false;
|
||||
fill_points = '';
|
||||
break;
|
||||
case 'percentil':
|
||||
case 'line':
|
||||
@ -1204,12 +1214,16 @@ function pandoraFlotArea(
|
||||
points_show = false;
|
||||
filled = false;
|
||||
steps_chart = false;
|
||||
radius = false;
|
||||
fill_points = '';
|
||||
break;
|
||||
case 'points':
|
||||
line_show = false;
|
||||
points_show = true;
|
||||
filled = false;
|
||||
steps_chart = false
|
||||
steps_chart = false;
|
||||
radius = 3;
|
||||
fill_points = fill_color;
|
||||
break;
|
||||
case 'unknown':
|
||||
case 'boolean':
|
||||
@ -1217,6 +1231,8 @@ function pandoraFlotArea(
|
||||
points_show = false;
|
||||
filled = true;
|
||||
steps_chart = true;
|
||||
radius = false;
|
||||
fill_points = '';
|
||||
break;
|
||||
}
|
||||
data_base.push({
|
||||
@ -1230,7 +1246,11 @@ function pandoraFlotArea(
|
||||
lineWidth: lineWidth,
|
||||
steps: steps_chart
|
||||
},
|
||||
points: { show: points_show }
|
||||
points: {
|
||||
show: points_show,
|
||||
radius: radius,
|
||||
fillColor: fill_points
|
||||
}
|
||||
});
|
||||
i++;
|
||||
}
|
||||
|
@ -180,7 +180,8 @@ function flot_area_graph (
|
||||
$agent_module_id, $array_data, $color,
|
||||
$legend, $series_type, $date_array,
|
||||
$data_module_graph, $show_elements_graph,
|
||||
$format_graph, $water_mark, $series_suffix_str ) {
|
||||
$format_graph, $water_mark, $series_suffix_str,
|
||||
$array_events_alerts ) {
|
||||
|
||||
global $config;
|
||||
|
||||
@ -326,6 +327,7 @@ function flot_area_graph (
|
||||
$data_module_graph = json_encode($data_module_graph);
|
||||
$show_elements_graph = json_encode($show_elements_graph);
|
||||
$format_graph = json_encode($format_graph);
|
||||
$array_events_alerts = json_encode($array_events_alerts);
|
||||
|
||||
// Javascript code
|
||||
$return .= "<script type='text/javascript'>";
|
||||
@ -345,8 +347,9 @@ function flot_area_graph (
|
||||
"'$series_suffix_str', \n" .
|
||||
"'$background_color', \n" .
|
||||
"'$legend_color', \n" .
|
||||
"'$short_data'
|
||||
);";
|
||||
"'$short_data', \n" .
|
||||
"JSON.parse('$array_events_alerts')".
|
||||
");";
|
||||
$return .= "});";
|
||||
$return .= "</script>";
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user