Fixed the custom colors for the vertical bar graphs. Ticket #3784
This commit is contained in:
parent
1e2946c5c7
commit
d91ebbd4a7
|
@ -537,9 +537,11 @@ function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors,
|
||||||
|
|
||||||
values = values.split(separator2);
|
values = values.split(separator2);
|
||||||
legend = legend.split(separator);
|
legend = legend.split(separator);
|
||||||
labels_long = labels_long.split(separator);
|
labels_long = labels_long.length > 0 ? labels_long.split(separator) : 0;
|
||||||
//colors = colors.split(separator);
|
colors = colors.length > 0 ? colors.split(separator) : [];
|
||||||
var colors_data = ['#FC4444','#FFA631','#FAD403','#5BB6E5','#F2919D','#80BA27'];
|
var colors_data = colors.length > 0
|
||||||
|
? colors
|
||||||
|
: ['#FC4444','#FFA631','#FAD403','#5BB6E5','#F2919D','#80BA27'];
|
||||||
var datas = new Array();
|
var datas = new Array();
|
||||||
|
|
||||||
for (i = 0; i < values.length; i++) {
|
for (i = 0; i < values.length; i++) {
|
||||||
|
|
|
@ -697,17 +697,9 @@ function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $lon
|
||||||
$watermark = 'false';
|
$watermark = 'false';
|
||||||
}
|
}
|
||||||
|
|
||||||
$colors = array();
|
$colors = array_map(function ($elem) {
|
||||||
$index = array_keys(reset($graph_data));
|
return $elem['color'] ? $elem['color'] : null;
|
||||||
|
}, $color);
|
||||||
foreach ($index as $serie_key) {
|
|
||||||
if (isset($color[$serie_key])) {
|
|
||||||
$colors[] = $color[$serie_key]['color'];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$colors[] = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set a weird separator to serialize and unserialize passing data from php to javascript
|
// Set a weird separator to serialize and unserialize passing data from php to javascript
|
||||||
$separator = ';;::;;';
|
$separator = ';;::;;';
|
||||||
|
|
Loading…
Reference in New Issue