scichart
Version:
Fast WebGL JavaScript Charting Library and Framework
192 lines (191 loc) • 8.07 kB
TypeScript
import { Point } from "../../Core/Point";
import { EChart2DModifierType } from "../../types/ChartModifierType";
import { EModifierType } from "../../types/ModifierType";
import { EXyDirection } from "../../types/XyDirection";
import { AxisBase2D } from "../Visuals/Axis/AxisBase2D";
import { IRenderableSeries } from "../Visuals/RenderableSeries/IRenderableSeries";
import { SciChartSurface } from "../Visuals/SciChartSurface";
import { ChartModifierBase } from "./ChartModifierBase";
import { TModifierExecuteCondition } from "../../types/ChartModifiers/TModifierExecuteCondition";
import { IncludedItems } from "../../Core/IncludedItems";
/**
* Options for passing to the constructor of {@link ChartModifierBase2D} derived types
*/
export interface IChartModifierBaseOptions {
/**
* A unique Id for the {@link ChartModifierBase2D}
*/
id?: string;
/**
* The primary action execute condition that modifier should respond to
*/
executeCondition?: TModifierExecuteCondition;
/**
* The secondary action execute condition that modifier should respond to
*/
secondaryExecuteCondition?: TModifierExecuteCondition;
/**
* Defines the {@link EXyDirection | Xy Direction} - whether the modifier works in X, Y or XY or neither direction,
* for vertical charts the behaviour could be inverted, for example for vertical chart
* with {@link RubberBandXyZoomModifier} and {@link EXyDirection.XDirection} the modifier works on Y axis
*/
xyDirection?: EXyDirection;
/**
* Defines the Modifier Group string - a grouping by ID for sharing mouse events across charts
*/
modifierGroup?: string;
/**
* The XAxis Id to be used by annotations internal to the modifier.
* Set if you have multiple x axes and need to distinguish between horizontal/vertical, or stacked axes
*/
xAxisId?: string;
/**
* The YAxis Id to be used by annotations internal to the modifier.
* Set if you have multiple y axes and need the modifier to use something other than the first one.
*/
yAxisId?: string;
/**
* A list of renderable series to include to this modifier
* @remarks Also see {@link ChartModifierBase2D.includedSeries} which has methods to include or exclude a series by instance
*/
includedSeriesIds?: string[];
/**
* A list of renderable series to exclude from this modifier
* @remarks Also see {@link ChartModifierBase2D.includedSeries} which has methods to include or exclude a series by instance
*/
excludedSeriesIds?: string[];
/**
* A list of X axes to include to this modifier
* @remarks Also see {@link ChartModifierBase2D.includedXAxes} which has methods to include or exclude an axis by instance
*/
includedXAxisIds?: string[];
/**
* A list of X axes to exclude from this modifier
* @remarks Also see {@link ChartModifierBase2D.includedXAxes} which has methods to include or exclude an axis by instance
*/
excludedXAxisIds?: string[];
/**
* A list of Y axes to include this modifier
* @remarks Also see {@link ChartModifierBase2D.includedYAxes} which has methods to include or exclude an axis by instance
*/
includedYAxisIds?: string[];
/**
* A list of Y axes to exclude from this modifier
* @remarks Also see {@link ChartModifierBase2D.includedYAxes} which has methods to include or exclude an axis by instance
*/
excludedYAxisIds?: string[];
}
/**
* Defines a base class to a ChartModifier2D - a class which provides Zoom, Pan, Tooltip or interaction behavior
* to SciChart - High Performance Realtime {@link https://www.scichart.com/javascript-chart-features | 2D JavaScript Charts}
*/
export declare abstract class ChartModifierBase2D extends ChartModifierBase<SciChartSurface> {
/**
* The type of chartmodifier. See {@link EChart2DModifierType} for available options
*/
abstract readonly type: EChart2DModifierType | string;
/**
* Direction to which the modifier can be applied
*/
xyDirection: EXyDirection;
/**
* The helper property to get and set the list of included renderable series
*/
includedSeries: IncludedItems;
/**
* The helper property to get and set the list of included X axes
*/
includedXAxes: IncludedItems;
/**
* The helper property to get and set the list of included Y axes
*/
includedYAxes: IncludedItems;
protected changedPropertiesList: string[];
protected xAxisIdProperty: string | undefined;
protected yAxisIdProperty: string | undefined;
protected xAxisProperty: AxisBase2D | undefined;
protected yAxisProperty: AxisBase2D | undefined;
protected typeMap: Map<string, string>;
/**
* Creates an instance of the {@link ChartModifierBase2D}
* @param options optional parameters via {@link IChartModifierBaseOptions} which can be passed to configure the modifier
*/
constructor(options?: IChartModifierBaseOptions);
/** @inheritDoc */
get modifierType(): EModifierType;
/** @inheritDoc */
onAttach(): void;
/** @inheritDoc */
get xAxisId(): string;
/** @inheritDoc */
set xAxisId(xAxisId: string);
/** @inheritDoc */
get yAxisId(): string;
/** @inheritDoc */
set yAxisId(yAxisId: string);
/** @inheritDoc */
get xAxis(): AxisBase2D | undefined;
/** @inheritDoc */
get yAxis(): AxisBase2D | undefined;
/**
* Gets all series on the parent surface.
* @protected
* @remarks This function allows mocking in tests
*/
getAllSeries(): IRenderableSeries[];
/**
* Returns the list of included X axes
*/
getIncludedXAxis(): AxisBase2D[];
/**
* Returns the list of included Y axes
*/
getIncludedYAxis(): AxisBase2D[];
/**
* Includes or excludes X axis
*/
includeXAxis(axis: AxisBase2D, isIncluded: boolean): void;
/**
* Includes or excludes Y axis
*/
includeYAxis(axis: AxisBase2D, isIncluded: boolean): void;
/**
* Includes all X and Y axes
*/
includeAllAxes(): void;
/**
* Tests if the series is included or excluded, by default it must also be visible to be included.
* To ignore the visibility check, override this with
* ```return this.includedSeries.testIsIncluded(series.id);```
* @param series
* @private
*/
protected testIsIncludedSeries(series: IRenderableSeries): boolean;
/**
* Includes renderable series. Returns True if the included items list has changed after the operation.
*/
includeSeries(series: IRenderableSeries, isIncluded: boolean): boolean;
/**
* Returns all visible and included renderable series. The list also contains included visible stacked renderable series
* This calls this.testIsIncludedSeries so it is best to customise the including check behaviour there.
*/
getIncludedRenderableSeries(): IRenderableSeries[];
/** @inheritDoc */
toJSON(): {
type: string;
options: Required<Omit<IChartModifierBaseOptions, never>>;
};
/** @inheritDoc */
linkAxes(): void;
protected testPropertyChanged(propertyName: string): boolean;
protected notifyPropertyChanged(propertyName: string): void;
/**
* Grows the Axis by a fraction around the mouse point
* @param mousePoint the X,Y location of the mouse at the time of the operation
* @param axis the Axis to grow or shrink
* @param fraction the fraction, e.g. 0.1 grows the axis by 10%
*/
protected growBy(mousePoint: Point, axis: AxisBase2D, fraction: number): void;
}
export declare const testIsOverAxes: (xAxisArr: AxisBase2D[], mousePoint: Point) => boolean;
export declare const getActiveAxes: (xAxisArr: AxisBase2D[], mousePoint: Point) => AxisBase2D[];