Added background color to bars charts
This commit is contained in:
parent
5fa51ceb6b
commit
1f20247ae3
|
@ -188,7 +188,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, $from_ux, $from_wux);
|
||||
$homedir,$font,$font_size, $from_ux, $from_wux, $backgroundColor);
|
||||
}
|
||||
else {
|
||||
$graph = array();
|
||||
|
@ -636,7 +636,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);
|
||||
$chart_data, $width, $height, $water_mark_url, $font, $font_size, $backgroundColor);
|
||||
}
|
||||
else {
|
||||
$graph = array();
|
||||
|
|
|
@ -309,7 +309,7 @@ function pandoraFlotPieCustom(graph_id, values, labels, width,
|
|||
}
|
||||
|
||||
function pandoraFlotHBars(graph_id, values, labels, water_mark,
|
||||
maxvalue, water_mark, separator, separator2, font, font_size) {
|
||||
maxvalue, water_mark, separator, separator2, font, font_size, background_color) {
|
||||
|
||||
var colors_data = ['#FC4444','#FFA631','#FAD403','#5BB6E5','#F2919D','#80BA27'];
|
||||
values = values.split(separator2);
|
||||
|
@ -355,7 +355,7 @@ function pandoraFlotHBars(graph_id, values, labels, water_mark,
|
|||
grid: {
|
||||
hoverable: true,
|
||||
borderWidth: 1,
|
||||
backgroundColor: { colors: ["#FFF", "#FFF"] }
|
||||
backgroundColor: { colors: [background_color, background_color] }
|
||||
},
|
||||
xaxis: {
|
||||
axisLabelUseCanvas: true,
|
||||
|
@ -494,7 +494,7 @@ 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 , from_ux, from_wux) {
|
||||
function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors, water_mark, maxvalue, water_mark, separator, separator2, font, font_size , from_ux, from_wux, background_color) {
|
||||
values = values.split(separator2);
|
||||
legend = legend.split(separator);
|
||||
font = font.split("/").pop().split(".").shift();
|
||||
|
@ -585,7 +585,7 @@ function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors,
|
|||
grid: {
|
||||
hoverable: true,
|
||||
borderWidth: 1,
|
||||
backgroundColor: { colors: ["#FFF", "#FFF"] }
|
||||
backgroundColor: { colors: [background_color, background_color] }
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -608,16 +608,7 @@ function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors,
|
|||
$('#' + graph_id).VUseTooltip();
|
||||
$('#' + graph_id).css("margin-left","auto");
|
||||
$('#' + graph_id).css("margin-right","auto");
|
||||
//~ $('#' + graph_id).find('div.legend-tooltip').tooltip({ track: true });
|
||||
/*
|
||||
$('#'+graph_id+' .xAxis .tickLabel')
|
||||
.css('transform', 'rotate(-45deg)')
|
||||
.css('max-width','100px')
|
||||
.find('div')
|
||||
.css('position', 'relative')
|
||||
.css('top', '+10px')
|
||||
.css('left', '-30px');
|
||||
*/
|
||||
|
||||
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent))
|
||||
$('#'+graph_id+' .xAxis .tickLabel')
|
||||
.find('div')
|
||||
|
|
|
@ -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) {
|
||||
function flot_hcolumn_chart ($graph_data, $width, $height, $water_mark, $font = '', $font_size = 7, $background_color = "white") {
|
||||
global $config;
|
||||
|
||||
include_javascript_dependencies_flot_graph();
|
||||
|
@ -755,7 +755,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)";
|
||||
false, $max, '$water_mark', '$separator', '$separator2', '$font', $font_size, '$background_color')";
|
||||
|
||||
$return .= "</script>";
|
||||
|
||||
|
@ -763,7 +763,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, $from_ux, $from_wux) {
|
||||
function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, $water_mark, $homedir, $font, $font_size, $from_ux, $from_wux, $background_color = 'white') {
|
||||
global $config;
|
||||
|
||||
include_javascript_dependencies_flot_graph();
|
||||
|
@ -847,14 +847,14 @@ function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $lon
|
|||
|
||||
if ($from_ux) {
|
||||
if($from_wux){
|
||||
$return .= "pandoraFlotVBars('$graph_id', '$values', '$labels', '$labels', '$legend', '$colors', false, $max, '$water_mark', '$separator', '$separator2','$font',$font_size, true, true)";
|
||||
$return .= "pandoraFlotVBars('$graph_id', '$values', '$labels', '$labels', '$legend', '$colors', false, $max, '$water_mark', '$separator', '$separator2','$font',$font_size, true, true, '$background_color')";
|
||||
}
|
||||
else{
|
||||
$return .= "pandoraFlotVBars('$graph_id', '$values', '$labels', '$labels', '$legend', '$colors', false, $max, '$water_mark', '$separator', '$separator2','$font',$font_size, true, false)";
|
||||
$return .= "pandoraFlotVBars('$graph_id', '$values', '$labels', '$labels', '$legend', '$colors', false, $max, '$water_mark', '$separator', '$separator2','$font',$font_size, true, false, '$background_color')";
|
||||
}
|
||||
}
|
||||
else {
|
||||
$return .= "pandoraFlotVBars('$graph_id', '$values', '$labels', '$labels', '$legend', '$colors', false, $max, '$water_mark', '$separator', '$separator2','$font',$font_size, false, false)";
|
||||
$return .= "pandoraFlotVBars('$graph_id', '$values', '$labels', '$labels', '$legend', '$colors', false, $max, '$water_mark', '$separator', '$separator2','$font',$font_size, false, false, '$background_color')";
|
||||
}
|
||||
|
||||
$return .= "</script>";
|
||||
|
|
Loading…
Reference in New Issue