I need to resize my graph inside my tabs. Can anyone tell me how to do this in angular? When i load the first time my graphs didnt show unless i move the window and resize it.. I need for the first time that it loads the graphs and fill the div for that..
(function() {
var app = angular.module('dashboard.view', []);
app.directive('dygraph', function(){
return {
restrict: 'E',
scope: {
data : '=',
options : '=?'
},
template: '<div style="width: 100%"></div>',
link: function (scope, elem, attrs) {
scope.options.width = elem.parent()[0].offsetWidth;
var graph = new Dygraph(elem.children()[0], scope.data, scope.options);
/*if(scope.options.title=="Scanning" || scope.options.title=="Bytes" || scope.options.title=="Pakets"){
graph.ready(function(){
var width = this.graphDiv.clientWidth;
if(width==0)
width=1129;
graph.resize(width,320);
});
}*/
}
};
});
If i do graph.resize it will appear on laod but if i change my tab the graph width is 0 again... Please help me!