arrow-symbols.src.js 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. /**
  2. * @license Highcharts JS v8.2.0 (2020-08-20)
  3. *
  4. * Arrow Symbols
  5. *
  6. * (c) 2017-2019 Lars A. V. Cabrera
  7. *
  8. * License: www.highcharts.com/license
  9. */
  10. 'use strict';
  11. (function (factory) {
  12. if (typeof module === 'object' && module.exports) {
  13. factory['default'] = factory;
  14. module.exports = factory;
  15. } else if (typeof define === 'function' && define.amd) {
  16. define('highcharts/modules/arrow-symbols', ['highcharts'], function (Highcharts) {
  17. factory(Highcharts);
  18. factory.Highcharts = Highcharts;
  19. return factory;
  20. });
  21. } else {
  22. factory(typeof Highcharts !== 'undefined' ? Highcharts : undefined);
  23. }
  24. }(function (Highcharts) {
  25. var _modules = Highcharts ? Highcharts._modules : {};
  26. function _registerModule(obj, path, args, fn) {
  27. if (!obj.hasOwnProperty(path)) {
  28. obj[path] = fn.apply(null, args);
  29. }
  30. }
  31. _registerModule(_modules, 'Extensions/ArrowSymbols.js', [_modules['Core/Renderer/SVG/SVGRenderer.js']], function (SVGRenderer) {
  32. /* *
  33. *
  34. * (c) 2017 Highsoft AS
  35. * Authors: Lars A. V. Cabrera
  36. *
  37. * License: www.highcharts.com/license
  38. *
  39. * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
  40. *
  41. * */
  42. /**
  43. * Creates an arrow symbol. Like a triangle, except not filled.
  44. * ```
  45. * o
  46. * o
  47. * o
  48. * o
  49. * o
  50. * o
  51. * o
  52. * ```
  53. *
  54. * @private
  55. * @function
  56. *
  57. * @param {number} x
  58. * x position of the arrow
  59. *
  60. * @param {number} y
  61. * y position of the arrow
  62. *
  63. * @param {number} w
  64. * width of the arrow
  65. *
  66. * @param {number} h
  67. * height of the arrow
  68. *
  69. * @return {Highcharts.SVGPathArray}
  70. * Path array
  71. */
  72. SVGRenderer.prototype.symbols.arrow = function (x, y, w, h) {
  73. return [
  74. ['M', x, y + h / 2],
  75. ['L', x + w, y],
  76. ['L', x, y + h / 2],
  77. ['L', x + w, y + h]
  78. ];
  79. };
  80. /**
  81. * Creates a half-width arrow symbol. Like a triangle, except not filled.
  82. * ```
  83. * o
  84. * o
  85. * o
  86. * o
  87. * o
  88. * ```
  89. *
  90. * @private
  91. * @function
  92. *
  93. * @param {number} x
  94. * x position of the arrow
  95. *
  96. * @param {number} y
  97. * y position of the arrow
  98. *
  99. * @param {number} w
  100. * width of the arrow
  101. *
  102. * @param {number} h
  103. * height of the arrow
  104. *
  105. * @return {Highcharts.SVGPathArray}
  106. * Path array
  107. */
  108. SVGRenderer.prototype.symbols['arrow-half'] = function (x, y, w, h) {
  109. return SVGRenderer.prototype.symbols.arrow(x, y, w / 2, h);
  110. };
  111. /**
  112. * Creates a left-oriented triangle.
  113. * ```
  114. * o
  115. * ooooooo
  116. * ooooooooooooo
  117. * ooooooo
  118. * o
  119. * ```
  120. *
  121. * @private
  122. * @function
  123. *
  124. * @param {number} x
  125. * x position of the triangle
  126. *
  127. * @param {number} y
  128. * y position of the triangle
  129. *
  130. * @param {number} w
  131. * width of the triangle
  132. *
  133. * @param {number} h
  134. * height of the triangle
  135. *
  136. * @return {Highcharts.SVGPathArray}
  137. * Path array
  138. */
  139. SVGRenderer.prototype.symbols['triangle-left'] = function (x, y, w, h) {
  140. return [
  141. ['M', x + w, y],
  142. ['L', x, y + h / 2],
  143. ['L', x + w, y + h],
  144. ['Z']
  145. ];
  146. };
  147. /**
  148. * Alias function for triangle-left.
  149. *
  150. * @private
  151. * @function
  152. *
  153. * @param {number} x
  154. * x position of the arrow
  155. *
  156. * @param {number} y
  157. * y position of the arrow
  158. *
  159. * @param {number} w
  160. * width of the arrow
  161. *
  162. * @param {number} h
  163. * height of the arrow
  164. *
  165. * @return {Highcharts.SVGPathArray}
  166. * Path array
  167. */
  168. SVGRenderer.prototype.symbols['arrow-filled'] = SVGRenderer.prototype.symbols['triangle-left'];
  169. /**
  170. * Creates a half-width, left-oriented triangle.
  171. * ```
  172. * o
  173. * oooo
  174. * ooooooo
  175. * oooo
  176. * o
  177. * ```
  178. *
  179. * @private
  180. * @function
  181. *
  182. * @param {number} x
  183. * x position of the triangle
  184. *
  185. * @param {number} y
  186. * y position of the triangle
  187. *
  188. * @param {number} w
  189. * width of the triangle
  190. *
  191. * @param {number} h
  192. * height of the triangle
  193. *
  194. * @return {Highcharts.SVGPathArray}
  195. * Path array
  196. */
  197. SVGRenderer.prototype.symbols['triangle-left-half'] = function (x, y, w, h) {
  198. return SVGRenderer.prototype.symbols['triangle-left'](x, y, w / 2, h);
  199. };
  200. /**
  201. * Alias function for triangle-left-half.
  202. *
  203. * @private
  204. * @function
  205. *
  206. * @param {number} x
  207. * x position of the arrow
  208. *
  209. * @param {number} y
  210. * y position of the arrow
  211. *
  212. * @param {number} w
  213. * width of the arrow
  214. *
  215. * @param {number} h
  216. * height of the arrow
  217. *
  218. * @return {Highcharts.SVGPathArray}
  219. * Path array
  220. */
  221. SVGRenderer.prototype.symbols['arrow-filled-half'] = SVGRenderer.prototype.symbols['triangle-left-half'];
  222. });
  223. _registerModule(_modules, 'masters/modules/arrow-symbols.src.js', [], function () {
  224. });
  225. }));