48
48
</ div >
49
49
</ div >
50
50
</ div >
51
-
51
+ < script type =" text/javascript " src =" https://www.gstatic.com/charts/loader.js " > </ script >
52
52
< script type ="text/javascript ">
53
53
54
- google . load ( "visualization" , "1" , {
55
- packages : [ "corechart" ]
56
- } ) ;
54
+ google . charts . load ( 'current' , { 'packages' :[ 'corechart' ] } ) ;
55
+ google . charts . setOnLoadCallback ( drawChart ) ;
57
56
58
- function drawChart2 ( ) {
59
- var data = google . visualization . arrayToDataTable ( [
60
- [ 'Year' , 'Score' ] ,
61
- <% @perf . each do |p | %>
62
- // Let's just hope this data isn't suspectible during later releases ;-)
63
- [ <%= "#{ p . date_submitted } " . inspect . html_safe %> , <%= p . score %> ] ,
64
- <% end %>
65
- ] ) ;
57
+ function drawChart ( ) {
58
+ var data = google . visualization . arrayToDataTable ( [
59
+ [ 'Year' , 'Score' ] ,
60
+ <% @perf . each do |p | %>
61
+ // Let's just hope this data isn't suspectible during later releases ;-)
62
+ [ <%= "#{ p . date_submitted } " . inspect . html_safe %> , <%= p . score %> ] ,
63
+ <% end %>
64
+ ] ) ;
66
65
67
- var options = {
68
- min : 1 ,
69
- max : 5 ,
70
- width : 'auto' ,
71
- height : '160' ,
72
- backgroundColor : 'transparent' ,
73
- colors : [ '#e26666' , '#579da9' , '#1e825e' , '#b5799e' , '#dba26b' ] ,
74
- tooltip : {
75
- textStyle : {
76
- color : '#666666' ,
77
- fontSize : 11
78
- } ,
79
- showColorCode : true
80
- } ,
81
- legend : {
82
- textStyle : {
83
- color : 'black' ,
84
- fontSize : 12
85
- }
86
- } ,
87
- chartArea : {
88
- left : 100 ,
89
- top : 10
90
- } ,
91
- focusTarget : 'category' ,
92
- hAxis : {
93
- textStyle : {
94
- color : 'black' ,
95
- fontSize : 12
96
- }
97
- } ,
98
- vAxis : {
99
- textStyle : {
100
- color : 'black' ,
101
- fontSize : 12
102
- }
103
- } ,
104
- pointSize : 8 ,
105
- chartArea : {
106
- left : 60 ,
107
- top : 10 ,
108
- height : '80%'
109
- } ,
110
- lineWidth : 2 ,
111
- } ;
66
+ var options = {
67
+ min : 1 ,
68
+ max : 5 ,
69
+ width : 'auto' ,
70
+ height : '160' ,
71
+ backgroundColor : 'transparent' ,
72
+ colors : [ '#e26666' , '#579da9' , '#1e825e' , '#b5799e' , '#dba26b' ] ,
73
+ tooltip : {
74
+ textStyle : {
75
+ color : '#666666' ,
76
+ fontSize : 11
77
+ } ,
78
+ showColorCode : true
79
+ } ,
80
+ legend : {
81
+ textStyle : {
82
+ color : 'black' ,
83
+ fontSize : 12
84
+ }
85
+ } ,
86
+ chartArea : {
87
+ left : 100 ,
88
+ top : 10
89
+ } ,
90
+ focusTarget : 'category' ,
91
+ hAxis : {
92
+ textStyle : {
93
+ color : 'black' ,
94
+ fontSize : 12
95
+ }
96
+ } ,
97
+ vAxis : {
98
+ textStyle : {
99
+ color : 'black' ,
100
+ fontSize : 12
101
+ }
102
+ } ,
103
+ pointSize : 8 ,
104
+ chartArea : {
105
+ left : 60 ,
106
+ top : 10 ,
107
+ height : '80%'
108
+ } ,
109
+ lineWidth : 2 ,
110
+ } ;
112
111
113
- var chart = new google . visualization . LineChart ( document . getElementById ( 'line_chart' ) ) ;
114
- chart . draw ( data , options ) ;
115
- }
112
+ var chart = new google . visualization . LineChart ( document . getElementById ( 'line_chart' ) ) ;
113
+ chart . draw ( data , options ) ;
114
+ }
116
115
117
- function makeActive ( ) {
118
- $ ( 'li[id="performance"]' ) . addClass ( 'active' ) ;
119
- } ;
116
+ function makeActive ( ) {
117
+ $ ( 'li[id="performance"]' ) . addClass ( 'active' ) ;
118
+ } ;
120
119
121
- $ ( document ) . ready ( function ( ) {
122
- drawChart2 ( ) ,
123
- makeActive ( )
124
- } ) ;
120
+ $ ( document ) . ready ( function ( ) {
121
+ makeActive ( )
122
+ } ) ;
125
123
126
- </ script >
124
+ </ script >
0 commit comments