UNPKG

igniteui-react-charts

Version:

Ignite UI React charting components for building rich data visualizations using TypeScript APIs.

581 lines (576 loc) 19.5 kB
import { __extends } from "tslib"; import { TrendLineType_$type } from "igniteui-react-core"; import { PriceDisplayType_$type } from "./PriceDisplayType"; import { CategoryCollisionMode_$type } from "./CategoryCollisionMode"; import { ValueLayerValueMode_$type } from "./ValueLayerValueMode"; import { IgrFinancialSeries } from "./igr-financial-series"; import { FinancialPriceSeries } from "./FinancialPriceSeries"; import { ensureEnum, brushToString, stringToBrush, toDoubleCollection, fromDoubleCollection, toPoint, fromRect, fromPoint } from "igniteui-react-core"; /** * Represents a IgxDataChartComponent financial price series that renders as Candlestick or OHLC representations. * Default required members: Open, Low, High, Close * * The `FinancialPriceSeries` class represents a IgxDataChartComponent financial price series that renders as Candlestick or OHLC representations. * * ```ts * <IgrDataChart * dataSource={this.state.dataSource} * width="700px" * height="500px"> * * * <IgrCategoryXAxis name="xAxis" label="Date" /> * <IgrNumericYAxis name="yAxis" /> * * * <IgrFinancialPriceSeries * name="series2" * xAxisName="xAxis" * yAxisName="yAxis" * displayType="Candlestick" * lowMemberPath="Low" * highMemberPath="High" * openMemberPath="Open" * closeMemberPath="Close" * volumeMemberPath="Volume" /> * </IgrDataChart> * ``` * * ```ts * this.series = new IgrFinancialPriceSeries({name: "series"}); * this.series.dataSource = this.financialData; * this.series.xAxis = this.timeXAxis; * this.series.yAxis = this.numericYAxis; * this.series.xAxisName = "timeXAxis"; * this.series.yAxisName = "numericYAxis"; * this.series.highMemberPath="High" ; * this.series.lowMemberPath="Low"; * this.series.closeMemberPath="Close"; * this.series.openMemberPath="Open"; * this.series.volumeMemberPath="Volume"; * ``` */ var IgrFinancialPriceSeries = /** @class */ /*@__PURE__*/ (function (_super) { __extends(IgrFinancialPriceSeries, _super); function IgrFinancialPriceSeries(props) { return _super.call(this, props) || this; } IgrFinancialPriceSeries.prototype.createImplementation = function () { return new FinancialPriceSeries(); }; Object.defineProperty(IgrFinancialPriceSeries.prototype, "i", { /** * @hidden */ get: function () { return this._implementation; }, enumerable: false, configurable: true }); Object.defineProperty(IgrFinancialPriceSeries.prototype, "isFinancialSeries", { /** * Gets whether the series has financial OHLC/candlestick visuals */ get: function () { return this.i.fd; }, enumerable: false, configurable: true }); Object.defineProperty(IgrFinancialPriceSeries.prototype, "trendLineType", { /** * Gets or sets the trend type for the current financial series. * * Use the `TrendLineType` property for the trend type of the current financial series. * * ```ts * <IgrDataChart * dataSource={this.state.dataSource} * width="700px" * height="500px"> * * * <IgrCategoryXAxis name="xAxis" label="Date" /> * <IgrNumericYAxis name="yAxis" /> * * * <IgrFinancialPriceSeries * name="series2" * xAxisName="xAxis" * yAxisName="yAxis" * displayType="Candlestick" * lowMemberPath="Low" * highMemberPath="High" * openMemberPath="Open" * closeMemberPath="Close" * volumeMemberPath="Volume" * trendLineType={this.state.trendLineType} /> * </IgrDataChart> * ``` * * ```ts * series.trendLineType= "CubicFit"; * ``` */ get: function () { return this.i.trendLineType; }, set: function (v) { this.i.trendLineType = ensureEnum(TrendLineType_$type, v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrFinancialPriceSeries.prototype, "trendLineBrush", { /** * Gets or sets the brush to use to draw the trend line. * * Use the `TrendLineBrush` property to brush the the trend line. * * ```ts * <IgrDataChart * dataSource={this.state.dataSource} * width="700px" * height="500px"> * * * <IgrCategoryXAxis name="xAxis" label="Date" /> * <IgrNumericYAxis name="yAxis" /> * * * <IgrFinancialPriceSeries * name="series2" * xAxisName="xAxis" * yAxisName="yAxis" * displayType="Candlestick" * lowMemberPath="Low" * highMemberPath="High" * openMemberPath="Open" * closeMemberPath="Close" * volumeMemberPath="Volume" * trendLineBrush="Blue" /> * </IgrDataChart> * ``` * * ```ts * series.trendLineBrush="red"; * ``` */ get: function () { return brushToString(this.i.trendLineBrush); }, set: function (v) { this.i.trendLineBrush = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrFinancialPriceSeries.prototype, "actualTrendLineBrush", { /** * Gets the effective TrendLineBrush for this FinancialPriceSeries. * * Use the `ActualTrendLineBrush` property to Gets the effective TrendLineBrush for the FinancialIndicator. * * ````ts * <IgrDataChart * ref={this.onChartRef} * dataSource={this.data} * width="100%" * height="100%" > * * <IgrCategoryXAxis name="xAxis" label="Label" /> * <IgrNumericYAxis name="yAxis" /> * * <IgrFinancialPriceSeries * name="series1" * xAxisName="xAxis" * yAxisName="yAxis" * highMemberPath="High" * lowMemberPath="Low" * closeMemberPath="Close" * openMemberPath="Open" * volumeMemberPath="Volume" * trendLineType={this.state.trendLineType} * displayType= "Candlestick" * trendLinePeriod = {2} * actualTrendLineBrush= "blue"/> * * </IgrDataChart> * * ``` * ```` */ get: function () { return brushToString(this.i.ac6); }, set: function (v) { this.i.ac6 = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrFinancialPriceSeries.prototype, "trendLineThickness", { /** * Gets or sets the thickness of the current FinancialPriceSeries object's trend line. * * Use the `TrendLineThickness` property for the thickness of the current FinancialPriceSeries object's trend line. * * ```ts * <IgrDataChart * dataSource={this.state.dataSource} * width="700px" * height="500px"> * * * <IgrCategoryXAxis name="xAxis" label="Date" /> * <IgrNumericYAxis name="yAxis" /> * * * <IgrFinancialPriceSeries * name="series2" * xAxisName="xAxis" * yAxisName="yAxis" * displayType="Candlestick" * lowMemberPath="Low" * highMemberPath="High" * openMemberPath="Open" * closeMemberPath="Close" * volumeMemberPath="Volume" * trendLineThickness="3"/> * </IgrDataChart> * ``` * * ```ts * series.trendLineThickness=5; * ``` */ get: function () { return this.i.trendLineThickness; }, set: function (v) { this.i.trendLineThickness = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrFinancialPriceSeries.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 FinancialPriceSeries object. */ get: function () { return fromDoubleCollection(this.i.ac8); }, set: function (v) { this.i.ac8 = toDoubleCollection(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrFinancialPriceSeries.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 the `TrendLinePeriod` property for the periodo the the current series. * * ```ts * <IgrDataChart * dataSource={this.state.dataSource} * width="700px" * height="500px"> * * * <IgrCategoryXAxis name="xAxis" label="Date" /> * <IgrNumericYAxis name="yAxis" /> * * * <IgrFinancialPriceSeries * name="series2" * xAxisName="xAxis" * yAxisName="yAxis" * displayType="Candlestick" * lowMemberPath="Low" * highMemberPath="High" * openMemberPath="Open" * closeMemberPath="Close" * volumeMemberPath="Volume" * trendLinePeriod={7} /> * </IgrDataChart> * ``` * * ```ts * series.trendLinePeriod= 7; * ``` */ get: function () { return this.i.trendLinePeriod; }, set: function (v) { this.i.trendLinePeriod = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrFinancialPriceSeries.prototype, "displayType", { /** * Gets or sets the display type for the current FinancialPriceSeries object. * * Use the `DisplayType` property for the display type of the current FinancialPriceSeries object. * * ```ts * <IgrDataChart * dataSource={this.state.dataSource} * width="700px" * height="500px"> * * * <IgrCategoryXAxis name="xAxis" label="Date" /> * <IgrNumericYAxis name="yAxis" /> * * * <IgrFinancialPriceSeries * name="series2" * xAxisName="xAxis" * yAxisName="yAxis" * displayType="Candlestick" * lowMemberPath="Low" * highMemberPath="High" * openMemberPath="Open" * closeMemberPath="Close" * volumeMemberPath="Volume" * /> * </IgrDataChart> * ``` * * ```ts * series.displayType=PriceDisplayType.Candlestick; * ``` */ get: function () { return this.i.abo; }, set: function (v) { this.i.abo = ensureEnum(PriceDisplayType_$type, v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrFinancialPriceSeries.prototype, "categoryCollisionMode", { /** * Gets or sets the category collision mode selection behavior to use for the series. */ get: function () { return this.i.abm; }, set: function (v) { this.i.abm = ensureEnum(CategoryCollisionMode_$type, v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrFinancialPriceSeries.prototype, "negativeOutline", { /** * Brush to use for outlining negative elements in the series. * * Use the `NegativeOutline` property to brush the outline negative elements in the series. * * ```ts * <IgrDataChart * dataSource={this.state.dataSource} * width="700px" * height="500px"> * * * <IgrCategoryXAxis name="xAxis" label="Date" /> * <IgrNumericYAxis name="yAxis" /> * * * <IgrFinancialPriceSeries * name="series2" * xAxisName="xAxis" * yAxisName="yAxis" * displayType="Candlestick" * lowMemberPath="Low" * highMemberPath="High" * openMemberPath="Open" * closeMemberPath="Close" * volumeMemberPath="Volume" * negativeOutline="Red" /> * </IgrDataChart> * ``` * * ```ts * series.negativeOutline="red"; * ``` */ get: function () { return brushToString(this.i.ac7); }, set: function (v) { this.i.ac7 = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrFinancialPriceSeries.prototype, "lowMemberAsLegendLabel", { /** * Gets or sets the label displayed before series' Low value in the Data Legend. */ get: function () { return this.i.ab5; }, set: function (v) { this.i.ab5 = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrFinancialPriceSeries.prototype, "highMemberAsLegendLabel", { /** * Gets or sets the label displayed before series' High value in the Data Legend. */ get: function () { return this.i.ab1; }, set: function (v) { this.i.ab1 = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrFinancialPriceSeries.prototype, "closeMemberAsLegendLabel", { /** * Gets or sets the label displayed before series' Close value in the Data Legend. */ get: function () { return this.i.abw; }, set: function (v) { this.i.abw = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrFinancialPriceSeries.prototype, "openMemberAsLegendLabel", { /** * Gets or sets the label displayed before series' Open value in the Data Legend. */ get: function () { return this.i.aca; }, set: function (v) { this.i.aca = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrFinancialPriceSeries.prototype, "lowMemberAsLegendUnit", { /** * Gets or sets the unit displayed after series' Low value in the Data Legend. */ get: function () { return this.i.ab7; }, set: function (v) { this.i.ab7 = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrFinancialPriceSeries.prototype, "highMemberAsLegendUnit", { /** * Gets or sets the unit displayed after series' High value in the Data Legend. */ get: function () { return this.i.ab3; }, set: function (v) { this.i.ab3 = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrFinancialPriceSeries.prototype, "closeMemberAsLegendUnit", { /** * Gets or sets the unit displayed after series' Close value in the Data Legend. */ get: function () { return this.i.aby; }, set: function (v) { this.i.aby = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrFinancialPriceSeries.prototype, "openMemberAsLegendUnit", { /** * Gets or sets the unit displayed after series' Open value in the Data Legend. */ get: function () { return this.i.acc; }, set: function (v) { this.i.acc = 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 return the best available value bounding box within the series that has the best value match for the world position provided. */ IgrFinancialPriceSeries.prototype.getSeriesValueBoundingBox = function (world) { var iv = this.i.w8(toPoint(world)); return fromRect(iv); }; /** * Scrolls the series to display the item for the specified data item. * The categorySeries 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` methos scrolls the series to display the item for the specified data item. */ IgrFinancialPriceSeries.prototype.scrollIntoView = function (item) { var iv = this.i.gj(item); return (iv); }; /** * For a category plotted series, returns the current width of the items within the categories. This only returns a value if the items have some form of width (e.g. columns, bars, etc.) otherwise 0 is returned. * * The `GetItemSpan` method is used For a category plotted series, returns the current width of the items within the categories. * * This only returns a value if the items have some form of width (e.g. columns, bars, etc.) otherwise 0 is returned */ IgrFinancialPriceSeries.prototype.getItemSpan = function () { var iv = this.i.i3(); return (iv); }; IgrFinancialPriceSeries.prototype.setNegativeColors = function (negativeBrush, negativeOutline) { this.i.sl(stringToBrush(negativeBrush), stringToBrush(negativeOutline)); }; /** * Gets a numeric value from the numeric axis associated with this series that matches the desired * value mode. * @param mode * The type of value desired from the series numeric axis. */ IgrFinancialPriceSeries.prototype.getSeriesValueType = function (mode) { var iv = this.i.aq(ensureEnum(ValueLayerValueMode_$type, mode)); return (iv); }; IgrFinancialPriceSeries.prototype.getSeriesValueTypePosition = function (mode) { var iv = this.i.wz(ensureEnum(ValueLayerValueMode_$type, mode)); return fromPoint(iv); }; IgrFinancialPriceSeries.prototype.getSeriesValueTypePositionFromValue = function (values) { var iv = this.i.w0(values); return fromPoint(iv); }; return IgrFinancialPriceSeries; }(IgrFinancialSeries)); export { IgrFinancialPriceSeries };