2
2
// @compilation_level SIMPLE_OPTIMIZATIONS
3
3
4
4
/**
5
- * @license Highcharts JS v4.1.3 (2015-02-27 )
5
+ * @license Highcharts JS v4.1.4 (2015-03-10 )
6
6
*
7
7
* (c) 2009-2014 Torstein Honsi
8
8
*
@@ -56,7 +56,7 @@ var UNDEFINED,
56
56
charts = [ ] ,
57
57
chartCount = 0 ,
58
58
PRODUCT = 'Highcharts' ,
59
- VERSION = '4.1.3 ' ,
59
+ VERSION = '4.1.4 ' ,
60
60
61
61
// some constants for frequently used strings
62
62
DIV = 'div' ,
@@ -149,8 +149,8 @@ function merge() {
149
149
value = original [ key ] ;
150
150
151
151
// Copy the contents of objects, but not arrays or DOM nodes
152
- if ( value && typeof value === 'object' && Object . prototype . toString . call ( value ) !== '[object Array]'
153
- && key !== 'renderTo' && typeof value . nodeType !== 'number' ) {
152
+ if ( value && typeof value === 'object' && Object . prototype . toString . call ( value ) !== '[object Array]' &&
153
+ key !== 'renderTo' && typeof value . nodeType !== 'number' ) {
154
154
copy [ key ] = doCopy ( copy [ key ] || { } , value ) ;
155
155
156
156
// Primitives and arrays are copied over directly
@@ -1259,8 +1259,8 @@ defaultOptions = {
1259
1259
global : {
1260
1260
useUTC : true ,
1261
1261
//timezoneOffset: 0,
1262
- canvasToolsURL : 'http://code.highcharts.com/4.1.3 /modules/canvas-tools.js' ,
1263
- VMLRadialGradientURL : 'http://code.highcharts.com/4.1.3 /gfx/vml-radial-gradient.png'
1262
+ canvasToolsURL : 'http://code.highcharts.com/4.1.4 /modules/canvas-tools.js' ,
1263
+ VMLRadialGradientURL : 'http://code.highcharts.com/4.1.4 /gfx/vml-radial-gradient.png'
1264
1264
} ,
1265
1265
chart : {
1266
1266
//animation: true,
@@ -1768,7 +1768,8 @@ var Color = function (input) {
1768
1768
get : get ,
1769
1769
brighten : brighten ,
1770
1770
rgba : rgba ,
1771
- setOpacity : setOpacity
1771
+ setOpacity : setOpacity ,
1772
+ raw : input
1772
1773
} ;
1773
1774
} ;
1774
1775
@@ -2858,17 +2859,22 @@ SVGElement.prototype = {
2858
2859
otherZIndex ,
2859
2860
element = this . element ,
2860
2861
inserted ,
2862
+ run = this . added ,
2861
2863
i ;
2862
2864
2863
2865
if ( defined ( value ) ) {
2864
2866
element . setAttribute ( key , value ) ; // So we can read it for other elements in the group
2865
- this [ key ] = + value ;
2867
+ value = + value ;
2868
+ if ( this [ key ] === value ) { // Only update when needed (#3865)
2869
+ run = false ;
2870
+ }
2871
+ this [ key ] = value ;
2866
2872
}
2867
2873
2868
2874
// Insert according to this and other elements' zIndex. Before .add() is called,
2869
2875
// nothing is done. Then on add, or by later calls to zIndexSetter, the node
2870
2876
// is placed on the right place in the DOM.
2871
- if ( this . added ) {
2877
+ if ( run ) {
2872
2878
value = this . zIndex ;
2873
2879
2874
2880
if ( value && parentGroup ) {
@@ -4152,7 +4158,11 @@ SVGRenderer.prototype = {
4152
4158
if ( x !== text . x || y !== text . y ) {
4153
4159
text . attr ( 'x' , x ) ;
4154
4160
if ( y !== UNDEFINED ) {
4155
- text . attr ( 'y' , y ) ;
4161
+ // As a workaround for #3649, use translation instead of y attribute. #3649
4162
+ // is a rendering bug in WebKit for Retina (Mac, iOS, PhantomJS) that
4163
+ // results in duplicated text when an y attribute is used in combination
4164
+ // with a CSS text-style.
4165
+ text . attr ( text . element . nodeName === 'SPAN' ? 'y' : 'translateY' , y ) ;
4156
4166
}
4157
4167
}
4158
4168
@@ -7193,17 +7203,18 @@ Axis.prototype = {
7193
7203
linkedParent = axis . linkedParent ,
7194
7204
ordinalCorrection ,
7195
7205
hasCategories = ! ! axis . categories ,
7196
- transA = axis . transA ;
7206
+ transA = axis . transA ,
7207
+ isXAxis = axis . isXAxis ;
7197
7208
7198
7209
// Adjust translation for padding. Y axis with categories need to go through the same (#1784).
7199
- if ( axis . isXAxis || hasCategories || pointRange ) {
7210
+ if ( isXAxis || hasCategories || pointRange ) {
7200
7211
if ( linkedParent ) {
7201
7212
minPointOffset = linkedParent . minPointOffset ;
7202
7213
pointRangePadding = linkedParent . pointRangePadding ;
7203
7214
7204
7215
} else {
7205
7216
each ( axis . series , function ( series ) {
7206
- var seriesPointRange = hasCategories ? 1 : ( axis . isXAxis ? series . pointRange : ( axis . axisPointRange || 0 ) ) , // #2806
7217
+ var seriesPointRange = hasCategories ? 1 : ( isXAxis ? series . pointRange : ( axis . axisPointRange || 0 ) ) , // #2806
7207
7218
pointPlacement = series . options . pointPlacement ,
7208
7219
seriesClosestPointRange = series . closestPointRange ;
7209
7220
@@ -7249,7 +7260,9 @@ Axis.prototype = {
7249
7260
// closestPointRange means the closest distance between points. In columns
7250
7261
// it is mostly equal to pointRange, but in lines pointRange is 0 while closestPointRange
7251
7262
// is some other value
7252
- axis . closestPointRange = closestPointRange ;
7263
+ if ( isXAxis ) {
7264
+ axis . closestPointRange = closestPointRange ;
7265
+ }
7253
7266
}
7254
7267
7255
7268
// Secondary values
@@ -7886,7 +7899,7 @@ Axis.prototype = {
7886
7899
each ( autoRotation , function ( rot ) {
7887
7900
var score ;
7888
7901
7889
- if ( rot && rot >= - 90 && rot <= 90 ) {
7902
+ if ( rot === rotationOption || ( rot && rot >= - 90 && rot <= 90 ) ) { // #3891
7890
7903
7891
7904
step = getStep ( mathAbs ( labelMetrics . h / mathSin ( deg2rad * rot ) ) ) ;
7892
7905
@@ -9528,6 +9541,7 @@ Pointer.prototype = {
9528
9541
}
9529
9542
}
9530
9543
9544
+ // Handle shared tooltip or cases where a series is not yet hovered
9531
9545
if ( ! ( hoverSeries && hoverSeries . noSharedTooltip ) && ( shared || ! hoverSeries ) ) { // #3821
9532
9546
// Find nearest points on all series
9533
9547
each ( series , function ( s ) {
@@ -9549,35 +9563,43 @@ Pointer.prototype = {
9549
9563
kdpoint = p ;
9550
9564
}
9551
9565
}
9552
- //point = kdpoints[0];
9553
9566
} ) ;
9567
+
9568
+ // Handle non-shared tooltips
9554
9569
} else {
9555
- kdpoint = hoverSeries ? hoverSeries . searchPoint ( e ) : UNDEFINED ;
9570
+ // If it has a hoverPoint and that series requires direct touch (like columns), use the hoverPoint (#3899).
9571
+ // Otherwise, search the k-d tree (like scatter).
9572
+ kdpoint = ( hoverSeries . directTouch && hoverPoint ) || ( hoverSeries && hoverSeries . searchPoint ( e ) ) ;
9556
9573
}
9557
9574
9558
- // Refresh tooltip for kdpoint
9559
- if ( kdpoint && kdpoint !== hoverPoint ) {
9575
+ // Refresh tooltip for kdpoint if new hover point or tooltip was hidden // #3926
9576
+ if ( kdpoint && ( kdpoint !== hoverPoint || ( tooltip && tooltip . isHidden ) ) ) {
9560
9577
// Draw tooltip if necessary
9561
9578
if ( shared && ! kdpoint . series . noSharedTooltip ) {
9562
9579
i = kdpoints . length ;
9563
9580
trueXkd = kdpoint . clientX ;
9564
9581
while ( i -- ) {
9565
9582
trueX = kdpoints [ i ] . clientX ;
9566
- if ( kdpoints [ i ] . x !== kdpoint . x || trueX !== trueXkd || ! defined ( kdpoints [ i ] . y ) || ( kdpoints [ i ] . series . noSharedTooltip || false ) ) {
9583
+ if ( kdpoints [ i ] . x !== kdpoint . x || trueX !== trueXkd || ( kdpoints [ i ] . series . noSharedTooltip || false ) ) {
9567
9584
kdpoints . splice ( i , 1 ) ;
9568
9585
}
9569
9586
}
9570
- if ( tooltip ) {
9587
+ if ( kdpoints . length && tooltip ) {
9571
9588
tooltip . refresh ( kdpoints , e ) ;
9572
9589
}
9590
+
9591
+ // do mouseover on all points except the closest
9573
9592
each ( kdpoints , function ( point ) {
9574
- point . onMouseOver ( e ) ;
9575
- } ) ;
9593
+ if ( point !== kdpoint ) {
9594
+ point . onMouseOver ( e ) ;
9595
+ }
9596
+ } ) ;
9597
+ kdpoint . onMouseOver ( e ) ; // #3919 do mouseover on the closest point last to ensure it is the hoverpoint
9576
9598
} else {
9577
- if ( tooltip ) {
9599
+ if ( tooltip ) {
9578
9600
tooltip . refresh ( kdpoint , e ) ;
9579
9601
}
9580
- kdpoint . onMouseOver ( e ) ;
9602
+ kdpoint . onMouseOver ( e ) ;
9581
9603
}
9582
9604
9583
9605
// Update positions (regardless of kdpoint or hoverPoint)
@@ -9592,7 +9614,9 @@ Pointer.prototype = {
9592
9614
// Start the event listener to pick up the tooltip
9593
9615
if ( tooltip && ! pointer . _onDocumentMouseMove ) {
9594
9616
pointer . _onDocumentMouseMove = function ( e ) {
9595
- pointer . onDocumentMouseMove ( e ) ;
9617
+ if ( charts [ hoverChartIndex ] ) {
9618
+ charts [ hoverChartIndex ] . pointer . onDocumentMouseMove ( e ) ;
9619
+ }
9596
9620
} ;
9597
9621
addEvent ( doc , 'mousemove' , pointer . _onDocumentMouseMove ) ;
9598
9622
}
@@ -9968,6 +9992,7 @@ Pointer.prototype = {
9968
9992
plotTop = chart . plotTop ;
9969
9993
9970
9994
e = this . normalize ( e ) ;
9995
+ e . originalEvent = e ; // #3913
9971
9996
e . cancelBubble = true ; // IE specific
9972
9997
9973
9998
if ( ! chart . cancelClick ) {
@@ -11900,7 +11925,7 @@ Chart.prototype = {
11900
11925
11901
11926
// Width and height checks for display:none. Target is doc in IE8 and Opera,
11902
11927
// win in Firefox, Chrome and IE9.
11903
- if ( ! chart . hasUserSize && width && height && ( target === win || target === doc ) ) {
11928
+ if ( ! chart . hasUserSize && ! chart . isPrinting && width && height && ( target === win || target === doc ) ) { // #1093
11904
11929
if ( width !== chart . containerWidth || height !== chart . containerHeight ) {
11905
11930
clearTimeout ( chart . reflowTimeout ) ;
11906
11931
if ( e ) { // Called from window.resize
@@ -14256,7 +14281,7 @@ Series.prototype = {
14256
14281
series [ graphKey ] = series . chart . renderer . path ( graphPath )
14257
14282
. attr ( attribs )
14258
14283
. add ( series . group )
14259
- . shadow ( ! i && options . shadow ) ;
14284
+ . shadow ( ( i < 2 ) && options . shadow ) ; // add shadow to normal series (0) or to first zone (1) #3932
14260
14285
}
14261
14286
} ) ;
14262
14287
} ,
@@ -14550,6 +14575,7 @@ Series.prototype = {
14550
14575
var series = this ,
14551
14576
chart = series . chart ,
14552
14577
wasDirtyData = series . isDirtyData , // cache it here as it is set to false in render, but used after
14578
+ wasDirty = series . isDirty ,
14553
14579
group = series . group ,
14554
14580
xAxis = series . xAxis ,
14555
14581
yAxis = series . yAxis ;
@@ -14571,11 +14597,12 @@ Series.prototype = {
14571
14597
14572
14598
series . translate ( ) ;
14573
14599
series . render ( ) ;
14574
-
14575
14600
if ( wasDirtyData ) {
14576
- delete this . kdTree ; // #3868 recalculate the kdtree with dirty data
14577
14601
fireEvent ( series , 'updatedData' ) ;
14578
14602
}
14603
+ if ( wasDirty || wasDirtyData ) { // #3945 recalculate the kdtree when dirty
14604
+ delete this . kdTree ; // #3868 recalculate the kdtree with dirty data
14605
+ }
14579
14606
} ,
14580
14607
14581
14608
/**
@@ -14629,9 +14656,12 @@ Series.prototype = {
14629
14656
}
14630
14657
}
14631
14658
14632
- // Start the recursive build process with a clone of the points array (#3873)
14659
+ // Start the recursive build process with a clone of the points array and null points filtered out (#3873)
14633
14660
function startRecursive ( ) {
14634
- series . kdTree = _kdtree ( series . points . slice ( ) , dimensions , dimensions ) ;
14661
+ var points = grep ( series . points , function ( point ) {
14662
+ return point . y !== null ;
14663
+ } ) ;
14664
+ series . kdTree = _kdtree ( points , dimensions , dimensions ) ;
14635
14665
}
14636
14666
14637
14667
delete series . kdTree ;
@@ -15195,7 +15225,7 @@ extend(Point.prototype, {
15195
15225
chart . isDirtyBox = true ;
15196
15226
}
15197
15227
15198
- if ( seriesOptions . legendType === 'point' ) { // #1831, #1885
15228
+ if ( chart . legend . display && seriesOptions . legendType === 'point' ) { // #1831, #1885, #3934
15199
15229
series . updateTotals ( ) ;
15200
15230
chart . legend . clearItems ( ) ;
15201
15231
}
@@ -17535,7 +17565,7 @@ if (seriesTypes.column) {
17535
17565
17536
17566
17537
17567
/**
17538
- * Highcharts JS v4.1.3 (2015-02-27 )
17568
+ * Highcharts JS v4.1.4 (2015-03-10 )
17539
17569
* Highcharts module to hide overlapping data labels. This module is included by default in Highmaps.
17540
17570
*
17541
17571
* (c) 2010-2014 Torstein Honsi
@@ -17649,10 +17679,6 @@ var TrackerMixin = Highcharts.TrackerMixin = {
17649
17679
var target = e . target ,
17650
17680
point ;
17651
17681
17652
- if ( chart . hoverSeries !== series ) {
17653
- series . onMouseOver ( ) ;
17654
- }
17655
-
17656
17682
while ( target && ! point ) {
17657
17683
point = target . point ;
17658
17684
target = target . parentNode ;
@@ -18046,6 +18072,10 @@ extend(Point.prototype, {
18046
18072
tooltip = chart . tooltip ,
18047
18073
hoverPoint = chart . hoverPoint ;
18048
18074
18075
+ if ( chart . hoverSeries !== series ) {
18076
+ series . onMouseOver ( ) ;
18077
+ }
18078
+
18049
18079
// set normal state to previous series
18050
18080
if ( hoverPoint && hoverPoint !== point ) {
18051
18081
hoverPoint . onMouseOut ( ) ;
0 commit comments