UNPKG

igniteui-react-charts

Version:

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

482 lines (477 loc) 14.9 kB
import { TrendLineType_$type } from "igniteui-react-core"; import { CategorySeriesMarkerCollisionAvoidance_$type } from "./CategorySeriesMarkerCollisionAvoidance"; import { ConsolidatedItemHitTestBehavior_$type } from "./ConsolidatedItemHitTestBehavior"; import { ValueLayerValueMode_$type } from "./ValueLayerValueMode"; import { IgrCategorySeries } from "./igr-category-series"; import { ensureEnum, brushToString, stringToBrush, toDoubleCollection, fromDoubleCollection, toPoint, fromPoint } from "igniteui-react-core"; /** * Represents the base class for all IgxDataChartComponent anchored category/value series. * * The `AnchoredCategorySeries` represents the base class for all IgxDataChartComponent anchored category/value series. * * ```ts * <IgrDataChart > * * * <IgrCategoryXAxis name="xAxisYears" * interval={12} labelLocation="OutsideBottom" * label="Year" overlap={1} gap={0.4} /> * * <IgrCategoryXAxis name="xAxisMonths" * interval={1} labelLocation="OutsideBottom" * label="Month" overlap={1} gap={0.4}/> * * <IgrNumericYAxis name="yAxisLeft" * title="Expanse | Revenue" * minimumValue={-900} labelLocation="OutsideLeft" * maximumValue={900} * interval={300} /> * * <IgrNumericYAxis name="yAxisRight" * title="Profit (%)" * minimumValue={0} labelLocation="OutsideRight" * maximumValue={100} /> * * * <IgrLineSeries name="series1" * valueMemberPath="Revenue" * xAxisName="xAxisMonths" * yAxisName="yAxisLeft" /> * </IgrDataChart> * ``` */ export class IgrAnchoredCategorySeries extends IgrCategorySeries { /** * @hidden */ get i() { return this._implementation; } constructor(props) { super(props); } /** * Gets or sets the value mapping property for the current series object. * * The `ValueMemberPath` property is used for the value mapping property of the current series object. * * ```ts * <IgrDataChart > * * * <IgrCategoryXAxis name="xAxisYears" * interval={12} labelLocation="OutsideBottom" * label="Year" overlap={1} gap={0.4} /> * * <IgrCategoryXAxis name="xAxisMonths" * interval={1} labelLocation="OutsideBottom" * label="Month" overlap={1} gap={0.4}/> * * <IgrNumericYAxis name="yAxisLeft" * title="Expanse | Revenue" * minimumValue={-900} labelLocation="OutsideLeft" * maximumValue={900} * interval={300} /> * * <IgrNumericYAxis name="yAxisRight" * title="Profit (%)" * minimumValue={0} labelLocation="OutsideRight" * maximumValue={100} /> * * * <IgrLineSeries name="series1" * valueMemberPath="Revenue" * xAxisName="xAxisMonths" * yAxisName="yAxisLeft" /> * </IgrDataChart> * ``` */ get valueMemberPath() { return this.i.ab0; } set valueMemberPath(v) { this.i.ab0 = v; } /** * Gets or sets the value mapping property for the current series object. */ get highlightedValueMemberPath() { return this.i.abs; } set highlightedValueMemberPath(v) { this.i.abs = v; } /** * Gets or sets the label displayed before series value in the Data Legend. */ get valueMemberAsLegendLabel() { return this.i.abw; } set valueMemberAsLegendLabel(v) { this.i.abw = v; } /** * Gets or sets the unit displayed after series value in the Data Legend. */ get valueMemberAsLegendUnit() { return this.i.aby; } set valueMemberAsLegendUnit(v) { this.i.aby = v; } /** * Gets or sets the trend type for the current series object. * * The `TrendLineType` property is used for the current series object's trend type.' * * ```ts * <IgrDataChart > * * * <IgrCategoryXAxis name="xAxisYears" * interval={12} labelLocation="OutsideBottom" * label="Year" overlap={1} gap={0.4} /> * * <IgrCategoryXAxis name="xAxisMonths" * interval={1} labelLocation="OutsideBottom" * label="Month" overlap={1} gap={0.4}/> * * <IgrNumericYAxis name="yAxisLeft" * title="Expanse | Revenue" * minimumValue={-900} labelLocation="OutsideLeft" * maximumValue={900} * interval={300} /> * * <IgrNumericYAxis name="yAxisRight" * title="Profit (%)" * minimumValue={0} labelLocation="OutsideRight" * maximumValue={100} /> * * * <IgrLineSeries name="series1" * valueMemberPath="Revenue" * xAxisName="xAxisMonths" * yAxisName="yAxisLeft" * trendLineType="SimpleAverage" /> * </IgrDataChart> * ``` * * ```ts * series.trendLineType= "CubicFit"; * ``` */ get trendLineType() { return this.i.trendLineType; } set trendLineType(v) { this.i.trendLineType = ensureEnum(TrendLineType_$type, v); } /** * Gets or sets the brush to use to draw the trend line. * * The `TrendLineBrush` property is used to brush the trend line. * * ```ts * <IgrDataChart > * * * <IgrCategoryXAxis name="xAxisYears" * interval={12} labelLocation="OutsideBottom" * label="Year" overlap={1} gap={0.4} /> * * <IgrCategoryXAxis name="xAxisMonths" * interval={1} labelLocation="OutsideBottom" * label="Month" overlap={1} gap={0.4}/> * * <IgrNumericYAxis name="yAxisLeft" * title="Expanse | Revenue" * minimumValue={-900} labelLocation="OutsideLeft" * maximumValue={900} * interval={300} /> * * <IgrNumericYAxis name="yAxisRight" * title="Profit (%)" * minimumValue={0} labelLocation="OutsideRight" * maximumValue={100} /> * * * <IgrLineSeries name="series1" * valueMemberPath="Revenue" * xAxisName="xAxisMonths" * yAxisName="yAxisLeft" * trendLineBrush="Gray" /> * </IgrDataChart> * ``` * * ```ts * series.trendLineBrush="red"; * ``` */ get trendLineBrush() { return brushToString(this.i.trendLineBrush); } set trendLineBrush(v) { this.i.trendLineBrush = stringToBrush(v); } /** * Gets the effective TrendLineBrush for this series. * * The `ActualTrendLineBrush` property is used to gets the effective `TrendLineBrush` for this series. */ get actualTrendLineBrush() { return brushToString(this.i.acn); } set actualTrendLineBrush(v) { this.i.acn = stringToBrush(v); } /** * Gets or sets the thickness of the current series object's trend line. * * The `TrendLineThickness` property is used for thickness of the current series object's trend line. * * ```ts * <IgrDataChart > * * * <IgrCategoryXAxis name="xAxisYears" * interval={12} labelLocation="OutsideBottom" * label="Year" overlap={1} gap={0.4} /> * * <IgrCategoryXAxis name="xAxisMonths" * interval={1} labelLocation="OutsideBottom" * label="Month" overlap={1} gap={0.4}/> * * <IgrNumericYAxis name="yAxisLeft" * title="Expanse | Revenue" * minimumValue={-900} labelLocation="OutsideLeft" * maximumValue={900} * interval={300} /> * * <IgrNumericYAxis name="yAxisRight" * title="Profit (%)" * minimumValue={0} labelLocation="OutsideRight" * maximumValue={100} /> * * * <IgrLineSeries name="series1" * valueMemberPath="Revenue" * xAxisName="xAxisMonths" * yAxisName="yAxisLeft" * trendLineThickness ="2" /> * </IgrDataChart> * ``` * * ```ts * series.trendLineThickness= 2; * ``` */ get trendLineThickness() { return this.i.trendLineThickness; } set trendLineThickness(v) { this.i.trendLineThickness = +v; } /** * 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 series object. */ get trendLineDashArray() { return fromDoubleCollection(this.i.aco); } set trendLineDashArray(v) { this.i.aco = toDoubleCollection(v); } /** * Gets or sets the trend line period for the current series. * The typical, and initial, value for trend line period is 7. * * The `TrendLinePeriod` property is used for trend line period of the current series. * * ```ts * <IgrDataChart > * * * <IgrCategoryXAxis name="xAxisYears" * interval={12} labelLocation="OutsideBottom" * label="Year" overlap={1} gap={0.4} /> * * <IgrCategoryXAxis name="xAxisMonths" * interval={1} labelLocation="OutsideBottom" * label="Month" overlap={1} gap={0.4}/> * * <IgrNumericYAxis name="yAxisLeft" * title="Expanse | Revenue" * minimumValue={-900} labelLocation="OutsideLeft" * maximumValue={900} * interval={300} /> * * <IgrNumericYAxis name="yAxisRight" * title="Profit (%)" * minimumValue={0} labelLocation="OutsideRight" * maximumValue={100} /> * * * <IgrLineSeries name="series1" * valueMemberPath="Revenue" * xAxisName="xAxisMonths" * yAxisName="yAxisLeft" * trendLinePeriod ="2" /> * </IgrDataChart> * ``` * * ```ts * series.trendLinePeriod= 7; * ``` */ get trendLinePeriod() { return this.i.trendLinePeriod; } set trendLinePeriod(v) { this.i.trendLinePeriod = +v; } /** * The desired behavior for markers in this series which are placed too close together for the current view, resulting in a collision. * * The `MarkerCollisionAvoidance` property controls the technique the chart uses to avoid overlapping markers. * * ```ts * <IgrDataChart > * * * <IgrCategoryXAxis name="xAxisYears" * interval={12} labelLocation="OutsideBottom" * label="Year" overlap={1} gap={0.4} /> * * <IgrCategoryXAxis name="xAxisMonths" * interval={1} labelLocation="OutsideBottom" * label="Month" overlap={1} gap={0.4}/> * * <IgrNumericYAxis name="yAxisLeft" * title="Expanse | Revenue" * minimumValue={-900} labelLocation="OutsideLeft" * maximumValue={900} * interval={300} /> * * <IgrNumericYAxis name="yAxisRight" * title="Profit (%)" * minimumValue={0} labelLocation="OutsideRight" * maximumValue={100} /> * * * <IgrLineSeries name="series1" * valueMemberPath="Revenue" * xAxisName="xAxisMonths" * yAxisName="yAxisLeft" * markerCollisionAvoidance="fade" /> * </IgrDataChart> * ``` */ get markerCollisionAvoidance() { return this.i.aba; } set markerCollisionAvoidance(v) { this.i.aba = ensureEnum(CategorySeriesMarkerCollisionAvoidance_$type, v); } /** * Determines the item returned in hit-testing when the pointer is over an object which represents several consolidated items. * * The `ConsolidatedItemHitTestBehavior` property is used to determines returned item in hit-testing when the pointer is over an object which represents several consolidated items. * * ```ts * <IgrDataChart > * * * <IgrCategoryXAxis name="xAxisYears" * interval={12} labelLocation="OutsideBottom" * label="Year" overlap={1} gap={0.4} /> * * <IgrCategoryXAxis name="xAxisMonths" * interval={1} labelLocation="OutsideBottom" * label="Month" overlap={1} gap={0.4}/> * * <IgrNumericYAxis name="yAxisLeft" * title="Expanse | Revenue" * minimumValue={-900} labelLocation="OutsideLeft" * maximumValue={900} * interval={300} /> * * <IgrNumericYAxis name="yAxisRight" * title="Profit (%)" * minimumValue={0} labelLocation="OutsideRight" * maximumValue={100} /> * * * <IgrLineSeries name="series1" * valueMemberPath="Revenue" * xAxisName="xAxisMonths" * yAxisName="yAxisLeft" * consolidatedItemHitTestBehavior="Basic" /> * </IgrDataChart> * ``` */ get consolidatedItemHitTestBehavior() { return this.i.abb; } set consolidatedItemHitTestBehavior(v) { this.i.abb = ensureEnum(ConsolidatedItemHitTestBehavior_$type, v); } getItemValue(item, memberPathName) { let iv = this.i.ku(item, memberPathName); return (iv); } /** * Gets the value of a requested member path from the series. * @param memberPathName * The property name of a valid member path for the series */ getMemberPathValue(memberPathName) { let iv = this.i.mi(memberPathName); 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 is used to notifies the target axis or series that it should scroll the requested data item into view. * * ```ts * this.series.scrollIntoView(dataItem); * ``` */ scrollIntoView(item) { let iv = this.i.ge(item); return (iv); } /** * Gets the item that is the best match for the specified world coordinates. * @param world * The world coordinates to use. * * The `getItem` method is used to gets the item that is the best match for the specified world coordinates. * * ```ts * let item: number = this.series.getItem({x:.5,y:.5}); * ``` */ getItem(world) { let iv = this.i.kr(toPoint(world)); return (iv); } /** * 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. */ getSeriesValueType(mode) { let iv = this.i.aq(ensureEnum(ValueLayerValueMode_$type, mode)); return (iv); } getSeriesValueTypePosition(mode) { let iv = this.i.wq(ensureEnum(ValueLayerValueMode_$type, mode)); return fromPoint(iv); } getSeriesValueTypePositionFromValue(values) { let iv = this.i.wr(values); return fromPoint(iv); } }