AroonOscillatorIndicator.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /* *
  2. *
  3. * License: www.highcharts.com/license
  4. *
  5. * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
  6. *
  7. * */
  8. 'use strict';
  9. import H from '../../Core/Globals.js';
  10. import multipleLinesMixin from '../../Mixins/MultipleLines.js';
  11. import requiredIndicator from '../../Mixins/IndicatorRequired.js';
  12. import U from '../../Core/Utilities.js';
  13. var merge = U.merge, seriesType = U.seriesType;
  14. var AROON = H.seriesTypes.aroon;
  15. /**
  16. * The Aroon Oscillator series type.
  17. *
  18. * @private
  19. * @class
  20. * @name Highcharts.seriesTypes.aroonoscillator
  21. *
  22. * @augments Highcharts.Series
  23. */
  24. seriesType('aroonoscillator', 'aroon',
  25. /**
  26. * Aroon Oscillator. This series requires the `linkedTo` option to be set
  27. * and should be loaded after the `stock/indicators/indicators.js` and
  28. * `stock/indicators/aroon.js`.
  29. *
  30. * @sample {highstock} stock/indicators/aroon-oscillator
  31. * Aroon Oscillator
  32. *
  33. * @extends plotOptions.aroon
  34. * @since 7.0.0
  35. * @product highstock
  36. * @excluding allAreas, aroonDown, colorAxis, compare, compareBase,
  37. * joinBy, keys, navigatorOptions, pointInterval,
  38. * pointIntervalUnit, pointPlacement, pointRange, pointStart,
  39. * showInNavigator, stacking
  40. * @requires stock/indicators/indicators
  41. * @requires stock/indicators/aroon
  42. * @requires stock/indicators/aroon-oscillator
  43. * @optionparent plotOptions.aroonoscillator
  44. */
  45. {
  46. /**
  47. * Paramters used in calculation of aroon oscillator series points.
  48. *
  49. * @excluding periods, index
  50. */
  51. params: {
  52. /**
  53. * Period for Aroon Oscillator
  54. *
  55. * @since 7.0.0
  56. * @product highstock
  57. */
  58. period: 25
  59. },
  60. tooltip: {
  61. pointFormat: '<span style="color:{point.color}">\u25CF</span><b> {series.name}</b>: {point.y}'
  62. }
  63. },
  64. /**
  65. * @lends Highcharts.Series#
  66. */
  67. merge(multipleLinesMixin, {
  68. nameBase: 'Aroon Oscillator',
  69. pointArrayMap: ['y'],
  70. pointValKey: 'y',
  71. linesApiNames: [],
  72. init: function () {
  73. var args = arguments, ctx = this;
  74. requiredIndicator.isParentLoaded(AROON, 'aroon', ctx.type, function (indicator) {
  75. indicator.prototype.init.apply(ctx, args);
  76. return;
  77. });
  78. },
  79. getValues: function (series, params) {
  80. // 0- date, 1- Aroon Oscillator
  81. var ARO = [], xData = [], yData = [], aroon, aroonUp, aroonDown, oscillator, i;
  82. aroon = AROON.prototype.getValues.call(this, series, params);
  83. for (i = 0; i < aroon.yData.length; i++) {
  84. aroonUp = aroon.yData[i][0];
  85. aroonDown = aroon.yData[i][1];
  86. oscillator = aroonUp - aroonDown;
  87. ARO.push([aroon.xData[i], oscillator]);
  88. xData.push(aroon.xData[i]);
  89. yData.push(oscillator);
  90. }
  91. return {
  92. values: ARO,
  93. xData: xData,
  94. yData: yData
  95. };
  96. }
  97. }));
  98. /**
  99. * An `Aroon Oscillator` series. If the [type](#series.aroonoscillator.type)
  100. * option is not specified, it is inherited from [chart.type](#chart.type).
  101. *
  102. * @extends series,plotOptions.aroonoscillator
  103. * @since 7.0.0
  104. * @product highstock
  105. * @excluding allAreas, aroonDown, colorAxis, compare, compareBase, dataParser,
  106. * dataURL, joinBy, keys, navigatorOptions, pointInterval,
  107. * pointIntervalUnit, pointPlacement, pointRange, pointStart,
  108. * showInNavigator, stacking
  109. * @requires stock/indicators/indicators
  110. * @requires stock/indicators/aroon
  111. * @requires stock/indicators/aroon-oscillator
  112. * @apioption series.aroonoscillator
  113. */
  114. ''; // adds doclet above to the transpiled file