@@ -34,7 +34,7 @@ var SYMBOL_SIZE = 20;
34
34
var SYMBOL_STROKE = SYMBOL_SIZE / 20 ;
35
35
var SYMBOL_SDF = { } ;
36
36
var SYMBOL_SVG_CIRCLE = Drawing . symbolFuncs [ 0 ] ( SYMBOL_SIZE * 0.05 ) ;
37
-
37
+ var TOO_MANY_POINTS = 1e5 ;
38
38
39
39
var ScatterRegl = module . exports = extend ( { } , require ( '../scatter' ) ) ;
40
40
@@ -356,12 +356,12 @@ ScatterRegl.calc = function calc(container, trace) {
356
356
}
357
357
}
358
358
359
- // FIXME: this slows down big number of points
360
- Axes . expand ( xaxis , trace . x , { padded : true , ppad : sizes } ) ;
361
- Axes . expand ( yaxis , trace . y , { padded : true , ppad : sizes } ) ;
359
+ Axes . expand ( xaxis , x , { padded : true , ppad : sizes } ) ;
360
+ Axes . expand ( yaxis , y , { padded : true , ppad : sizes } ) ;
362
361
}
363
362
else {
364
- scatterOptions . size = markerSizeFunc ( markerOpts && markerOpts . size || 10 ) ;
363
+ // console.log(x, xOptions, xa._min)
364
+ var size = scatterOptions . size = markerSizeFunc ( markerOpts && markerOpts . size || 10 ) ;
365
365
scatterOptions . borderSizes = markerOpts . line . width * 0.5 ;
366
366
367
367
// axes bounds
@@ -373,17 +373,21 @@ ScatterRegl.calc = function calc(container, trace) {
373
373
if ( ybounds [ 1 ] < yy ) ybounds [ 1 ] = yy ;
374
374
}
375
375
376
- if ( ! xaxis . autorange ) {
377
- // update axes fast
376
+ // FIXME: is there a better way to separate expansion?
377
+ if ( count < TOO_MANY_POINTS ) {
378
+ Axes . expand ( xaxis , x , { padded : true , ppad : size } ) ;
379
+ Axes . expand ( yaxis , y , { padded : true , ppad : size } ) ;
380
+ }
381
+ // update axes fast for big number of points
382
+ else {
378
383
var pad = scatterOptions . size ;
379
384
if ( xaxis . _min ) {
380
385
xaxis . _min . push ( { val : xbounds [ 0 ] , pad : pad } ) ;
381
386
}
382
387
if ( xaxis . _max ) {
383
388
xaxis . _max . push ( { val : xbounds [ 1 ] , pad : pad } ) ;
384
389
}
385
- }
386
- if ( ! yaxis . autorange ) {
390
+
387
391
if ( yaxis . _min ) {
388
392
yaxis . _min . push ( { val : ybounds [ 0 ] , pad : pad } ) ;
389
393
}
0 commit comments