/[Frey]/trunk/static/Frey/jQuery/flot/dataset_checkboxes.js
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/static/Frey/jQuery/flot/dataset_checkboxes.js

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 877 by dpavlin, Tue Dec 16 23:03:21 2008 UTC revision 878 by dpavlin, Thu Dec 18 16:02:52 2008 UTC
# Line 26  Line 26 
26                  data.push(datasets[key]);                  data.push(datasets[key]);
27          });          });
28    
29            var placeholder = $('#placeholder');
30            if ( ! placeholder ) alert("can't find #placeholder");
31    
32          if (data.length > 0)          if (data.length > 0)
33              $.plot($("#placeholder"), data, options);              $.plot( placeholder, data, options);
34    
35            placeholder.bind("plotselected", function (event,ranges) {
36                    var from = ranges.xaxis.from.toFixed(1);
37                    var to   = ranges.xaxis.to.toFixed(1);
38    
39                    function DateTimeStr(t) {
40                            var d = new Date( parseInt(t) );
41    
42                            function pad2(n) {
43                                    var s = new String(n);
44                                    if ( s.length == 1 ) {
45                                            return '0' + s;
46                                    } else {
47                                            return s;
48                                    }
49                            }
50    
51                            var str =
52                                    pad2( d.getUTCFullYear() )  + '-' +
53                                    pad2( d.getUTCMonth() + 1 ) + '-' +
54                                    pad2( d.getUTCDay() )       + 'T' +
55                                    pad2( d.getUTCHours() )     + ':' +
56                                    pad2( d.getUTCMinutes() )   + ':' +
57                                    pad2( d.getUTCSeconds() )   ;
58    
59                            return str;
60                    }
61    
62                    $('#selection').text( DateTimeStr( from ) + ' to ' + DateTimeStr( to ) );
63            });
64    
65      }      }
66    
67      plotAccordingToChoices();      plotAccordingToChoices();

Legend:
Removed from v.877  
changed lines
  Added in v.878

  ViewVC Help
Powered by ViewVC 1.1.26