From 97615ce9fd4123ea781707ca3262fb46bf687f7a Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Thu, 26 May 2016 09:50:13 +0200 Subject: [PATCH] Now some graphs has auto margin (left and right) to center it to its container --- pandora_console/include/graphs/flot/pandora.flot.js | 11 ++++++++--- pandora_console/include/graphs/functions_d3.php | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js index 4e258c2040..6ef1c6d549 100644 --- a/pandora_console/include/graphs/flot/pandora.flot.js +++ b/pandora_console/include/graphs/flot/pandora.flot.js @@ -102,6 +102,8 @@ function pandoraFlotPie(graph_id, values, labels, nseries, width, font_size, wat $('#' + graph_id).bind('plothover', pieHover); $('#' + graph_id).bind('plotclick', pieClick); $('#' + graph_id).bind('mouseout',resetInteractivity); + $('#' + graph_id).css('margin-left', 'auto'); + $('#' + graph_id).css('margin-right', 'auto'); function pieHover(event, pos, obj) { @@ -224,6 +226,8 @@ function pandoraFlotPieCustom(graph_id, values, labels, width, $('#' + graph_id).bind('plothover', pieHover); $('#' + graph_id).bind('plotclick', Clickpie); $('#' + graph_id).bind('mouseout',resetInteractivity); + $('#' + graph_id).css('margin-left', 'auto'); + $('#' + graph_id).css('margin-right', 'auto'); function pieHover(event, pos, obj) { @@ -347,7 +351,8 @@ function pandoraFlotHBars(graph_id, values, labels, water_mark, var plot = $.plot($('#' + graph_id), datas, options ); $('#' + graph_id).HUseTooltip(); - $('#' + graph_id).css("margin-left","35px"); + $('#' + graph_id).css("margin-left","auto"); + $('#' + graph_id).css("margin-right","auto"); // Adjust the top of yaxis tick to set it in the middle of the bars //yAxisHeight = $('#' + graph_id + ' .yAxis .tickLabel') //.css('height').split('px')[0]; @@ -620,8 +625,8 @@ function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors, var plot = $.plot($('#'+graph_id),datas, options ); $('#' + graph_id).VUseTooltip(); - $('#' + graph_id).css("margin-left","25px"); - $('#' + graph_id).css("margin-right","20px"); + $('#' + graph_id).css("margin-left","auto"); + $('#' + graph_id).css("margin-right","auto"); // Adjust the top of yaxis tick to set it in the middle of the bars //yAxisHeight = $('#'+graph_id+' .yAxis .tickLabel').css('height').split('px')[0]; diff --git a/pandora_console/include/graphs/functions_d3.php b/pandora_console/include/graphs/functions_d3.php index 6e135c1492..20cc615490 100644 --- a/pandora_console/include/graphs/functions_d3.php +++ b/pandora_console/include/graphs/functions_d3.php @@ -152,7 +152,7 @@ function d3_bullet_chart($chart_data, $width, $height, $color, $legend, $id_bullet = uniqid(); $output .= - '
+ '