@@ -105,8 +105,7 @@ function setupChart () {
105
105
const area_dropdown = document . getElementById ( 'selected-area' )
106
106
const period_dropdown = document . getElementById ( 'selected-period' )
107
107
const chart = new google . visualization . LineChart ( node )
108
- const AREA_SCORE_OFFSET = 3
109
- let all_scores
108
+ let score_data
110
109
111
110
Object . keys ( periodRanges ) . forEach ( date => {
112
111
const selector = document . createElement ( 'option' )
@@ -116,7 +115,7 @@ function setupChart () {
116
115
} )
117
116
118
117
function update_chart ( ) {
119
- if ( ! all_scores ) throw new Error ( 'scores not loaded' )
118
+ if ( ! score_data ) throw new Error ( 'scores not loaded' )
120
119
const area_index = + area_dropdown . value
121
120
const chosen_period = period_dropdown . value
122
121
const table = new google . visualization . DataTable ( )
@@ -134,19 +133,18 @@ function setupChart () {
134
133
table . addColumn ( 'number' , 'Subtests' )
135
134
table . addColumn ( { type : 'string' , role : 'tooltip' , p : { html : true } } )
136
135
137
- for ( const scores_for_run of all_scores . scores ) {
138
- const area_score = scores_for_run [ area_index + AREA_SCORE_OFFSET ]
139
- const [ date_string , wpt_sha , browser_version ] = scores_for_run
140
- const date = parseDateString ( date_string )
136
+ for ( const run of score_data . runs ) {
137
+ const area_score = run . scores [ area_index ]
138
+ const date = parseDateString ( run . date )
141
139
if ( date < minDate ) {
142
140
continue
143
141
}
144
142
const row = [
145
143
date ,
146
144
area_score . total_score / area_score . total_tests ,
147
- toolTip ( date , wpt_sha , browser_version , area_score ) ,
145
+ toolTip ( date , run . wpt_revision , run . servo_revision , area_score ) ,
148
146
area_score . total_subtests_passed / area_score . total_subtests ,
149
- toolTip ( date , wpt_sha , browser_version , area_score )
147
+ toolTip ( date , run . wpt_revision , run . servo_revision , area_score )
150
148
]
151
149
table . addRow ( row )
152
150
}
@@ -155,15 +153,15 @@ function setupChart () {
155
153
156
154
fetchData
157
155
. then ( resp => resp . json ( ) )
158
- . then ( scores => {
159
- all_scores = scores
160
- if ( scores . scores . length < 60 ) {
156
+ . then ( data => {
157
+ score_data = data
158
+ if ( score_data . runs . length < 60 ) {
161
159
options . hAxis . format = 'dd MMM YYYY'
162
160
} else {
163
161
options . hAxis . format = 'MMM YYYY'
164
162
}
165
163
166
- for ( const [ index , area ] of scores . focus_areas . entries ( ) ) {
164
+ for ( const [ index , area ] of score_data . focus_areas . entries ( ) ) {
167
165
const selector = document . createElement ( 'option' )
168
166
selector . value = index
169
167
selector . textContent = area
0 commit comments