@@ -199,8 +199,8 @@ Y.extend(Y.IntradayAxisBase, Y.CategoryAxisBase, {
199
199
last = allData [ allData . length - 1 ] . Timestamp ;
200
200
if ( dataGranularity ) {
201
201
interval = parseFloat ( dataGranularity ) * 60000 ;
202
- max = new Date ( max ) . valueOf ( ) ;
203
- last = new Date ( last ) . valueOf ( ) ;
202
+ max = + new Date ( max ) ;
203
+ last = + new Date ( last ) ;
204
204
205
205
if ( max > last ) {
206
206
while ( max > last ) {
@@ -318,10 +318,10 @@ Y.CanvasAxis = Y.Base.create("canvasAxis", Y.AxisBase, [Y.Renderer], Y.merge(Y.A
318
318
explicitLabels = this . _labelValuesExplicitlySet ? this . get ( "labelValues" ) : null ,
319
319
direction = ( position === "left" || position === "right" ) ? "vertical" : "horizontal" ;
320
320
if ( margin ) {
321
- marginLeft = Y . Lang . isNumber ( margin . left ) ? margin . left : 0 ;
322
- marginRight = Y . Lang . isNumber ( margin . right ) ? margin . right : 0 ;
323
- marginTop = Y . Lang . isNumber ( margin . top ) ? margin . top : 0 ;
324
- marginBottom = Y . Lang . isNumber ( margin . bottom ) ? margin . bottom : 0 ;
321
+ marginLeft = typeof margin . left === "number" && isFinite ( margin . left ) ? margin . left : 0 ;
322
+ marginRight = typeof margin . right === "number" && isFinite ( margin . right ) ? margin . right : 0 ;
323
+ marginTop = typeof margin . top === "number" && isFinite ( margin . top ) ? margin . top : 0 ;
324
+ marginBottom = typeof margin . bottom === "number" && isFinite ( margin . bottom ) ? margin . bottom : 0 ;
325
325
}
326
326
//need to defaultMargins method to the layout classes.
327
327
for ( i in defaultMargins )
@@ -2874,8 +2874,7 @@ Y.MultipleLineSeries = Y.Base.create("multipleLineSeries", Y.CartesianSeries, [Y
2874
2874
{
2875
2875
return ;
2876
2876
}
2877
- var isNumber = Y . Lang . isNumber ,
2878
- direction = this . get ( "direction" ) ,
2877
+ var direction = this . get ( "direction" ) ,
2879
2878
len ,
2880
2879
lastPointValid ,
2881
2880
pointValid ,
@@ -2917,7 +2916,7 @@ Y.MultipleLineSeries = Y.Base.create("multipleLineSeries", Y.CartesianSeries, [Y
2917
2916
{
2918
2917
nextX = Math . round ( xcoords [ i ] * 1000 ) / 1000 ;
2919
2918
nextY = Math . round ( ycoords [ i ] * 1000 ) / 1000 ;
2920
- pointValid = isNumber ( nextX ) && isNumber ( nextY ) ;
2919
+ pointValid = typeof nextX === "number" && isFinite ( nextX ) && typeof nextY === "number" && isFinite ( nextY ) ;
2921
2920
if ( pointValid ) {
2922
2921
thresholdIndex = 0 ;
2923
2922
if ( thresholds ) {
@@ -2939,7 +2938,7 @@ Y.MultipleLineSeries = Y.Base.create("multipleLineSeries", Y.CartesianSeries, [Y
2939
2938
m = Math . round ( ( ( nextY - lastValidY ) / ( nextX - lastValidX ) ) * 1000 ) / 1000 ;
2940
2939
intersectX = ( ( thresholdCoords [ thresholdIndex ] - nextY ) / m ) + nextX ;
2941
2940
intersectY = thresholdCoords [ thresholdIndex ] ;
2942
- if ( isNumber ( lastPathIndex ) ) {
2941
+ if ( typeof lastPathIndex === "number" && isFinite ( lastPathIndex ) ) {
2943
2942
this . _lineTo ( graphPaths [ lastPathIndex ] , intersectX , intersectY ) ;
2944
2943
}
2945
2944
this . _moveTo ( graphPaths [ pathIndex ] , intersectX , intersectY ) ;
@@ -3098,27 +3097,27 @@ Y.Crosshair.prototype = {
3098
3097
graph ,
3099
3098
i ,
3100
3099
index = Math . floor ( ( x / this . width ) * this . _xcoords . length ) ,
3101
- len = series . length ;
3100
+ len = series . length ,
3101
+ isNumber ;
3102
+
3102
3103
this . _yline . set ( "transform" , "translate(" + x + ")" ) ;
3103
3104
if ( series ) {
3104
3105
for ( i = 0 ; i < len ; i = i + 1 ) {
3105
3106
graph = series [ i ] ;
3106
3107
y = graph . coords [ index ] ;
3108
+ isNumber = typeof y === "number" && isFinite ( y ) ;
3109
+
3107
3110
if ( graph . marker ) {
3108
- if ( Y . Lang . isNumber ( y ) ) {
3109
- graph . marker . set ( "visible" , true ) ;
3111
+ if ( isNumber ) {
3110
3112
graph . marker . set ( "transform" , "translate(" + x + ", " + y + ")" ) ;
3111
- } else {
3112
- graph . marker . set ( "visible" , false ) ;
3113
3113
}
3114
+ graph . marker . set ( "visible" , isNumber ) ;
3114
3115
}
3115
3116
if ( graph . line ) {
3116
- if ( Y . Lang . isNumber ( y ) ) {
3117
- graph . xLine . set ( "visible" , true ) ;
3117
+ if ( isNumber ) {
3118
3118
graph . xLine . set ( "transform" , "translateY(" + y + ")" ) ;
3119
- } else {
3120
- graph . xLine . set ( "visible" , false ) ;
3121
3119
}
3120
+ graph . xLine . set ( "visible" , isNumber ) ;
3122
3121
}
3123
3122
}
3124
3123
}
@@ -3198,11 +3197,11 @@ Y.Gridlines = Y.Base.create("gridlines", Y.Base, [Y.Renderer], {
3198
3197
* would result in a solid fill across the area.
3199
3198
* @protected
3200
3199
*/
3201
- draw : function ( )
3200
+ draw : function ( w , h , startIndex , interval )
3202
3201
{
3203
3202
if ( this . get ( "axis" ) && this . get ( "graphic" ) )
3204
3203
{
3205
- this . _drawGridlines . apply ( this , arguments ) ;
3204
+ this . _drawGridlines ( w , h , startIndex , interval ) ;
3206
3205
}
3207
3206
} ,
3208
3207
@@ -3608,11 +3607,11 @@ Y.GridlinesCanvas = Y.Base.create("gridlinesCanvas", Y.Gridlines, [], {
3608
3607
* would result in a solid fill across the area.
3609
3608
* @protected
3610
3609
*/
3611
- draw : function ( )
3610
+ draw : function ( w , h , startIndex , interval )
3612
3611
{
3613
3612
if ( this . get ( "axis" ) )
3614
3613
{
3615
- this . _drawGridlines . apply ( this , arguments ) ;
3614
+ this . _drawGridlines ( w , h , startIndex , interval ) ;
3616
3615
}
3617
3616
} ,
3618
3617
@@ -3946,7 +3945,7 @@ StockIndicatorsLegend.prototype = {
3946
3945
this . dateLabelFunction = cfg . dateLabelFunction ;
3947
3946
this . dateLabelFormat = cfg . dateLabelFormat ;
3948
3947
this . dateLabelScope = cfg . dateLabelScope || this ;
3949
- cfg . render . getDOMNode ( ) . appendChild ( this . contentDiv ) ;
3948
+ cfg . render . _node . appendChild ( this . contentDiv ) ;
3950
3949
3951
3950
len = seriesQueue . length ;
3952
3951
myul = Y . DOM . create (
@@ -4085,7 +4084,7 @@ StockIndicatorsLegend.prototype = {
4085
4084
item . li . style . display = "inline-block" ;
4086
4085
val = dataItem [ key ] ;
4087
4086
item . value . innerHTML = Y . Number . format ( parseFloat ( val ) , this . valueLabelFormat ) ;
4088
- Y . DOM . setStyle ( item . value , " color" , val > 0 ? this . priceUpColor : this . priceDownColor ) ;
4087
+ item . value . style . color = val > 0 ? this . priceUpColor : this . priceDownColor ;
4089
4088
} else {
4090
4089
item . li . style . display = "none" ;
4091
4090
}
@@ -4279,8 +4278,8 @@ Y.StockIndicatorsAxisLegend.prototype = {
4279
4278
minLabel = DOCUMENT . createElement ( "span" ) ,
4280
4279
height ,
4281
4280
width ,
4282
- minText = this . _labelFunction . apply ( this , [ this . _minimum , this . _labelFormat ] ) ,
4283
- maxText = this . _labelFunction . apply ( this , [ this . _maximum , this . _labelFormat ] ) ,
4281
+ minText = this . _labelFunction ( this . _minimum , this . _labelFormat ) ,
4282
+ maxText = this . _labelFunction ( this . _maximum , this . _labelFormat ) ,
4284
4283
container = DOCUMENT . createElement ( "div" ) ,
4285
4284
arrow = DOCUMENT . createElement ( "span" ) ,
4286
4285
key ,
@@ -4380,7 +4379,7 @@ Y.StockIndicatorsAxisLegend.prototype = {
4380
4379
arrow = DOCUMENT . createElement ( "span" ) ,
4381
4380
label = DOCUMENT . createElement ( "span" ) ,
4382
4381
key ,
4383
- text = this . _labelFunction . apply ( this , [ value , this . _labelFormat ] ) ,
4382
+ text = this . _labelFunction ( value , this . _labelFormat ) ,
4384
4383
ycoord = previousClose . ycoord ||
4385
4384
axis . _getCoordFromValue ( this . _minimum , this . _maximum , this . height , value , this . height , true ) ;
4386
4385
ycoord = ycoord + this . _y ;
@@ -4544,7 +4543,7 @@ Y.StockIndicatorsAxisLegend.prototype = {
4544
4543
label . style . background = background ;
4545
4544
arrow . style . borderRightColor = background ;
4546
4545
}
4547
- text = this . _labelFunction . apply ( this , [ value , this . _labelFormat ] ) ,
4546
+ text = this . _labelFunction ( value , this . _labelFormat ) ,
4548
4547
ycoord = this . _y + axis . _getCoordFromValue ( this . _minimum , this . _maximum , this . height , value , this . height , true ) ;
4549
4548
label . appendChild ( DOCUMENT . createTextNode ( text ) ) ;
4550
4549
container . style . position = "absolute" ;
@@ -5318,7 +5317,7 @@ Y.StockIndicatorsChart = Y.Base.create("stockIndicatorsChart", Y.Widget, [Y.Ren
5318
5317
*/
5319
5318
initializer : function ( ) {
5320
5319
var cb = this . get ( "contentBox" ) ;
5321
- cb . setStyle ( " position" , "relative" ) ;
5320
+ cb . _node . style . position = "relative" ;
5322
5321
this . _axes = [ ] ;
5323
5322
this . _graphs = [ ] ;
5324
5323
this . _graphics = [ ] ;
@@ -5569,7 +5568,7 @@ Y.StockIndicatorsChart = Y.Base.create("stockIndicatorsChart", Y.Widget, [Y.Ren
5569
5568
startTimeline : function ( ) {
5570
5569
if ( ! this . _runTimeline ) {
5571
5570
this . _runTimeline = true ;
5572
- this . _timelineStart = ( new Date ( ) ) . valueOf ( ) - 17 ;
5571
+ this . _timelineStart = + new Date ( ) - 17 ;
5573
5572
this . redraw ( ) ;
5574
5573
}
5575
5574
} ,
@@ -5602,7 +5601,7 @@ Y.StockIndicatorsChart = Y.Base.create("stockIndicatorsChart", Y.Widget, [Y.Ren
5602
5601
chart ,
5603
5602
i ,
5604
5603
len = charts . length ,
5605
- endTime = ( new Date ( ) ) . valueOf ( ) ;
5604
+ endTime = + new Date ( ) ;
5606
5605
if ( endTime >= this . _timelineStart + 17 ) {
5607
5606
for ( i = 0 ; i < len ; i = i + 1 ) {
5608
5607
chart = charts [ i ] ;
@@ -5615,7 +5614,7 @@ Y.StockIndicatorsChart = Y.Base.create("stockIndicatorsChart", Y.Widget, [Y.Ren
5615
5614
legend . redraw ( ) ;
5616
5615
}
5617
5616
}
5618
- this . _timelineStart = ( new Date ( ) ) . valueOf ( ) ;
5617
+ this . _timelineStart = + new Date ( ) ;
5619
5618
}
5620
5619
if ( this . _runTimeline && ! this . _autoDraw ) {
5621
5620
this . _timelineId = this . _onEnterFrame . apply ( WINDOW , [ function ( ) {
@@ -5678,13 +5677,19 @@ Y.StockIndicatorsChart = Y.Base.create("stockIndicatorsChart", Y.Widget, [Y.Ren
5678
5677
valueLen ,
5679
5678
valueKey ,
5680
5679
groupMarkers ,
5681
- nomarkers = [ "candlestick" , "line" , "ohlc" , "volumecolumn" , "multipleline" ] ;
5680
+ nomarkers = {
5681
+ "candlestick" : true ,
5682
+ "line" : true ,
5683
+ "ohlc" : true ,
5684
+ "volumecolumn" : true ,
5685
+ "multipleline" : true
5686
+ } ;
5682
5687
for ( indIter = 0 ; indIter < indLen ; indIter = indIter + 1 ) {
5683
5688
indicator = indicators [ indIter ] ;
5684
5689
valueKey = indicator . valueKey ;
5685
5690
indicatorType = indicator . type ;
5686
5691
if ( indicatorType === "candlestick" || indicatorType === "ohlc" || typeof valueKey === "string" ) {
5687
- groupMarkers = Y . Array . indexOf ( nomarkers , indicatorType ) === - 1 && indicator . groupMarkers ;
5692
+ groupMarkers = ! nomarkers [ indicatorType ] && indicator . groupMarkers ;
5688
5693
seriesConfig = {
5689
5694
groupMarkers : groupMarkers ,
5690
5695
type : indicator . type ,
@@ -5701,10 +5706,10 @@ Y.StockIndicatorsChart = Y.Base.create("stockIndicatorsChart", Y.Widget, [Y.Ren
5701
5706
yKey : indicator . valueKey [ valueIter ]
5702
5707
} ;
5703
5708
if ( typeof indicatorType === "string" ) {
5704
- seriesConfig . groupMarkers = Y . Array . indexOf ( nomarkers , indicatorType ) === - 1 && indicator . groupMarkers ;
5709
+ seriesConfig . groupMarkers = ! nomarkers [ indicatorType ] && indicator . groupMarkers ;
5705
5710
seriesConfig . type = indicatorType ;
5706
5711
} else {
5707
- seriesConfig . groupMarkers = Y . Array . indexOf ( nomarkers , indicatorType [ valueIter ] ) === - 1 && indicator . groupMarkers ;
5712
+ seriesConfig . groupMarkers = ! nomarkers [ indicatorType ] && indicator . groupMarkers ;
5708
5713
seriesConfig . type = indicatorType [ valueIter ] ;
5709
5714
if ( indicatorType [ valueIter ] === "multipleline" && config . threshold && config . range === "1d" ) {
5710
5715
seriesConfig . thresholds = [ parseFloat ( indicator . previousClose ) ] ;
@@ -5964,11 +5969,12 @@ Y.StockIndicatorsChart = Y.Base.create("stockIndicatorsChart", Y.Widget, [Y.Ren
5964
5969
numericAxis = new NumericClass ( numericConfig ) ;
5965
5970
dateAxis = new DateClass ( dateConfig ) ;
5966
5971
bb = dateAxis . get ( "boundingBox" ) ;
5967
- bb . setStyle ( "left" , 0 + "px" ) ;
5968
- bb . setStyle ( "top" , dateConfig . y + "px" ) ;
5972
+ bb . _node . style . left = 0 ;
5973
+ bb . _node . style . top = dateConfig . y + "px" ;
5974
+
5969
5975
bb = numericAxis . get ( "boundingBox" ) ;
5970
- bb . setStyle ( " left" , numericConfig . x + "px" ) ;
5971
- bb . setStyle ( " top" , numericConfig . y + "px" ) ;
5976
+ bb . _node . style . left = numericConfig . x + "px" ;
5977
+ bb . _node . style . top = numericConfig . y + "px" ;
5972
5978
axes = {
5973
5979
numeric : numericAxis ,
5974
5980
date : dateAxis
@@ -6146,7 +6152,8 @@ Y.StockIndicatorsChart = Y.Base.create("stockIndicatorsChart", Y.Widget, [Y.Ren
6146
6152
key ,
6147
6153
color ,
6148
6154
crosshairKey ,
6149
- validKeys = config . keys ;
6155
+ validKeys = Y . Array . hash ( config . keys ) ;
6156
+
6150
6157
for ( key in graphs ) {
6151
6158
if ( graphs . hasOwnProperty ( key ) ) {
6152
6159
crosshairKey = key === "quote" ? "close" : key ;
@@ -6155,7 +6162,7 @@ Y.StockIndicatorsChart = Y.Base.create("stockIndicatorsChart", Y.Widget, [Y.Ren
6155
6162
if ( color && typeof color === "object" && graph . get ( "type" ) === "combo" ) {
6156
6163
color = color . line ;
6157
6164
}
6158
- if ( Y . Array . indexOf ( validKeys , crosshairKey ) > - 1 ) {
6165
+ if ( validKeys [ crosshairKey ] ) {
6159
6166
series = {
6160
6167
marker : {
6161
6168
shape : "circle" ,
@@ -6360,7 +6367,7 @@ Y.StockIndicatorsChart = Y.Base.create("stockIndicatorsChart", Y.Widget, [Y.Ren
6360
6367
config . legend . width = graphConfig . width ;
6361
6368
}
6362
6369
legend = this . _addLegend ( config , cb ) ;
6363
- if ( thresholdStyles && typeof previousClose === "number" ) {
6370
+ if ( thresholdStyles && typeof previousClose === "number" && isFinite ( previousClose ) ) {
6364
6371
thresholdConfig = {
6365
6372
type : "thresholdline" ,
6366
6373
thresholds : [ previousClose ] ,
@@ -6500,15 +6507,9 @@ Y.StockIndicatorsChart = Y.Base.create("stockIndicatorsChart", Y.Widget, [Y.Ren
6500
6507
}
6501
6508
}
6502
6509
}
6503
- if ( this . _startHandle ) {
6504
- this . _startHandle . detach ( ) ;
6505
- }
6506
- if ( this . _moveHandle ) {
6507
- this . _moveHandle . detach ( ) ;
6508
- }
6509
- if ( this . _endHandle ) {
6510
- this . _endHandle . detach ( ) ;
6511
- }
6510
+ this . _startHandle . detach ( ) ;
6511
+ this . _moveHandle . detach ( ) ;
6512
+ this . _endHandle . detach ( ) ;
6512
6513
} ,
6513
6514
6514
6515
destructor : function ( ) {
0 commit comments