highcharts-rails 5.0.11 → 5.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.markdown +32 -0
  3. data/app/assets/javascripts/highcharts.js +1199 -379
  4. data/app/assets/javascripts/highcharts/highcharts-3d.js +1542 -209
  5. data/app/assets/javascripts/highcharts/highcharts-more.js +6 -1
  6. data/app/assets/javascripts/highcharts/modules/accessibility.js +13 -6
  7. data/app/assets/javascripts/highcharts/modules/annotations.js +1 -1
  8. data/app/assets/javascripts/highcharts/modules/boost.js +66 -24
  9. data/app/assets/javascripts/highcharts/modules/broken-axis.js +1 -1
  10. data/app/assets/javascripts/highcharts/modules/data.js +1 -1
  11. data/app/assets/javascripts/highcharts/modules/drilldown.js +6 -44
  12. data/app/assets/javascripts/highcharts/modules/exporting.js +8 -4
  13. data/app/assets/javascripts/highcharts/modules/funnel.js +1 -8
  14. data/app/assets/javascripts/highcharts/modules/grid-axis.js +1 -1
  15. data/app/assets/javascripts/highcharts/modules/heatmap.js +17 -51
  16. data/app/assets/javascripts/highcharts/modules/no-data-to-display.js +19 -10
  17. data/app/assets/javascripts/highcharts/modules/offline-exporting.js +7 -2
  18. data/app/assets/javascripts/highcharts/modules/overlapping-datalabels.js +1 -1
  19. data/app/assets/javascripts/highcharts/modules/series-label.js +1 -1
  20. data/app/assets/javascripts/highcharts/modules/solid-gauge.js +7 -51
  21. data/app/assets/javascripts/highcharts/modules/stock.js +82 -9
  22. data/app/assets/javascripts/highcharts/modules/treemap.js +1 -1
  23. data/app/assets/javascripts/highcharts/modules/xrange-series.js +1 -1
  24. data/lib/highcharts/version.rb +1 -1
  25. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b764775567eb6bbfce94c9275195b020ff487098
4
- data.tar.gz: fe68c40d26e5d217e35d3f61cc3f7ab3a7e63895
3
+ metadata.gz: 74a8ba8427add11ea1ab2b5c13f709c943c4e2fa
4
+ data.tar.gz: 5a0ad370f0bf2979f4639cfa8e15712f9e7c96f4
5
5
  SHA512:
6
- metadata.gz: 8ed031934239b74521186cf926d1895fe71b56b1c5f8895e6f022e1ec0637555bed1d629d0fb438b0e3d8cbe935eb472b36ce54959aeefcf7dba49fdc89907e9
7
- data.tar.gz: 336deebb8450320097810c7daf4c41f163086c1f896748111595ca65229c5b1ee1365c788808a8663734b7208c21f798bca1326b29dde6924f36611c21c97f7a
6
+ metadata.gz: 2ea324cc2f8641130d1a8ab70433f8feb409347262bb1a61aa12477d329ac372e367d39d55208b621f5e4d107d20cb3b56424155b44fdd6ea088cea975802e85
7
+ data.tar.gz: 31158550cb0e0612d6789c9c655a5fc876d7f2511763a8183bd72cf37d662e458321b77c08608d8ac24e9be45ad2bb2370ff222896710c87b149d6d4002777be
data/CHANGELOG.markdown CHANGED
@@ -1,3 +1,35 @@
1
+ # 5.0.12 / 2017-11-10
2
+
3
+ * Updated Highcharts to 5.0.12 (2017-05-24)
4
+ * Added core support for color animation.
5
+ * Added error message on trying to define the same series type twice. Fixes #6686.
6
+ * Let Series.update fall back to the optimized Series.setData if only the data is updated.
7
+ * Bug fixes
8
+ * Fixed #223, pie chart data labels were not truncated to chart area when pie size was explicitly set.
9
+ * Fixed #3160, let the xAxis.offset option modify the clip area to avoid clipping line graphs.
10
+ * Fixed #4588, loading and "no data" labels overlapped.
11
+ * Fixed #4921, ignoreHiddenSeries caused wrong column position and width after hiding and showing all series.
12
+ * Fixed #6307, offline export issues with styled mode in IE and Edge.
13
+ * Fixed #6517, regression with shared tooltip and columns. Tooltip not following mouse move.
14
+ * Fixed #6659, long series name in legend broke the geometry of the chart. Added textOverflow and max width to default itemStyle.
15
+ * Fixed #6659, long series names made tooltip overflow the chart.
16
+ * Fixed #6664, no-data label remained in heat maps after adding points.
17
+ * Fixed #6670, visible: false didn't work correctly on funnel chart points.
18
+ * Fixed #6687, wrong hover points with columns and shared tooltip.
19
+ * Fixed #6700, axis label font size wrongly detected in styled mode.
20
+ * Fixed #6704, series names were not grouped for two series after drilldown.
21
+ * Fixed #6705, bubble chart click events and point select was broken.
22
+ * Fixed #6706, crash with heatmap and boost-canvas.
23
+ * Fixed #6721, area range fill was broken with null values and connectNulls: true.
24
+ * Fixed #6731, category axis allowed zooming outside range.
25
+ * Fixed AT announcing clickable for some a11y demos.
26
+ * Fixed Firefox issue with styled export, ref #6307.
27
+ * Fixed bug with inserting multiple data tables in export-data.
28
+ * Fixed issue where chart container height was not respected when initially hidden. See #6693.
29
+ * Fixed issue with data labels not appearing on exported charts in styled mode.
30
+ * Fixed issue with missing gridLines in 3D.
31
+ * Fixed issue with mouseOver event in column chart with shared tooltip.
32
+
1
33
  # 5.0.11 / 2017-11-10
2
34
 
3
35
  * Updated Highcharts to 5.0.11 (2017-05-04)
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v5.0.11 (2017-05-04)
2
+ * @license Highcharts JS v5.0.12 (2017-05-24)
3
3
  *
4
4
  * (c) 2009-2016 Torstein Honsi
5
5
  *
@@ -35,7 +35,7 @@
35
35
 
36
36
  var Highcharts = win.Highcharts ? win.Highcharts.error(16, true) : {
37
37
  product: 'Highcharts',
38
- version: '5.0.11',
38
+ version: '5.0.12',
39
39
  deg2rad: Math.PI * 2 / 360,
40
40
  doc: doc,
41
41
  hasBidiBug: hasBidiBug,
@@ -59,7 +59,7 @@
59
59
  * An array containing the current chart objects in the page. A chart's
60
60
  * position in the array is preserved throughout the page's lifetime. When
61
61
  * a chart is destroyed, the array item becomes `undefined`.
62
- * @type {Array}
62
+ * @type {Array.<Highcharts.Chart>}
63
63
  * @memberOf Highcharts
64
64
  */
65
65
  charts: []
@@ -470,6 +470,19 @@
470
470
  }
471
471
  }; // End of Fx prototype
472
472
 
473
+ /**
474
+ * Handle animation of the color attributes directly.
475
+ */
476
+ H.Fx.prototype.fillSetter =
477
+ H.Fx.prototype.strokeSetter = function() {
478
+ this.elem.attr(
479
+ this.prop,
480
+ H.color(this.start).tweenTo(H.color(this.end), this.pos),
481
+ null,
482
+ true
483
+ );
484
+ };
485
+
473
486
 
474
487
  /**
475
488
  * Utility function to extend an object with the members of another.
@@ -2005,6 +2018,10 @@
2005
2018
  var defaultOptions = H.getOptions(),
2006
2019
  seriesTypes = H.seriesTypes;
2007
2020
 
2021
+ if (seriesTypes[type]) {
2022
+ return H.error(27); // Series type already defined
2023
+ }
2024
+
2008
2025
  // Merge the options
2009
2026
  defaultOptions.plotOptions[type] = H.merge(
2010
2027
  defaultOptions.plotOptions[parent],
@@ -2228,6 +2245,7 @@
2228
2245
  // Collection of named colors. Can be extended from the outside by adding
2229
2246
  // colors to Highcharts.Color.prototype.names.
2230
2247
  names: {
2248
+ none: 'rgba(255,255,255,0)',
2231
2249
  white: '#ffffff',
2232
2250
  black: '#000000'
2233
2251
  },
@@ -2369,6 +2387,45 @@
2369
2387
  setOpacity: function(alpha) {
2370
2388
  this.rgba[3] = alpha;
2371
2389
  return this;
2390
+ },
2391
+
2392
+ /*
2393
+ * Return an intermediate color between two colors.
2394
+ *
2395
+ * @param {Highcharts.Color} to
2396
+ * The color object to tween to.
2397
+ * @param {Number} pos
2398
+ * The intermediate position, where 0 is the from color (current
2399
+ * color item), and 1 is the `to` color.
2400
+ *
2401
+ * @return {String}
2402
+ * The intermediate color in rgba notation.
2403
+ */
2404
+ tweenTo: function(to, pos) {
2405
+ // Check for has alpha, because rgba colors perform worse due to lack of
2406
+ // support in WebKit.
2407
+ var from = this,
2408
+ hasAlpha,
2409
+ ret;
2410
+
2411
+ // Unsupported color, return to-color (#3920)
2412
+ if (!to.rgba.length) {
2413
+ ret = to.input || 'none';
2414
+
2415
+ // Interpolate
2416
+ } else {
2417
+ from = from.rgba;
2418
+ to = to.rgba;
2419
+ hasAlpha = (to[3] !== 1 || from[3] !== 1);
2420
+ ret = (hasAlpha ? 'rgba(' : 'rgb(') +
2421
+ Math.round(to[0] + (from[0] - to[0]) * (1 - pos)) + ',' +
2422
+ Math.round(to[1] + (from[1] - to[1]) * (1 - pos)) + ',' +
2423
+ Math.round(to[2] + (from[2] - to[2]) * (1 - pos)) +
2424
+ (hasAlpha ?
2425
+ (',' + (to[3] + (from[3] - to[3]) * (1 - pos))) :
2426
+ '') + ')';
2427
+ }
2428
+ return ret;
2372
2429
  }
2373
2430
  };
