@@ -53,7 +53,7 @@ function waveform(div_id) {
5353 function update_segment ( ) {
5454 seg_start = graph_sub . xScale . domain ( ) [ 0 ]
5555 seg_end = graph_sub . xScale . domain ( ) [ 1 ]
56-
56+
5757 if ( seg_start < 0 || seg_end > audioBuffer . duration ) {
5858 seg_start = Math . max ( 0 , seg_start ) ;
5959 seg_end = Math . min ( audioBuffer . duration , seg_end ) ;
@@ -70,7 +70,7 @@ function waveform(div_id) {
7070
7171 } ;
7272
73-
73+
7474 segmentLayer . on ( 'drag' , function ( item , e ) {
7575 update_waveform ( graph_sub , data )
7676 } ) ;
@@ -81,7 +81,7 @@ function waveform(div_id) {
8181
8282 // 4. draw graph
8383 d3 . select ( id ) . call ( graph . draw ) ;
84-
84+
8585 var graph_sub = wavesUI . timeline ( )
8686 . xDomain ( [ 0 , audioBuffer . duration ] )
8787 . width ( graph_width )
@@ -95,7 +95,7 @@ function waveform(div_id) {
9595
9696 graph_sub . add ( waveformLayerSub ) ;
9797 update_waveform ( graph_sub , data )
98-
98+
9999 d3 . select ( id_sub ) . call ( graph_sub . draw ) ;
100100
101101 // Add X-Ticks addTicks(id_sub, graph_sub);
@@ -134,15 +134,15 @@ function waveform(div_id) {
134134
135135 // update axis
136136 axis . call ( xAxis ) ;
137-
137+
138138 } )
139139 . on ( 'mouseup' , function ( e ) {
140140 // set the final xZoom value of the graph
141141 graph_sub . xZoomSet ( ) ;
142142 // update axis
143143 axis . call ( xAxis ) ;
144144 } ) ;
145-
145+
146146 } catch ( err ) {
147147 console . log ( err ) ;
148148 }
@@ -163,11 +163,11 @@ function timeline_get_data(json_url, div_id) {
163163 . xDomain ( [ 0 , duration ] )
164164 . width ( graph_width )
165165 . height ( height ) ;
166-
166+
167167 for ( var i = 0 ; i < data_list . length ; i ++ ) {
168168 var data = data_list [ i ] ;
169169 var ytop = i * ( graph_height + 10 )
170-
170+
171171 timeline_result ( data , graph , ytop ) ;
172172 }
173173
@@ -225,7 +225,7 @@ function timeline_result(data, graph, ytop) {
225225 timeline_framewise_value ( data , graph , ytop ) ;
226226 break ;
227227 case 'label' :
228- timeline_framewise_label ( data , graph , ytop ) ;
228+ timeline_framewise_label ( data , graph , ytop ) ;
229229 break ;
230230 }
231231 break ;
@@ -248,15 +248,15 @@ function timeline_framewise_value(data, graph, ytop) {
248248 }
249249
250250
251-
251+
252252 if ( dim == 0 ) {
253253 // format data
254254 var min_value = 1 ;
255255 var max_value = - 1 ;
256256 var data = values . map ( function ( dummy , index ) {
257257 min_value = Math . min ( min_value , values [ index ] )
258258 max_value = Math . max ( max_value , values [ index ] )
259-
259+
260260 return {
261261 cx : ( blocksize / 2 + stepsize * index ) / samplerate ,
262262 cy : values [ index ]
@@ -272,21 +272,21 @@ function timeline_framewise_value(data, graph, ytop) {
272272 . data ( data )
273273 . color ( 'steelblue' )
274274 . opacity ( 0.8 ) ;
275-
275+
276276 // 3. add layers to graph
277277 graph . add ( breakpointLayer ) ;
278-
278+
279279 } else {
280280 var colors = d3 . scale . category20 ( ) . domain ( d3 . set ( Math . min ( dim , 20 ) ) . values ( ) ) . range ( ) ;
281-
281+
282282 for ( var i = 0 ; i < dim ; i ++ ) {
283283 // format data
284284 var min_value = 0 ;
285285 var max_value = 0 ;
286286 var data = values . map ( function ( dummy , index ) {
287287 min_value = Math . min ( min_value , values [ index ] [ i ] )
288288 max_value = Math . max ( max_value , values [ index ] [ i ] )
289-
289+
290290 return {
291291 cx : ( blocksize / 2 + stepsize * index ) / samplerate ,
292292 cy : values [ index ] [ i ]
@@ -302,7 +302,7 @@ function timeline_framewise_value(data, graph, ytop) {
302302 . data ( data )
303303 . color ( colors [ i % 20 ] )
304304 . opacity ( 0.8 ) ;
305-
305+
306306 // 3. add layers to graph
307307 graph . add ( breakpointLayer ) ;
308308 } ;
@@ -322,7 +322,7 @@ function timeline_segment_value(data, graph, ytop) {
322322 height : values [ index ]
323323 } ;
324324 } ) ;
325-
325+
326326
327327 // var minValue = Math.min.apply(null, values);
328328 var max_value = Math . max . apply ( null , values ) ;
@@ -336,10 +336,10 @@ function timeline_segment_value(data, graph, ytop) {
336336 top : ytop ,
337337 yDomain : [ 0 , max_value ]
338338 } ) ;
339-
339+
340340 // 3. add layers to graph
341341 graph . add ( segmentLayer ) ;
342-
342+
343343}
344344
345345function timeline_segment_label ( data , graph , ytop ) {
@@ -358,7 +358,7 @@ function timeline_segment_label(data, graph, ytop) {
358358 } ) ;
359359
360360 var colors = d3 . scale . category10 ( ) . domain ( d3 . set ( labels ) . values ( ) ) . range ( ) ;
361-
361+
362362 var segmentLayer = wavesUI . segment ( )
363363 . data ( data )
364364 . color ( function ( d ) { return colors [ d . label ] } )
@@ -368,11 +368,11 @@ function timeline_segment_label(data, graph, ytop) {
368368 top : ytop ,
369369 handlerOpacity : 1
370370 } ) ;
371-
371+
372372
373373 // 3. add layers to graph
374374 graph . add ( segmentLayer ) ;
375-
375+
376376}
377377
378378function timeline_event_label ( data , graph , ytop ) {
@@ -400,7 +400,7 @@ function timeline_event_label(data, graph, ytop) {
400400 top : ytop ,
401401 yDomain : [ 0 , max_value ] ,
402402 } ) ;
403-
403+
404404 // 3. add layers to graph
405405 graph . add ( markerLayer ) ;
406406
@@ -426,7 +426,7 @@ function timeline_framewise_label(data, graph, ytop) {
426426 } ) ;
427427
428428 var colors = d3 . scale . category10 ( ) . domain ( d3 . set ( labels ) . values ( ) ) . range ( ) ;
429-
429+
430430 var segmentLayer = wavesUI . segment ( )
431431 . data ( data )
432432 . color ( function ( d ) { return colors [ d . label ] } )
@@ -436,9 +436,9 @@ function timeline_framewise_label(data, graph, ytop) {
436436 top : ytop ,
437437 handlerOpacity : 1
438438 } ) ;
439-
439+
440440
441441 // 3. add layers to graph
442442 graph . add ( segmentLayer ) ;
443-
443+
444444}
0 commit comments