@@ -53,7 +53,7 @@ function calc(container, trace) {
53
53
var x = xaxis . type === 'linear' ? trace . x : xaxis . makeCalcdata ( trace , 'x' ) ;
54
54
var y = yaxis . type === 'linear' ? trace . y : yaxis . makeCalcdata ( trace , 'y' ) ;
55
55
56
- var count = ( x || y ) . length , i , l , xx , yy ;
56
+ var count = trace . _length , i , l , xx , yy ;
57
57
58
58
if ( ! x ) {
59
59
x = Array ( count ) ;
@@ -71,28 +71,26 @@ function calc(container, trace) {
71
71
// get log converted positions
72
72
var rawx , rawy ;
73
73
if ( xaxis . type === 'log' ) {
74
- rawx = Array ( x . length ) ;
75
- for ( i = 0 , l = x . length ; i < l ; i ++ ) {
76
- rawx [ i ] = x [ i ] ;
74
+ rawx = x . slice ( 0 , count ) ;
75
+ for ( i = 0 ; i < count ; i ++ ) {
77
76
x [ i ] = xaxis . d2l ( x [ i ] ) ;
78
77
}
79
78
}
80
79
else {
81
80
rawx = x ;
82
- for ( i = 0 , l = x . length ; i < l ; i ++ ) {
81
+ for ( i = 0 ; i < count ; i ++ ) {
83
82
x [ i ] = parseFloat ( x [ i ] ) ;
84
83
}
85
84
}
86
85
if ( yaxis . type === 'log' ) {
87
- rawy = Array ( y . length ) ;
88
- for ( i = 0 , l = y . length ; i < l ; i ++ ) {
89
- rawy [ i ] = y [ i ] ;
86
+ rawy = y . slice ( 0 , count ) ;
87
+ for ( i = 0 ; i < count ; i ++ ) {
90
88
y [ i ] = yaxis . d2l ( y [ i ] ) ;
91
89
}
92
90
}
93
91
else {
94
92
rawy = y ;
95
- for ( i = 0 , l = y . length ; i < l ; i ++ ) {
93
+ for ( i = 0 ; i < count ; i ++ ) {
96
94
y [ i ] = parseFloat ( y [ i ] ) ;
97
95
}
98
96
}
1 commit comments
etpinard commentedon Feb 8, 2018
Nice. This might even be a perf boost