2374
2431
  H.color = function(input) {
@@ -2426,23 +2483,25 @@
2426
2483
  */
2427
2484
  /**
2428
2485
  * The SVGElement prototype is a JavaScript wrapper for SVG elements used in the
2429
- * rendering layer of Highcharts. Combined with the {@link SVGRenderer} object,
2430
- * these prototypes allow freeform annotation in the charts or even in HTML
2431
- * pages without instanciating a chart. The SVGElement can also wrap HTML
2432
- * labels, when `text` or `label` elements are created with the `useHTML`
2433
- * parameter.
2486
+ * rendering layer of Highcharts. Combined with the {@link
2487
+ * Highcharts.SVGRenderer} object, these prototypes allow freeform annotation
2488
+ * in the charts or even in HTML pages without instanciating a chart. The
2489
+ * SVGElement can also wrap HTML labels, when `text` or `label` elements are
2490
+ * created with the `useHTML` parameter.
2434
2491
  *
2435
2492
  * The SVGElement instances are created through factory functions on the
2436
- * {@link SVGRenderer} object, like [rect]{@link SVGRenderer#rect},
2437
- * [path]{@link SVGRenderer#path}, [text]{@link SVGRenderer#text}, [label]{@link
2438
- * SVGRenderer#label}, [g]{@link SVGRenderer#g} and more.
2493
+ * {@link Highcharts.SVGRenderer} object, like
2494
+ * [rect]{@link Highcharts.SVGRenderer#rect}, [path]{@link
2495
+ * Highcharts.SVGRenderer#path}, [text]{@link Highcharts.SVGRenderer#text},
2496
+ * [label]{@link Highcharts.SVGRenderer#label}, [g]{@link
2497
+ * Highcharts.SVGRenderer#g} and more.
2439
2498
  *
2440
- * @class
2499
+ * @class Highcharts.SVGElement
2441
2500
  */
2442
2501
  SVGElement = H.SVGElement = function() {
2443
2502
  return this;
2444
2503
  };
2445
- SVGElement.prototype = {
2504
+ extend(SVGElement.prototype, /** @lends Highcharts.SVGElement.prototype */ {
2446
2505
 
2447
2506
  // Default base for animation
2448
2507
  opacity: 1,
@@ -2461,8 +2520,10 @@
2461
2520
  * Initialize the SVG renderer. This function only exists to make the
2462
2521
  * initiation process overridable. It should not be called directly.
2463
2522
  *
2464
- * @param {SVGRenderer} renderer The SVGRenderer instance to initialize to.
2465
- * @param {String} nodeName The SVG node name.
2523
+ * @param {HighchartsSVGRenderer} renderer
2524
+ * The SVGRenderer instance to initialize to.
2525
+ * @param {String} nodeName
2526
+ * The SVG node name.
2466
2527
  * @returns {void}
2467
2528
  */
2468
2529
  init: function(renderer, nodeName) {
@@ -2478,7 +2539,7 @@
2478
2539
 
2479
2540
  /**
2480
2541
  * The renderer that the SVGElement belongs to.
2481
- * @type {SVGRenderer}
2542
+ * @type {Highcharts.SVGRenderer}
2482
2543
  */
2483
2544
  this.renderer = renderer;
2484
2545
  },
@@ -2489,7 +2550,11 @@
2489
2550
  * @param {SVGAttributes} params SVG attributes or CSS to animate.
2490
2551
  * @param {AnimationOptions} [options] Animation options.
2491
2552
  * @param {Function} [complete] Function to perform at the end of animation.
2492
- * @returns {SVGElement} Returns the SVGElement for chaining.
2553
+ *
2554
+ * @sample highcharts/members/element-on/
2555
+ * Setting some attributes by animation
2556
+ *
2557
+ * @returns {Highcharts.SVGElement} Returns the SVGElement for chaining.
2493
2558
  */
2494
2559
  animate: function(params, options, complete) {
2495
2560
  var animOptions = H.animObject(
@@ -2809,16 +2874,19 @@
2809
2874
  * setter. If the first argument is a string and the second is undefined,
2810
2875
  * the function serves as a getter and the current value of the property
2811
2876
  * is returned.
2812
- * @param {Function} complete - A callback function to execute after setting
2877
+ * @param {Function} [complete] - A callback function to execute after setting
2813
2878
  * the attributes. This makes the function compliant and interchangeable
2814
2879
  * with the {@link SVGElement#animate} function.
2815
- * @param {boolean} continueAnimation - Used internally when `.attr` is
2880
+ * @param {boolean} [continueAnimation=true] Used internally when `.attr` is
2816
2881
  * called as part of an animation step. Otherwise, calling `.attr` for an
2817
2882
  * attribute will stop animation for that attribute.
2818
2883
  *
2819
2884
  * @returns {SVGElement|string|number} If used as a setter, it returns the
2820
2885
  * current {@link SVGElement} so the calls can be chained. If used as a
2821
2886
  * getter, the current value of the attribute is returned.
2887
+ *
2888
+ * @sample highcharts/members/renderer-rect/
2889
+ * Setting some attributes
2822
2890
  *
2823
2891
  * @example
2824
2892
  * // Set multiple attributes
@@ -2897,13 +2965,7 @@
2897
2965
  }
2898
2966
  }, this);
2899
2967
 
2900
- // Update transform. Do this outside the loop to prevent redundant updating for batch setting
2901
- // of attributes.
2902
- if (this.doTransform) {
2903
- this.updateTransform();
2904
- this.doTransform = false;
2905
- }
2906
-
2968
+ this.afterSetters();
2907
2969
  }
2908
2970
 
2909
2971
  // In accordance with animate, run a complete callback
@@ -2914,6 +2976,20 @@
2914
2976
  return ret;
2915
2977
  },
2916
2978
 
2979
+ /**
2980
+ * This method is executed in the end of {attr}, after setting all attributes in the hash.
2981
+ * In can be used to efficiently consolidate multiple attributes in one SVG property -- e.g.,
2982
+ * translate, rotate and scale are merged in one "transform" attribute in the SVG node.
2983
+ */
2984
+ afterSetters: function() {
2985
+ // Update transform. Do this outside the loop to prevent redundant updating for batch setting
2986
+ // of attributes.
2987
+ if (this.doTransform) {
2988
+ this.updateTransform();
2989
+ this.doTransform = false;
2990
+ }
2991
+ },
2992
+
2917
2993
 
2918
2994
  /**
2919
2995
  * Update the shadow elements with new attributes.
@@ -2949,7 +3025,7 @@
2949
3025
  * @param {boolean} [replace=false] - When true, the existing class name(s)
2950
3026
  * will be overwritten with the new one. When false, the new one is
2951
3027
  * added.
2952
- * @returns {SVGElement} Return the SVG element for chainability.
3028
+ * @returns {Highcharts.SVGElement} Return the SVG element for chainability.
2953
3029
  */
2954
3030
  addClass: function(className, replace) {
2955
3031
  var currentClassName = this.attr('class') || '';
@@ -2977,7 +3053,7 @@
2977
3053
  /**
2978
3054
  * Remove a class name from the element.
2979
3055
  * @param {string} className The class name to remove.
2980
- * @return {SVGElement} Returns the SVG element for chainability.
3056
+ * @return {Highcharts.SVGElement} Returns the SVG element for chainability.
2981
3057
  */
2982
3058
  removeClass: function(className) {
2983
3059
  attr(this.element, 'class', (attr(this.element, 'class') || '').replace(className, ''));
@@ -3014,7 +3090,7 @@
3014
3090
  *
3015
3091
  * @param {ClipRect} [clipRect] - The clipping rectangle. If skipped, the
3016
3092
  * current clip is removed.
3017
- * @returns {SVGElement} Returns the SVG element to allow chaining.
3093
+ * @returns {Highcharts.SVGElement} Returns the SVG element to allow chaining.
3018
3094
  */
3019
3095
  clip: function(clipRect) {
3020
3096
  return this.attr(
@@ -3074,7 +3150,10 @@
3074
3150
  * Highcharts, like `width`, `ellipsis` and `textOverflow` for SVG text
3075
3151
  * elements.
3076
3152
  * @param {CSSObject} styles The new CSS styles.
3077
- * @returns {SVGElement} Return the SVG element for chaining.
3153
+ * @returns {Highcharts.SVGElement} Return the SVG element for chaining.
3154
+ *
3155
+ * @sample highcharts/members/renderer-text-on-chart/
3156
+ * Styled text
3078
3157
  */
3079
3158
  css: function(styles) {
3080
3159
  var oldStyles = this.styles,
@@ -3189,7 +3268,10 @@
3189
3268
  * touch devices, to prevent the browser from waiting for a click event
3190
3269
  * from firing.
3191
3270
  * @param {Function} handler - The handler callback.
3192
- * @returns {SVGElement} The SVGElement for chaining.
3271
+ * @returns {Highcharts.SVGElement} The SVGElement for chaining.
3272
+ *
3273
+ * @sample highcharts/members/element-on/
3274
+ * A clickable rectangle
3193
3275
  */
3194
3276
  on: function(eventType, handler) {
3195
3277
  var svgElement = this,
@@ -3222,7 +3304,7 @@
3222
3304
  *
3223
3305
  * @param {Array} coordinates The center reference. The format is
3224
3306
  * `[centerX, centerY, diameter]` in pixels.
3225
- * @returns {SVGElement} Returns the SVGElement for chaining.
3307
+ * @returns {Highcharts.SVGElement} Returns the SVGElement for chaining.
3226
3308
  */
3227
3309
  setRadialReference: function(coordinates) {
3228
3310
  var existingGradient = this.renderer.gradients[this.element.gradient];
@@ -3263,7 +3345,7 @@
3263
3345
  *
3264
3346
  * @param {boolean} inverted - Whether to invert or not. An inverted shape
3265
3347
  * can be un-inverted by setting it to false.
3266
- * @returns {SVGElement} Return the SVGElement for chaining.
3348
+ * @returns {Highcharts.SVGElement} Return the SVGElement for chaining.
3267
3349
  */
3268
3350
  invert: function(inverted) {
3269
3351
  var wrapper = this;
@@ -3321,9 +3403,12 @@
3321
3403
  },
3322
3404
 
3323
3405
  /**
3324
- * Bring the element to the front.
3406
+ * Bring the element to the front. Alternatively, a new zIndex can be set.
3325
3407
  *
3326
- * @returns {SVGElement} Returns the SVGElement for chaining.
3408
+ * @returns {Highcharts.SVGElement} Returns the SVGElement for chaining.
3409
+ *
3410
+ * @sample highcharts/members/element-tofront/
3411
+ * Click an element to bring it to front
3327
3412
  */
3328
3413
  toFront: function() {
3329
3414
  var element = this.element;
@@ -3334,7 +3419,7 @@
3334
3419
 
3335
3420
  /**
3336
3421
  * Align the element relative to the chart or another box.
3337
- * ß
3422
+ *
3338
3423
  * @param {Object} [alignOptions] The alignment options. The function can be
3339
3424
  * called without this parameter in order to re-align an element after the
3340
3425
  * box has been updated.
@@ -3352,7 +3437,7 @@
3352
3437
  * When the box is a string, it refers to an object in the Renderer. For
3353
3438
  * example, when box is `spacingBox`, it refers to `Renderer.spacingBox`
3354
3439
  * which holds `width`, `height`, `x` and `y` properties.
3355
- * @returns {SVGElement} Returns the SVGElement for chaining.
3440
+ * @returns {Highcharts.SVGElement} Returns the SVGElement for chaining.
3356
3441
  */
3357
3442
  align: function(alignOptions, alignByTranslate, box) {
3358
3443
  var align,
@@ -3438,6 +3523,9 @@
3438
3523
  * would be have been if it were not rotated.
3439
3524
  * @returns {Object} The bounding box with `x`, `y`, `width` and `height`
3440
3525
  * properties.
3526
+ *
3527
+ * @sample highcharts/members/renderer-on-chart/
3528
+ * Draw a rectangle based on a text's bounding box
3441
3529
  */
3442
3530
  getBBox: function(reload, rot) {
3443
3531
  var wrapper = this,
@@ -3598,7 +3686,7 @@
3598
3686
  * `inherit` rather than `visible`. The difference is that an element with
3599
3687
  * `visibility="visible"` will be visible even if the parent is hidden.
3600
3688
  *
3601
- * @returns {SVGElement} Returns the SVGElement for chaining.
3689
+ * @returns {Highcharts.SVGElement} Returns the SVGElement for chaining.
3602
3690
  */
3603
3691
  show: function(inherit) {
3604
3692
  return this.attr({
@@ -3610,7 +3698,7 @@
3610
3698
  * Hide the element, equivalent to setting the `visibility` attribute to
3611
3699
  * `hidden`.
3612
3700
  *
3613
- * @returns {SVGElement} Returns the SVGElement for chaining.
3701
+ * @returns {Highcharts.SVGElement} Returns the SVGElement for chaining.
3614
3702
  */
3615
3703
  hide: function() {
3616
3704
  return this.attr({
@@ -3641,10 +3729,11 @@
3641
3729
  /**
3642
3730
  * Add the element to the DOM. All elements must be added this way.
3643
3731
  *
3644
- * @param {SVGElement|SVGDOMElement} [parent] The parent item to add it to.
3645
- * If undefined, the element is added to the {@link SVGRenderer.box}.
3732
+ * @param {Highcharts.SVGElement|SVGDOMElement} [parent] The parent item to add it to.
3733
+ * If undefined, the element is added to the {@link
3734
+ * Highcharts.SVGRenderer.box}.
3646
3735
  *
3647
- * @returns {SVGElement} Returns the SVGElement for chaining.
3736
+ * @returns {Highcharts.SVGElement} Returns the SVGElement for chaining.
3648
3737
  *
3649
3738
  * @sample highcharts/members/renderer-g - Elements added to a group
3650
3739
  */
@@ -3793,13 +3882,13 @@
3793
3882
  * @param {boolean|ShadowOptions} shadowOptions The shadow options. If
3794
3883
  * `true`, the default options are applied. If `false`, the current
3795
3884
  * shadow will be removed.
3796
- * @param {SVGElement} [group] The SVG group element where the shadows will
3885
+ * @param {Highcharts.SVGElement} [group] The SVG group element where the shadows will
3797
3886
  * be applied. The default is to add it to the same parent as the current
3798
3887
  * element. Internally, this is ised for pie slices, where all the
3799
3888
  * shadows are added to an element behind all the slices.
3800
3889
  * @param {boolean} [cutOff] Used internally for column shadows.
3801
3890
  *
3802
- * @returns {SVGElement} Returns the SVGElement for chaining.
3891
+ * @returns {Highcharts.SVGElement} Returns the SVGElement for chaining.
3803
3892
  *
3804
3893
  * @example
3805
3894
  * renderer.rect(10, 100, 100, 100)
@@ -3884,7 +3973,8 @@
3884
3973
 
3885
3974
  /**
3886
3975
  * Get the current value of an attribute or pseudo attribute, used mainly
3887
- * for animation. Called internally from the {@link SVGRenderer#attr}
3976
+ * for animation. Called internally from the {@link
3977
+ * Highcharts.SVGRenderer#attr}
3888
3978
  * function.
3889
3979
  *
3890
3980
  * @private
@@ -4059,7 +4149,7 @@
4059
4149
  _defaultSetter: function(value, key, element) {
4060
4150
  element.setAttribute(key, value);
4061
4151
  }
4062
- };
4152
+ });
4063
4153
 
4064
4154
  // Some shared setters and getters
4065
4155
  SVGElement.prototype.yGetter = SVGElement.prototype.xGetter;
@@ -4111,16 +4201,16 @@
4111
4201
  * @sample highcharts/members/renderer-on-chart - Annotating a chart programmatically.
4112
4202
  * @sample highcharts/members/renderer-basic - Independedt SVG drawing.
4113
4203
  *
4114
- * @class
4204
+ * @class Highcharts.SVGRenderer
4115
4205
  */
4116
4206
  SVGRenderer = H.SVGRenderer = function() {
4117
4207
  this.init.apply(this, arguments);
4118
4208
  };
4119
- SVGRenderer.prototype = {
4209
+ extend(SVGRenderer.prototype, /** @lends Highcharts.SVGRenderer.prototype */ {
4120
4210
  /**
4121
4211
  * A pointer to the renderer's associated Element class. The VMLRenderer
4122
4212
  * will have a pointer to VMLElement here.
4123
- * @type {SVGElement}
4213
+ * @type {Highcharts.SVGElement}
4124
4214
  */
4125
4215
  Element: SVGElement,
4126
4216
  SVG_NS: SVG_NS,
@@ -4159,7 +4249,7 @@
4159
4249
  this.box = element;
4160
4250
  /**
4161
4251
  * The wrapper for the root `svg` node of the renderer.
4162
- * @type {SVGElement}
4252
+ * @type {Highcharts.SVGElement}
4163
4253
  */
4164
4254
  this.boxWrapper = boxWrapper;
4165
4255
  renderer.alignedObjects = [];
@@ -4179,7 +4269,7 @@
4179
4269
 
4180
4270
  // Add description
4181
4271
  desc = this.createElement('desc').add();
4182
- desc.element.appendChild(doc.createTextNode('Created with Highcharts 5.0.11'));
4272
+ desc.element.appendChild(doc.createTextNode('Created with Highcharts 5.0.12'));
4183
4273
 
4184
4274
 
4185
4275
  renderer.defs = this.createElement('defs').add();
@@ -4296,7 +4386,7 @@
4296
4386
  * SVGRenderer#rect} or {@link SVGRenderer#text}.
4297
4387
  *
4298
4388
  * @param {string} nodeName - The node name, for example `rect`, `g` etc.
4299
- * @returns {SVGElement} The generated SVGElement.
4389
+ * @returns {Highcharts.SVGElement} The generated SVGElement.
4300
4390
  */
4301
4391
  createElement: function(nodeName) {
4302
4392
  var wrapper = new this.Element();
@@ -4384,7 +4474,7 @@
4384
4474
  * CSS text features like `width`, `text-overflow`, `white-space`, and
4385
4475
  * also attributes like `href` and `style`.
4386
4476
  * @private
4387
- * @param {SVGElement} wrapper The parent SVGElement.
4477
+ * @param {Highcharts.SVGElement} wrapper The parent SVGElement.
4388
4478
  */
4389
4479
  buildText: function(wrapper) {
4390
4480
  var textNode = wrapper.element,
@@ -4461,7 +4551,7 @@
4461
4551
 
4462
4552
  clsRegex = /<.*class="([^"]+)".*>/;
4463
4553
  styleRegex = /<.*style="([^"]+)".*>/;
4464
- hrefRegex = /<.*href="(http[^"]+)".*>/;
4554
+ hrefRegex = /<.*href="([^"]+)".*>/;
4465
4555
 
4466
4556
  if (tempParent) {
4467
4557
  tempParent.appendChild(textNode); // attach it to the DOM to read offset width
@@ -4848,13 +4938,19 @@
4848
4938
  * var path = renderer.path(['M', 10, 10, 'L', 30, 30, 'z'])
4849
4939
  * .attr({ stroke: '#ff00ff' })
4850
4940
  * .add();
4851
- * @returns {SVGElement} The generated wrapper element.
4941
+ * @returns {Highcharts.SVGElement} The generated wrapper element.
4942
+ *
4943
+ * @sample highcharts/members/renderer-path-on-chart/
4944
+ * Draw a path in a chart
4945
+ * @sample highcharts/members/renderer-path/
4946
+ * Draw a path independent from a chart
4947
+ *
4852
4948
  */
4853
4949
  /**
4854
4950
  * Draw a path, wraps the SVG `path` element.
4855
4951
  *
4856
4952
  * @param {SVGAttributes} [attribs] The initial attributes.
4857
- * @returns {SVGElement} The generated wrapper element.
4953
+ * @returns {Highcharts.SVGElement} The generated wrapper element.
4858
4954
  */
4859
4955
  path: function(path) {
4860
4956
  var attribs = {
@@ -4876,13 +4972,15 @@
4876
4972
  * @param {number} [x] The center x position.
4877
4973
  * @param {number} [y] The center y position.
4878
4974
  * @param {number} [r] The radius.
4879
- * @returns {SVGElement} The generated wrapper element.
4975
+ * @returns {Highcharts.SVGElement} The generated wrapper element.
4976
+ *
4977
+ * @sample highcharts/members/renderer-circle/ Drawing a circle
4880
4978
  */
4881
4979
  /**
4882
4980
  * Draw a circle, wraps the SVG `circle` element.
4883
4981
  *
4884
4982
  * @param {SVGAttributes} [attribs] The initial attributes.
4885
- * @returns {SVGElement} The generated wrapper element.
4983
+ * @returns {Highcharts.SVGElement} The generated wrapper element.
4886
4984
  */
4887
4985
  circle: function(x, y, r) {
4888
4986
  var attribs = isObject(x) ? x : {
@@ -4910,12 +5008,15 @@
4910
5008
  * 0 is to the right and `-Math.PI/2` is up.
4911
5009
  * @param {number} [end=0] The ending angle of the arc in radians, where 0
4912
5010
  * is to the right and `-Math.PI/2` is up.
4913
- * @returns {SVGElement} The generated wrapper element.
5011
+ * @returns {Highcharts.SVGElement} The generated wrapper element.
5012
+ *
5013
+ * @sample highcharts/members/renderer-arc/
5014
+ * Drawing an arc
4914
5015
  */
4915
5016
  /**
4916
5017
  * Draw and return an arc. Overloaded function that takes arguments object.
4917
5018
  * @param {SVGAttributes} attribs Initial SVG attributes.
4918
- * @returns {SVGElement} The generated wrapper element.
5019
+ * @returns {Highcharts.SVGElement} The generated wrapper element.
4919
5020
  */
4920
5021
  arc: function(x, y, r, innerR, start, end) {
4921
5022
  var arc,
@@ -4953,13 +5054,19 @@
4953
5054
  * @param {number} [r] Border corner radius.
4954
5055
  * @param {number} [strokeWidth] A stroke width can be supplied to allow
4955
5056
  * crisp drawing.
4956
- * @returns {SVGElement} The generated wrapper element.
5057
+ * @returns {Highcharts.SVGElement} The generated wrapper element.
4957
5058
  */
4958
5059
  /**
4959
5060
  * Draw and return a rectangle.
4960
- * @param {SVGAttributes} [attributes] General SVG attributes for the
4961
- * rectangle.
4962
- * @returns {SVGElement} The generated wrapper element.
5061
+ * @param {SVGAttributes} [attributes]
5062
+ * General SVG attributes for the rectangle.
5063
+ * @return {Highcharts.SVGElement}
5064
+ * The generated wrapper element.
5065
+ *
5066
+ * @sample highcharts/members/renderer-rect-on-chart/
5067
+ * Draw a rectangle in a chart
5068
+ * @sample highcharts/members/renderer-rect/
5069
+ * Draw a rectangle independent from a chart
4963
5070
  */
4964
5071
  rect: function(x, y, width, height, r, strokeWidth) {
4965
5072
 
@@ -5028,11 +5135,16 @@
5028
5135
  },
5029
5136
 
5030
5137
  /**
5031
- * Create and return an svg group element.
5138
+ * Create and return an svg group element. Child {@link Highcharts.SVGElement}
5139
+ * objects are added to the group by using the group as the first parameter
5140
+ * in {@link Highcharts.SVGElement#add|add()}.
5032
5141
  *
5033
5142
  * @param {string} [name] The group will be given a class name of
5034
5143
  * `highcharts-{name}`. This can be used for styling and scripting.
5035
- * @returns {SVGElement} The generated wrapper element.
5144
+ * @returns {Highcharts.SVGElement} The generated wrapper element.
5145
+ *
5146
+ * @sample highcharts/members/renderer-g/
5147
+ * Show and hide grouped objects
5036
5148
  */
5037
5149
  g: function(name) {
5038
5150
  var elem = this.createElement('g');
@@ -5050,7 +5162,12 @@
5050
5162
  * image file width.
5051
5163
  * @param {number} [height] The image height. If omitted it defaults to the
5052
5164
  * image file height.
5053
- * @returns {SVGElement} The generated wrapper element.
5165
+ * @returns {Highcharts.SVGElement} The generated wrapper element.
5166
+ *
5167
+ * @sample highcharts/members/renderer-image-on-chart/
5168
+ * Add an image in a chart
5169
+ * @sample highcharts/members/renderer-image/
5170
+ * Add an image independent of a chart
5054
5171
  */
5055
5172
  image: function(src, x, y, width, height) {
5056
5173
  var attribs = {
@@ -5463,7 +5580,7 @@
5463
5580
  },
5464
5581
 
5465
5582
  /**
5466
- * @typedef {SVGElement} ClipRect - A clipping rectangle that can be applied
5583
+ * @typedef {Highcharts.SVGElement} ClipRect - A clipping rectangle that can be applied
5467
5584
  * to one or more {@link SVGElement} instances. It is instanciated with the
5468
5585
  * {@link SVGRenderer#clipRect} function and applied with the {@link
5469
5586
  * SVGElement#clip} function.
@@ -5507,11 +5624,27 @@
5507
5624
 
5508
5625
 
5509
5626
  /**
5510
- * Add text to the SVG object
5511
- * @param {String} str
5512
- * @param {number} x Left position
5513
- * @param {number} y Top position
5514
- * @param {Boolean} useHTML Use HTML to render the text
5627
+ * Draw text. The text can contain a subset of HTML, like spans and anchors
5628
+ * and some basic text styling of these. For more advanced features like
5629
+ * border and background, use {@link Highcharts.SVGRenderer#label} instead.
5630
+ * To update the text after render, run `text.attr({ text: 'New text' })`.
5631
+ * @param {String} str
5632
+ * The text of (subset) HTML to draw.
5633
+ * @param {number} x
5634
+ * The x position of the text's lower left corner.
5635
+ * @param {number} y
5636
+ * The y position of the text's lower left corner.
5637
+ * @param {Boolean} [useHTML=false]
5638
+ * Use HTML to render the text.
5639
+ *
5640
+ * @return {Highcharts.SVGElement} The text object.
5641
+ *
5642
+ * @sample highcharts/members/renderer-text-on-chart/
5643
+ * Annotate the chart freely
5644
+ * @sample highcharts/members/renderer-on-chart/
5645
+ * Annotate with a border and in response to the data
5646
+ * @sample highcharts/members/renderer-text/
5647
+ * Formatted text
5515
5648
  */
5516
5649
  text: function(str, x, y, useHTML) {
5517
5650
 
@@ -5626,20 +5759,42 @@
5626
5759
  },
5627
5760
 
5628
5761
  /**
5629
- * Add a label, a text item that can hold a colored or gradient background
5630
- * as well as a border and shadow. Supported custom attributes include
5631
- * `padding`.
5762
+ * Draw a label, which is an extended text element with support for border
5763
+ * and background. Highcharts creates a `g` element with a text and a `path`
5764
+ * or `rect` inside, to make it behave somewhat like a HTML div. Border and
5765
+ * background are set through `stroke`, `stroke-width` and `fill` attributes
5766
+ * using the {@link Highcharts.SVGElement#attr|attr} method. To update the
5767
+ * text after render, run `label.attr({ text: 'New text' })`.
5632
5768
  *
5633
- * @param {string} str
5634
- * @param {number} x
5635
- * @param {number} y
5636
- * @param {String} shape
5637
- * @param {number} anchorX In case the shape has a pointer, like a flag, this is the
5638
- * coordinates it should be pinned to
5639
- * @param {number} anchorY
5640
- * @param {Boolean} baseline Whether to position the label relative to the text baseline,
5641
- * like renderer.text, or to the upper border of the rectangle.
5642
- * @param {String} className Class name for the group
5769
+ * @param {string} str
5770
+ * The initial text string or (subset) HTML to render.
5771
+ * @param {number} x
5772
+ * The x position of the label's left side.
5773
+ * @param {number} y
5774
+ * The y position of the label's top side or baseline, depending on
5775
+ * the `baseline` parameter.
5776
+ * @param {String} shape
5777
+ * The shape of the label's border/background, if any. Defaults to
5778
+ * `rect`. Other possible values are `callout` or other shapes
5779
+ * defined in {@link Highcharts.SVGRenderer#symbols}.
5780
+ * @param {number} anchorX
5781
+ * In case the `shape` has a pointer, like a flag, this is the
5782
+ * coordinates it should be pinned to.
5783
+ * @param {number} anchorY
5784
+ * In case the `shape` has a pointer, like a flag, this is the
5785
+ * coordinates it should be pinned to.
5786
+ * @param {Boolean} baseline
5787
+ * Whether to position the label relative to the text baseline,
5788
+ * like {@link Highcharts.SVGRenderer#text|renderer.text}, or to the
5789
+ * upper border of the rectangle.
5790
+ * @param {String} className
5791
+ * Class name for the group.
5792
+ *
5793
+ * @return {Highcharts.SVGElement}
5794
+ * The generated label.
5795
+ *
5796
+ * @sample highcharts/members/renderer-label-on-chart/
5797
+ * A label on the chart
5643
5798
  */
5644
5799
  label: function(str, x, y, shape, anchorX, anchorY, useHTML, baseline, className) {
5645
5800
 
@@ -5959,7 +6114,7 @@
5959
6114
  }
5960
6115
  });
5961
6116
  }
5962
- }; // end SVGRenderer
6117
+ }); // end SVGRenderer
5963
6118
 
5964
6119
 
5965
6120
  // general renderer
@@ -7527,7 +7682,7 @@
7527
7682
  useUTC: true,
7528
7683
  //timezoneOffset: 0,
7529
7684
 
7530
- VMLRadialGradientURL: 'http://code.highcharts.com/5.0.11/gfx/vml-radial-gradient.png'
7685
+ VMLRadialGradientURL: 'http://code.highcharts.com/5.0.12/gfx/vml-radial-gradient.png'
7531
7686
 
7532
7687
  },
7533
7688
  chart: {
@@ -7643,7 +7798,8 @@
7643
7798
  itemStyle: {
7644
7799
  color: '#333333',
7645
7800
  fontSize: '12px',
7646
- fontWeight: 'bold'
7801
+ fontWeight: 'bold',
7802
+ textOverflow: 'ellipsis'
7647
7803
  },
7648
7804
  itemHoverStyle: {
7649
7805
  //cursor: 'pointer', removed as of #601
@@ -7896,6 +8052,7 @@
7896
8052
  this.pos = pos;
7897
8053
  this.type = type || '';
7898
8054
  this.isNew = true;
8055
+ this.isNewLabel = true;
7899
8056
 
7900
8057
  if (!type && !noLabel) {
7901
8058
  this.addLabel();
@@ -8335,9 +8492,11 @@
8335
8492
  // Set the new position, and show or hide
8336
8493
  if (show && isNumber(xy.y)) {
8337
8494
  xy.opacity = opacity;
8338
- label[tick.isNew ? 'attr' : 'animate'](xy);
8495
+ label[tick.isNewLabel ? 'attr' : 'animate'](xy);
8496
+ tick.isNewLabel = false;
8339
8497
  } else {
8340
8498
  label.attr('y', -9999); // #1338
8499
+ tick.isNewLabel = true;
8341
8500
  }
8342
8501
  tick.isNew = false;
8343
8502
  }
@@ -8422,7 +8581,7 @@
8422
8581
 
8423
8582
  /**
8424
8583
  * Create a new axis object. Called internally when instanciating a new chart or
8425
- * adding axes by {@link Chart#addAxis}.
8584
+ * adding axes by {@link Highcharts.Chart#addAxis}.
8426
8585
  *
8427
8586
  * A chart can have from 0 axes (pie chart) to multiples. In a normal, single
8428
8587
  * series cartesian chart, there is one X axis and one Y axis.
@@ -8455,7 +8614,10 @@
8455
8614
  H.extend(Axis.prototype, /** @lends Highcharts.Axis.prototype */ {
8456
8615
 
8457
8616
  /**
8458
- * Default options for the X axis - the Y axis has extended defaults
8617
+ * Default options for the X axis - the Y axis has extended defaults.
8618
+ *
8619
+ * @private
8620
+ * @type {Object}
8459
8621
  */
8460
8622
  defaultOptions: {
8461
8623
  // allowDecimals: null,
@@ -8558,7 +8720,10 @@
8558
8720
  },
8559
8721
 
8560
8722
  /**
8561
- * This options set extends the defaultOptions for Y axes
8723
+ * This options set extends the defaultOptions for Y axes.
8724
+ *
8725
+ * @private
8726
+ * @type {Object}
8562
8727
  */
8563
8728
  defaultYAxisOptions: {
8564
8729
  endOnTick: true,
@@ -8602,7 +8767,10 @@
8602
8767
  },
8603
8768
 
8604
8769
  /**
8605
- * These options extend the defaultOptions for left axes
8770
+ * These options extend the defaultOptions for left axes.
8771
+ *
8772
+ * @private
8773
+ * @type {Object}
8606
8774
  */
8607
8775
  defaultLeftAxisOptions: {
8608
8776
  labels: {
@@ -8614,7 +8782,10 @@
8614
8782
  },
8615
8783
 
8616
8784
  /**
8617
- * These options extend the defaultOptions for right axes
8785
+ * These options extend the defaultOptions for right axes.
8786
+ *
8787
+ * @private
8788
+ * @type {Object}
8618
8789
  */
8619
8790
  defaultRightAxisOptions: {
8620
8791
  labels: {
@@ -8626,7 +8797,10 @@
8626
8797
  },
8627
8798
 
8628
8799
  /**
8629
- * These options extend the defaultOptions for bottom axes
8800
+ * These options extend the defaultOptions for bottom axes.
8801
+ *
8802
+ * @private
8803
+ * @type {Object}
8630
8804
  */
8631
8805
  defaultBottomAxisOptions: {
8632
8806
  labels: {
@@ -8640,7 +8814,10 @@
8640
8814
  }
8641
8815
  },
8642
8816
  /**
8643
- * These options extend the defaultOptions for top axes
8817
+ * These options extend the defaultOptions for top axes.
8818
+ *
8819
+ * @private
8820
+ * @type {Object}
8644
8821
  */
8645
8822
  defaultTopAxisOptions: {
8646
8823
  labels: {
@@ -8666,7 +8843,7 @@
8666
8843
  axis.chart = chart;
8667
8844
 
8668
8845
  // Flag, is the axis horizontal
8669
- axis.horiz = chart.inverted ? !isXAxis : isXAxis;
8846
+ axis.horiz = chart.inverted && !axis.isZAxis ? !isXAxis : isXAxis;
8670
8847
 
8671
8848
  // Flag, isXAxis
8672
8849
  axis.isXAxis = isXAxis;
@@ -8795,7 +8972,7 @@
8795
8972
  axis.series = axis.series || []; // populated by Series
8796
8973
 
8797
8974
  // inverted charts have reversed xAxes as default
8798
- if (chart.inverted && isXAxis && axis.reversed === undefined) {
8975
+ if (chart.inverted && !axis.isZAxis && isXAxis && axis.reversed === undefined) {
8799
8976
  axis.reversed = true;
8800
8977
  }
8801
8978
 
@@ -8833,7 +9010,11 @@
8833
9010
 
8834
9011
  /**
8835
9012
  * The default label formatter. The context is a special config object for
8836
- * the label.
9013
+ * the label. In apps, use the {@link
9014
+ * https://api.highcharts.com/highcharts/xAxis.labels.formatter|
9015
+ * labels.formatter} instead except when a modification is needed.
9016
+ *
9017
+ * @private
8837
9018
  */
8838
9019
  defaultLabelFormatter: function() {
8839
9020
  var axis = this.axis,
@@ -9138,7 +9319,18 @@
9138
9319
  },
9139
9320
 
9140
9321
  /**
9141
- * Set the tick positions of a linear axis to round values like whole tens or every five.
9322
+ * Internal function to et the tick positions of a linear axis to round
9323
+ * values like whole tens or every five.
9324
+ *
9325
+ * @param {Number} tickInterval
9326
+ * The normalized tick interval
9327
+ * @param {Number} min
9328
+ * Axis minimum.
9329
+ * @param {Number} max
9330
+ * Axis maximum.
9331
+ *
9332
+ * @return {Array.<Number>}
9333
+ * An array of numbers where ticks should be placed.
9142
9334
  */
9143
9335
  getLinearTickPositions: function(tickInterval, min, max) {
9144
9336
  var pos,
@@ -9244,6 +9436,8 @@
9244
9436
  * not yet processed, so we don't have information on data cropping and grouping, or
9245
9437
  * updated axis.pointRange or series.pointRange. The data can't be processed until
9246
9438
  * we have finally established min and max.
9439
+ *
9440
+ * @private
9247
9441
  */
9248
9442
  adjustForMinRange: function() {
9249
9443
  var axis = this,
@@ -9251,7 +9445,7 @@
9251
9445
  min = axis.min,
9252
9446
  max = axis.max,
9253
9447
  zoomOffset,
9254
- spaceAvailable = axis.dataMax - axis.dataMin >= axis.minRange,
9448
+ spaceAvailable,
9255
9449
  closestDataRange,
9256
9450
  i,
9257
9451
  distance,
@@ -9287,6 +9481,8 @@
9287
9481
 
9288
9482
  // if minRange is exceeded, adjust
9289
9483
  if (max - min < axis.minRange) {
9484
+
9485
+ spaceAvailable = axis.dataMax - axis.dataMin >= axis.minRange;
9290
9486
  minRange = axis.minRange;
9291
9487
  zoomOffset = (minRange - max + min) / 2;
9292
9488
 
@@ -9318,7 +9514,9 @@
9318
9514
  },
9319
9515
 
9320
9516
  /**
9321
- * Find the closestPointRange across all series
9517
+ * Find the closestPointRange across all series.
9518
+ *
9519
+ * @private
9322
9520
  */
9323
9521
  getClosest: function() {
9324
9522
  var ret;
@@ -9385,7 +9583,7 @@
9385
9583
 
9386
9584
  if (this.names.length > 0) {
9387
9585
  this.names.length = 0;
9388
- this.minRange = undefined;
9586
+ this.minRange = this.userMinRange; // Reset
9389
9587
  each(this.series || [], function(series) {
9390
9588
 
9391
9589
  // Reset incrementer (#5928)
@@ -9843,8 +10041,11 @@
9843
10041
  },
9844
10042
 
9845
10043
  /**
9846
- * Check if there are multiple axes in the same pane
9847
- * @returns {Boolean} There are other axes
10044
+ * Check if there are multiple axes in the same pane.
10045
+ *
10046
+ * @private
10047
+ * @return {Boolean}
10048
+ * True if there are other axes.
9848
10049
  */
9849
10050
  alignToOthers: function() {
9850
10051
  var others = {}, // Whether there is another axis to pair with this one
@@ -9913,7 +10114,9 @@
9913
10114
 
9914
10115
  /**
9915
10116
  * When using multiple axes, adjust the number of ticks to match the highest
9916
- * number of ticks in that group
10117
+ * number of ticks in that group.
10118
+ *
10119
+ * @private
9917
10120
  */
9918
10121
  adjustTickAmount: function() {
9919
10122
  var tickInterval = this.tickInterval,
@@ -10017,24 +10220,28 @@
10017
10220
  * will not allow a range lower than the `minRange` option, which by default
10018
10221
  * is the range of five points.
10019
10222
  *
10020
- * @param {Number} [newMin]
10021
- * The new minimum value.
10022
- * @param {Number} [newMax]
10023
- * The new maximum value.
10024
- * @param {Boolean} [redraw=true]
10025
- * Whether to redraw the chart or wait for an explicit call to
10026
- * {@link Highcharts.Chart#redraw}
10027
- * @param {AnimationOptions} [animation=true]
10028
- * Enable or modify animations.
10029
- * @param {Object} [eventArguments]
10030
- * Arguments to be accessed in event handler.
10223
+ * @param {Number} [newMin]
10224
+ * The new minimum value.
10225
+ * @param {Number} [newMax]
10226
+ * The new maximum value.
10227
+ * @param {Boolean} [redraw=true]
10228
+ * Whether to redraw the chart or wait for an explicit call to
10229
+ * {@link Highcharts.Chart#redraw}
10230
+ * @param {AnimationOptions} [animation=true]
10231
+ * Enable or modify animations.
10232
+ * @param {Object} [eventArguments]
10233
+ * Arguments to be accessed in event handler.
10031
10234
  *
10032
10235
  * @sample highcharts/members/axis-setextremes/
10033
- * Set extremes from a button
10236
+ * Set extremes from a button
10034
10237
  * @sample highcharts/members/axis-setextremes-datetime/
10035
- * Set extremes on a datetime axis
10238
+ * Set extremes on a datetime axis
10036
10239
  * @sample highcharts/members/axis-setextremes-off-ticks/
10037
- * Set extremes off ticks
10240
+ * Set extremes off ticks
10241
+ * @sample stock/members/axis-setextremes/
10242
+ * Set extremes in Highstock
10243
+ * @sample maps/members/axis-setextremes/
10244
+ * Set extremes in Highmaps
10038
10245
  */
10039
10246
  setExtremes: function(newMin, newMax, redraw, animation, eventArguments) {
10040
10247
  var axis = this,
@@ -10174,7 +10381,11 @@
10174
10381
  *
10175
10382
  * @returns {Extremes}
10176
10383
  * An object containing extremes information.
10177
- * @sample members/axis-getextremes/ Report extremes by click on a button
10384
+ *
10385
+ * @sample members/axis-getextremes/
10386
+ * Report extremes by click on a button
10387
+ * @sample maps/members/axis-getextremes/
10388
+ * Get extremes in Highmaps
10178
10389
  */
10179
10390
  getExtremes: function() {
10180
10391
  var axis = this,
@@ -10214,8 +10425,13 @@
10214
10425
  },
10215
10426
 
10216
10427
  /**
10217
- * Compute auto alignment for the axis label based on which side the axis is on
10218
- * and the given rotation for the label
10428
+ * Compute auto alignment for the axis label based on which side the axis is
10429
+ * on and the given rotation for the label.
10430
+ *
10431
+ * @param {Number} rotation
10432
+ * The rotation in degrees as set by either the `rotation` or
10433
+ * `autoRotation` options.
10434
+ * @private
10219
10435
  */
10220
10436
  autoLabelAlign: function(rotation) {
10221
10437
  var ret,
@@ -10255,9 +10471,10 @@
10255
10471
  * Return the size of the labels
10256
10472
  */
10257
10473
  labelMetrics: function() {
10474
+ var index = this.tickPositions && this.tickPositions[0] || 0;
10258
10475
  return this.chart.renderer.fontMetrics(
10259
10476
  this.options.labels.style && this.options.labels.style.fontSize,
10260
- this.ticks[0] && this.ticks[0].label
10477
+ this.ticks[index] && this.ticks[index].label
10261
10478
  );
10262
10479
  },
10263
10480
 
@@ -10525,8 +10742,12 @@
10525
10742
 
10526
10743
  /**
10527
10744
  * Generates a tick for initial positioning.
10528
- * @param {number} pos - The tick position in axis values.
10529
- * @param {number} i - The index of the tick in axis.tickPositions.
10745
+ *
10746
+ * @private
10747
+ * @param {number} pos
10748
+ * The tick position in axis values.
10749
+ * @param {number} i
10750
+ * The index of the tick in {@link Axis.tickPositions}.
10530
10751
  */
10531
10752
  generateTick: function(pos) {
10532
10753
  var ticks = this.ticks;
@@ -10550,7 +10771,7 @@
10550
10771
  ticks = axis.ticks,
10551
10772
  horiz = axis.horiz,
10552
10773
  side = axis.side,
10553
- invertedSide = chart.inverted ? [1, 0, 3, 2][side] : side,
10774
+ invertedSide = chart.inverted && !axis.isZAxis ? [1, 0, 3, 2][side] : side,
10554
10775
  hasData,
10555
10776
  showAxis,
10556
10777
  titleOffset = 0,
@@ -10683,13 +10904,26 @@
10683
10904
  0 // #4866
10684
10905
  );
10685
10906
 
10686
- // Decide the clipping needed to keep the graph inside the plot area and axis lines
10687
- clip = options.offset ? 0 : Math.floor(axis.axisLine.strokeWidth() / 2) * 2; // #4308, #4371
10688
- clipOffset[invertedSide] = Math.max(clipOffset[invertedSide], clip);
10907
+ // Decide the clipping needed to keep the graph inside the plot area and
10908
+ // axis lines
10909
+ clip = Math.floor(axis.axisLine.strokeWidth() / 2) * 2; // #4308, #4371
10910
+ if (options.offset > 0) {
10911
+ clip -= options.offset * 2;
10912
+ }
10913
+ clipOffset[invertedSide] = Math.max(
10914
+ clipOffset[invertedSide] || clip,
10915
+ clip
10916
+ );
10689
10917
  },
10690
10918
 
10691
10919
  /**
10692
- * Get the path for the axis line
10920
+ * Internal function to get the path for the axis line. Extended for polar
10921
+ * charts.
10922
+ *
10923
+ * @param {Number} lineWidth
10924
+ * The line width in pixels.
10925
+ * @return {Array}
10926
+ * The SVG path definition in array form.
10693
10927
  */
10694
10928
  getLinePath: function(lineWidth) {
10695
10929
  var chart = this.chart,
@@ -10697,7 +10931,8 @@
10697
10931
  offset = this.offset,
10698
10932
  horiz = this.horiz,
10699
10933
  lineLeft = this.left + (opposite ? this.width : 0) + offset,
10700
- lineTop = chart.chartHeight - this.bottom - (opposite ? this.height : 0) + offset;
10934
+ lineTop = chart.chartHeight - this.bottom -
10935
+ (opposite ? this.height : 0) + offset;
10701
10936
 
10702
10937
  if (opposite) {
10703
10938
  lineWidth *= -1; // crispify the other way - #1480, #1687
@@ -10968,11 +11203,14 @@
10968
11203
  }
10969
11204
 
10970
11205
  if (axisTitle && showAxis) {
10971
-
10972
- axisTitle[axisTitle.isNew ? 'attr' : 'animate'](
10973
- axis.getTitlePosition()
10974
- );
10975
- axisTitle.isNew = false;
11206
+ var titleXy = axis.getTitlePosition();
11207
+ if (isNumber(titleXy.y)) {
11208
+ axisTitle[axisTitle.isNew ? 'attr' : 'animate'](titleXy);
11209
+ axisTitle.isNew = false;
11210
+ } else {
11211
+ axisTitle.attr('y', -9999);
11212
+ axisTitle.isNew = true;
11213
+ }
10976
11214
  }
10977
11215
 
10978
11216
  // Stacked totals:
@@ -11011,7 +11249,12 @@
11011
11249
  keepProps: ['extKey', 'hcEvents', 'names', 'series', 'userMax', 'userMin'],
11012
11250
 
11013
11251
  /**
11014
- * Destroys an Axis instance.
11252
+ * Destroys an Axis instance. See {@link Axis#remove} for the API endpoint
11253
+ * to fully remove the axis.
11254
+ *
11255
+ * @private
11256
+ * @param {Boolean} keepEvents
11257
+ * Whether to preserve events, used internally in Axis.update.
11015
11258
  */
11016
11259
  destroy: function(keepEvents) {
11017
11260
  var axis = this,
@@ -11064,10 +11307,13 @@
11064
11307
  },
11065
11308
 
11066
11309
  /**
11067
- * Draw the crosshair
11068
- *
11069
- * @param {Object} e The event arguments from the modified pointer event
11070
- * @param {Object} point The Point object
11310
+ * Internal function to draw a crosshair.
11311
+ *
11312
+ * @param {PointerEvent} [e]
11313
+ * The event arguments from the modified pointer event, extended
11314
+ * with `chartX` and `chartY`
11315
+ * @param {Point} [point]
11316
+ * The Point object if the crosshair snaps to points.
11071
11317
  */
11072
11318
  drawCrosshair: function(e, point) {
11073
11319
 
@@ -12413,6 +12659,18 @@
12413
12659
  if (tooltip.split) {
12414
12660
  this.renderSplit(text, pointOrPoints);
12415
12661
  } else {
12662
+
12663
+ // Prevent the tooltip from flowing over the chart box (#6659)
12664
+
12665
+ if (!options.style.width) {
12666
+
12667
+ label.css({
12668
+ width: this.chart.spacingBox.width
12669
+ });
12670
+
12671
+ }
12672
+
12673
+
12416
12674
  label.attr({
12417
12675
  text: text && text.join ? text.join('') : text
12418
12676
  });
@@ -12785,8 +13043,25 @@
12785
13043
  },
12786
13044
 
12787
13045
  /**
12788
- * Add crossbrowser support for chartX and chartY
12789
- * @param {Object} e The event object in standard browsers
13046
+ * @typedef {Object} PointerEvent
13047
+ * A native browser mouse or touch event, extended with position
13048
+ * information relative to the {@link Chart.container}.
13049
+ * @property {Number} chartX
13050
+ * The X coordinate of the pointer interaction relative to the
13051
+ * chart.
13052
+ * @property {Number} chartY
13053
+ * The Y coordinate of the pointer interaction relative to the
13054
+ * chart.
13055
+ *
13056
+ */
13057
+ /**
13058
+ * Add crossbrowser support for chartX and chartY.
13059
+ *
13060
+ * @param {Object} e
13061
+ * The event object in standard browsers.
13062
+ *
13063
+ * @return {PointerEvent}
13064
+ * A browser event with extended properties `chartX` and `chartY`
12790
13065
  */
12791
13066
  normalize: function(e, chartPosition) {
12792
13067
  var chartX,
@@ -12919,63 +13194,92 @@
12919
13194
  return point;
12920
13195
  },
12921
13196
 
12922
- getHoverData: function(existingHoverPoint, existingHoverSeries, series, isDirectTouch, shared, e) {
13197
+ getChartCoordinatesFromPoint: function(point, inverted) {
13198
+ var series = point.series,
13199
+ xAxis = series.xAxis,
13200
+ yAxis = series.yAxis;
13201
+
13202
+ if (xAxis && yAxis) {
13203
+ return inverted ? {
13204
+ chartX: xAxis.len + xAxis.pos - point.clientX,
13205
+ chartY: yAxis.len + yAxis.pos - point.plotY
13206
+ } : {
13207
+ chartX: point.clientX + xAxis.pos,
13208
+ chartY: point.plotY + yAxis.pos
13209
+ };
13210
+ }
13211
+ },
13212
+
13213
+ /**
13214
+ * Calculates what is the current hovered point/points and series.
13215
+ *
13216
+ * @private
13217
+ *
13218
+ * @param {undefined|Point} existingHoverPoint
13219
+ * The point currrently beeing hovered.
13220
+ * @param {undefined|Series} existingHoverSeries
13221
+ * The series currently beeing hovered.
13222
+ * @param {Array<.Series>} series
13223
+ * All the series in the chart.
13224
+ * @param {boolean} isDirectTouch
13225
+ * Is the pointer directly hovering the point.
13226
+ * @param {boolean} shared
13227
+ * Whether it is a shared tooltip or not.
13228
+ * @param {object} coordinates
13229
+ * Chart coordinates of the pointer.
13230
+ * @param {number} coordinates.chartX
13231
+ * @param {number} coordinates.chartY
13232
+ *
13233
+ * @return {object}
13234
+ * Object containing resulting hover data.
13235
+ */
13236
+ getHoverData: function(
13237
+ existingHoverPoint,
13238
+ existingHoverSeries,
13239
+ series,
13240
+ isDirectTouch,
13241
+ shared,
13242
+ coordinates
13243
+ ) {
12923
13244
  var hoverPoint = existingHoverPoint,
12924
13245
  hoverSeries = existingHoverSeries,
12925
- searchSeries,
13246
+ searchSeries = shared ? series : [hoverSeries],
13247
+ useExisting = !!(isDirectTouch && existingHoverPoint),
13248
+ notSticky = hoverSeries && !hoverSeries.stickyTracking,
13249
+ isHoverPoint = function(point, i) {
13250
+ return i === 0;
13251
+ },
12926
13252
  hoverPoints;
12927
13253
 
12928
- // If it has a hoverPoint and that series requires direct touch (like columns, #3899), or we're on
12929
- // a noSharedTooltip series among shared tooltip series (#4546), use the hoverPoint . Otherwise,
12930
- // search the k-d tree.
12931
- // Handle shared tooltip or cases where a series is not yet hovered
12932
- if (isDirectTouch) {
12933
- if (shared) {
12934
- hoverPoints = [];
12935
- each(series, function(s) {
12936
- // Skip hidden series
12937
- var noSharedTooltip = s.noSharedTooltip && shared,
12938
- directTouch = !shared && s.directTouch,
12939
- kdpointT;
12940
- if (s.visible && !noSharedTooltip && !directTouch && pick(s.options.enableMouseTracking, true)) { // #3821
12941
- kdpointT = s.searchKDTree({
12942
- clientX: hoverPoint.clientX,
12943
- plotY: hoverPoint.plotY
12944
- }, !noSharedTooltip && s.kdDimensions === 1);
12945
- if (kdpointT && kdpointT.series) { // Point.series becomes null when reset and before redraw (#5197)
12946
- hoverPoints.push(kdpointT);
12947
- }
12948
- }
12949
- });
12950
- // If kdTree is not built
12951
- if (hoverPoints.length === 0) {
12952
- hoverPoints = [hoverPoint];
12953
- }
12954
- } else {
12955
- hoverPoints = [hoverPoint];
12956
- }
12957
- // When the hovered series has stickyTracking false.
12958
- } else if (hoverSeries && !hoverSeries.stickyTracking) {
12959
- if (!shared) {
12960
- series = [hoverSeries];
12961
- }
12962
- hoverPoints = this.getKDPoints(series, shared, e);
12963
- hoverPoint = H.find(hoverPoints, function(p) {
13254
+ // If there is a hoverPoint and its series requires direct touch (like
13255
+ // columns, #3899), or we're on a noSharedTooltip series among shared
13256
+ // tooltip series (#4546), use the existing hoverPoint.
13257
+ if (useExisting) {
13258
+ isHoverPoint = function(p) {
13259
+ return p === existingHoverPoint;
13260
+ };
13261
+ } else if (notSticky) {
13262
+ isHoverPoint = function(p) {
12964
13263
  return p.series === hoverSeries;
12965
- });
12966
- // When the hoverSeries has stickyTracking or there is no series hovered.
13264
+ };
12967
13265
  } else {
12968
- // Avoid series with stickyTracking
13266
+ // Avoid series with stickyTracking false
12969
13267
  searchSeries = H.grep(series, function(s) {
12970
13268
  return s.stickyTracking;
12971
13269
  });
12972
- hoverPoints = this.getKDPoints(searchSeries, shared, e);
12973
- hoverPoint = hoverPoints[0];
12974
- hoverSeries = hoverPoint && hoverPoint.series;
12975
- // If
12976
- if (shared) {
12977
- hoverPoints = this.getKDPoints(series, shared, e);
12978
- }
13270
+ }
13271
+ hoverPoints = (useExisting && !shared) ?
13272
+ // Non-shared tooltips with directTouch don't use the k-d-tree
13273
+ [existingHoverPoint] :
13274
+ this.getKDPoints(searchSeries, shared, coordinates);
13275
+ hoverPoint = H.find(hoverPoints, isHoverPoint);
13276
+ hoverSeries = hoverPoint && hoverPoint.series;
13277
+
13278
+ // In this case we could only look for the hoverPoint in series with
13279
+ // stickyTracking, but we should still include all series in the shared
13280
+ // tooltip.
13281
+ if (!useExisting && !notSticky && shared) {
13282
+ hoverPoints = this.getKDPoints(series, shared, coordinates);
12979
13283
  }
12980
13284
  // Keep the order of series in tooltip
12981
13285
  // Must be done after assigning of hoverPoint
@@ -13002,24 +13306,37 @@
13002
13306
  hoverPoint = p || chart.hoverPoint,
13003
13307
  hoverSeries = hoverPoint && hoverPoint.series || chart.hoverSeries,
13004
13308
  // onMouseOver or already hovering a series with directTouch
13005
- isDirectTouch = !!p || (hoverSeries && hoverSeries.directTouch),
13006
- hoverData = this.getHoverData(hoverPoint, hoverSeries, series, isDirectTouch, shared, e),
13309
+ isDirectTouch = !!p || (
13310
+ (hoverSeries && hoverSeries.directTouch) &&
13311
+ pointer.isDirectTouch
13312
+ ),
13313
+ hoverData = this.getHoverData(
13314
+ hoverPoint,
13315
+ hoverSeries,
13316
+ series,
13317
+ isDirectTouch,
13318
+ shared,
13319
+ e
13320
+ ),
13007
13321
  useSharedTooltip,
13008
13322
  followPointer,
13009
13323
  anchor,
13010
13324
  points;
13011
-
13012
13325
  // Update variables from hoverData.
13013
13326
  hoverPoint = hoverData.hoverPoint;
13014
13327
  hoverSeries = hoverData.hoverSeries;
13015
13328
  followPointer = hoverSeries && hoverSeries.tooltipOptions.followPointer;
13016
- useSharedTooltip = shared && hoverPoint && !hoverPoint.series.noSharedTooltip;
13329
+ useSharedTooltip = (
13330
+ shared &&
13331
+ hoverPoint &&
13332
+ !hoverPoint.series.noSharedTooltip
13333
+ );
13017
13334
  points = (useSharedTooltip ?
13018
13335
  hoverData.hoverPoints :
13019
13336
  (hoverPoint ? [hoverPoint] : [])
13020
13337
  );
13021
-
13022
- // Refresh tooltip for kdpoint if new hover point or tooltip was hidden // #3926, #4200
13338
+ // Refresh tooltip for kdpoint if new hover point or tooltip was hidden
13339
+ // #3926, #4200
13023
13340
  if (
13024
13341
  hoverPoint &&
13025
13342
  // !(hoverSeries && hoverSeries.directTouch) &&
@@ -13040,13 +13357,11 @@
13040
13357
  }
13041
13358
 
13042
13359
  // If tracking is on series in stead of on each point,
13043
- // fire mouseOver on hover point.
13044
- if (hoverSeries && !hoverSeries.directTouch) { // #4448
13045
- if (chart.hoverPoint) {
13046
- chart.hoverPoint.firePointEvent('mouseOut');
13047
- }
13048
- hoverPoint.firePointEvent('mouseOver');
13360
+ // fire mouseOver on hover point. // #4448
13361
+ if (chart.hoverPoint) {
13362
+ chart.hoverPoint.firePointEvent('mouseOut');
13049
13363
  }
13364
+ hoverPoint.firePointEvent('mouseOver');
13050
13365
  chart.hoverPoints = points;
13051
13366
  chart.hoverPoint = hoverPoint;
13052
13367
  // Draw tooltip if necessary
@@ -13077,12 +13392,14 @@
13077
13392
  var snap = pick(axis.crosshair.snap, true);
13078
13393
  if (!snap) {
13079
13394
  axis.drawCrosshair(e);
13080
- // axis has snapping crosshairs, and one of the hover points is belongs to axis
13395
+
13396
+ // Axis has snapping crosshairs, and one of the hover points belongs
13397
+ // to axis
13081
13398
  } else if (H.find(points, function(p) {
13082
13399
  return p.series[axis.coll] === axis;
13083
13400
  })) {
13084
13401
  axis.drawCrosshair(e, hoverPoint);
13085
- // axis has snapping crosshairs, but no hover point is not belonging to axis
13402
+ // Axis has snapping crosshairs, but no hover point belongs to axis
13086
13403
  } else {
13087
13404
  axis.hideCrosshair();
13088
13405
  }
@@ -13090,9 +13407,12 @@
13090
13407
  },
13091
13408
 
13092
13409
  /**
13093
- * Reset the tracking by hiding the tooltip, the hover series state and the hover point
13410
+ * Reset the tracking by hiding the tooltip, the hover series state and the
13411
+ * hover point
13094
13412
  *
13095
- * @param allowMove {Boolean} Instead of destroying the tooltip altogether, allow moving it if possible
13413
+ * @param allowMove {Boolean}
13414
+ * Instead of destroying the tooltip altogether, allow moving it if
13415
+ * possible
13096
13416
  */
13097
13417
  reset: function(allowMove, delay) {
13098
13418
  var pointer = this,
@@ -13464,7 +13784,7 @@
13464
13784
  onTrackerMouseOut: function(e) {
13465
13785
  var series = this.chart.hoverSeries,
13466
13786
  relatedTarget = e.relatedTarget || e.toElement;
13467
-
13787
+ this.isDirectTouch = false;
13468
13788
  if (series && relatedTarget && !series.stickyTracking &&
13469
13789
  !this.inClass(relatedTarget, 'highcharts-tooltip') &&
13470
13790
  (!this.inClass(relatedTarget, 'highcharts-series-' + series.index) || // #2499, #4465
@@ -13973,13 +14293,13 @@
13973
14293
  }
13974
14294
 
13975
14295
  }(Highcharts));
13976
- (function(H) {
14296
+ (function(Highcharts) {
13977
14297
  /**
13978
14298
  * (c) 2010-2017 Torstein Honsi
13979
14299
  *
13980
14300
  * License: www.highcharts.com/license
13981
14301
  */
13982
- var Legend,
14302
+ var H = Highcharts,
13983
14303
 
13984
14304
  addEvent = H.addEvent,
13985
14305
  css = H.css,
@@ -13994,15 +14314,19 @@
13994
14314
  stableSort = H.stableSort,
13995
14315
  win = H.win,
13996
14316
  wrap = H.wrap;
14317
+
13997
14318
  /**
13998
- * The overview of the chart's series.
14319
+ * The overview of the chart's series. The legend object is instanciated
14320
+ * internally in the chart constructor, and available from `chart.legend`. Each
14321
+ * chart has only one legend.
14322
+ *
13999
14323
  * @class
14000
14324
  */
14001
- Legend = H.Legend = function(chart, options) {
14325
+ Highcharts.Legend = function(chart, options) {
14002
14326
  this.init(chart, options);
14003
14327
  };
14004
14328
 
14005
- Legend.prototype = {
14329
+ Highcharts.Legend.prototype = {
14006
14330
 
14007
14331
  /**
14008
14332
  * Initialize the legend
@@ -14046,10 +14370,15 @@
14046
14370
  },
14047
14371
 
14048
14372
  /**
14049
- * Update the legend with new options. Equivalent to running chart.update
14373
+ * Update the legend with new options. Equivalent to running `chart.update`
14050
14374
  * with a legend configuration option.
14051
- * @param {Object} options Legend options
14052
- * @param {Boolean} redraw Whether to redraw the chart, defaults to true.
14375
+ * @param {LegendOptions} options
14376
+ * Legend options.
14377
+ * @param {Boolean} [redraw=true]
14378
+ * Whether to redraw the chart.
14379
+ *
14380
+ * @sample highcharts/legend/legend-update/
14381
+ * Legend update
14053
14382
  */
14054
14383
  update: function(options, redraw) {
14055
14384
  var chart = this.chart;
@@ -14313,6 +14642,9 @@
14313
14642
  showCheckbox = legend.createCheckboxForItem &&
14314
14643
  seriesOptions &&
14315
14644
  seriesOptions.showCheckbox,
14645
+ // full width minus text width
14646
+ itemExtraWidth = symbolWidth + symbolPadding + itemDistance +
14647
+ (showCheckbox ? 20 : 0),
14316
14648
  useHTML = options.useHTML,
14317
14649
  fontSize = 12,
14318
14650
  itemClassName = item.options.className;
@@ -14381,6 +14713,18 @@
14381
14713
  // Colorize the items
14382
14714
  legend.colorizeItem(item, item.visible);
14383
14715
 
14716
+ // Take care of max width and text overflow (#6659)
14717
+
14718
+ if (!itemStyle.width) {
14719
+
14720
+ li.css({
14721
+ width: (options.itemWidth || chart.spacingBox.width) -
14722
+ itemExtraWidth
14723
+ });
14724
+
14725
+ }
14726
+
14727
+
14384
14728
  // Always update the text
14385
14729
  legend.setText(item);
14386
14730
 
@@ -14390,8 +14734,7 @@
14390
14734
  itemWidth = item.checkboxOffset =
14391
14735
  options.itemWidth ||
14392
14736
  item.legendItemWidth ||
14393
- symbolWidth + symbolPadding + bBox.width + itemDistance +
14394
- (showCheckbox ? 20 : 0);
14737
+ bBox.width + itemExtraWidth;
14395
14738
  legend.itemHeight = itemHeight = Math.round(
14396
14739
  item.legendItemHeight || bBox.height || legend.symbolHeight
14397
14740
  );
@@ -15011,7 +15354,7 @@
15011
15354
  // to nested group elements, as the legend item texts are within 4 group
15012
15355
  // elements.
15013
15356
  if (/Trident\/7\.0/.test(win.navigator.userAgent) || isFirefox) {
15014
- wrap(Legend.prototype, 'positionItem', function(proceed, item) {
15357
+ wrap(Highcharts.Legend.prototype, 'positionItem', function(proceed, item) {
15015
15358
  var legend = this,
15016
15359
  // If chart destroyed in sync, this is undefined (#2030)
15017
15360
  runPositionItem = function() {
@@ -15223,6 +15566,30 @@
15223
15566
  * @type {Array.<Highcharts.Series>}
15224
15567
  */
15225
15568
  this.series = [];
15569
+
15570
+ /**
15571
+ * The chart title. The title has an `update` method that allows
15572
+ * modifying the options directly or indirectly via `chart.update`.
15573
+ *
15574
+ * @memberof Highcharts.Chart
15575
+ * @name title
15576
+ * @type Object
15577
+ *
15578
+ * @sample highcharts/members/title-update/
15579
+ * Updating titles
15580
+ */
15581
+
15582
+ /**
15583
+ * The chart subtitle. The subtitle has an `update` method that allows
15584
+ * modifying the options directly or indirectly via `chart.update`.
15585
+ *
15586
+ * @memberof Highcharts.Chart
15587
+ * @name subtitle
15588
+ * @type Object
15589
+ */
15590
+
15591
+
15592
+
15226
15593
  this.hasCartesianSeries = optionsChart.showAxes;
15227
15594
  //this.axisOffset = undefined;
15228
15595
  //this.inverted = undefined;
@@ -15622,10 +15989,17 @@
15622
15989
  },
15623
15990
 
15624
15991
  /**
15625
- * Show the title and subtitle of the chart
15992
+ * Set a new title or subtitle for the chart.
15993
+ *
15994
+ * @param titleOptions {TitleOptions}
15995
+ * New title options.
15996
+ * @param subtitleOptions {SubtitleOptions}
15997
+ * New subtitle options.
15998
+ * @param redraw {Boolean}
15999
+ * Whether to redraw the chart or wait for a later call to
16000
+ * `chart.redraw()`.
15626
16001
  *
15627
- * @param titleOptions {Object} New title options
15628
- * @param subtitleOptions {Object} New subtitle options
16002
+ * @sample highcharts/members/chart-settitle/ Set title text and styles
15629
16003
  *
15630
16004
  */
15631
16005
  setTitle: function(titleOptions, subtitleOptions, redraw) {
@@ -15799,7 +16173,8 @@
15799
16173
  * @param {Boolean} revert - Revert to the saved original styles.
15800
16174
  */
15801
16175
  temporaryDisplay: function(revert) {
15802
- var node = this.renderTo;
16176
+ var node = this.renderTo,
16177
+ tempStyle;
15803
16178
  if (!revert) {
15804
16179
  while (node && node.style) {
15805
16180
  if (getStyle(node, 'display', false) === 'none') {
@@ -15808,11 +16183,15 @@
15808
16183
  height: node.style.height,
15809
16184
  overflow: node.style.overflow
15810
16185
  };
15811
- H.css(node, {
16186
+ tempStyle = {
15812
16187
  display: 'block',
15813
- height: 0,
15814
16188
  overflow: 'hidden'
15815
- });
16189
+ };
16190
+ if (node !== this.renderTo) {
16191
+ tempStyle.height = 0;
16192
+ }
16193
+
16194
+ H.css(node, tempStyle);
15816
16195
  if (node.style.setProperty) { // #2631
15817
16196
  node.style.setProperty('display', 'block', 'important');
15818
16197
  }
@@ -16123,6 +16502,8 @@
16123
16502
  * Test resizing from buttons
16124
16503
  * @sample highcharts/members/chart-setsize-jquery-resizable/
16125
16504
  * Add a jQuery UI resizable
16505
+ * @sample stock/members/chart-setsize/
16506
+ * Highstock with UI resizable
16126
16507
  */
16127
16508
  setSize: function(width, height, animation) {
16128
16509
  var chart = this,
@@ -16208,6 +16589,11 @@
16208
16589
  plotHeight,
16209
16590
  plotBorderWidth;
16210
16591
 
16592
+ function clipOffsetSide(side) {
16593
+ var offset = clipOffset[side] || 0;
16594
+ return Math.max(plotBorderWidth || offset, offset) / 2;
16595
+ }
16596
+
16211
16597
  chart.plotLeft = plotLeft = Math.round(chart.plotLeft);
16212
16598
  chart.plotTop = plotTop = Math.round(chart.plotTop);
16213
16599
  chart.plotWidth = plotWidth = Math.max(
@@ -16239,21 +16625,21 @@
16239
16625
  };
16240
16626
 
16241
16627
  plotBorderWidth = 2 * Math.floor(chart.plotBorderWidth / 2);
16242
- clipX = Math.ceil(Math.max(plotBorderWidth, clipOffset[3]) / 2);
16243
- clipY = Math.ceil(Math.max(plotBorderWidth, clipOffset[0]) / 2);
16628
+ clipX = Math.ceil(clipOffsetSide(3));
16629
+ clipY = Math.ceil(clipOffsetSide(0));
16244
16630
  chart.clipBox = {
16245
16631
  x: clipX,
16246
16632
  y: clipY,
16247
16633
  width: Math.floor(
16248
16634
  chart.plotSizeX -
16249
- Math.max(plotBorderWidth, clipOffset[1]) / 2 -
16635
+ clipOffsetSide(1) -
16250
16636
  clipX
16251
16637
  ),
16252
16638
  height: Math.max(
16253
16639
  0,
16254
16640
  Math.floor(
16255
16641
  chart.plotSizeY -
16256
- Math.max(plotBorderWidth, clipOffset[2]) / 2 -
16642
+ clipOffsetSide(2) -
16257
16643
  clipY
16258
16644
  )
16259
16645
  )
@@ -16293,7 +16679,7 @@
16293
16679
  chart[m] = pick(chart.margin[side], chart.spacing[side]);
16294
16680
  });
16295
16681
  chart.axisOffset = [0, 0, 0, 0]; // top, right, bottom, left
16296
- chart.clipOffset = [0, 0, 0, 0];
16682
+ chart.clipOffset = [];
16297
16683
  },
16298
16684
 
16299
16685
  /**
@@ -16702,7 +17088,10 @@
16702
17088
  * before adding a second chart into the same container, as well as on
16703
17089
  * window unload to prevent leaks.
16704
17090
  *
16705
- * @sample highcharts/members/chart-destroy/ Destroy the chart from a button
17091
+ * @sample highcharts/members/chart-destroy/
17092
+ * Destroy the chart from a button
17093
+ * @sample stock/members/chart-destroy/
17094
+ * Destroy with Highstock
16706
17095
  */
16707
17096
  destroy: function() {
16708
17097
  var chart = this,
@@ -16882,13 +17271,14 @@
16882
17271
  }); // end Chart
16883
17272
 
16884
17273
  }(Highcharts));
16885
- (function(H) {
17274
+ (function(Highcharts) {
16886
17275
  /**
16887
17276
  * (c) 2010-2017 Torstein Honsi
16888
17277
  *
16889
17278
  * License: www.highcharts.com/license
16890
17279
  */
16891
17280
  var Point,
17281
+ H = Highcharts,
16892
17282
 
16893
17283
  each = H.each,
16894
17284
  extend = H.extend,
@@ -16901,18 +17291,19 @@
16901
17291
  removeEvent = H.removeEvent;
16902
17292
 
16903
17293
  /**
16904
- * The Point object. The point objects are generated from the series.data
17294
+ * The Point object. The point objects are generated from the `series.data`
16905
17295
  * configuration objects or raw numbers. They can be accessed from the
16906
- * Series.points array.
16907
- * @constructor Point
17296
+ * `Series.points` array. Other ways to instaniate points are through {@link
17297
+ * Highcharts.Series#addPoint} or {@link Highcharts.Series#setData}.
17298
+ *
17299
+ * @class
16908
17300
  */
16909
- Point = H.Point = function() {};
16910
- Point.prototype = {
17301
+
17302
+ Highcharts.Point = Point = function() {};
17303
+ Highcharts.Point.prototype = {
16911
17304
 
16912
17305
  /**
16913
17306
  * Initialize the point. Called internally based on the series.data option.
16914
- * @function #init
16915
- * @memberOf Point
16916
17307
  * @param {Object} series The series object containing this point.
16917
17308
  * @param {Object} options The data in either number, array or object
16918
17309
  * format.
@@ -16926,8 +17317,22 @@
16926
17317
  colorCount = series.chart.options.chart.colorCount,
16927
17318
  colorIndex;
16928
17319
 
17320
+ /**
17321
+ * The series object associated with the point.
17322
+ *
17323
+ * @name series
17324
+ * @memberof Highcharts.Point
17325
+ * @type Highcharts.Series
17326
+ */
16929
17327
  point.series = series;
16930
17328
 
17329
+
17330
+ /**
17331
+ * The point's current color.
17332
+ * @name color
17333
+ * @memberof Highcharts.Point
17334
+ * @type {Color}
17335
+ */
16931
17336
  point.color = series.color; // #3445
16932
17337
 
16933
17338
  point.applyOptions(options, x);
@@ -16956,8 +17361,6 @@
16956
17361
  * Apply the options containing the x and y data and possible some extra
16957
17362
  * properties. Called on point init or from point.update.
16958
17363
  *
16959
- * @function #applyOptions
16960
- * @memberOf Point
16961
17364
  * @param {Object} options The point options as defined in series.data.
16962
17365
  * @param {Number} x Optionally, the X value.
16963
17366
  * @returns {Object} The Point instance.
@@ -17228,9 +17631,60 @@
17228
17631
 
17229
17632
  fireEvent(this, eventType, eventArgs, defaultFunction);
17230
17633
  },
17634
+
17635
+ /**
17636
+ * For certain series types, like pie charts, where individual points can
17637
+ * be shown or hidden.
17638
+ *
17639
+ * @name visible
17640
+ * @memberOf Highcharts.Point
17641
+ * @type {Boolean}
17642
+ */
17231
17643
  visible: true
17232
17644
  };
17233
17645
 
17646
+ /**
17647
+ * For categorized axes this property holds the category name for the
17648
+ * point. For other axes it holds the X value.
17649
+ *
17650
+ * @name category
17651
+ * @memberOf Highcharts.Point
17652
+ * @type {String|Number}
17653
+ */
17654
+
17655
+ /**
17656
+ * The percentage for points in a stacked series or pies.
17657
+ *
17658
+ * @name percentage
17659
+ * @memberOf Highcharts.Point
17660
+ * @type {Number}
17661
+ */
17662
+
17663
+ /**
17664
+ * The total of values in either a stack for stacked series, or a pie in a pie
17665
+ * series.
17666
+ *
17667
+ * @name total
17668
+ * @memberOf Highcharts.Point
17669
+ * @type {Number}
17670
+ */
17671
+
17672
+ /**
17673
+ * The x value of the point.
17674
+ *
17675
+ * @name x
17676
+ * @memberOf Highcharts.Point
17677
+ * @type {Number}
17678
+ */
17679
+
17680
+ /**
17681
+ * The y value of the point.
17682
+ *
17683
+ * @name y
17684
+ * @memberOf Highcharts.Point
17685
+ * @type {Number}
17686
+ */
17687
+
17234
17688
  }(Highcharts));
17235
17689
  (function(H) {
17236
17690
  /**
@@ -17267,28 +17721,51 @@
17267
17721
  win = H.win;
17268
17722
 
17269
17723
  /**
17270
- * The base function which all other series types inherit from. The data in the
17271
- * series is stored in various arrays.
17724
+ * This is the base series prototype that all other series types inherit from.
17725
+ * A new series is initiated either through the {@link https://api.highcharts.com/highcharts/series|
17726
+ * series} option structure, or after the chart is initiated, through {@link
17727
+ * Highcharts.Chart#addSeries}.
17728
+ *
17729
+ * The object can be accessed in a number of ways. All series and point event
17730
+ * handlers give a reference to the `series` object. The chart object has a
17731
+ * {@link Highcharts.Chart.series|series} property that is a collection of all
17732
+ * the chart's series. The point objects and axis objects also have the same
17733
+ * reference.
17734
+ *
17735
+ * Another way to reference the series programmatically is by `id`. Add an id
17736
+ * in the series configuration options, and get the series object by {@link
17737
+ * Highcharts.Chart#get}.
17272
17738
  *
17273
- * - First, series.options.data contains all the original config options for
17274
- * each point whether added by options or methods like series.addPoint.
17275
- * - Next, series.data contains those values converted to points, but in case
17276
- * the series data length exceeds the cropThreshold, or if the data is grouped,
17277
- * series.data doesn't contain all the points. It only contains the points that
17739
+ * Configuration options for the series are given in three levels. Options for
17740
+ * all series in a chart are given in the {@link https://api.highcharts.com/highcharts/plotOptions.series|
17741
+ * plotOptions.series} object. Then options for all series of a specific type
17742
+ * are given in the plotOptions of that type, for example `plotOptions.line`.
17743
+ * Next, options for one single series are given in the series array, or as
17744
+ * arguements to `chart.addSeries`.
17745
+ *
17746
+ * The data in the series is stored in various arrays.
17747
+ *
17748
+ * - First, `series.options.data` contains all the original config options for
17749
+ * each point whether added by options or methods like `series.addPoint`.
17750
+ * - Next, `series.data` contains those values converted to points, but in case
17751
+ * the series data length exceeds the `cropThreshold`, or if the data is grouped,
17752
+ * `series.data` doesn't contain all the points. It only contains the points that
17278
17753
  * have been created on demand.
17279
- * - Then there's series.points that contains all currently visible point
17754
+ * - Then there's `series.points` that contains all currently visible point
17280
17755
  * objects. In case of cropping, the cropped-away points are not part of this
17281
- * array. The series.points array starts at series.cropStart compared to
17282
- * series.data and series.options.data. If however the series data is grouped,
17756
+ * array. The `series.points` array starts at `series.cropStart` compared to
17757
+ * `series.data` and `series.options.data`. If however the series data is grouped,
17283
17758
  * these can't be correlated one to one.
17284
- * - series.xData and series.processedXData contain clean x values, equivalent
17285
- * to series.data and series.points.
17286
- * - series.yData and series.processedYData contain clean y values, equivalent
17287
- * to series.data and series.points.
17759
+ * - `series.xData` and `series.processedXData` contain clean x values, equivalent
17760
+ * to `series.data` and `series.points`.
17761
+ * - `series.yData` and `series.processedYData` contain clean y values, equivalent
17762
+ * to `series.data` and `series.points`.
17288
17763
  *
17289
- * @constructor Series
17290
- * @param {Object} chart - The chart instance.
17291
- * @param {Object} options - The series options.
17764
+ * @class Highcharts.Series
17765
+ * @param {Highcharts.Chart} chart
17766
+ * The chart instance.
17767
+ * @param {Object} options
17768
+ * The series options.
17292
17769
  */
17293
17770
  H.Series = H.seriesType('line', null, { // base series options
17294
17771
 
@@ -17409,7 +17886,7 @@
17409
17886
  // zIndex: null
17410
17887
  findNearestPointBy: 'x'
17411
17888
 
17412
- }, /** @lends Series.prototype */ {
17889
+ }, /** @lends Highcharts.Series.prototype */ {
17413
17890
  isCartesian: true,
17414
17891
  pointClass: Point,
17415
17892
  sorted: true, // requires the data to be sorted
@@ -17426,7 +17903,33 @@
17426
17903
  chartSeries = chart.series,
17427
17904
  lastSeries;
17428
17905
 
17906
+ /**
17907
+ * Read only. The chart that the series belongs to.
17908
+ *
17909
+ * @name chart
17910
+ * @memberOf Series
17911
+ * @type {Chart}
17912
+ */
17429
17913
  series.chart = chart;
17914
+
17915
+ /**
17916
+ * Read only. The series' type, like "line", "area", "column" etc. The
17917
+ * type in the series options anc can be altered using {@link
17918
+ * Series#update}.
17919
+ *
17920
+ * @name type
17921
+ * @memberOf Series
17922
+ * @type String
17923
+ */
17924
+
17925
+ /**
17926
+ * Read only. The series' current options. To update, use {@link
17927
+ * Series#update}.
17928
+ *
17929
+ * @name options
17930
+ * @memberOf Series
17931
+ * @type SeriesOptions
17932
+ */
17430
17933
  series.options = options = series.setOptions(options);
17431
17934
  series.linkedSeries = [];
17432
17935
 
@@ -17435,9 +17938,34 @@
17435
17938
 
17436
17939
  // set some variables
17437
17940
  extend(series, {
17941
+ /**
17942
+ * The series name as given in the options. Defaults to
17943
+ * "Series {n}".
17944
+ *
17945
+ * @name name
17946
+ * @memberOf Series
17947
+ * @type {String}
17948
+ */
17438
17949
  name: options.name,
17439
17950
  state: '',
17951
+ /**
17952
+ * Read only. The series' visibility state as set by {@link
17953
+ * Series#show}, {@link Series#hide}, or in the initial
17954
+ * configuration.
17955
+ *
17956
+ * @name visible
17957
+ * @memberOf Series
17958
+ * @type {Boolean}
17959
+ */
17440
17960
  visible: options.visible !== false, // true by default
17961
+ /**
17962
+ * Read only. The series' selected state as set by {@link
17963
+ * Highcharts.Series#select}.
17964
+ *
17965
+ * @name selected
17966
+ * @memberOf Series
17967
+ * @type {Boolean}
17968
+ */
17441
17969
  selected: options.selected === true // false by default
17442
17970
  });
17443
17971
 
@@ -17557,6 +18085,22 @@
17557
18085
  series.insert(axis.series);
17558
18086
 
17559
18087
  // set this series.xAxis or series.yAxis reference
18088
+ /**
18089
+ * Read only. The unique xAxis object associated with the
18090
+ * series.
18091
+ *
18092
+ * @name xAxis
18093
+ * @memberOf Series
18094
+ * @type Axis
18095
+ */
18096
+ /**
18097
+ * Read only. The unique yAxis object associated with the
18098
+ * series.
18099
+ *
18100
+ * @name yAxis
18101
+ * @memberOf Series
18102
+ * @type Axis
18103
+ */
17560
18104
  series[AXIS] = axis;
17561
18105
 
17562
18106
  // mark dirty for redraw
@@ -17815,9 +18359,40 @@
17815
18359
  drawLegendSymbol: LegendSymbolMixin.drawLineMarker,
17816
18360
 
17817
18361
  /**
17818
- * Replace the series data with a new set of data
17819
- * @param {Object} data
17820
- * @param {Object} redraw
18362
+ * Apply a new set of data to the series and optionally redraw it. The new
18363
+ * data array is passed by reference (except in case of `updatePoints`), and
18364
+ * may later be mutated when updating the chart data.
18365
+ *
18366
+ * Note the difference in behaviour when setting the same amount of points,
18367
+ * or a different amount of points, as handled by the `updatePoints`
18368
+ * parameter.
18369
+ *
18370
+ * @param {SeriesDataOptions} data
18371
+ * Takes an array of data in the same format as described under
18372
+ * `series<type>data` for the given series type.
18373
+ * @param {Boolean} [redraw=true]
18374
+ * Whether to redraw the chart after the series is altered. If doing
18375
+ * more operations on the chart, it is a good idea to set redraw to
18376
+ * false and call {@link Chart#redraw} after.
18377
+ * @param {AnimationOptions} [animation]
18378
+ * When the updated data is the same length as the existing data,
18379
+ * points will be updated by default, and animation visualizes how
18380
+ * the points are changed. Set false to disable animation, or a
18381
+ * configuration object to set duration or easing.
18382
+ * @param {Boolean} [updatePoints=true]
18383
+ * When the updated data is the same length as the existing data,
18384
+ * points will be updated instead of replaced. This allows updating
18385
+ * with animation and performs better. In this case, the original
18386
+ * array is not passed by reference. Set false to prevent.
18387
+ *
18388
+ * @sample highcharts/members/series-setdata/
18389
+ * Set new data from a button
18390
+ * @sample highcharts/members/series-setdata-pie/
18391
+ * Set data in a pie
18392
+ * @sample stock/members/series-setdata/
18393
+ * Set new data in Highstock
18394
+ * @sample maps/members/series-setdata/
18395
+ * Set new data in Highmaps
17821
18396
  */
17822
18397
  setData: function(data, redraw, animation, updatePoints) {
17823
18398
  var series = this,
@@ -17930,6 +18505,15 @@
17930
18505
  H.error(14, true);
17931
18506
  }
17932
18507
 
18508
+ /**
18509
+ * Read only. An array containing the series' data point objects. To
18510
+ * modify the data, use {@link Highcharts.Series#setData} or {@link
18511
+ * Highcharts.Point#update}.
18512
+ *
18513
+ * @name data
18514
+ * @memberOf Highcharts.Series
18515
+ * @type {Array.<Highcharts.Point>}
18516
+ */
17933
18517
  series.data = [];
17934
18518
  series.options.data = series.userOptions.data = data;
17935
18519
 
@@ -18169,6 +18753,22 @@
18169
18753
  point = (new PointClass()).init(
18170
18754
  series, [processedXData[i]].concat(splat(processedYData[i]))
18171
18755
  );
18756
+
18757
+ /**
18758
+ * Highstock only. If a point object is created by data
18759
+ * grouping, it doesn't reflect actual points in the raw data.
18760
+ * In this case, the `dataGroup` property holds information
18761
+ * that points back to the raw data.
18762
+ *
18763
+ * - `dataGroup.start` is the index of the first raw data point
18764
+ * in the group.
18765
+ * - `dataGroup.length` is the amount of points in the group.
18766
+ *
18767
+ * @name dataGroup
18768
+ * @memberOf Point
18769
+ * @type {Object}
18770
+ *
18771
+ */
18172
18772
  point.dataGroup = series.groupMap[i];
18173
18773
  }
18174
18774
  if (point) { // #6279
@@ -20083,6 +20683,8 @@
20083
20683
  *
20084
20684
  * @sample highcharts/members/chart-addseries/
20085
20685
  * Add a series from a button
20686
+ * @sample stock/members/chart-addseries/
20687
+ * Add a series in Highstock
20086
20688
  */
20087
20689
  addSeries: function(options, redraw, animation) {
20088
20690
  var series,
@@ -20144,8 +20746,21 @@
20144
20746
  },
20145
20747
 
20146
20748
  /**
20147
- * Dim the chart and show a loading text or symbol
20148
- * @param {String} str An optional text to show in the loading label instead of the default one
20749
+ * Dim the chart and show a loading text or symbol. Options for the loading
20750
+ * screen are defined in {@link
20751
+ * https://api.highcharts.com/highcharts/loading|the loading options}.
20752
+ *
20753
+ * @param {String} str
20754
+ * An optional text to show in the loading label instead of the
20755
+ * default one. The default text is set in {@link
20756
+ * http://api.highcharts.com/highcharts/lang.loading|lang.loading}.
20757
+ *
20758
+ * @sample highcharts/members/chart-hideloading/
20759
+ * Show and hide loading from a button
20760
+ * @sample highcharts/members/chart-showloading/
20761
+ * Apply different text labels
20762
+ * @sample stock/members/chart-show-hide-loading/
20763
+ * Toggle loading in Highstock
20149
20764
  */
20150
20765
  showLoading: function(str) {
20151
20766
  var chart = this,
@@ -20215,6 +20830,8 @@
20215
20830
  * @see Highcharts.Chart#showLoading
20216
20831
  * @sample highcharts/members/chart-hideloading/
20217
20832
  * Show and hide loading from a button
20833
+ * @sample stock/members/chart-show-hide-loading/
20834
+ * Toggle loading in Highstock
20218
20835
  */
20219
20836
  hideLoading: function() {
20220
20837
  var options = this.options,
@@ -20257,7 +20874,30 @@
20257
20874
  ],
20258
20875
 
20259
20876
  /**
20260
- * Chart.update function that takes the whole options stucture.
20877
+ * A generic function to update any element of the chart. Elements can be
20878
+ * enabled and disabled, moved, re-styled, re-formatted etc.
20879
+ *
20880
+ * A special case is configuration objects that take arrays, for example
20881
+ * {@link https://api.highcharts.com/highcharts/xAxis|xAxis},
20882
+ * {@link https://api.highcharts.com/highcharts/yAxis|yAxis} or
20883
+ * {@link https://api.highcharts.com/highcharts/series|series}. For these
20884
+ * collections, an `id` option is used to map the new option set to an
20885
+ * existing object. If an existing object of the same id is not found, the
20886
+ * corresponding item is updated. So for example, running `chart.update`
20887
+ * with a series item without an id, will cause the existing chart's series
20888
+ * with the same index in the series array to be updated.
20889
+ *
20890
+ * See also the {@link https://api.highcharts.com/highcharts/responsive|
20891
+ * responsive option set}. Switching between `responsive.rules` basically
20892
+ * runs `chart.update` under the hood.
20893
+ *
20894
+ * @param {Options} options
20895
+ * A configuration object for the new chart options.
20896
+ * @param {Boolean} [redraw=true]
20897
+ * Whether to redraw the chart.
20898
+ *
20899
+ * @sample highcharts/members/chart-update/
20900
+ * Update chart geometry
20261
20901
  */
20262
20902
  update: function(options, redraw) {
20263
20903
  var chart = this,
@@ -20415,14 +21055,32 @@
20415
21055
  });
20416
21056
 
20417
21057
  // extend the Point prototype for dynamic methods
20418
- extend(Point.prototype, /** @lends Point.prototype */ {
21058
+ extend(Point.prototype, /** @lends Highcharts.Point.prototype */ {
20419
21059
  /**
20420
- * Point.update with new options (typically x/y data) and optionally redraw the series.
21060
+ * Update point with new options (typically x/y data) and optionally redraw
21061
+ * the series.
20421
21062
  *
20422
- * @param {Object} options Point options as defined in the series.data array
20423
- * @param {Boolean} redraw Whether to redraw the chart or wait for an explicit call
20424
- * @param {Boolean|Object} animation Whether to apply animation, and optionally animation
20425
- * configuration
21063
+ * @param {Object} options
21064
+ * The point options. Point options are handled as described under
21065
+ * the `series<type>.data` item for each series type. For example
21066
+ * for a line series, if options is a single number, the point will
21067
+ * be given that number as the main y value. If it is an array, it
21068
+ * will be interpreted as x and y values respectively. If it is an
21069
+ * object, advanced options are applied.
21070
+ * @param {Boolean} [redraw=true]
21071
+ * Whether to redraw the chart after the point is updated. If doing
21072
+ * more operations on the chart, it is best practice to set
21073
+ * `redraw` to false and call `chart.redraw()` after.
21074
+ * @param {AnimationOptions} [animation=true]
21075
+ * Whether to apply animation, and optionally animation
21076
+ * configuration.
21077
+ *
21078
+ * @sample highcharts/members/point-update-column/
21079
+ * Update column value
21080
+ * @sample highcharts/members/point-update-pie/
21081
+ * Update pie slice
21082
+ * @sample maps/members/point-update/
21083
+ * Update map area value in Highmaps
20426
21084
  */
20427
21085
  update: function(options, redraw, animation, runEvent) {
20428
21086
  var point = this,
@@ -20494,9 +21152,21 @@
20494
21152
 
20495
21153
  /**
20496
21154
  * Remove a point and optionally redraw the series and if necessary the axes
20497
- * @param {Boolean} redraw Whether to redraw the chart or wait for an explicit call
20498
- * @param {Boolean|Object} animation Whether to apply animation, and optionally animation
20499
- * configuration
21155
+ * @param {Boolean} redraw
21156
+ * Whether to redraw the chart or wait for an explicit call. When
21157
+ * doing more operations on the chart, for example running
21158
+ * `point.remove()` in a loop, it is best practice to set `redraw`
21159
+ * to false and call `chart.redraw()` after.
21160
+ * @param {AnimationOptions} [animation=false]
21161
+ * Whether to apply animation, and optionally animation
21162
+ * configuration.
21163
+ *
21164
+ * @sample highcharts/plotoptions/series-point-events-remove/
21165
+ * Remove point and confirm
21166
+ * @sample highcharts/members/point-remove/
21167
+ * Remove pie slice
21168
+ * @sample maps/members/point-remove/
21169
+ * Remove selected points in Highmaps
20500
21170
  */
20501
21171
  remove: function(redraw, animation) {
20502
21172
  this.series.removePoint(inArray(this, this.series.data), redraw, animation);
@@ -20506,13 +21176,43 @@
20506
21176
  // Extend the series prototype for dynamic methods
20507
21177
  extend(Series.prototype, /** @lends Series.prototype */ {
20508
21178
  /**
20509
- * Add a point dynamically after chart load time
20510
- * @param {Object} options Point options as given in series.data
20511
- * @param {Boolean} redraw Whether to redraw the chart or wait for an explicit call
20512
- * @param {Boolean} shift If shift is true, a point is shifted off the start
20513
- * of the series as one is appended to the end.
20514
- * @param {Boolean|AnimationOptions} animation Whether to apply animation, and optionally animation
20515
- * configuration
21179
+ * Add a point to the series after render time. The point can be added at
21180
+ * the end, or by giving it an X value, to the start or in the middle of the
21181
+ * series.
21182
+ *
21183
+ * @param {Number|Array|Object} options
21184
+ * The point options. If options is a single number, a point with
21185
+ * that y value is appended to the series.If it is an array, it will
21186
+ * be interpreted as x and y values respectively. If it is an
21187
+ * object, advanced options as outlined under `series.data` are
21188
+ * applied.
21189
+ * @param {Boolean} [redraw=true]
21190
+ * Whether to redraw the chart after the point is added. When adding
21191
+ * more than one point, it is highly recommended that the redraw
21192
+ * option be set to false, and instead {@link Chart#redraw}
21193
+ * is explicitly called after the adding of points is finished.
21194
+ * Otherwise, the chart will redraw after adding each point.
21195
+ * @param {Boolean} [shift=false]
21196
+ * If true, a point is shifted off the start of the series as one is
21197
+ * appended to the end.
21198
+ * @param {AnimationOptions} [animation]
21199
+ * Whether to apply animation, and optionally animation
21200
+ * configuration.
21201
+ *
21202
+ * @sample highcharts/members/series-addpoint-append/
21203
+ * Append point
21204
+ * @sample highcharts/members/series-addpoint-append-and-shift/
21205
+ * Append and shift
21206
+ * @sample highcharts/members/series-addpoint-x-and-y/
21207
+ * Both X and Y values given
21208
+ * @sample highcharts/members/series-addpoint-pie/
21209
+ * Append pie slice
21210
+ * @sample stock/members/series-addpoint/
21211
+ * Append 100 points in Highstock
21212
+ * @sample stock/members/series-addpoint-shift/
21213
+ * Append and shift in Highstock
21214
+ * @sample maps/members/series-addpoint/
21215
+ * Add a point in Highmaps
20516
21216
  */
20517
21217
  addPoint: function(options, redraw, shift, animation) {
20518
21218
  var series = this,
@@ -20588,7 +21288,24 @@
20588
21288
  },
20589
21289
 
20590
21290
  /**
20591
- * Remove a point (rendered or not), by index
21291
+ * Remove a point from the series. Unlike the {@link Highcharts.Point#remove}
21292
+ * method, this can also be done on a point that is not instanciated because
21293
+ * it is outside the view or subject to Highstock data grouping.
21294
+ *
21295
+ * @param {Number} i
21296
+ * The index of the point in the {@link Highcharts.Series.data|data}
21297
+ * array.
21298
+ * @param {Boolean} [redraw=true]
21299
+ * Whether to redraw the chart after the point is added. When
21300
+ * removing more than one point, it is highly recommended that the
21301
+ * `redraw` option be set to `false`, and instead {@link
21302
+ * Highcharts.Chart#redraw} is explicitly called after the adding of
21303
+ * points is finished.
21304
+ * @param {AnimationOptions} [animation]
21305
+ * Whether and optionally how the series should be animated.
21306
+ *
21307
+ * @sample highcharts/members/series-removepoint/
21308
+ * Remove cropped point
20592
21309
  */
20593
21310
  removePoint: function(i, redraw, animation) {
20594
21311
 
@@ -20632,11 +21349,19 @@
20632
21349
  },
20633
21350
 
20634
21351
  /**
20635
- * Remove a series and optionally redraw the chart
21352
+ * Remove a series and optionally redraw the chart.
20636
21353
  *
20637
- * @param {Boolean} redraw Whether to redraw the chart or wait for an explicit call
20638
- * @param {Boolean|Object} animation Whether to apply animation, and optionally animation
20639
- * configuration
21354
+ * @param {Boolean} [redraw=true]
21355
+ * Whether to redraw the chart or wait for an explicit call to
21356
+ * {@link Highcharts.Chart#redraw}.
21357
+ * @param {AnimationOptions} [animation]
21358
+ * Whether to apply animation, and optionally animation
21359
+ * configuration
21360
+ * @param {Boolean} [withEvent=true]
21361
+ * Used internally, whether to fire the series `remove` event.
21362
+ *
21363
+ * @sample highcharts/members/series-remove/
21364
+ * Remove first series from a button
20640
21365
  */
20641
21366
  remove: function(redraw, animation, withEvent) {
20642
21367
  var series = this,
@@ -20665,7 +21390,24 @@
20665
21390
  },
20666
21391
 
20667
21392
  /**
20668
- * Series.update with a new set of options
21393
+ * Update the series with a new set of options. For a clean and precise
21394
+ * handling of new options, all methods and elements from the series are
21395
+ * removed, and it is initiated from scratch. Therefore, this method is more
21396
+ * performance expensive than some other utility methods like {@link
21397
+ * Series#setData} or {@link Series#setVisible}.
21398
+ *
21399
+ * @param {SeriesOptions} options
21400
+ * New options that will be merged with the series' existing
21401
+ * options.
21402
+ * @param {Boolean} [redraw=true]
21403
+ * Whether to redraw the chart after the series is altered. If doing
21404
+ * more operations on the chart, it is a good idea to set redraw to
21405
+ * false and call {@link Chart#redraw} after.
21406
+ *
21407
+ * @sample highcharts/members/series-update/
21408
+ * Updating series options
21409
+ * @sample maps/members/series-update/
21410
+ * Update series options in Highmaps
20669
21411
  */
20670
21412
  update: function(newOptions, redraw) {
20671
21413
  var series = this,
@@ -20679,6 +21421,14 @@
20679
21421
  preserve = ['group', 'markerGroup', 'dataLabelsGroup'],
20680
21422
  n;
20681
21423
 
21424
+ // Running Series.update to update the data only is an intuitive usage,
21425
+ // so we want to make sure that when used like this, we run the
21426
+ // cheaper setData function and allow animation instead of completely
21427
+ // recreating the series instance.
21428
+ if (Object.keys && Object.keys(newOptions).toString() === 'data') {
21429
+ return this.setData(newOptions.data, redraw);
21430
+ }
21431
+
20682
21432
  // If we're changing type or zIndex, create new groups (#3380, #3404)
20683
21433
  if ((newType && newType !== oldType) || newOptions.zIndex !== undefined) {
20684
21434
  preserve.length = 0;
@@ -21441,8 +22191,15 @@
21441
22191
  var otherOptions = otherSeries.options,
21442
22192
  otherYAxis = otherSeries.yAxis,
21443
22193
  columnIndex;
21444
- if (otherSeries.type === series.type && otherSeries.visible &&
21445
- yAxis.len === otherYAxis.len && yAxis.pos === otherYAxis.pos) { // #642, #2086
22194
+ if (
22195
+ otherSeries.type === series.type &&
22196
+ (
22197
+ otherSeries.visible ||
22198
+ !series.chart.options.chart.ignoreHiddenSeries
22199
+ ) &&
22200
+ yAxis.len === otherYAxis.len &&
22201
+ yAxis.pos === otherYAxis.pos
22202
+ ) { // #642, #2086
21446
22203
  if (otherOptions.stacking) {
21447
22204
  stackKey = otherSeries.stackKey;
21448
22205
  if (stackGroups[stackKey] === undefined) {
@@ -22543,7 +23300,7 @@
22543
23300
  hasRendered = series.hasRendered || 0,
22544
23301
  str,
22545
23302
  dataLabelsGroup,
22546
- defer = pick(options.defer, true),
23303
+ defer = pick(options.defer, !!seriesOptions.animation),
22547
23304
  renderer = series.chart.renderer;
22548
23305
 
22549
23306
  if (options.enabled || series._hasPointLabels) {
@@ -23055,41 +23812,39 @@
23055
23812
 
23056
23813
 
23057
23814
  // Detect overflowing data labels
23058
- if (series.options.size === null) {
23059
- dataLabelWidth = dataLabel.getBBox().width;
23815
+ dataLabelWidth = dataLabel.getBBox().width;
23060
23816
 
23061
- sideOverflow = null;
23062
- // Overflow left
23063
- if (x - dataLabelWidth < connectorPadding) {
23064
- sideOverflow = Math.round(
23065
- dataLabelWidth - x + connectorPadding
23066
- );
23067
- overflow[3] = Math.max(sideOverflow, overflow[3]);
23817
+ sideOverflow = null;
23818
+ // Overflow left
23819
+ if (x - dataLabelWidth < connectorPadding) {
23820
+ sideOverflow = Math.round(
23821
+ dataLabelWidth - x + connectorPadding
23822
+ );
23823
+ overflow[3] = Math.max(sideOverflow, overflow[3]);
23068
23824
 
23069
- // Overflow right
23070
- } else if (x + dataLabelWidth > plotWidth - connectorPadding) {
23071
- sideOverflow = Math.round(
23072
- x + dataLabelWidth - plotWidth + connectorPadding
23073
- );
23074
- overflow[1] = Math.max(sideOverflow, overflow[1]);
23075
- }
23825
+ // Overflow right
23826
+ } else if (x + dataLabelWidth > plotWidth - connectorPadding) {
23827
+ sideOverflow = Math.round(
23828
+ x + dataLabelWidth - plotWidth + connectorPadding
23829
+ );
23830
+ overflow[1] = Math.max(sideOverflow, overflow[1]);
23831
+ }
23076
23832
 
23077
- // Overflow top
23078
- if (y - labelHeight / 2 < 0) {
23079
- overflow[0] = Math.max(
23080
- Math.round(-y + labelHeight / 2),
23081
- overflow[0]
23082
- );
23833
+ // Overflow top
23834
+ if (y - labelHeight / 2 < 0) {
23835
+ overflow[0] = Math.max(
23836
+ Math.round(-y + labelHeight / 2),
23837
+ overflow[0]
23838
+ );
23083
23839
 
23084
- // Overflow left
23085
- } else if (y + labelHeight / 2 > plotHeight) {
23086
- overflow[2] = Math.max(
23087
- Math.round(y + labelHeight / 2 - plotHeight),
23088
- overflow[2]
23089
- );
23090
- }
23091
- dataLabel.sideOverflow = sideOverflow;
23840
+ // Overflow left
23841
+ } else if (y + labelHeight / 2 > plotHeight) {
23842
+ overflow[2] = Math.max(
23843
+ Math.round(y + labelHeight / 2 - plotHeight),
23844
+ overflow[2]
23845
+ );
23092
23846
  }
23847
+ dataLabel.sideOverflow = sideOverflow;
23093
23848
  } // for each point
23094
23849
  }); // for each half
23095
23850
 
@@ -23219,47 +23974,62 @@
23219
23974
  centerOption = options.center,
23220
23975
  minSize = options.minSize || 80,
23221
23976
  newSize = minSize,
23222
- ret;
23223
-
23224
- // Handle horizontal size and center
23225
- if (centerOption[0] !== null) { // Fixed center
23226
- newSize = Math.max(center[2] - Math.max(overflow[1], overflow[3]), minSize);
23977
+ // If a size is set, return true and don't try to shrink the pie
23978
+ // to fit the labels.
23979
+ ret = options.size !== null;
23227
23980
 
23228
- } else { // Auto center
23229
- newSize = Math.max(
23230
- center[2] - overflow[1] - overflow[3], // horizontal overflow
23231
- minSize
23232
- );
23233
- center[0] += (overflow[3] - overflow[1]) / 2; // horizontal center
23234
- }
23981
+ if (!ret) {
23982
+ // Handle horizontal size and center
23983
+ if (centerOption[0] !== null) { // Fixed center
23984
+ newSize = Math.max(center[2] -
23985
+ Math.max(overflow[1], overflow[3]), minSize);
23986
+
23987
+ } else { // Auto center
23988
+ newSize = Math.max(
23989
+ // horizontal overflow
23990
+ center[2] - overflow[1] - overflow[3],
23991
+ minSize
23992
+ );
23993
+ // horizontal center
23994
+ center[0] += (overflow[3] - overflow[1]) / 2;
23995
+ }
23235
23996
 
23236
- // Handle vertical size and center
23237
- if (centerOption[1] !== null) { // Fixed center
23238
- newSize = Math.max(Math.min(newSize, center[2] - Math.max(overflow[0], overflow[2])), minSize);
23997
+ // Handle vertical size and center
23998
+ if (centerOption[1] !== null) { // Fixed center
23999
+ newSize = Math.max(Math.min(newSize, center[2] -
24000
+ Math.max(overflow[0], overflow[2])), minSize);
23239
24001
 
23240
- } else { // Auto center
23241
- newSize = Math.max(
23242
- Math.min(
23243
- newSize,
23244
- center[2] - overflow[0] - overflow[2] // vertical overflow
23245
- ),
23246
- minSize
23247
- );
23248
- center[1] += (overflow[0] - overflow[2]) / 2; // vertical center
23249
- }
24002
+ } else { // Auto center
24003
+ newSize = Math.max(
24004
+ Math.min(
24005
+ newSize,
24006
+ // vertical overflow
24007
+ center[2] - overflow[0] - overflow[2]
24008
+ ),
24009
+ minSize
24010
+ );
24011
+ // vertical center
24012
+ center[1] += (overflow[0] - overflow[2]) / 2;
24013
+ }
23250
24014
 
23251
- // If the size must be decreased, we need to run translate and drawDataLabels again
23252
- if (newSize < center[2]) {
23253
- center[2] = newSize;
23254
- center[3] = Math.min(relativeLength(options.innerSize || 0, newSize), newSize); // #3632
23255
- this.translate(center);
24015
+ // If the size must be decreased, we need to run translate and
24016
+ // drawDataLabels again
24017
+ if (newSize < center[2]) {
24018
+ center[2] = newSize;
24019
+ center[3] = Math.min( // #3632
24020
+ relativeLength(options.innerSize || 0, newSize),
24021
+ newSize
24022
+ );
24023
+ this.translate(center);
23256
24024
 
23257
- if (this.drawDataLabels) {
23258
- this.drawDataLabels();
24025
+ if (this.drawDataLabels) {
24026
+ this.drawDataLabels();
24027
+ }
24028
+ // Else, return true to indicate that the pie and its labels is
24029
+ // within the plot area
24030
+ } else {
24031
+ ret = true;
23259
24032
  }
23260
- // Else, return true to indicate that the pie and its labels is within the plot area
23261
- } else {
23262
- ret = true;
23263
24033
  }
23264
24034
  return ret;
23265
24035
  };
@@ -23550,9 +24320,9 @@
23550
24320
  pointer = chart.pointer,
23551
24321
  onMouseOver = function(e) {
23552
24322
  var point = pointer.getPointFromEvent(e);
23553
-
23554
24323
  // undefined on graph in scatterchart
23555
24324
  if (point !== undefined) {
24325
+ pointer.isDirectTouch = true;
23556
24326
  point.onMouseOver(e);
23557
24327
  }
23558
24328
  };
@@ -23984,12 +24754,28 @@
23984
24754
  /*
23985
24755
  * Extend the Point object with interaction
23986
24756
  */
23987
- extend(Point.prototype, /** @lends Point.prototype */ {
23988
- /**
23989
- * Toggle the selection status of a point
23990
- * @param {Boolean} selected Whether to select or unselect the point.
23991
- * @param {Boolean} accumulate Whether to add to the previous selection. By default,
23992
- * this happens if the control key (Cmd on Mac) was pressed during clicking.
24757
+ extend(Point.prototype, /** @lends Highcharts.Point.prototype */ {
24758
+ /**
24759
+ * Toggle the selection status of a point.
24760
+ * @param {Boolean} [selected]
24761
+ * When `true`, the point is selected. When `false`, the point is
24762
+ * unselected. When `null` or `undefined`, the selection state is
24763
+ * toggled.
24764
+ * @param {Boolean} [accumulate=false]
24765
+ * When `true`, the selection is added to other selected points.
24766
+ * When `false`, other selected points are deselected. Internally in
24767
+ * Highcharts, when {@link http://api.highcharts.com/highcharts/plotOptions.series.allowPointSelect|allowPointSelect}
24768
+ * is `true`, selected points are accumulated on Control, Shift or
24769
+ * Cmd clicking the point.
24770
+ *
24771
+ * @see Highcharts.Chart#getSelectedPoints
24772
+ *
24773
+ * @sample highcharts/members/point-select/
24774
+ * Select a point from a button
24775
+ * @sample highcharts/chart/events-selection-points/
24776
+ * Select a range of points through a drag selection
24777
+ * @sample maps/series/data-id/
24778
+ * Select a point in Highmaps
23993
24779
  */
23994
24780
  select: function(selected, accumulate) {
23995
24781
  var point = this,
@@ -24002,6 +24788,14 @@
24002
24788
  point.firePointEvent(selected ? 'select' : 'unselect', {
24003
24789
  accumulate: accumulate
24004
24790
  }, function() {
24791
+
24792
+ /**
24793
+ * Whether the point is selected or not.
24794
+ * @see Highcharts.Point#select
24795
+ * @memberof Highcharts.Point
24796
+ * @name selected
24797
+ * @type {Boolean}
24798
+ */
24005
24799
  point.selected = point.options.selected = selected;
24006
24800
  series.options.data[inArray(point, series.data)] = point.options;
24007
24801
 
@@ -24031,7 +24825,10 @@
24031
24825
  series = point.series,
24032
24826
  chart = series.chart,
24033
24827
  pointer = chart.pointer;
24034
- point.firePointEvent('mouseOver');
24828
+ e = e ?
24829
+ pointer.normalize(e) :
24830
+ // In cases where onMouseOver is called directly without an event
24831
+ pointer.getChartCoordinatesFromPoint(point, chart.inverted);
24035
24832
  pointer.runPointActions(e, point);
24036
24833
  },
24037
24834
 
@@ -24203,8 +25000,8 @@
24203
25000
  if (haloOptions && haloOptions.size) {
24204
25001
  if (!halo) {
24205
25002
  series.halo = halo = chart.renderer.path()
24206
- // #5818, #5903
24207
- .add(hasMarkers ? series.markerGroup : series.group);
25003
+ // #5818, #5903, #6705
25004
+ .add((point.graphic || stateMarkerGraphic).parentGroup);
24208
25005
  }
24209
25006
  halo[move ? 'animate' : 'attr']({
24210
25007
  d: point.haloPath(haloOptions.size)
@@ -24255,7 +25052,7 @@
24255
25052
  * Extend the Series object with interaction
24256
25053
  */
24257
25054
 
24258
- extend(Series.prototype, /** @lends Series.prototype */ {
25055
+ extend(Series.prototype, /** @lends Highcharts.Series.prototype */ {
24259
25056
  /**
24260
25057
  * Series mouse over handler
24261
25058
  */
@@ -24383,10 +25180,15 @@
24383
25180
  },
24384
25181
 
24385
25182
  /**
24386
- * Set the visibility of the graph
25183
+ * Show or hide the series.
24387
25184
  *
24388
- * @param vis {Boolean} True to show the series, false to hide. If undefined,
24389
- * the visibility is toggled.
25185
+ * @param {Boolean} [visible]
25186
+ * True to show the series, false to hide. If undefined, the
25187
+ * visibility is toggled.
25188
+ * @param {Boolean} [redraw=true]
25189
+ * Whether to redraw the chart after the series is altered. If doing
25190
+ * more operations on the chart, it is a good idea to set redraw to
25191
+ * false and call {@link Chart#redraw|chart.redraw()} after.
24390
25192
  */
24391
25193
  setVisible: function(vis, redraw) {
24392
25194
  var series = this,
@@ -24446,14 +25248,23 @@
24446
25248
  },
24447
25249
 
24448
25250
  /**
24449
- * Show the graph
25251
+ * Show the series if hidden.
25252
+ *
25253
+ * @sample highcharts/members/series-hide/
25254
+ * Toggle visibility from a button
24450
25255
  */
24451
25256
  show: function() {
24452
25257
  this.setVisible(true);
24453
25258
  },
24454
25259
 
24455
25260
  /**
24456
- * Hide the graph
25261
+ * Hide the series if visible. If the {@link
25262
+ * https://api.highcharts.com/highcharts/chart.ignoreHiddenSeries|
25263
+ * chart.ignoreHiddenSeries} option is true, the chart is redrawn without
25264
+ * this series.
25265
+ *
25266
+ * @sample highcharts/members/series-hide/
25267
+ * Toggle visibility from a button
24457
25268
  */
24458
25269
  hide: function() {
24459
25270
  this.setVisible(false);
@@ -24461,15 +25272,24 @@
24461
25272
 
24462
25273
 
24463
25274
  /**
24464
- * Set the selected state of the graph
25275
+ * Select or unselect the series. This means its {@link
25276
+ * Highcharts.Series.selected|selected} property is set, the checkbox in the
25277
+ * legend is toggled and when selected, the series is returned by the
25278
+ * {@link Highcharts.Chart#getSelectedSeries} function.
25279
+ *
25280
+ * @param {Boolean} [selected]
25281
+ * True to select the series, false to unselect. If undefined, the
25282
+ * selection state is toggled.
24465
25283
  *
24466
- * @param selected {Boolean} True to select the series, false to unselect. If
24467
- * undefined, the selection state is toggled.
25284
+ * @sample highcharts/members/series-select/
25285
+ * Select a series from a button
24468
25286
  */
24469
25287
  select: function(selected) {
24470
25288
  var series = this;
24471
- // if called without an argument, toggle
24472
- series.selected = selected = (selected === undefined) ? !series.selected : selected;
25289
+
25290
+ series.selected = selected = (selected === undefined) ?
25291
+ !series.selected :
25292
+ selected;
24473
25293
 
24474
25294
  if (series.checkbox) {
24475
25295
  series.checkbox.checked = selected;