| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- /**
- * @license Highstock JS v8.2.0 (2020-08-20)
- *
- * Indicator series type for Highstock
- *
- * (c) 2010-2019 Rafal Sebestjanski
- *
- * License: www.highcharts.com/license
- */
- 'use strict';
- (function (factory) {
- if (typeof module === 'object' && module.exports) {
- factory['default'] = factory;
- module.exports = factory;
- } else if (typeof define === 'function' && define.amd) {
- define('highcharts/indicators/trix', ['highcharts', 'highcharts/modules/stock'], function (Highcharts) {
- factory(Highcharts);
- factory.Highcharts = Highcharts;
- return factory;
- });
- } else {
- factory(typeof Highcharts !== 'undefined' ? Highcharts : undefined);
- }
- }(function (Highcharts) {
- var _modules = Highcharts ? Highcharts._modules : {};
- function _registerModule(obj, path, args, fn) {
- if (!obj.hasOwnProperty(path)) {
- obj[path] = fn.apply(null, args);
- }
- }
- _registerModule(_modules, 'Mixins/IndicatorRequired.js', [_modules['Core/Utilities.js']], function (U) {
- /**
- *
- * (c) 2010-2020 Daniel Studencki
- *
- * License: www.highcharts.com/license
- *
- * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
- *
- * */
- var error = U.error;
- /* eslint-disable no-invalid-this, valid-jsdoc */
- var requiredIndicatorMixin = {
- /**
- * Check whether given indicator is loaded,
- else throw error.
- * @private
- * @param {Highcharts.Indicator} indicator
- * Indicator constructor function.
- * @param {string} requiredIndicator
- * Required indicator type.
- * @param {string} type
- * Type of indicator where function was called (parent).
- * @param {Highcharts.IndicatorCallbackFunction} callback
- * Callback which is triggered if the given indicator is loaded.
- * Takes indicator as an argument.
- * @param {string} errMessage
- * Error message that will be logged in console.
- * @return {boolean}
- * Returns false when there is no required indicator loaded.
- */
- isParentLoaded: function (indicator,
- requiredIndicator,
- type,
- callback,
- errMessage) {
- if (indicator) {
- return callback ? callback(indicator) : true;
- }
- error(errMessage || this.generateMessage(type, requiredIndicator));
- return false;
- },
- /**
- * @private
- * @param {string} indicatorType
- * Indicator type
- * @param {string} required
- * Required indicator
- * @return {string}
- * Error message
- */
- generateMessage: function (indicatorType, required) {
- return 'Error: "' + indicatorType +
- '" indicator type requires "' + required +
- '" indicator loaded before. Please read docs: ' +
- 'https://api.highcharts.com/highstock/plotOptions.' +
- indicatorType;
- }
- };
- return requiredIndicatorMixin;
- });
- _registerModule(_modules, 'Stock/Indicators/TRIXIndicator.js', [_modules['Core/Globals.js'], _modules['Core/Utilities.js'], _modules['Mixins/IndicatorRequired.js']], function (H, U, requiredIndicator) {
- /* *
- *
- * License: www.highcharts.com/license
- *
- * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
- *
- * */
- var correctFloat = U.correctFloat,
- seriesType = U.seriesType;
- var TEMA = H.seriesTypes.tema;
- /**
- * The TRIX series type.
- *
- * @private
- * @class
- * @name Highcharts.seriesTypes.trix
- *
- * @augments Highcharts.Series
- */
- seriesType('trix', 'tema',
- /**
- * Triple exponential average (TRIX) oscillator. This series requires
- * `linkedTo` option to be set.
- *
- * Requires https://code.highcharts.com/stock/indicators/ema.js
- * and https://code.highcharts.com/stock/indicators/tema.js.
- *
- * @sample {highstock} stock/indicators/trix
- * TRIX indicator
- *
- * @extends plotOptions.tema
- * @since 7.0.0
- * @product highstock
- * @excluding allAreas, colorAxis, compare, compareBase, joinBy, keys,
- * navigatorOptions, pointInterval, pointIntervalUnit,
- * pointPlacement, pointRange, pointStart, showInNavigator,
- * stacking
- * @optionparent plotOptions.trix
- */
- {},
- /**
- * @lends Highcharts.Series#
- */
- {
- init: function () {
- var args = arguments,
- ctx = this;
- requiredIndicator.isParentLoaded(TEMA, 'tema', ctx.type, function (indicator) {
- indicator.prototype.init.apply(ctx, args);
- return;
- });
- },
- // TRIX is calculated using TEMA so we just extend getTemaPoint method.
- getTemaPoint: function (xVal, tripledPeriod, EMAlevels, i) {
- if (i > tripledPeriod) {
- var TRIXPoint = [
- xVal[i - 3],
- EMAlevels.prevLevel3 !== 0 ?
- correctFloat(EMAlevels.level3 - EMAlevels.prevLevel3) /
- EMAlevels.prevLevel3 * 100 : null
- ];
- }
- return TRIXPoint;
- }
- });
- /**
- * A `TRIX` series. If the [type](#series.tema.type) option is not specified, it
- * is inherited from [chart.type](#chart.type).
- *
- * @extends series,plotOptions.tema
- * @since 7.0.0
- * @product highstock
- * @excluding allAreas, colorAxis, compare, compareBase, dataParser, dataURL,
- * joinBy, keys, navigatorOptions, pointInterval, pointIntervalUnit,
- * pointPlacement, pointRange, pointStart, showInNavigator, stacking
- * @apioption series.trix
- */
- ''; // to include the above in the js output
- });
- _registerModule(_modules, 'masters/indicators/trix.src.js', [], function () {
- });
- }));
|