arrow-symbols.src.js 4.5 KB

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