File tree Expand file tree Collapse file tree 2 files changed +20
-16
lines changed Expand file tree Collapse file tree 2 files changed +20
-16
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,7 @@ Changes:
81
81
types (sponsored by Utility Data Corporation).
82
82
- Resize plugin for automatically redrawing when the placeholder
83
83
changes size, e.g. on window resizes (sponsored by Novus Partners).
84
+ A resize() method has been added to plot object facilitate this.
84
85
- Support Infinity/-Infinity for plotting asymptotes by hacking it
85
86
into +/-Number.MAX_VALUE (reported by rabaea.mircea).
86
87
- Support for restricting navigate plugin to not pan/zoom an axis (based
Original file line number Diff line number Diff line change @@ -23,29 +23,32 @@ plots, you can just fix the size of their placeholders.
23
23
24
24
25
25
( function ( $ ) {
26
- var redrawing = 0 ;
27
26
var options = { } ; // no options
28
27
29
28
function init ( plot ) {
29
+ function onResize ( ) {
30
+ var placeholder = plot . getPlaceholder ( ) ;
31
+
32
+ // somebody might have hidden us and we can't plot
33
+ // when we don't have the dimensions
34
+ if ( placeholder . width ( ) == 0 || placeholder . height ( ) == 0 )
35
+ return ;
36
+
37
+ plot . resize ( ) ;
38
+ plot . setupGrid ( ) ;
39
+ plot . draw ( ) ;
40
+ }
41
+
30
42
function bindEvents ( plot , eventHolder ) {
31
- if ( ! redrawing )
32
- plot . getPlaceholder ( ) . resize ( onResize ) ;
33
-
34
- function onResize ( ) {
35
- var placeholder = plot . getPlaceholder ( ) ;
36
-
37
- // somebody might have hidden us and we can't plot
38
- // when we don't have the dimensions
39
- if ( placeholder . width ( ) == 0 || placeholder . height ( ) == 0 )
40
- return ;
41
-
42
- ++ redrawing ;
43
- $ . plot ( placeholder , plot . getData ( ) , plot . getOptions ( ) ) ;
44
- -- redrawing ;
45
- }
43
+ plot . getPlaceholder ( ) . resize ( onResize ) ;
44
+ }
45
+
46
+ function shutdown ( plot , eventHolder ) {
47
+ plot . getPlaceholder ( ) . unbind ( "resize" , onResize ) ;
46
48
}
47
49
48
50
plot . hooks . bindEvents . push ( bindEvents ) ;
51
+ plot . hooks . shutdown . push ( shutdown ) ;
49
52
}
50
53
51
54
$ . plot . plugins . push ( {
You can’t perform that action at this time.
0 commit comments