@@ -31,12 +31,13 @@ module.exports = function plot(gd, plotinfo, cdscatter) {
3131 . selectAll ( 'g.trace.scatter' )
3232 . data ( cdscatter ) ;
3333 scattertraces . enter ( ) . append ( 'g' )
34- . attr ( 'class' , 'trace scatter' )
35- . style ( 'stroke-miterlimit' , 2 ) ;
34+ . attr ( 'class' , 'trace scatter' )
35+ . style ( 'stroke-miterlimit' , 2 ) ;
3636
3737 // BUILD LINES AND FILLS
38- var prevpath = '' ,
39- tozero , tonext , nexttonext ;
38+ var prevpath = '' ,
39+ tozero , tonext , nexttonext ;
40+
4041 scattertraces . each ( function ( d ) {
4142 var trace = d [ 0 ] . trace ,
4243 line = trace . line ,
@@ -47,7 +48,7 @@ module.exports = function plot(gd, plotinfo, cdscatter) {
4748
4849 arraysToCalcdata ( d ) ;
4950
50- if ( ! subTypes . hasLines ( trace ) && trace . fill === 'none' ) return ;
51+ if ( ! subTypes . hasLines ( trace ) && trace . fill === 'none' ) return ;
5152
5253 var thispath ,
5354 // fullpath is all paths for this curve, joined together straight
@@ -61,10 +62,10 @@ module.exports = function plot(gd, plotinfo, cdscatter) {
6162 // make the fill-to-zero path now, so it shows behind the line
6263 // fill to next puts the fill associated with one trace
6364 // grouped with the previous
64- if ( trace . fill . substr ( 0 , 6 ) === 'tozero' ||
65- ( trace . fill . substr ( 0 , 2 ) === 'to' && ! prevpath ) ) {
65+ if ( trace . fill . substr ( 0 , 6 ) === 'tozero' ||
66+ ( trace . fill . substr ( 0 , 2 ) === 'to' && ! prevpath ) ) {
6667 tozero = tr . append ( 'path' )
67- . classed ( 'js-fill' , true ) ;
68+ . classed ( 'js-fill' , true ) ;
6869 }
6970 else tozero = null ;
7071
@@ -75,15 +76,15 @@ module.exports = function plot(gd, plotinfo, cdscatter) {
7576 if ( nexttonext ) tonext = nexttonext . datum ( d ) ;
7677
7778 // now make a new nexttonext for next time
78- nexttonext = tr . append ( 'path' ) . classed ( 'js-fill' , true ) ;
79+ nexttonext = tr . append ( 'path' ) . classed ( 'js-fill' , true ) ;
7980
80- if ( [ 'hv' , 'vh' , 'hvh' , 'vhv' ] . indexOf ( line . shape ) !== - 1 ) {
81+ if ( [ 'hv' , 'vh' , 'hvh' , 'vhv' ] . indexOf ( line . shape ) !== - 1 ) {
8182 pathfn = Drawing . steps ( line . shape ) ;
8283 revpathbase = Drawing . steps (
8384 line . shape . split ( '' ) . reverse ( ) . join ( '' )
8485 ) ;
8586 }
86- else if ( line . shape === 'spline' ) {
87+ else if ( line . shape === 'spline' ) {
8788 pathfn = revpathbase = function ( pts ) {
8889 return Drawing . smoothopen ( pts , line . smoothing ) ;
8990 } ;
@@ -96,7 +97,7 @@ module.exports = function plot(gd, plotinfo, cdscatter) {
9697
9798 revpathfn = function ( pts ) {
9899 // note: this is destructive (reverses pts in place) so can't use pts after this
99- return 'L' + revpathbase ( pts . reverse ( ) ) . substr ( 1 ) ;
100+ return 'L' + revpathbase ( pts . reverse ( ) ) . substr ( 1 ) ;
100101 } ;
101102
102103 var segments = linePoints ( d , {
@@ -115,27 +116,27 @@ module.exports = function plot(gd, plotinfo, cdscatter) {
115116 for ( var i = 0 ; i < segments . length ; i ++ ) {
116117 var pts = segments [ i ] ;
117118 thispath = pathfn ( pts ) ;
118- fullpath += fullpath ? ( 'L' + thispath . substr ( 1 ) ) : thispath ;
119+ fullpath += fullpath ? ( 'L' + thispath . substr ( 1 ) ) : thispath ;
119120 revpath = revpathfn ( pts ) + revpath ;
120121 if ( subTypes . hasLines ( trace ) && pts . length > 1 ) {
121- tr . append ( 'path' ) . classed ( 'js-line' , true ) . attr ( 'd' , thispath ) ;
122+ tr . append ( 'path' ) . classed ( 'js-line' , true ) . attr ( 'd' , thispath ) ;
122123 }
123124 }
124125 if ( tozero ) {
125126 if ( pt0 && pt1 ) {
126- if ( trace . fill . charAt ( trace . fill . length - 1 ) === 'y' ) {
127- pt0 [ 1 ] = pt1 [ 1 ] = ya . c2p ( 0 , true ) ;
127+ if ( trace . fill . charAt ( trace . fill . length - 1 ) === 'y' ) {
128+ pt0 [ 1 ] = pt1 [ 1 ] = ya . c2p ( 0 , true ) ;
128129 }
129- else pt0 [ 0 ] = pt1 [ 0 ] = xa . c2p ( 0 , true ) ;
130+ else pt0 [ 0 ] = pt1 [ 0 ] = xa . c2p ( 0 , true ) ;
130131
131132 // fill to zero: full trace path, plus extension of
132133 // the endpoints to the appropriate axis
133- tozero . attr ( 'd' , fullpath + 'L' + pt1 + 'L' + pt0 + 'Z' ) ;
134+ tozero . attr ( 'd' , fullpath + 'L' + pt1 + 'L' + pt0 + 'Z' ) ;
134135 }
135136 }
136- else if ( trace . fill . substr ( 0 , 6 ) === 'tonext' && fullpath && prevpath ) {
137+ else if ( trace . fill . substr ( 0 , 6 ) === 'tonext' && fullpath && prevpath ) {
137138 // fill to next: full trace path, plus the previous path reversed
138- tonext . attr ( 'd' , fullpath + prevpath + 'Z' ) ;
139+ tonext . attr ( 'd' , fullpath + prevpath + 'Z' ) ;
139140 }
140141 prevpath = revpath ;
141142 }
@@ -145,12 +146,12 @@ module.exports = function plot(gd, plotinfo, cdscatter) {
145146 scattertraces . selectAll ( 'path:not([d])' ) . remove ( ) ;
146147
147148 function visFilter ( d ) {
148- return d . filter ( function ( v ) { return v . vis ; } ) ;
149+ return d . filter ( function ( v ) { return v . vis ; } ) ;
149150 }
150151
151152 scattertraces . append ( 'g' )
152- . attr ( 'class' , 'points' )
153- . each ( function ( d ) {
153+ . attr ( 'class' , 'points' )
154+ . each ( function ( d ) {
154155 var trace = d [ 0 ] . trace ,
155156 s = d3 . select ( this ) ,
156157 showMarkers = subTypes . hasMarkers ( trace ) ,
@@ -184,20 +185,20 @@ function selectMarkers(gd, plotinfo, cdscatter) {
184185 xr = d3 . extent ( xa . range . map ( xa . l2c ) ) ,
185186 yr = d3 . extent ( ya . range . map ( ya . l2c ) ) ;
186187
187- cdscatter . forEach ( function ( d , i ) {
188+ cdscatter . forEach ( function ( d , i ) {
188189 var trace = d [ 0 ] . trace ;
189190 if ( ! subTypes . hasMarkers ( trace ) ) return ;
190191 // if marker.maxdisplayed is used, select a maximum of
191192 // mnum markers to show, from the set that are in the viewport
192193 var mnum = trace . marker . maxdisplayed ;
193194
194195 // TODO: remove some as we get away from the viewport?
195- if ( mnum === 0 ) return ;
196+ if ( mnum === 0 ) return ;
196197
197198 var cd = d . filter ( function ( v ) {
198199 return v . x >= xr [ 0 ] && v . x <= xr [ 1 ] && v . y >= yr [ 0 ] && v . y <= yr [ 1 ] ;
199200 } ) ,
200- inc = Math . ceil ( cd . length / mnum ) ,
201+ inc = Math . ceil ( cd . length / mnum ) ,
201202 tnum = 0 ;
202203 cdscatter . forEach ( function ( cdj , j ) {
203204 var tracei = cdj [ 0 ] . trace ;
@@ -211,13 +212,13 @@ function selectMarkers(gd, plotinfo, cdscatter) {
211212 // display this formula offsets successive traces by 1/3 of the
212213 // increment, adding an extra small amount after each triplet so
213214 // it's not quite periodic
214- var i0 = Math . round ( tnum * inc / 3 + Math . floor ( tnum / 3 ) * inc / 7.1 ) ;
215+ var i0 = Math . round ( tnum * inc / 3 + Math . floor ( tnum / 3 ) * inc / 7.1 ) ;
215216
216217 // for error bars: save in cd which markers to show
217218 // so we don't have to repeat this
218- d . forEach ( function ( v ) { delete v . vis ; } ) ;
219- cd . forEach ( function ( v , i ) {
220- if ( Math . round ( ( i + i0 ) % inc ) === 0 ) v . vis = true ;
219+ d . forEach ( function ( v ) { delete v . vis ; } ) ;
220+ cd . forEach ( function ( v , i ) {
221+ if ( Math . round ( ( i + i0 ) % inc ) === 0 ) v . vis = true ;
221222 } ) ;
222223 } ) ;
223224}
0 commit comments