Now the boolean charts is showed as digital signal charts (only with dinamic flot charts engine)

This commit is contained in:
mdtrooper 2015-08-25 13:00:46 +02:00
parent 89d2ddd2dd
commit 3d014c6ab5
4 changed files with 35 additions and 21 deletions

View File

@ -3102,6 +3102,8 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
$series_type['unknown'.$series_suffix] = 'area';
}
$series_type['sum' . $series_suffix] = 'boolean';
//Boolean graph doesn't have min!!!
/*if (!$avg_only) {
$chart[$timestamp]['min'.$series_suffix] = 0;
@ -3231,11 +3233,11 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
$series_suffix_str = '';
if ($compare !== false) {
$series_suffix = '2';
$series_suffix_str = ' ('.__('Previous').')';
$series_suffix_str = ' (' . __('Previous') . ')';
// Build the data of the previous period
grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
$unit_name, $show_alerts, $avg_only, $date-$period, $series_suffix,
$series_suffix_str, $show_unknown);
$unit_name, $show_alerts, $avg_only, $date-$period, $series_suffix,
$series_suffix_str, $show_unknown);
switch ($compare) {
case 'separated':
// Store the chart calculated
@ -3254,18 +3256,19 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
$series_type_prev = $series_type;
$color_prev = $color;
foreach ($color_prev as $k => $col) {
$color_prev[$k]['color'] = '#'.get_complementary_rgb($color_prev[$k]['color']);
$color_prev[$k]['color'] = '#' . get_complementary_rgb($color_prev[$k]['color']);
}
break;
}
}
grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
$unit_name, $show_alerts, $avg_only, $date, '', '', $show_unknown);
$unit_name, $show_alerts, $avg_only, $date, '', '', $show_unknown);
if ($compare === 'overlapped') {
$i = 0;
foreach ($chart as $k=>$v) {
$chart[$k] = array_merge($v,$chart_prev[$i]);
foreach($chart as $k => $v) {
$chart[$k] = array_merge($v, $chart_prev[$i]);
$i++;
}
@ -3277,8 +3280,10 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
$flash_chart = false;
}
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => ui_get_full_url("/images/logo_vertical_water.png", false, false, false));
$water_mark = array(
'file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => ui_get_full_url("/images/logo_vertical_water.png",
false, false, false));
if ($compare === 'separated') {
return area_graph($flash_chart, $chart, $width, $height/2, $color, $legend,

View File

@ -568,7 +568,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
alertsz[alert_ids[i]] = v;
});
switch(type) {
switch (type) {
case 'line_simple':
stacked = null;
filled = false;
@ -606,15 +606,22 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
}
});
switch(serie_types[i]) {
switch (serie_types[i]) {
case 'line':
default:
line_show = true;
points_show = false;
steps_chart = false
break;
case 'points':
line_show = false;
points_show = true;
steps_chart = false
break;
case 'boolean':
line_show = true;
points_show = false;
steps_chart = true;
break;
}
@ -645,15 +652,15 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
//~ { color: criticalw, yaxis: { from: vcritical_min } },
//~ { color: criticalw, yaxis: { to: -1 } }
//~ ];
lineWidht = $('#hidden-lineWidhtGraph');
if (typeof(lineWidht[0])=='undefined'){
if (typeof(lineWidht[0])=='undefined') {
WidhtLine = 1;
}
else{
else {
WidhtLine = lineWidht[0].value;
}
// Data
data_base.push({
id: 'serie_' + i,
@ -661,13 +668,15 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
label: legend[i],
color: serie_color,
//threshold: [{ below: 80, color: "rgb(200, 20, 30)" } , { below: 65, color: "rgb(30, 200, 30)" }, { below: 50, color: "rgb(30, 200, 30)" }],
lines: { show: line_show,
lines: {
show: line_show,
fill: filled,
fillColor: {
colors: [ { opacity: 0.9 }, { opacity: 0.9 } ]
},
lineWidth: WidhtLine,
steps: false },
steps: steps_chart
},
points: { show: points_show }
});

View File

@ -187,7 +187,7 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
// Parent layer
$return = "<div class='parent_graph' style='width: " . $width . "px; " . $background_style . "'>";
// Set some containers to legend, graph, timestamp tooltip, etc.
$return .= "<p id='legend_$graph_id' class='legend_graph' style='font-size:".$font_size."pt'></p>";
$return .= "<p id='legend_$graph_id' class='legend_graph' style='font-size:" . $font_size . "pt'></p>";
$return .= "<div id='timestamp_$graph_id' class='timestamp_graph' style='font-size:".$font_size."pt;display:none; position:absolute; background:#fff; border: solid 1px #aaa; padding: 2px; z-index:1000;'></div>";
$return .= "<div id='$graph_id' class='graph $adapt_key' style='width: ".$width."px; height: ".$height."px;'></div>";
if ($menu) {
@ -229,7 +229,7 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
}
}
foreach($chart_data as $label => $values) {
foreach ($chart_data as $label => $values) {
$labels[] = io_safe_output($label);
foreach($values as $key => $value) {
@ -308,7 +308,7 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
}
$extra_width = (int)($width / 3);
$return .= "<div id='extra_$graph_id' style='font-size: ".$font_size."pt; display:none; position:absolute; overflow: auto; max-height: ".($height+50)."px; width: ".$extra_width."px; background:#fff; padding: 2px 2px 2px 2px; border: solid #000 1px;'></div>";
$return .= "<div id='extra_$graph_id' style='font-size: " . $font_size . "pt; display:none; position:absolute; overflow: auto; max-height: ".($height+50)."px; width: ".$extra_width."px; background:#fff; padding: 2px 2px 2px 2px; border: solid #000 1px;'></div>";
// Process extra data
$events = array();

View File

@ -701,7 +701,7 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
$MyData->setSerieDescription("Xaxis", $xaxisname);
$MyData->setAbscissa("Xaxis");
$MyData->setAxisDisplay(0, AXIS_FORMAT_METRIC);
switch($backgroundColor) {
case 'white':
$transparent = false;