Merge branch '1278-extension-vmware-ext-4456-y-4479' into 'develop'

1278 extension vmware ext 4456 y 4479

See merge request artica/pandorafms!1158
This commit is contained in:
vgilc 2017-12-04 16:21:15 +01:00
commit f572603882
3 changed files with 24 additions and 8 deletions

View File

@ -622,7 +622,7 @@ function hbar_graph($flash_chart, $chart_data, $width, $height,
$color, $legend, $long_index, $no_data_image, $xaxisname = "",
$yaxisname = "", $water_mark = "", $font = '', $font_size = '',
$unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white',
$tick_color = "white") {
$tick_color = "white", $val_min=null, $val_max=null) {
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
@ -632,7 +632,7 @@ function hbar_graph($flash_chart, $chart_data, $width, $height,
if ($flash_chart) {
return flot_hcolumn_chart(
$chart_data, $width, $height, $water_mark_url, $font, $font_size, $backgroundColor, $tick_color);
$chart_data, $width, $height, $water_mark_url, $font, $font_size, $backgroundColor, $tick_color, $val_min, $val_max);
}
else {

View File

@ -326,8 +326,7 @@ function pandoraFlotPieCustom(graph_id, values, labels, width,
}
function pandoraFlotHBars(graph_id, values, labels, water_mark,
maxvalue, water_mark, separator, separator2, font, font_size, background_color,
tick_color) {
maxvalue, water_mark, separator, separator2, font, font_size, background_color, tick_color, min, max) {
var colors_data = ['#FC4444','#FFA631','#FAD403','#5BB6E5','#F2919D','#80BA27'];
values = values.split(separator2);
@ -402,7 +401,13 @@ function pandoraFlotHBars(graph_id, values, labels, water_mark,
// with all 0 values.
options['yaxis']['tickDecimals'] = 0;
}
if (max) {
options['xaxis']['max'] = max;
}
if (min) {
options['xaxis']['min'] = min;
}
var plot = $.plot($('#' + graph_id), datas, options );

View File

@ -674,7 +674,7 @@ function flot_custom_pie_chart ($flash_charts, $graph_values,
}
// Returns a 3D column chart
function flot_hcolumn_chart ($graph_data, $width, $height, $water_mark, $font = '', $font_size = 7, $background_color = "white", $tick_color = "white") {
function flot_hcolumn_chart ($graph_data, $width, $height, $water_mark, $font = '', $font_size = 7, $background_color = "white", $tick_color = "white", $val_min=null, $val_max=null) {
global $config;
include_javascript_dependencies_flot_graph();
@ -710,7 +710,8 @@ function flot_hcolumn_chart ($graph_data, $width, $height, $water_mark, $font =
$a = array();
$vars = array();
$max = 0;
$max = PHP_INT_MIN+1;
$min = PHP_INT_MAX-1;
$i = count($graph_data);
$data = array();
@ -727,9 +728,19 @@ function flot_hcolumn_chart ($graph_data, $width, $height, $water_mark, $font =
if ($value > $max) {
$max = $value;
}
if ($value < $min) {
$min = $value;
}
}
}
if (!is_numeric($val_min)) {
$val_min = $min;
}
if (!is_numeric($val_max)) {
$val_max = $max;
}
// Store serialized data to use it from javascript
$labels = implode($separator,$labels);
@ -755,7 +766,7 @@ function flot_hcolumn_chart ($graph_data, $width, $height, $water_mark, $font =
$return .= "<script type='text/javascript'>";
$return .= "pandoraFlotHBars('$graph_id', '$values', '$labels',
false, $max, '$water_mark', '$separator', '$separator2', '$font', $font_size, '$background_color', '$tick_color')";
false, $max, '$water_mark', '$separator', '$separator2', '$font', $font_size, '$background_color', '$tick_color', $val_min, $val_max)";
$return .= "</script>";