dumbbell.src.js 62 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453
  1. /**
  2. * @license Highcharts JS v8.2.2 (2020-10-22)
  3. *
  4. * (c) 2009-2019 Sebastian Bochan, Rafal Sebestjanski
  5. *
  6. * License: www.highcharts.com/license
  7. */
  8. 'use strict';
  9. (function (factory) {
  10. if (typeof module === 'object' && module.exports) {
  11. factory['default'] = factory;
  12. module.exports = factory;
  13. } else if (typeof define === 'function' && define.amd) {
  14. define('highcharts/modules/dumbbell', ['highcharts'], function (Highcharts) {
  15. factory(Highcharts);
  16. factory.Highcharts = Highcharts;
  17. return factory;
  18. });
  19. } else {
  20. factory(typeof Highcharts !== 'undefined' ? Highcharts : undefined);
  21. }
  22. }(function (Highcharts) {
  23. var _modules = Highcharts ? Highcharts._modules : {};
  24. function _registerModule(obj, path, args, fn) {
  25. if (!obj.hasOwnProperty(path)) {
  26. obj[path] = fn.apply(null, args);
  27. }
  28. }
  29. _registerModule(_modules, 'Series/AreaRangeSeries.js', [_modules['Core/Series/Series.js'], _modules['Core/Globals.js'], _modules['Core/Series/Point.js'], _modules['Core/Utilities.js']], function (BaseSeries, H, Point, U) {
  30. /* *
  31. *
  32. * (c) 2010-2020 Torstein Honsi
  33. *
  34. * License: www.highcharts.com/license
  35. *
  36. * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
  37. *
  38. * */
  39. var noop = H.noop;
  40. var defined = U.defined,
  41. extend = U.extend,
  42. isArray = U.isArray,
  43. isNumber = U.isNumber,
  44. pick = U.pick;
  45. var Series = H.Series,
  46. areaProto = BaseSeries.seriesTypes.area.prototype,
  47. columnProto = BaseSeries.seriesTypes.column.prototype,
  48. pointProto = Point.prototype,
  49. seriesProto = Series.prototype;
  50. /**
  51. * The area range series is a carteseian series with higher and lower values for
  52. * each point along an X axis, where the area between the values is shaded.
  53. *
  54. * @sample {highcharts} highcharts/demo/arearange/
  55. * Area range chart
  56. * @sample {highstock} stock/demo/arearange/
  57. * Area range chart
  58. *
  59. * @extends plotOptions.area
  60. * @product highcharts highstock
  61. * @excluding stack, stacking
  62. * @requires highcharts-more
  63. * @optionparent plotOptions.arearange
  64. */
  65. BaseSeries.seriesType('arearange', 'area', {
  66. /**
  67. * @see [fillColor](#plotOptions.arearange.fillColor)
  68. * @see [fillOpacity](#plotOptions.arearange.fillOpacity)
  69. *
  70. * @apioption plotOptions.arearange.color
  71. */
  72. /**
  73. * @default low
  74. * @apioption plotOptions.arearange.colorKey
  75. */
  76. /**
  77. * @see [color](#plotOptions.arearange.color)
  78. * @see [fillOpacity](#plotOptions.arearange.fillOpacity)
  79. *
  80. * @apioption plotOptions.arearange.fillColor
  81. */
  82. /**
  83. * @see [color](#plotOptions.arearange.color)
  84. * @see [fillColor](#plotOptions.arearange.fillColor)
  85. *
  86. * @default {highcharts} 0.75
  87. * @default {highstock} 0.75
  88. * @apioption plotOptions.arearange.fillOpacity
  89. */
  90. /**
  91. * Whether to apply a drop shadow to the graph line. Since 2.3 the shadow
  92. * can be an object configuration containing `color`, `offsetX`, `offsetY`,
  93. * `opacity` and `width`.
  94. *
  95. * @type {boolean|Highcharts.ShadowOptionsObject}
  96. * @product highcharts
  97. * @apioption plotOptions.arearange.shadow
  98. */
  99. /**
  100. * Pixel width of the arearange graph line.
  101. *
  102. * @since 2.3.0
  103. *
  104. * @private
  105. */
  106. lineWidth: 1,
  107. threshold: null,
  108. tooltip: {
  109. pointFormat: '<span style="color:{series.color}">\u25CF</span> ' +
  110. '{series.name}: <b>{point.low}</b> - <b>{point.high}</b><br/>'
  111. },
  112. /**
  113. * Whether the whole area or just the line should respond to mouseover
  114. * tooltips and other mouse or touch events.
  115. *
  116. * @since 2.3.0
  117. *
  118. * @private
  119. */
  120. trackByArea: true,
  121. /**
  122. * Extended data labels for range series types. Range series data labels use
  123. * no `x` and `y` options. Instead, they have `xLow`, `xHigh`, `yLow` and
  124. * `yHigh` options to allow the higher and lower data label sets
  125. * individually.
  126. *
  127. * @declare Highcharts.SeriesAreaRangeDataLabelsOptionsObject
  128. * @exclude x, y
  129. * @since 2.3.0
  130. * @product highcharts highstock
  131. *
  132. * @private
  133. */
  134. dataLabels: {
  135. align: void 0,
  136. verticalAlign: void 0,
  137. /**
  138. * X offset of the lower data labels relative to the point value.
  139. *
  140. * @sample highcharts/plotoptions/arearange-datalabels/
  141. * Data labels on range series
  142. * @sample highcharts/plotoptions/arearange-datalabels/
  143. * Data labels on range series
  144. */
  145. xLow: 0,
  146. /**
  147. * X offset of the higher data labels relative to the point value.
  148. *
  149. * @sample highcharts/plotoptions/arearange-datalabels/
  150. * Data labels on range series
  151. */
  152. xHigh: 0,
  153. /**
  154. * Y offset of the lower data labels relative to the point value.
  155. *
  156. * @sample highcharts/plotoptions/arearange-datalabels/
  157. * Data labels on range series
  158. */
  159. yLow: 0,
  160. /**
  161. * Y offset of the higher data labels relative to the point value.
  162. *
  163. * @sample highcharts/plotoptions/arearange-datalabels/
  164. * Data labels on range series
  165. */
  166. yHigh: 0
  167. }
  168. // Prototype members
  169. }, {
  170. pointArrayMap: ['low', 'high'],
  171. pointValKey: 'low',
  172. deferTranslatePolar: true,
  173. /* eslint-disable valid-jsdoc */
  174. /**
  175. * @private
  176. */
  177. toYData: function (point) {
  178. return [point.low, point.high];
  179. },
  180. /**
  181. * Translate a point's plotHigh from the internal angle and radius measures
  182. * to true plotHigh coordinates. This is an addition of the toXY method
  183. * found in Polar.js, because it runs too early for arearanges to be
  184. * considered (#3419).
  185. * @private
  186. */
  187. highToXY: function (point) {
  188. // Find the polar plotX and plotY
  189. var chart = this.chart,
  190. xy = this.xAxis.postTranslate(point.rectPlotX,
  191. this.yAxis.len - point.plotHigh);
  192. point.plotHighX = xy.x - chart.plotLeft;
  193. point.plotHigh = xy.y - chart.plotTop;
  194. point.plotLowX = point.plotX;
  195. },
  196. /**
  197. * Translate data points from raw values x and y to plotX and plotY.
  198. * @private
  199. */
  200. translate: function () {
  201. var series = this,
  202. yAxis = series.yAxis,
  203. hasModifyValue = !!series.modifyValue;
  204. areaProto.translate.apply(series);
  205. // Set plotLow and plotHigh
  206. series.points.forEach(function (point) {
  207. var high = point.high,
  208. plotY = point.plotY;
  209. if (point.isNull) {
  210. point.plotY = null;
  211. }
  212. else {
  213. point.plotLow = plotY;
  214. point.plotHigh = yAxis.translate(hasModifyValue ?
  215. series.modifyValue(high, point) :
  216. high, 0, 1, 0, 1);
  217. if (hasModifyValue) {
  218. point.yBottom = point.plotHigh;
  219. }
  220. }
  221. });
  222. // Postprocess plotHigh
  223. if (this.chart.polar) {
  224. this.points.forEach(function (point) {
  225. series.highToXY(point);
  226. point.tooltipPos = [
  227. (point.plotHighX + point.plotLowX) / 2,
  228. (point.plotHigh + point.plotLow) / 2
  229. ];
  230. });
  231. }
  232. },
  233. /**
  234. * Extend the line series' getSegmentPath method by applying the segment
  235. * path to both lower and higher values of the range.
  236. * @private
  237. */
  238. getGraphPath: function (points) {
  239. var highPoints = [],
  240. highAreaPoints = [],
  241. i,
  242. getGraphPath = areaProto.getGraphPath,
  243. point,
  244. pointShim,
  245. linePath,
  246. lowerPath,
  247. options = this.options,
  248. polar = this.chart.polar,
  249. connectEnds = polar && options.connectEnds !== false,
  250. connectNulls = options.connectNulls,
  251. step = options.step,
  252. higherPath,
  253. higherAreaPath;
  254. points = points || this.points;
  255. // Create the top line and the top part of the area fill. The area fill
  256. // compensates for null points by drawing down to the lower graph,
  257. // moving across the null gap and starting again at the lower graph.
  258. i = points.length;
  259. while (i--) {
  260. point = points[i];
  261. // Support for polar
  262. var highAreaPoint = polar ? {
  263. plotX: point.rectPlotX,
  264. plotY: point.yBottom,
  265. doCurve: false // #5186, gaps in areasplinerange fill
  266. } : {
  267. plotX: point.plotX,
  268. plotY: point.plotY,
  269. doCurve: false // #5186, gaps in areasplinerange fill
  270. };
  271. if (!point.isNull &&
  272. !connectEnds &&
  273. !connectNulls &&
  274. (!points[i + 1] || points[i + 1].isNull)) {
  275. highAreaPoints.push(highAreaPoint);
  276. }
  277. pointShim = {
  278. polarPlotY: point.polarPlotY,
  279. rectPlotX: point.rectPlotX,
  280. yBottom: point.yBottom,
  281. // plotHighX is for polar charts
  282. plotX: pick(point.plotHighX, point.plotX),
  283. plotY: point.plotHigh,
  284. isNull: point.isNull
  285. };
  286. highAreaPoints.push(pointShim);
  287. highPoints.push(pointShim);
  288. if (!point.isNull &&
  289. !connectEnds &&
  290. !connectNulls &&
  291. (!points[i - 1] || points[i - 1].isNull)) {
  292. highAreaPoints.push(highAreaPoint);
  293. }
  294. }
  295. // Get the paths
  296. lowerPath = getGraphPath.call(this, points);
  297. if (step) {
  298. if (step === true) {
  299. step = 'left';
  300. }
  301. options.step = {
  302. left: 'right',
  303. center: 'center',
  304. right: 'left'
  305. }[step]; // swap for reading in getGraphPath
  306. }
  307. higherPath = getGraphPath.call(this, highPoints);
  308. higherAreaPath = getGraphPath.call(this, highAreaPoints);
  309. options.step = step;
  310. // Create a line on both top and bottom of the range
  311. linePath = []
  312. .concat(lowerPath, higherPath);
  313. // For the area path, we need to change the 'move' statement
  314. // into 'lineTo'
  315. if (!this.chart.polar && higherAreaPath[0] && higherAreaPath[0][0] === 'M') {
  316. // This probably doesn't work for spline
  317. higherAreaPath[0] = ['L', higherAreaPath[0][1], higherAreaPath[0][2]];
  318. }
  319. this.graphPath = linePath;
  320. this.areaPath = lowerPath.concat(higherAreaPath);
  321. // Prepare for sideways animation
  322. linePath.isArea = true;
  323. linePath.xMap = lowerPath.xMap;
  324. this.areaPath.xMap = lowerPath.xMap;
  325. return linePath;
  326. },
  327. /**
  328. * Extend the basic drawDataLabels method by running it for both lower and
  329. * higher values.
  330. * @private
  331. */
  332. drawDataLabels: function () {
  333. var data = this.points,
  334. length = data.length,
  335. i,
  336. originalDataLabels = [],
  337. dataLabelOptions = this.options.dataLabels,
  338. point,
  339. up,
  340. inverted = this.chart.inverted,
  341. upperDataLabelOptions,
  342. lowerDataLabelOptions;
  343. // Split into upper and lower options. If data labels is an array, the
  344. // first element is the upper label, the second is the lower.
  345. //
  346. // TODO: We want to change this and allow multiple labels for both upper
  347. // and lower values in the future - introducing some options for which
  348. // point value to use as Y for the dataLabel, so that this could be
  349. // handled in Series.drawDataLabels. This would also improve performance
  350. // since we now have to loop over all the points multiple times to work
  351. // around the data label logic.
  352. if (isArray(dataLabelOptions)) {
  353. upperDataLabelOptions = dataLabelOptions[0] || { enabled: false };
  354. lowerDataLabelOptions = dataLabelOptions[1] || { enabled: false };
  355. }
  356. else {
  357. // Make copies
  358. upperDataLabelOptions = extend({}, dataLabelOptions);
  359. upperDataLabelOptions.x = dataLabelOptions.xHigh;
  360. upperDataLabelOptions.y = dataLabelOptions.yHigh;
  361. lowerDataLabelOptions = extend({}, dataLabelOptions);
  362. lowerDataLabelOptions.x = dataLabelOptions.xLow;
  363. lowerDataLabelOptions.y = dataLabelOptions.yLow;
  364. }
  365. // Draw upper labels
  366. if (upperDataLabelOptions.enabled || this._hasPointLabels) {
  367. // Set preliminary values for plotY and dataLabel
  368. // and draw the upper labels
  369. i = length;
  370. while (i--) {
  371. point = data[i];
  372. if (point) {
  373. up = upperDataLabelOptions.inside ?
  374. point.plotHigh < point.plotLow :
  375. point.plotHigh > point.plotLow;
  376. point.y = point.high;
  377. point._plotY = point.plotY;
  378. point.plotY = point.plotHigh;
  379. // Store original data labels and set preliminary label
  380. // objects to be picked up in the uber method
  381. originalDataLabels[i] = point.dataLabel;
  382. point.dataLabel = point.dataLabelUpper;
  383. // Set the default offset
  384. point.below = up;
  385. if (inverted) {
  386. if (!upperDataLabelOptions.align) {
  387. upperDataLabelOptions.align = up ? 'right' : 'left';
  388. }
  389. }
  390. else {
  391. if (!upperDataLabelOptions.verticalAlign) {
  392. upperDataLabelOptions.verticalAlign = up ?
  393. 'top' :
  394. 'bottom';
  395. }
  396. }
  397. }
  398. }
  399. this.options.dataLabels = upperDataLabelOptions;
  400. if (seriesProto.drawDataLabels) {
  401. // #1209:
  402. seriesProto.drawDataLabels.apply(this, arguments);
  403. }
  404. // Reset state after the upper labels were created. Move
  405. // it to point.dataLabelUpper and reassign the originals.
  406. // We do this here to support not drawing a lower label.
  407. i = length;
  408. while (i--) {
  409. point = data[i];
  410. if (point) {
  411. point.dataLabelUpper = point.dataLabel;
  412. point.dataLabel = originalDataLabels[i];
  413. delete point.dataLabels;
  414. point.y = point.low;
  415. point.plotY = point._plotY;
  416. }
  417. }
  418. }
  419. // Draw lower labels
  420. if (lowerDataLabelOptions.enabled || this._hasPointLabels) {
  421. i = length;
  422. while (i--) {
  423. point = data[i];
  424. if (point) {
  425. up = lowerDataLabelOptions.inside ?
  426. point.plotHigh < point.plotLow :
  427. point.plotHigh > point.plotLow;
  428. // Set the default offset
  429. point.below = !up;
  430. if (inverted) {
  431. if (!lowerDataLabelOptions.align) {
  432. lowerDataLabelOptions.align = up ? 'left' : 'right';
  433. }
  434. }
  435. else {
  436. if (!lowerDataLabelOptions.verticalAlign) {
  437. lowerDataLabelOptions.verticalAlign = up ?
  438. 'bottom' :
  439. 'top';
  440. }
  441. }
  442. }
  443. }
  444. this.options.dataLabels = lowerDataLabelOptions;
  445. if (seriesProto.drawDataLabels) {
  446. seriesProto.drawDataLabels.apply(this, arguments);
  447. }
  448. }
  449. // Merge upper and lower into point.dataLabels for later destroying
  450. if (upperDataLabelOptions.enabled) {
  451. i = length;
  452. while (i--) {
  453. point = data[i];
  454. if (point) {
  455. point.dataLabels = [
  456. point.dataLabelUpper,
  457. point.dataLabel
  458. ].filter(function (label) {
  459. return !!label;
  460. });
  461. }
  462. }
  463. }
  464. // Reset options
  465. this.options.dataLabels = dataLabelOptions;
  466. },
  467. alignDataLabel: function () {
  468. columnProto.alignDataLabel.apply(this, arguments);
  469. },
  470. drawPoints: function () {
  471. var series = this,
  472. pointLength = series.points.length,
  473. point,
  474. i;
  475. // Draw bottom points
  476. seriesProto.drawPoints
  477. .apply(series, arguments);
  478. // Prepare drawing top points
  479. i = 0;
  480. while (i < pointLength) {
  481. point = series.points[i];
  482. // Save original props to be overridden by temporary props for top
  483. // points
  484. point.origProps = {
  485. plotY: point.plotY,
  486. plotX: point.plotX,
  487. isInside: point.isInside,
  488. negative: point.negative,
  489. zone: point.zone,
  490. y: point.y
  491. };
  492. point.lowerGraphic = point.graphic;
  493. point.graphic = point.upperGraphic;
  494. point.plotY = point.plotHigh;
  495. if (defined(point.plotHighX)) {
  496. point.plotX = point.plotHighX;
  497. }
  498. point.y = point.high;
  499. point.negative = point.high < (series.options.threshold || 0);
  500. point.zone = (series.zones.length && point.getZone());
  501. if (!series.chart.polar) {
  502. point.isInside = point.isTopInside = (typeof point.plotY !== 'undefined' &&
  503. point.plotY >= 0 &&
  504. point.plotY <= series.yAxis.len && // #3519
  505. point.plotX >= 0 &&
  506. point.plotX <= series.xAxis.len);
  507. }
  508. i++;
  509. }
  510. // Draw top points
  511. seriesProto.drawPoints.apply(series, arguments);
  512. // Reset top points preliminary modifications
  513. i = 0;
  514. while (i < pointLength) {
  515. point = series.points[i];
  516. point.upperGraphic = point.graphic;
  517. point.graphic = point.lowerGraphic;
  518. extend(point, point.origProps);
  519. delete point.origProps;
  520. i++;
  521. }
  522. },
  523. /* eslint-enable valid-jsdoc */
  524. setStackedPoints: noop
  525. }, {
  526. /**
  527. * Range series only. The high or maximum value for each data point.
  528. * @name Highcharts.Point#high
  529. * @type {number|undefined}
  530. */
  531. /**
  532. * Range series only. The low or minimum value for each data point.
  533. * @name Highcharts.Point#low
  534. * @type {number|undefined}
  535. */
  536. /* eslint-disable valid-jsdoc */
  537. /**
  538. * @private
  539. */
  540. setState: function () {
  541. var prevState = this.state,
  542. series = this.series,
  543. isPolar = series.chart.polar;
  544. if (!defined(this.plotHigh)) {
  545. // Boost doesn't calculate plotHigh
  546. this.plotHigh = series.yAxis.toPixels(this.high, true);
  547. }
  548. if (!defined(this.plotLow)) {
  549. // Boost doesn't calculate plotLow
  550. this.plotLow = this.plotY = series.yAxis.toPixels(this.low, true);
  551. }
  552. if (series.stateMarkerGraphic) {
  553. series.lowerStateMarkerGraphic = series.stateMarkerGraphic;
  554. series.stateMarkerGraphic = series.upperStateMarkerGraphic;
  555. }
  556. // Change state also for the top marker
  557. this.graphic = this.upperGraphic;
  558. this.plotY = this.plotHigh;
  559. if (isPolar) {
  560. this.plotX = this.plotHighX;
  561. }
  562. // Top state:
  563. pointProto.setState.apply(this, arguments);
  564. this.state = prevState;
  565. // Now restore defaults
  566. this.plotY = this.plotLow;
  567. this.graphic = this.lowerGraphic;
  568. if (isPolar) {
  569. this.plotX = this.plotLowX;
  570. }
  571. if (series.stateMarkerGraphic) {
  572. series.upperStateMarkerGraphic = series.stateMarkerGraphic;
  573. series.stateMarkerGraphic = series.lowerStateMarkerGraphic;
  574. // Lower marker is stored at stateMarkerGraphic
  575. // to avoid reference duplication (#7021)
  576. series.lowerStateMarkerGraphic = void 0;
  577. }
  578. pointProto.setState.apply(this, arguments);
  579. },
  580. haloPath: function () {
  581. var isPolar = this.series.chart.polar,
  582. path = [];
  583. // Bottom halo
  584. this.plotY = this.plotLow;
  585. if (isPolar) {
  586. this.plotX = this.plotLowX;
  587. }
  588. if (this.isInside) {
  589. path = pointProto.haloPath.apply(this, arguments);
  590. }
  591. // Top halo
  592. this.plotY = this.plotHigh;
  593. if (isPolar) {
  594. this.plotX = this.plotHighX;
  595. }
  596. if (this.isTopInside) {
  597. path = path.concat(pointProto.haloPath.apply(this, arguments));
  598. }
  599. return path;
  600. },
  601. destroyElements: function () {
  602. var graphics = ['lowerGraphic', 'upperGraphic'];
  603. graphics.forEach(function (graphicName) {
  604. if (this[graphicName]) {
  605. this[graphicName] =
  606. this[graphicName].destroy();
  607. }
  608. }, this);
  609. // Clear graphic for states, removed in the above each:
  610. this.graphic = null;
  611. return pointProto.destroyElements.apply(this, arguments);
  612. },
  613. isValid: function () {
  614. return isNumber(this.low) && isNumber(this.high);
  615. }
  616. /* eslint-enable valid-jsdoc */
  617. });
  618. /**
  619. * A `arearange` series. If the [type](#series.arearange.type) option is not
  620. * specified, it is inherited from [chart.type](#chart.type).
  621. *
  622. *
  623. * @extends series,plotOptions.arearange
  624. * @excluding dataParser, dataURL, stack, stacking
  625. * @product highcharts highstock
  626. * @requires highcharts-more
  627. * @apioption series.arearange
  628. */
  629. /**
  630. * @see [fillColor](#series.arearange.fillColor)
  631. * @see [fillOpacity](#series.arearange.fillOpacity)
  632. *
  633. * @apioption series.arearange.color
  634. */
  635. /**
  636. * An array of data points for the series. For the `arearange` series type,
  637. * points can be given in the following ways:
  638. *
  639. * 1. An array of arrays with 3 or 2 values. In this case, the values
  640. * correspond to `x,low,high`. If the first value is a string, it is
  641. * applied as the name of the point, and the `x` value is inferred.
  642. * The `x` value can also be omitted, in which case the inner arrays
  643. * should be of length 2\. Then the `x` value is automatically calculated,
  644. * either starting at 0 and incremented by 1, or from `pointStart`
  645. * and `pointInterval` given in the series options.
  646. * ```js
  647. * data: [
  648. * [0, 8, 3],
  649. * [1, 1, 1],
  650. * [2, 6, 8]
  651. * ]
  652. * ```
  653. *
  654. * 2. An array of objects with named values. The following snippet shows only a
  655. * few settings, see the complete options set below. If the total number of
  656. * data points exceeds the series'
  657. * [turboThreshold](#series.arearange.turboThreshold),
  658. * this option is not available.
  659. * ```js
  660. * data: [{
  661. * x: 1,
  662. * low: 9,
  663. * high: 0,
  664. * name: "Point2",
  665. * color: "#00FF00"
  666. * }, {
  667. * x: 1,
  668. * low: 3,
  669. * high: 4,
  670. * name: "Point1",
  671. * color: "#FF00FF"
  672. * }]
  673. * ```
  674. *
  675. * @sample {highcharts} highcharts/series/data-array-of-arrays/
  676. * Arrays of numeric x and y
  677. * @sample {highcharts} highcharts/series/data-array-of-arrays-datetime/
  678. * Arrays of datetime x and y
  679. * @sample {highcharts} highcharts/series/data-array-of-name-value/
  680. * Arrays of point.name and y
  681. * @sample {highcharts} highcharts/series/data-array-of-objects/
  682. * Config objects
  683. *
  684. * @type {Array<Array<(number|string),number>|Array<(number|string),number,number>|*>}
  685. * @extends series.line.data
  686. * @excluding marker, y
  687. * @product highcharts highstock
  688. * @apioption series.arearange.data
  689. */
  690. /**
  691. * @extends series.arearange.dataLabels
  692. * @product highcharts highstock
  693. * @apioption series.arearange.data.dataLabels
  694. */
  695. /**
  696. * @see [color](#series.arearange.color)
  697. * @see [fillOpacity](#series.arearange.fillOpacity)
  698. *
  699. * @apioption series.arearange.fillColor
  700. */
  701. /**
  702. * @see [color](#series.arearange.color)
  703. * @see [fillColor](#series.arearange.fillColor)
  704. *
  705. * @default {highcharts} 0.75
  706. * @default {highstock} 0.75
  707. * @apioption series.arearange.fillOpacity
  708. */
  709. /**
  710. * The high or maximum value for each data point.
  711. *
  712. * @type {number}
  713. * @product highcharts highstock
  714. * @apioption series.arearange.data.high
  715. */
  716. /**
  717. * The low or minimum value for each data point.
  718. *
  719. * @type {number}
  720. * @product highcharts highstock
  721. * @apioption series.arearange.data.low
  722. */
  723. ''; // adds doclets above to tranpiled file
  724. });
  725. _registerModule(_modules, 'Series/ColumnRangeSeries.js', [_modules['Core/Series/Series.js'], _modules['Core/Globals.js'], _modules['Core/Options.js'], _modules['Core/Utilities.js']], function (BaseSeries, H, O, U) {
  726. /* *
  727. *
  728. * (c) 2010-2020 Torstein Honsi
  729. *
  730. * License: www.highcharts.com/license
  731. *
  732. * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
  733. *
  734. * */
  735. var noop = H.noop;
  736. var defaultOptions = O.defaultOptions;
  737. var clamp = U.clamp,
  738. merge = U.merge,
  739. pick = U.pick;
  740. var columnProto = BaseSeries.seriesTypes.column.prototype;
  741. /**
  742. * The column range is a cartesian series type with higher and lower
  743. * Y values along an X axis. To display horizontal bars, set
  744. * [chart.inverted](#chart.inverted) to `true`.
  745. *
  746. * @sample {highcharts|highstock} highcharts/demo/columnrange/
  747. * Inverted column range
  748. *
  749. * @extends plotOptions.column
  750. * @since 2.3.0
  751. * @excluding negativeColor, stacking, softThreshold, threshold
  752. * @product highcharts highstock
  753. * @requires highcharts-more
  754. * @optionparent plotOptions.columnrange
  755. */
  756. var columnRangeOptions = {
  757. /**
  758. * Extended data labels for range series types. Range series data labels
  759. * have no `x` and `y` options. Instead,
  760. they have `xLow`,
  761. `xHigh`,
  762. * `yLow` and `yHigh` options to allow the higher and lower data label
  763. * sets individually.
  764. *
  765. * @declare Highcharts.SeriesAreaRangeDataLabelsOptionsObject
  766. * @extends plotOptions.arearange.dataLabels
  767. * @since 2.3.0
  768. * @product highcharts highstock
  769. * @apioption plotOptions.columnrange.dataLabels
  770. */
  771. pointRange: null,
  772. /** @ignore-option */
  773. marker: null,
  774. states: {
  775. hover: {
  776. /** @ignore-option */
  777. halo: false
  778. }
  779. }
  780. };
  781. /**
  782. * The ColumnRangeSeries class
  783. *
  784. * @private
  785. * @class
  786. * @name Highcharts.seriesTypes.columnrange
  787. *
  788. * @augments Highcharts.Series
  789. */
  790. BaseSeries.seriesType('columnrange', 'arearange', merge(defaultOptions.plotOptions.column, defaultOptions.plotOptions.arearange, columnRangeOptions), {
  791. // eslint-disable-next-line valid-jsdoc
  792. /**
  793. * Translate data points from raw values x and y to plotX and plotY
  794. * @private
  795. */
  796. translate: function () {
  797. var series = this,
  798. yAxis = series.yAxis,
  799. xAxis = series.xAxis,
  800. startAngleRad = xAxis.startAngleRad,
  801. start,
  802. chart = series.chart,
  803. isRadial = series.xAxis.isRadial,
  804. safeDistance = Math.max(chart.chartWidth,
  805. chart.chartHeight) + 999,
  806. plotHigh;
  807. // eslint-disable-next-line valid-jsdoc
  808. /**
  809. * Don't draw too far outside plot area (#6835)
  810. * @private
  811. */
  812. function safeBounds(pixelPos) {
  813. return clamp(pixelPos, -safeDistance, safeDistance);
  814. }
  815. columnProto.translate.apply(series);
  816. // Set plotLow and plotHigh
  817. series.points.forEach(function (point) {
  818. var shapeArgs = point.shapeArgs,
  819. minPointLength = series.options.minPointLength,
  820. heightDifference,
  821. height,
  822. y;
  823. point.plotHigh = plotHigh = safeBounds(yAxis.translate(point.high, 0, 1, 0, 1));
  824. point.plotLow = safeBounds(point.plotY);
  825. // adjust shape
  826. y = plotHigh;
  827. height = pick(point.rectPlotY, point.plotY) - plotHigh;
  828. // Adjust for minPointLength
  829. if (Math.abs(height) < minPointLength) {
  830. heightDifference = (minPointLength - height);
  831. height += heightDifference;
  832. y -= heightDifference / 2;
  833. // Adjust for negative ranges or reversed Y axis (#1457)
  834. }
  835. else if (height < 0) {
  836. height *= -1;
  837. y -= height;
  838. }
  839. if (isRadial) {
  840. start = point.barX + startAngleRad;
  841. point.shapeType = 'arc';
  842. point.shapeArgs = series.polarArc(y + height, y, start, start + point.pointWidth);
  843. }
  844. else {
  845. shapeArgs.height = height;
  846. shapeArgs.y = y;
  847. point.tooltipPos = chart.inverted ?
  848. [
  849. yAxis.len + yAxis.pos - chart.plotLeft - y -
  850. height / 2,
  851. xAxis.len + xAxis.pos - chart.plotTop -
  852. shapeArgs.x - shapeArgs.width / 2,
  853. height
  854. ] : [
  855. xAxis.left - chart.plotLeft + shapeArgs.x +
  856. shapeArgs.width / 2,
  857. yAxis.pos - chart.plotTop + y + height / 2,
  858. height
  859. ]; // don't inherit from column tooltip position - #3372
  860. }
  861. });
  862. },
  863. directTouch: true,
  864. trackerGroups: ['group', 'dataLabelsGroup'],
  865. drawGraph: noop,
  866. getSymbol: noop,
  867. // Overrides from modules that may be loaded after this module
  868. crispCol: function () {
  869. return columnProto.crispCol.apply(this, arguments);
  870. },
  871. drawPoints: function () {
  872. return columnProto.drawPoints.apply(this, arguments);
  873. },
  874. drawTracker: function () {
  875. return columnProto.drawTracker.apply(this, arguments);
  876. },
  877. getColumnMetrics: function () {
  878. return columnProto.getColumnMetrics.apply(this, arguments);
  879. },
  880. pointAttribs: function () {
  881. return columnProto.pointAttribs.apply(this, arguments);
  882. },
  883. animate: function () {
  884. return columnProto.animate.apply(this, arguments);
  885. },
  886. polarArc: function () {
  887. return columnProto.polarArc.apply(this, arguments);
  888. },
  889. translate3dPoints: function () {
  890. return columnProto.translate3dPoints.apply(this, arguments);
  891. },
  892. translate3dShapes: function () {
  893. return columnProto.translate3dShapes.apply(this, arguments);
  894. }
  895. }, {
  896. setState: columnProto.pointClass.prototype.setState
  897. });
  898. /**
  899. * A `columnrange` series. If the [type](#series.columnrange.type)
  900. * option is not specified, it is inherited from
  901. * [chart.type](#chart.type).
  902. *
  903. * @extends series,plotOptions.columnrange
  904. * @excluding dataParser, dataURL, stack, stacking
  905. * @product highcharts highstock
  906. * @requires highcharts-more
  907. * @apioption series.columnrange
  908. */
  909. /**
  910. * An array of data points for the series. For the `columnrange` series
  911. * type, points can be given in the following ways:
  912. *
  913. * 1. An array of arrays with 3 or 2 values. In this case, the values correspond
  914. * to `x,low,high`. If the first value is a string, it is applied as the name
  915. * of the point, and the `x` value is inferred. The `x` value can also be
  916. * omitted, in which case the inner arrays should be of length 2\. Then the
  917. * `x` value is automatically calculated, either starting at 0 and
  918. * incremented by 1, or from `pointStart` and `pointInterval` given in the
  919. * series options.
  920. * ```js
  921. * data: [
  922. * [0, 4, 2],
  923. * [1, 2, 1],
  924. * [2, 9, 10]
  925. * ]
  926. * ```
  927. *
  928. * 2. An array of objects with named values. The following snippet shows only a
  929. * few settings, see the complete options set below. If the total number of
  930. * data points exceeds the series'
  931. * [turboThreshold](#series.columnrange.turboThreshold), this option is not
  932. * available.
  933. * ```js
  934. * data: [{
  935. * x: 1,
  936. * low: 0,
  937. * high: 4,
  938. * name: "Point2",
  939. * color: "#00FF00"
  940. * }, {
  941. * x: 1,
  942. * low: 5,
  943. * high: 3,
  944. * name: "Point1",
  945. * color: "#FF00FF"
  946. * }]
  947. * ```
  948. *
  949. * @sample {highcharts} highcharts/series/data-array-of-arrays/
  950. * Arrays of numeric x and y
  951. * @sample {highcharts} highcharts/series/data-array-of-arrays-datetime/
  952. * Arrays of datetime x and y
  953. * @sample {highcharts} highcharts/series/data-array-of-name-value/
  954. * Arrays of point.name and y
  955. * @sample {highcharts} highcharts/series/data-array-of-objects/
  956. * Config objects
  957. *
  958. * @type {Array<Array<(number|string),number>|Array<(number|string),number,number>|*>}
  959. * @extends series.arearange.data
  960. * @excluding marker
  961. * @product highcharts highstock
  962. * @apioption series.columnrange.data
  963. */
  964. /**
  965. * @extends series.columnrange.dataLabels
  966. * @product highcharts highstock
  967. * @apioption series.columnrange.data.dataLabels
  968. */
  969. /**
  970. * @excluding halo, lineWidth, lineWidthPlus, marker
  971. * @product highcharts highstock
  972. * @apioption series.columnrange.states.hover
  973. */
  974. /**
  975. * @excluding halo, lineWidth, lineWidthPlus, marker
  976. * @product highcharts highstock
  977. * @apioption series.columnrange.states.select
  978. */
  979. ''; // adds doclets above into transpiled
  980. });
  981. _registerModule(_modules, 'Series/DumbbellSeries.js', [_modules['Core/Series/Series.js'], _modules['Core/Renderer/SVG/SVGRenderer.js'], _modules['Core/Globals.js'], _modules['Core/Utilities.js']], function (BaseSeries, SVGRenderer, H, U) {
  982. /* *
  983. *
  984. * (c) 2010-2020 Sebastian Bochan, Rafal Sebestjanski
  985. *
  986. * License: www.highcharts.com/license
  987. *
  988. * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
  989. *
  990. * */
  991. var noop = H.noop;
  992. var extend = U.extend,
  993. pick = U.pick;
  994. var seriesProto = H.Series.prototype, seriesTypes = BaseSeries.seriesTypes, areaRangeProto = seriesTypes.arearange.prototype, columnRangeProto = seriesTypes.columnrange.prototype, colProto = seriesTypes.column.prototype, areaRangePointProto = areaRangeProto.pointClass.prototype, TrackerMixin = H.TrackerMixin; // Interaction
  995. /**
  996. * The dumbbell series is a cartesian series with higher and lower values for
  997. * each point along an X axis, connected with a line between the values.
  998. * Requires `highcharts-more.js` and `modules/dumbbell.js`.
  999. *
  1000. * @sample {highcharts} highcharts/demo/dumbbell/
  1001. * Dumbbell chart
  1002. * @sample {highcharts} highcharts/series-dumbbell/styled-mode-dumbbell/
  1003. * Styled mode
  1004. *
  1005. * @extends plotOptions.arearange
  1006. * @product highcharts highstock
  1007. * @excluding fillColor, fillOpacity, lineWidth, stack, stacking,
  1008. * stickyTracking, trackByArea, boostThreshold, boostBlending
  1009. * @since 8.0.0
  1010. * @optionparent plotOptions.dumbbell
  1011. */
  1012. BaseSeries.seriesType('dumbbell', 'arearange', {
  1013. /** @ignore-option */
  1014. trackByArea: false,
  1015. /** @ignore-option */
  1016. fillColor: 'none',
  1017. /** @ignore-option */
  1018. lineWidth: 0,
  1019. pointRange: 1,
  1020. /**
  1021. * Pixel width of the line that connects the dumbbell point's values.
  1022. *
  1023. * @since 8.0.0
  1024. * @product highcharts highstock
  1025. */
  1026. connectorWidth: 1,
  1027. /** @ignore-option */
  1028. stickyTracking: false,
  1029. groupPadding: 0.2,
  1030. crisp: false,
  1031. pointPadding: 0.1,
  1032. /**
  1033. * Color of the start markers in a dumbbell graph.
  1034. *
  1035. * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}
  1036. * @since 8.0.0
  1037. * @product highcharts highstock
  1038. */
  1039. lowColor: '#333333',
  1040. /**
  1041. * Color of the line that connects the dumbbell point's values.
  1042. * By default it is the series' color.
  1043. *
  1044. * @type {string}
  1045. * @product highcharts highstock
  1046. * @since 8.0.0
  1047. * @apioption plotOptions.dumbbell.connectorColor
  1048. */
  1049. states: {
  1050. hover: {
  1051. /** @ignore-option */
  1052. lineWidthPlus: 0,
  1053. /**
  1054. * The additional connector line width for a hovered point.
  1055. *
  1056. * @since 8.0.0
  1057. * @product highcharts highstock
  1058. */
  1059. connectorWidthPlus: 1,
  1060. /** @ignore-option */
  1061. halo: false
  1062. }
  1063. }
  1064. }, {
  1065. trackerGroups: ['group', 'markerGroup', 'dataLabelsGroup'],
  1066. drawTracker: TrackerMixin.drawTrackerPoint,
  1067. drawGraph: noop,
  1068. crispCol: colProto.crispCol,
  1069. /**
  1070. * Get connector line path and styles that connects dumbbell point's low and
  1071. * high values.
  1072. * @private
  1073. *
  1074. * @param {Highcharts.Series} this The series of points.
  1075. * @param {Highcharts.Point} point The point to inspect.
  1076. *
  1077. * @return {Highcharts.SVGAttributes} attribs The path and styles.
  1078. */
  1079. getConnectorAttribs: function (point) {
  1080. var series = this, chart = series.chart, pointOptions = point.options, seriesOptions = series.options, xAxis = series.xAxis, yAxis = series.yAxis, connectorWidth = pick(pointOptions.connectorWidth, seriesOptions.connectorWidth), connectorColor = pick(pointOptions.connectorColor, seriesOptions.connectorColor, pointOptions.color, point.zone ? point.zone.color : void 0, point.color), connectorWidthPlus = pick(seriesOptions.states &&
  1081. seriesOptions.states.hover &&
  1082. seriesOptions.states.hover.connectorWidthPlus, 1), dashStyle = pick(pointOptions.dashStyle, seriesOptions.dashStyle), pointTop = pick(point.plotLow, point.plotY), pxThreshold = yAxis.toPixels(seriesOptions.threshold || 0, true), pointHeight = chart.inverted ?
  1083. yAxis.len - pxThreshold : pxThreshold, pointBottom = pick(point.plotHigh, pointHeight), attribs, origProps;
  1084. if (point.state) {
  1085. connectorWidth = connectorWidth + connectorWidthPlus;
  1086. }
  1087. if (pointTop < 0) {
  1088. pointTop = 0;
  1089. }
  1090. else if (pointTop >= yAxis.len) {
  1091. pointTop = yAxis.len;
  1092. }
  1093. if (pointBottom < 0) {
  1094. pointBottom = 0;
  1095. }
  1096. else if (pointBottom >= yAxis.len) {
  1097. pointBottom = yAxis.len;
  1098. }
  1099. if (point.plotX < 0 || point.plotX > xAxis.len) {
  1100. connectorWidth = 0;
  1101. }
  1102. // Connector should reflect upper marker's zone color
  1103. if (point.upperGraphic) {
  1104. origProps = {
  1105. y: point.y,
  1106. zone: point.zone
  1107. };
  1108. point.y = point.high;
  1109. point.zone = point.zone ? point.getZone() : void 0;
  1110. connectorColor = pick(pointOptions.connectorColor, seriesOptions.connectorColor, pointOptions.color, point.zone ? point.zone.color : void 0, point.color);
  1111. extend(point, origProps);
  1112. }
  1113. attribs = {
  1114. d: SVGRenderer.prototype.crispLine([[
  1115. 'M',
  1116. point.plotX,
  1117. pointTop
  1118. ], [
  1119. 'L',
  1120. point.plotX,
  1121. pointBottom
  1122. ]], connectorWidth, 'ceil')
  1123. };
  1124. if (!chart.styledMode) {
  1125. attribs.stroke = connectorColor;
  1126. attribs['stroke-width'] = connectorWidth;
  1127. if (dashStyle) {
  1128. attribs.dashstyle = dashStyle;
  1129. }
  1130. }
  1131. return attribs;
  1132. },
  1133. /**
  1134. * Draw connector line that connects dumbbell point's low and high values.
  1135. * @private
  1136. *
  1137. * @param {Highcharts.Series} this The series of points.
  1138. * @param {Highcharts.Point} point The point to inspect.
  1139. *
  1140. * @return {void}
  1141. */
  1142. drawConnector: function (point) {
  1143. var series = this,
  1144. animationLimit = pick(series.options.animationLimit, 250),
  1145. verb = point.connector && series.chart.pointCount < animationLimit ?
  1146. 'animate' : 'attr';
  1147. if (!point.connector) {
  1148. point.connector = series.chart.renderer.path()
  1149. .addClass('highcharts-lollipop-stem')
  1150. .attr({
  1151. zIndex: -1
  1152. })
  1153. .add(series.markerGroup);
  1154. }
  1155. point.connector[verb](this.getConnectorAttribs(point));
  1156. },
  1157. /**
  1158. * Return the width and x offset of the dumbbell adjusted for grouping,
  1159. * groupPadding, pointPadding, pointWidth etc.
  1160. *
  1161. * @private
  1162. *
  1163. * @function Highcharts.seriesTypes.column#getColumnMetrics
  1164. *
  1165. * @param {Highcharts.Series} this The series of points.
  1166. *
  1167. * @return {Highcharts.ColumnMetricsObject} metrics shapeArgs
  1168. *
  1169. */
  1170. getColumnMetrics: function () {
  1171. var metrics = colProto.getColumnMetrics.apply(this,
  1172. arguments);
  1173. metrics.offset += metrics.width / 2;
  1174. return metrics;
  1175. },
  1176. translatePoint: areaRangeProto.translate,
  1177. setShapeArgs: columnRangeProto.translate,
  1178. /**
  1179. * Translate each point to the plot area coordinate system and find
  1180. * shape positions
  1181. *
  1182. * @private
  1183. *
  1184. * @function Highcharts.seriesTypes.dumbbell#translate
  1185. *
  1186. * @param {Highcharts.Series} this The series of points.
  1187. *
  1188. * @return {void}
  1189. */
  1190. translate: function () {
  1191. // Calculate shapeargs
  1192. this.setShapeArgs.apply(this);
  1193. // Calculate point low / high values
  1194. this.translatePoint.apply(this, arguments);
  1195. // Correct x position
  1196. this.points.forEach(function (point) {
  1197. var shapeArgs = point.shapeArgs,
  1198. pointWidth = point.pointWidth;
  1199. point.plotX = shapeArgs.x;
  1200. shapeArgs.x = point.plotX - pointWidth / 2;
  1201. point.tooltipPos = null;
  1202. });
  1203. this.columnMetrics.offset -= this.columnMetrics.width / 2;
  1204. },
  1205. seriesDrawPoints: areaRangeProto.drawPoints,
  1206. /**
  1207. * Extend the arearange series' drawPoints method by applying a connector
  1208. * and coloring markers.
  1209. * @private
  1210. *
  1211. * @function Highcharts.Series#drawPoints
  1212. *
  1213. * @param {Highcharts.Series} this The series of points.
  1214. *
  1215. * @return {void}
  1216. */
  1217. drawPoints: function () {
  1218. var series = this,
  1219. chart = series.chart,
  1220. pointLength = series.points.length,
  1221. seriesLowColor = series.lowColor = series.options.lowColor,
  1222. i = 0,
  1223. lowerGraphicColor,
  1224. point,
  1225. zoneColor;
  1226. this.seriesDrawPoints.apply(series, arguments);
  1227. // Draw connectors and color upper markers
  1228. while (i < pointLength) {
  1229. point = series.points[i];
  1230. series.drawConnector(point);
  1231. if (point.upperGraphic) {
  1232. point.upperGraphic.element.point = point;
  1233. point.upperGraphic.addClass('highcharts-lollipop-high');
  1234. }
  1235. point.connector.element.point = point;
  1236. if (point.lowerGraphic) {
  1237. zoneColor = point.zone && point.zone.color;
  1238. lowerGraphicColor = pick(point.options.lowColor, seriesLowColor, point.options.color, zoneColor, point.color, series.color);
  1239. if (!chart.styledMode) {
  1240. point.lowerGraphic.attr({
  1241. fill: lowerGraphicColor
  1242. });
  1243. }
  1244. point.lowerGraphic.addClass('highcharts-lollipop-low');
  1245. }
  1246. i++;
  1247. }
  1248. },
  1249. /**
  1250. * Get non-presentational attributes for a point. Used internally for
  1251. * both styled mode and classic. Set correct position in link with connector
  1252. * line.
  1253. *
  1254. * @see Series#pointAttribs
  1255. *
  1256. * @function Highcharts.Series#markerAttribs
  1257. *
  1258. * @param {Highcharts.Series} this The series of points.
  1259. *
  1260. * @return {Highcharts.SVGAttributes}
  1261. * A hash containing those attributes that are not settable from
  1262. * CSS.
  1263. */
  1264. markerAttribs: function () {
  1265. var ret = areaRangeProto.markerAttribs.apply(this,
  1266. arguments);
  1267. ret.x = Math.floor(ret.x);
  1268. ret.y = Math.floor(ret.y);
  1269. return ret;
  1270. },
  1271. /**
  1272. * Get presentational attributes
  1273. *
  1274. * @private
  1275. * @function Highcharts.seriesTypes.column#pointAttribs
  1276. *
  1277. * @param {Highcharts.Series} this The series of points.
  1278. * @param {Highcharts.Point} point The point to inspect.
  1279. * @param {string} state current state of point (normal, hover, select)
  1280. *
  1281. * @return {Highcharts.SVGAttributes} pointAttribs SVGAttributes
  1282. */
  1283. pointAttribs: function (point, state) {
  1284. var pointAttribs;
  1285. pointAttribs = seriesProto.pointAttribs.apply(this, arguments);
  1286. if (state === 'hover') {
  1287. delete pointAttribs.fill;
  1288. }
  1289. return pointAttribs;
  1290. }
  1291. }, {
  1292. // seriesTypes doesn't inherit from arearange point proto so put below
  1293. // methods rigidly.
  1294. destroyElements: areaRangePointProto.destroyElements,
  1295. isValid: areaRangePointProto.isValid,
  1296. pointSetState: areaRangePointProto.setState,
  1297. /**
  1298. * Set the point's state extended by have influence on the connector
  1299. * (between low and high value).
  1300. *
  1301. * @private
  1302. * @param {Highcharts.Point} this The point to inspect.
  1303. *
  1304. * @return {void}
  1305. */
  1306. setState: function () {
  1307. var point = this,
  1308. series = point.series,
  1309. chart = series.chart,
  1310. seriesLowColor = series.options.lowColor,
  1311. seriesMarker = series.options.marker,
  1312. pointOptions = point.options,
  1313. pointLowColor = pointOptions.lowColor,
  1314. zoneColor = point.zone && point.zone.color,
  1315. lowerGraphicColor = pick(pointLowColor,
  1316. seriesLowColor,
  1317. pointOptions.color,
  1318. zoneColor,
  1319. point.color,
  1320. series.color),
  1321. verb = 'attr',
  1322. upperGraphicColor,
  1323. origProps;
  1324. this.pointSetState.apply(this, arguments);
  1325. if (!point.state) {
  1326. verb = 'animate';
  1327. if (point.lowerGraphic && !chart.styledMode) {
  1328. point.lowerGraphic.attr({
  1329. fill: lowerGraphicColor
  1330. });
  1331. if (point.upperGraphic) {
  1332. origProps = {
  1333. y: point.y,
  1334. zone: point.zone
  1335. };
  1336. point.y = point.high;
  1337. point.zone = point.zone ? point.getZone() : void 0;
  1338. upperGraphicColor = pick(point.marker ? point.marker.fillColor : void 0, seriesMarker ? seriesMarker.fillColor : void 0, pointOptions.color, point.zone ? point.zone.color : void 0, point.color);
  1339. point.upperGraphic.attr({
  1340. fill: upperGraphicColor
  1341. });
  1342. extend(point, origProps);
  1343. }
  1344. }
  1345. }
  1346. point.connector[verb](series.getConnectorAttribs(point));
  1347. }
  1348. });
  1349. /**
  1350. * The `dumbbell` series. If the [type](#series.dumbbell.type) option is
  1351. * not specified, it is inherited from [chart.type](#chart.type).
  1352. *
  1353. * @extends series,plotOptions.dumbbell
  1354. * @excluding boostThreshold, boostBlending
  1355. * @product highcharts highstock
  1356. * @requires highcharts-more
  1357. * @requires modules/dumbbell
  1358. * @apioption series.dumbbell
  1359. */
  1360. /**
  1361. * An array of data points for the series. For the `dumbbell` series
  1362. * type, points can be given in the following ways:
  1363. *
  1364. * 1. An array of arrays with 3 or 2 values. In this case, the values correspond
  1365. * to `x,low,high`. If the first value is a string, it is applied as the name
  1366. * of the point, and the `x` value is inferred. The `x` value can also be
  1367. * omitted, in which case the inner arrays should be of length 2\. Then the
  1368. * `x` value is automatically calculated, either starting at 0 and
  1369. * incremented by 1, or from `pointStart` and `pointInterval` given in the
  1370. * series options.
  1371. * ```js
  1372. * data: [
  1373. * [0, 4, 2],
  1374. * [1, 2, 1],
  1375. * [2, 9, 10]
  1376. * ]
  1377. * ```
  1378. *
  1379. * 2. An array of objects with named values. The following snippet shows only a
  1380. * few settings, see the complete options set below. If the total number of
  1381. * data points exceeds the series'
  1382. * [turboThreshold](#series.dumbbell.turboThreshold), this option is not
  1383. * available.
  1384. * ```js
  1385. * data: [{
  1386. * x: 1,
  1387. * low: 0,
  1388. * high: 4,
  1389. * name: "Point2",
  1390. * color: "#00FF00",
  1391. * lowColor: "#00FFFF",
  1392. * connectorWidth: 3,
  1393. * connectorColor: "#FF00FF"
  1394. * }, {
  1395. * x: 1,
  1396. * low: 5,
  1397. * high: 3,
  1398. * name: "Point1",
  1399. * color: "#FF00FF"
  1400. * }]
  1401. * ```
  1402. *
  1403. * @sample {highcharts} highcharts/series/data-array-of-arrays/
  1404. * Arrays of numeric x and y
  1405. * @sample {highcharts} highcharts/series/data-array-of-arrays-datetime/
  1406. * Arrays of datetime x and y
  1407. * @sample {highcharts} highcharts/series/data-array-of-name-value/
  1408. * Arrays of point.name and y
  1409. * @sample {highcharts} highcharts/series/data-array-of-objects/
  1410. * Config objects
  1411. *
  1412. * @type {Array<Array<(number|string),number>|Array<(number|string),number,number>|*>}
  1413. * @extends series.arearange.data
  1414. * @product highcharts highstock
  1415. * @apioption series.dumbbell.data
  1416. */
  1417. /**
  1418. * Color of the line that connects the dumbbell point's values.
  1419. * By default it is the series' color.
  1420. *
  1421. * @type {string}
  1422. * @since 8.0.0
  1423. * @product highcharts highstock
  1424. * @apioption series.dumbbell.data.connectorColor
  1425. */
  1426. /**
  1427. * Pixel width of the line that connects the dumbbell point's values.
  1428. *
  1429. * @type {number}
  1430. * @since 8.0.0
  1431. * @default 1
  1432. * @product highcharts highstock
  1433. * @apioption series.dumbbell.data.connectorWidth
  1434. */
  1435. /**
  1436. * Color of the start markers in a dumbbell graph.
  1437. *
  1438. * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}
  1439. * @since 8.0.0
  1440. * @default #333333
  1441. * @product highcharts highstock
  1442. * @apioption series.dumbbell.data.lowColor
  1443. */
  1444. ''; // adds doclets above to transpiled file
  1445. });
  1446. _registerModule(_modules, 'masters/modules/dumbbell.src.js', [], function () {
  1447. });
  1448. }));