File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " angular-rickshaw" ,
3- "version" : " 0.7 .0" ,
3+ "version" : " 0.8 .0" ,
44 "main" : " rickshaw.js" ,
55 "authors" : [
66 " Nick Ng <ngyewch@gmail.com>"
Original file line number Diff line number Diff line change 2525/* global Rickshaw */
2626
2727angular . module ( 'angular-rickshaw' , [ ] )
28- . directive ( 'rickshaw' , function ( $compile ) {
28+ . directive ( 'rickshaw' , function ( $compile , $window ) {
2929 return {
3030 restrict : 'EA' ,
3131 scope : {
@@ -35,13 +35,14 @@ angular.module('angular-rickshaw', [])
3535 } ,
3636 // replace: true,
3737 link : function ( scope , element , attrs ) {
38+ var mainEl ;
3839 var graphEl ;
3940 var graph ;
4041 var settings ;
4142
4243 function update ( ) {
4344 if ( ! graph ) {
44- var mainEl = angular . element ( element ) ;
45+ mainEl = angular . element ( element ) ;
4546 mainEl . append ( graphEl ) ;
4647 mainEl . empty ( ) ;
4748 graphEl = $compile ( '<div></div>' ) ( scope ) ;
@@ -77,6 +78,7 @@ angular.module('angular-rickshaw', [])
7778 }
7879 }
7980
81+ graph . setSize ( ) ;
8082 graph . render ( ) ;
8183
8284 if ( scope . features && scope . features . xAxis ) {
@@ -157,6 +159,14 @@ angular.module('angular-rickshaw', [])
157159 seriesWatch ( ) ;
158160 featuresWatch ( ) ;
159161 } ) ;
162+
163+ angular . element ( $window ) . on ( 'resize' , function ( ) {
164+ scope . $broadcast ( 'rickshaw::resize' ) ;
165+ } ) ;
166+
167+ scope . $on ( 'rickshaw::resize' , function ( ) {
168+ update ( ) ;
169+ } ) ;
160170
161171 update ( ) ;
162172 } ,
You can’t perform that action at this time.
0 commit comments