igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
291 lines (290 loc) • 10.1 kB
JavaScript
import { FinancialCalculationDataSource as FinancialCalculationDataSource_internal } from "./FinancialCalculationDataSource";
import { ensureBool } from "igniteui-react-core";
/**
* Represents the data contract between a financial series and the
* decoupled calculation responsibilities which implement its mathmatical logic.
* The FinancialCalculationDataSource contract represents the subset
* of data which needs to be provided in order to test or run a calculation,
* and its intentionally a subset of the information available to the series,
* in order to make calculation strategies more easily testable and usable in isolation to
* the financial series container.
*/
var IgrFinancialCalculationDataSource = /** @class */ /*@__PURE__*/ (function () {
function IgrFinancialCalculationDataSource() {
this._implementation = this.createImplementation();
this._implementation.externalObject = this;
this.onImplementationCreated();
}
IgrFinancialCalculationDataSource.prototype.createImplementation = function () {
return new FinancialCalculationDataSource_internal();
};
Object.defineProperty(IgrFinancialCalculationDataSource.prototype, "i", {
get: function () {
return this._implementation;
},
enumerable: false,
configurable: true
});
IgrFinancialCalculationDataSource.prototype.onImplementationCreated = function () {
};
IgrFinancialCalculationDataSource.prototype._provideImplementation = function (i) {
this._implementation = i;
this._implementation.externalObject = this;
this.onImplementationCreated();
};
Object.defineProperty(IgrFinancialCalculationDataSource.prototype, "openColumn", {
get: function () {
return this.i.series.getOpenColumnAsArray();
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrFinancialCalculationDataSource.prototype, "highColumn", {
get: function () {
return this.i.series.getHighColumnAsArray();
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrFinancialCalculationDataSource.prototype, "lowColumn", {
get: function () {
return this.i.series.getLowColumnAsArray();
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrFinancialCalculationDataSource.prototype, "closeColumn", {
get: function () {
return this.i.series.getCloseColumnAsArray();
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrFinancialCalculationDataSource.prototype, "volumeColumn", {
get: function () {
return this.i.series.getVolumeColumnAsArray();
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrFinancialCalculationDataSource.prototype, "indicatorColumn", {
get: function () {
return this.i.series.indicatorColumn.asArray();
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrFinancialCalculationDataSource.prototype, "typicalColumn", {
/**
* An enumerable list of typical prices provided by the series to use
* in calculations.
*/
get: function () {
var r = this.i.typicalColumn;
if (r == null) {
return null;
}
return r.externalObject;
},
set: function (v) {
v == null ? this.i.typicalColumn = null : this.i.typicalColumn = v.i;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrFinancialCalculationDataSource.prototype, "trueRange", {
/**
* And enumerable list of true range values provided by the series to use
* in calculations.
*/
get: function () {
var r = this.i.trueRange;
if (r == null) {
return null;
}
return r.externalObject;
},
set: function (v) {
v == null ? this.i.trueRange = null : this.i.trueRange = v.i;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrFinancialCalculationDataSource.prototype, "trueLow", {
/**
* An enumerable list of true low values provided by the series to use
* in calculations.
*/
get: function () {
var r = this.i.trueLow;
if (r == null) {
return null;
}
return r.externalObject;
},
set: function (v) {
v == null ? this.i.trueLow = null : this.i.trueLow = v.i;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrFinancialCalculationDataSource.prototype, "period", {
/**
* The period to use when calculating, if applicable.
*/
get: function () {
return this.i.period;
},
set: function (v) {
this.i.period = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrFinancialCalculationDataSource.prototype, "shortPeriod", {
/**
* The short period to use when calculating, if applicable.
*/
get: function () {
return this.i.shortPeriod;
},
set: function (v) {
this.i.shortPeriod = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrFinancialCalculationDataSource.prototype, "longPeriod", {
/**
* The long period to use when calculating, if applicable.
*/
get: function () {
return this.i.longPeriod;
},
set: function (v) {
this.i.longPeriod = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrFinancialCalculationDataSource.prototype, "count", {
/**
* The count of the values in the series.
*/
get: function () {
return this.i.count;
},
set: function (v) {
this.i.count = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrFinancialCalculationDataSource.prototype, "calculateFrom", {
/**
* The starting index from which to calculate
*/
get: function () {
return this.i.calculateFrom;
},
set: function (v) {
this.i.calculateFrom = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrFinancialCalculationDataSource.prototype, "calculateCount", {
/**
* The number of items from the starting index from which to calculate
*/
get: function () {
return this.i.calculateCount;
},
set: function (v) {
this.i.calculateCount = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrFinancialCalculationDataSource.prototype, "multiplier", {
/**
* If the calculation supports some sort of scaling factor,
* this value will be used.
*/
get: function () {
return this.i.multiplier;
},
set: function (v) {
this.i.multiplier = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrFinancialCalculationDataSource.prototype, "minimumValue", {
/**
* If the calculation determines the range of indicator values,
* it will set the minimum and maximux properties.
* This will contain the previous minimum value when the indicator
* calculation is called again, in case this makes the update of the
* value speedier.
*/
get: function () {
return this.i.minimumValue;
},
set: function (v) {
this.i.minimumValue = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrFinancialCalculationDataSource.prototype, "maximumValue", {
/**
* If the calculation determines the range of indicator values,
* it will set the minimum and maximux properties.
* This will contain the previous minimum value when the indicator
* calculation is called again, in case this makes the update of the
* value speedier.
*/
get: function () {
return this.i.maximumValue;
},
set: function (v) {
this.i.maximumValue = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrFinancialCalculationDataSource.prototype, "specifiesRange", {
/**
* The calculation strategy should set this to true if it
* specifes the minimum and maximum value properties.
*/
get: function () {
return this.i.specifiesRange;
},
set: function (v) {
this.i.specifiesRange = ensureBool(v);
},
enumerable: false,
configurable: true
});
IgrFinancialCalculationDataSource.prototype.findByName = function (name) {
if (this.findEphemera) {
if (name && name.indexOf("@@e:") == 0) {
return this.findEphemera(name);
}
}
if (this.typicalColumn && this.typicalColumn.name && this.typicalColumn.name == name) {
return this.typicalColumn;
}
if (this.trueRange && this.trueRange.name && this.trueRange.name == name) {
return this.trueRange;
}
if (this.trueLow && this.trueLow.name && this.trueLow.name == name) {
return this.trueLow;
}
return null;
};
return IgrFinancialCalculationDataSource;
}());
export { IgrFinancialCalculationDataSource };