Added resize functionality to flot graphs and fix overview in container graphs

This commit is contained in:
fermin831 2017-11-14 18:44:29 +01:00
parent 6a71b9a359
commit 78ef64ead2
2 changed files with 13 additions and 1 deletions

View File

@ -102,7 +102,7 @@ echo "</div>";
}
$('div[class *= bullet]').css('margin-left','0');
$('div[class *= graph]').css('margin-left','0');
$('div[class = graph]').css('margin-left','0');
$('div[id *= gauge_]').css('width','100%');
$('select[id *= period_container_'+hash+']').change(function() {

View File

@ -1601,6 +1601,12 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
// Adjust the overview plot to the width and position of the main plot
adjust_left_width_canvas(graph_id, 'overview_'+graph_id);
update_left_width_canvas(graph_id);
// Adjust overview when main chart is resized
$('#'+graph_id).resize(function(){
update_left_width_canvas(graph_id);
});
// Adjust linked graph to the width and position of the main plot
@ -2139,6 +2145,12 @@ function adjust_left_width_canvas(adapter_id, adapted_id) {
$('#'+adapted_id).css('margin-left', adapter_left_margin);
}
function update_left_width_canvas(graph_id) {
$('#overview_'+graph_id).width($('#'+graph_id).width() - 30);
$('#overview_'+graph_id).css('margin-left', $('#'+graph_id+' .yAxis .tickLabel').width());
}
function check_adaptions(graph_id) {
var classes = $('#'+graph_id).attr('class').split(' ');