Fixed the custom colors for the vertical bar graphs. Ticket #3784

This commit is contained in:
Alejandro Gallardo Escobar 2016-06-08 15:48:47 +02:00
parent 1e2946c5c7
commit d91ebbd4a7
2 changed files with 8 additions and 14 deletions

View File

@ -537,9 +537,11 @@ function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors,
values = values.split(separator2);
legend = legend.split(separator);
labels_long = labels_long.split(separator);
//colors = colors.split(separator);
var colors_data = ['#FC4444','#FFA631','#FAD403','#5BB6E5','#F2919D','#80BA27'];
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
: ['#FC4444','#FFA631','#FAD403','#5BB6E5','#F2919D','#80BA27'];
var datas = new Array();
for (i = 0; i < values.length; i++) {

View File

@ -697,17 +697,9 @@ function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $lon
$watermark = 'false';
}
$colors = array();
$index = array_keys(reset($graph_data));
foreach ($index as $serie_key) {
if (isset($color[$serie_key])) {
$colors[] = $color[$serie_key]['color'];
}
else {
$colors[] = '';
}
}
$colors = array_map(function ($elem) {
return $elem['color'] ? $elem['color'] : null;
}, $color);
// Set a weird separator to serialize and unserialize passing data from php to javascript
$separator = ';;::;;';