igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
392 lines (389 loc) • 13 kB
JavaScript
import { __extends } from "tslib";
import { IndicatorDisplayType_$type } from "./IndicatorDisplayType";
import { TrendLineType_$type } from "igniteui-react-core";
import { IgrFinancialSeries } from "./igr-financial-series";
import { ensureEnum, brushToString, stringToBrush, toDoubleCollection, fromDoubleCollection, toPoint, fromRect } from "igniteui-react-core";
/**
* Represents the base functionality for a IgxDataChartComponent financial indicator series.
*
* The `FinancialIndicator` class represents the base functionality for a IgxDataChartComponent financial indicator series.
*
* ```ts
* <IgrDataChart
* dataSource={this.state.dataSource}
* width="700px"
* height="500px">
*
*
* <IgrOrdinalTimeXAxis name="xAxis" label="Date" />
* <IgrNumericYAxis name="yAxis" />
*
* <IgrMassIndexIndicator
* name="series3"
* xAxisName="xAxis"
* yAxisName="yAxis"
* displayType="Line"
* lowMemberPath="Low"
* highMemberPath="High"
* openMemberPath="Open"
* closeMemberPath="Close"
* volumeMemberPath="Volume" />
* </IgrDataChart>
* ```
*/
var IgrFinancialIndicator = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(IgrFinancialIndicator, _super);
function IgrFinancialIndicator(props) {
return _super.call(this, props) || this;
}
Object.defineProperty(IgrFinancialIndicator.prototype, "i", {
/**
* @hidden
*/
get: function () {
return this._implementation;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrFinancialIndicator.prototype, "isFinancialIndicator", {
/**
* Gets whether the series is financial indicator
*/
get: function () {
return this.i.e9;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrFinancialIndicator.prototype, "displayType", {
/**
* Gets or sets the display for the current FinancialIndicator object.
*
* The `DisplayType` property is used to display the current FinancialIndicator object.
*
* ```ts
* <IgrDataChart
* dataSource={this.state.dataSource}
* width="700px"
* height="500px">
*
*
* <IgrOrdinalTimeXAxis name="xAxis" label="Date" />
* <IgrNumericYAxis name="yAxis" />
*
* <IgrMassIndexIndicator
* name="series3"
* xAxisName="xAxis"
* yAxisName="yAxis"
* displayType="Line"
* lowMemberPath="Low"
* highMemberPath="High"
* openMemberPath="Open"
* closeMemberPath="Close"
* volumeMemberPath="Volume"
* displayType="Column" />
* </IgrDataChart>
* ```
*
* ```ts
* series.displayType= IndicatorDisplayType.Column;
* ```
*/
get: function () {
return this.i.abe;
},
set: function (v) {
this.i.abe = ensureEnum(IndicatorDisplayType_$type, v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrFinancialIndicator.prototype, "defaultDisplayType", {
/**
* Gets default display type for the current Financial Indicator
*/
get: function () {
return this.i.abd;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrFinancialIndicator.prototype, "ignoreFirst", {
/**
* Gets or sets the number of values to hide at the beginning of the indicator.
*
* Use the `IgnoreFirst` propert to hide the number of values at the beginning of the indicator.
*
* ```ts
* <IgrDataChart
* dataSource={this.state.dataSource}
* width="700px"
* height="500px">
*
*
* <IgrOrdinalTimeXAxis name="xAxis" label="Date" />
* <IgrNumericYAxis name="yAxis" />
*
* <IgrMassIndexIndicator
* name="series3"
* xAxisName="xAxis"
* yAxisName="yAxis"
* displayType="Line"
* lowMemberPath="Low"
* highMemberPath="High"
* openMemberPath="Open"
* closeMemberPath="Close"
* volumeMemberPath="Volume"
* ignoreFirst="2"/>
* </IgrDataChart>
* ```
*
* ```ts
* series.ignoreFirst = 2;
* ```
*/
get: function () {
return this.i.abk;
},
set: function (v) {
this.i.abk = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrFinancialIndicator.prototype, "trendLineType", {
/**
* Gets or sets the trend type for the current indicator series.
*
* Use `TrendLineType` property to get the trend type for the current indicator series.
*
* ```ts
* <IgrDataChart
* dataSource={this.state.dataSource}
* width="700px"
* height="500px">
*
*
* <IgrOrdinalTimeXAxis name="xAxis" label="Date" />
* <IgrNumericYAxis name="yAxis" />
*
* <IgrMassIndexIndicator
* name="series3"
* xAxisName="xAxis"
* yAxisName="yAxis"
* displayType="Line"
* lowMemberPath="Low"
* highMemberPath="High"
* openMemberPath="Open"
* closeMemberPath="Close"
* volumeMemberPath="Volume"
* trendLineType="CubicFit"/>
* </IgrDataChart>
* ```
*
* ```ts
* series.trendLineType= TrendLineType.CubicFit;
* ```
*/
get: function () {
return this.i.trendLineType;
},
set: function (v) {
this.i.trendLineType = ensureEnum(TrendLineType_$type, v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrFinancialIndicator.prototype, "trendLineBrush", {
/**
* Gets or sets the brush to use to draw the trend line.
*
* Use the `TrendLineBrush` propert to draw the trend line.
*
* ```ts
* <IgrDataChart
* dataSource={this.state.dataSource}
* width="700px"
* height="500px">
*
*
* <IgrOrdinalTimeXAxis name="xAxis" label="Date" />
* <IgrNumericYAxis name="yAxis" />
*
* <IgrMassIndexIndicator
* name="series3"
* xAxisName="xAxis"
* yAxisName="yAxis"
* displayType="Line"
* lowMemberPath="Low"
* highMemberPath="High"
* openMemberPath="Open"
* closeMemberPath="Close"
* volumeMemberPath="Volume"
* trendLineBrush="Red"/>
* </IgrDataChart>
* ```
*/
get: function () {
return brushToString(this.i.trendLineBrush);
},
set: function (v) {
this.i.trendLineBrush = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrFinancialIndicator.prototype, "actualTrendLineBrush", {
/**
* Gets the effective TrendLineBrush for this indicator.
*
* Use the `ActualTrendLineBrush` property to Gets the effective TrendLineBrush for the FinancialIndicator.
*/
get: function () {
return brushToString(this.i.ab2);
},
set: function (v) {
this.i.ab2 = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrFinancialIndicator.prototype, "trendLineThickness", {
/**
* Gets or sets the thickness of the current indicator object's trend line.
*
* Use `TrendLineThickness` property for the thickness of the current indicator object's trend line.
*
* ```ts
* <IgrDataChart
* dataSource={this.state.dataSource}
* width="700px"
* height="500px">
*
*
* <IgrOrdinalTimeXAxis name="xAxis" label="Date" />
* <IgrNumericYAxis name="yAxis" />
*
* <IgrMassIndexIndicator
* name="series3"
* xAxisName="xAxis"
* yAxisName="yAxis"
* displayType="Line"
* lowMemberPath="Low"
* highMemberPath="High"
* openMemberPath="Open"
* closeMemberPath="Close"
* volumeMemberPath="Volume"
* trendLineThickness="2"/>
* </IgrDataChart>
* ```
*
* ```ts
* series.trendLineThickness=2 ;
* ```
*/
get: function () {
return this.i.trendLineThickness;
},
set: function (v) {
this.i.trendLineThickness = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrFinancialIndicator.prototype, "trendLineDashArray", {
/**
* Gets or sets a collection of double values that indicate the pattern of dashes and gaps that
* is used to draw the trend line for the current indicator object.
*/
get: function () {
return fromDoubleCollection(this.i.ab3);
},
set: function (v) {
this.i.ab3 = toDoubleCollection(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrFinancialIndicator.prototype, "trendLinePeriod", {
/**
* Gets or sets the trend line period for the current series.
* The typical, and initial, value for trend line period is 7.
*
* Use `TrendLinePeriod` property for the trend line period of the current series.
*
* ```ts
* <IgrDataChart
* dataSource={this.state.dataSource}
* width="700px"
* height="500px">
*
*
* <IgrOrdinalTimeXAxis name="xAxis" label="Date" />
* <IgrNumericYAxis name="yAxis" />
*
* <IgrMassIndexIndicator
* name="series3"
* xAxisName="xAxis"
* yAxisName="yAxis"
* displayType="Line"
* lowMemberPath="Low"
* highMemberPath="High"
* openMemberPath="Open"
* closeMemberPath="Close"
* volumeMemberPath="Volume"
* trendLinePeriod="30"/>
* </IgrDataChart>
* ```
*
* ```ts
* series.trendLinePeriod =30;
* ```
*/
get: function () {
return this.i.trendLinePeriod;
},
set: function (v) {
this.i.trendLinePeriod = +v;
},
enumerable: false,
configurable: true
});
/**
* If possible, will return the best available value bounding box within the series that has the best value match for the world position provided.
* @param world * The world coordinate for which to get a value bounding box for
*
* The `GetSeriesValueBoundingBox` method returns the best available value bounding box within the series that has the best value match for the world position provided.
*/
IgrFinancialIndicator.prototype.getSeriesValueBoundingBox = function (world) {
var iv = this.i.wy(toPoint(world));
return fromRect(iv);
};
IgrFinancialIndicator.prototype.getSeriesValue = function (world, useInterpolation, skipUnknowns) {
var iv = this.i.i8(toPoint(world), useInterpolation, skipUnknowns);
return (iv);
};
IgrFinancialIndicator.prototype.getPreviousOrExactIndex = function (world, skipUnknowns) {
var iv = this.i.ke(toPoint(world), skipUnknowns);
return (iv);
};
IgrFinancialIndicator.prototype.getNextOrExactIndex = function (world, skipUnknowns) {
var iv = this.i.kc(toPoint(world), skipUnknowns);
return (iv);
};
/**
* Scrolls the series to display the item for the specified data item.
* The series is scrolled by the minimum amount required to place the specified data item within
* the central 80% of the visible axis.
* @param item * The data item (item) to scroll to.
*
* The `ScrollIntoView` method scrolls the series to display the item for the specified data item.
*/
IgrFinancialIndicator.prototype.scrollIntoView = function (item) {
var iv = this.i.ge(item);
return (iv);
};
return IgrFinancialIndicator;
}(IgrFinancialSeries));
export { IgrFinancialIndicator };