UX console in progress... (Fixed vcharts)

This commit is contained in:
Arturo Gonzalez 2017-01-23 17:55:27 +01:00
parent 265e440a4f
commit c99ff92c86
3 changed files with 25 additions and 13 deletions

View File

@ -168,8 +168,8 @@ function slicesbar_graph($chart_data, $period, $width, $height, $colors,
function vbar_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') {
$unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white',
$from_ux = false) {
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
if (empty($chart_data)) {
@ -179,7 +179,7 @@ function vbar_graph($flash_chart, $chart_data, $width, $height,
if ($flash_chart) {
return flot_vcolumn_chart ($chart_data, $width, $height, $color,
$legend, $long_index, $homeurl, $unit, $water_mark_url,
$homedir,$font,$font_size);
$homedir,$font,$font_size, $from_ux);
}
else {
$graph = array();

View File

@ -546,13 +546,13 @@ function showTooltip(x, y, color, contents) {
}).appendTo("body").fadeIn(200);
}
function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors, water_mark, maxvalue, water_mark, separator, separator2, font, font_size ) {
function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors, water_mark, maxvalue, water_mark, separator, separator2, font, font_size , from_ux) {
values = values.split(separator2);
legend = legend.split(separator);
font = font.split("/").pop().split(".").shift();
labels_long = labels_long.length > 0 ? labels_long.split(separator) : 0;
colors = colors.length > 0 ? colors.split(separator) : [];
var colors_data = colors.length > 0
? colors
: ['#FFA631','#FC4444','#FAD403','#5BB6E5','#F2919D','#80BA27'];
@ -561,15 +561,22 @@ function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors,
for (i = 0; i < values.length; i++) {
var serie = values[i].split(separator);
var aux = new Array();
for (j = 0; j < serie.length; j++) {
var aux2 = parseFloat(serie[j]);
aux.push([aux2, j]);
datas.push( {
data: [[j, aux2]],
color: colors_data[0]
});
if (from_ux) {
datas.push( {
data: [[j, aux2]],
color: colors_data[j]
});
}
else {
datas.push( {
data: [[j, aux2]],
color: colors_data[0]
});
}
};
}

View File

@ -730,7 +730,7 @@ function flot_hcolumn_chart ($graph_data, $width, $height, $water_mark, $font =
}
// Returns a 3D column chart
function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, $water_mark, $homedir, $font, $font_size) {
function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, $water_mark, $homedir, $font, $font_size, $from_ux) {
global $config;
include_javascript_dependencies_flot_graph();
@ -792,7 +792,7 @@ function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $lon
// Store serialized data to use it from javascript
$labels = implode($separator,$labels);
$colors = implode($separator, $colors);
// Store data series in javascript format
$jsvars = '';
$jsseries = array();
@ -812,7 +812,12 @@ function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $lon
// Javascript code
$return .= "<script type='text/javascript'>";
$return .= "pandoraFlotVBars('$graph_id', '$values', '$labels', '$labels', '$legend', '$colors', false, $max, '$water_mark', '$separator', '$separator2','$font',$font_size)";
if ($from_ux) {
$return .= "pandoraFlotVBars('$graph_id', '$values', '$labels', '$labels', '$legend', '$colors', false, $max, '$water_mark', '$separator', '$separator2','$font',$font_size, true)";
}
else {
$return .= "pandoraFlotVBars('$graph_id', '$values', '$labels', '$labels', '$legend', '$colors', false, $max, '$water_mark', '$separator', '$separator2','$font',$font_size, false)";
}
$return .= "</script>";