fixed errors graph
This commit is contained in:
parent
3910b455ca
commit
815e9c6759
|
@ -506,13 +506,13 @@ function grafico_modulo_sparse_data(
|
||||||
if($show_elements_graph['flag_overlapped']){
|
if($show_elements_graph['flag_overlapped']){
|
||||||
$events_array['data'][$count_events] = array(
|
$events_array['data'][$count_events] = array(
|
||||||
($v['utimestamp'] + $date_array['period'] *1000),
|
($v['utimestamp'] + $date_array['period'] *1000),
|
||||||
$max * 1.2
|
$max * 1.15
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$events_array['data'][$count_events] = array(
|
$events_array['data'][$count_events] = array(
|
||||||
($v['utimestamp']*1000),
|
($v['utimestamp']*1000),
|
||||||
$max * 1.2
|
$max * 1.15
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$count_events++;
|
$count_events++;
|
||||||
|
@ -583,8 +583,6 @@ function grafico_modulo_sparse_data(
|
||||||
$series_type['percentil' . $series_suffix] = 'percentil';
|
$series_type['percentil' . $series_suffix] = 'percentil';
|
||||||
|
|
||||||
$array_events_alerts[$series_suffix] = $events;
|
$array_events_alerts[$series_suffix] = $events;
|
||||||
|
|
||||||
$data_module_graph['series_suffix'] = $series_suffix;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
||||||
|
@ -777,6 +775,9 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
||||||
|
|
||||||
//esto la sparse
|
//esto la sparse
|
||||||
//setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
//setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
||||||
|
|
||||||
|
$data_module_graph['series_suffix'] = $series_suffix;
|
||||||
|
|
||||||
// Check available data
|
// Check available data
|
||||||
if ($show_elements_graph['compare'] === 'separated') {
|
if ($show_elements_graph['compare'] === 'separated') {
|
||||||
if (!empty($array_data)) {
|
if (!empty($array_data)) {
|
||||||
|
|
|
@ -1132,7 +1132,6 @@ function pandoraFlotArea(
|
||||||
background_color, legend_color, short_data,
|
background_color, legend_color, short_data,
|
||||||
events_array
|
events_array
|
||||||
) {
|
) {
|
||||||
console.log(events_array);
|
|
||||||
//diferents vars
|
//diferents vars
|
||||||
var unit = format_graph.unit ? format_graph.unit : '';
|
var unit = format_graph.unit ? format_graph.unit : '';
|
||||||
var homeurl = format_graph.homeurl;
|
var homeurl = format_graph.homeurl;
|
||||||
|
@ -1144,7 +1143,6 @@ function pandoraFlotArea(
|
||||||
var dashboard = show_elements_graph.dashboard;
|
var dashboard = show_elements_graph.dashboard;
|
||||||
var menu = show_elements_graph.menu;
|
var menu = show_elements_graph.menu;
|
||||||
var max_x = date_array['final_date'] *1000;
|
var max_x = date_array['final_date'] *1000;
|
||||||
var s_suffix = data_module_graph['series_suffix'];
|
|
||||||
|
|
||||||
//for threshold
|
//for threshold
|
||||||
var threshold = true;
|
var threshold = true;
|
||||||
|
@ -1193,19 +1191,16 @@ function pandoraFlotArea(
|
||||||
i=0;
|
i=0;
|
||||||
$.each(values, function (index, value) {
|
$.each(values, function (index, value) {
|
||||||
if (typeof value.data !== "undefined") {
|
if (typeof value.data !== "undefined") {
|
||||||
console.log(index);
|
if(index.search("alert") >= 0){
|
||||||
console.log(s_suffix);
|
fill_color = '#ff7f00';
|
||||||
if(index == 'alert' + s_suffix) {
|
|
||||||
console.log('entra');
|
|
||||||
fill_color = '#ffff00';
|
|
||||||
}
|
}
|
||||||
else if(index == 'event' + s_suffix) {
|
else if(index.search("event") >= 0){
|
||||||
console.log('entra2');
|
fill_color = '#ff0000';
|
||||||
fill_color = '#ff66cc';
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
fill_color = '';
|
fill_color = 'green';
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (series_type[index]) {
|
switch (series_type[index]) {
|
||||||
case 'area':
|
case 'area':
|
||||||
line_show = true;
|
line_show = true;
|
||||||
|
@ -1230,7 +1225,7 @@ function pandoraFlotArea(
|
||||||
points_show = true;
|
points_show = true;
|
||||||
filled = false;
|
filled = false;
|
||||||
steps_chart = false;
|
steps_chart = false;
|
||||||
radius = 3;
|
radius = 1.5;
|
||||||
fill_points = fill_color;
|
fill_points = fill_color;
|
||||||
break;
|
break;
|
||||||
case 'unknown':
|
case 'unknown':
|
||||||
|
@ -2143,41 +2138,74 @@ function pandoraFlotArea(
|
||||||
|
|
||||||
$('#' + graph_id).bind("plotclick", function (event, pos, item) {
|
$('#' + graph_id).bind("plotclick", function (event, pos, item) {
|
||||||
plot.unhighlight();
|
plot.unhighlight();
|
||||||
if (item && item.series.label != '' && (item.series.label == legend_events || item.series.label == legend_events+series_suffix_str || item.series.label == legend_alerts || item.series.label == legend_alerts+series_suffix_str)) {
|
if(item && item.series.label != '' &&
|
||||||
|
( (item.series.label.search("alert") >= 0) ||
|
||||||
|
(item.series.label.search("event") >= 0) )
|
||||||
|
){
|
||||||
plot.unhighlight();
|
plot.unhighlight();
|
||||||
var dataset = plot.getData();
|
|
||||||
|
|
||||||
var extra_info = '<i>No info to show</i>';
|
$('#extra_'+graph_id).css('width', '170px');
|
||||||
var extra_show = false;
|
$('#extra_'+graph_id).css('height', '60px');
|
||||||
|
|
||||||
var coord_x = (item.dataIndex/item.series.xaxis.datamax)* (event.target.clientWidth - event.target.offsetLeft + 1) + event.target.offsetLeft;
|
var dataset = plot.getData();
|
||||||
|
var extra_info = '<i>No info to show</i>';
|
||||||
|
var extra_show = false;
|
||||||
|
var extra_height = $('#extra_'+graph_id).height();
|
||||||
|
var extra_width = parseInt($('#extra_'+graph_id)
|
||||||
|
.css('width')
|
||||||
|
.split('px')[0]);
|
||||||
|
var events_data = new Array();
|
||||||
|
var offset_graph = plot.getPlotOffset();
|
||||||
|
var offset_relative = plot.offset();
|
||||||
|
var width_graph = plot.width();
|
||||||
|
var height_legend = $('#legend_' + graph_id).height();
|
||||||
|
var coord_x = pos.pageX - offset_relative.left + offset_graph.left;
|
||||||
|
var coord_y = offset_graph.top + height_legend + extra_height;
|
||||||
|
|
||||||
|
if(coord_x + extra_width > width_graph){
|
||||||
|
coord_x = coord_x - extra_width;
|
||||||
|
}
|
||||||
|
|
||||||
|
var coord_y = offset_graph.top + height_legend + extra_height;
|
||||||
|
|
||||||
$('#extra_'+graph_id).css('left',coord_x);
|
$('#extra_'+graph_id).css('left',coord_x);
|
||||||
$('#extra_'+graph_id).css('top', event.target.offsetTop + 55 );
|
$('#extra_'+graph_id).css('top', coord_y );
|
||||||
|
|
||||||
switch(item.series.label) {
|
if( (item.series.label.search("alert") >= 0) ||
|
||||||
case legend_alerts+series_suffix_str:
|
(item.series.label.search("event") >= 0) ){
|
||||||
case legend_alerts:
|
|
||||||
extra_info = '<b>'+legend_alerts+':<br><span style="font-size:xx-small; font-weight: normal;">From: '+labels_long[item.dataIndex];
|
$.each(events_array, function (i, v) {
|
||||||
if (labels_long[item.dataIndex+1] != undefined) {
|
$.each(v, function (index, value) {
|
||||||
extra_info += '<br>To: '+labels_long[item.dataIndex+1];
|
if((value.utimestamp) == item.datapoint[0]/1000){
|
||||||
}
|
events_data = value;
|
||||||
extra_info += '</span></b>'+get_event_details(alertsz[item.dataIndex]);
|
}
|
||||||
extra_show = true;
|
});
|
||||||
break;
|
});
|
||||||
case legend_events+series_suffix_str:
|
|
||||||
case legend_events:
|
if(events_data.event_type.search("alert") >= 0){
|
||||||
extra_info = '<b>'+legend_events+':<br><span style="font-size:xx-small; font-weight: normal;">From: '+labels_long[item.dataIndex];
|
$extra_color = '#FFA631';
|
||||||
if (labels_long[item.dataIndex+1] != undefined) {
|
}
|
||||||
extra_info += '<br>To: '+labels_long[item.dataIndex+1];
|
else if(events_data.event_type.search("critical") >= 0){
|
||||||
}
|
$extra_color = '#FC4444';
|
||||||
extra_info += '</span></b>'+get_event_details(eventsz[item.dataIndex]);
|
}
|
||||||
extra_show = true;
|
else if(events_data.event_type.search("warning") >= 0){
|
||||||
break;
|
$extra_color = '#FAD403';
|
||||||
default:
|
}
|
||||||
return;
|
else if(events_data.event_type.search("unknown") >= 0){
|
||||||
break;
|
$extra_color = '#3BA0FF';
|
||||||
|
}
|
||||||
|
else if(events_data.event_type.search("normal") >= 0){
|
||||||
|
$extra_color = '#80BA27';
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$extra_color = '#ffffff';
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#extra_'+graph_id).css('background-color',$extra_color);
|
||||||
|
|
||||||
|
extra_info = '<b>'+events_data.evento+':';
|
||||||
|
extra_info += '<br><br><span style="font-weight: normal;">Time: '+events_data.timestamp;
|
||||||
|
extra_show = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extra_show) {
|
if (extra_show) {
|
||||||
|
|
Loading…
Reference in New Issue