scichart
Version:
Fast WebGL JavaScript Charting Library and Framework
112 lines (111 loc) • 4.17 kB
TypeScript
import { Point } from "../../Core/Point";
import { EChart2DModifierType } from "../../types/ChartModifierType";
import { AxisBase2D } from "../Visuals/Axis/AxisBase2D";
import { ChartModifierBase2D, IChartModifierBaseOptions } from "./ChartModifierBase2D";
import { ModifierMouseArgs } from "./ModifierMouseArgs";
/**
* Options for passing to the constructor of {@link MouseWheelZoomModifier}
*/
export interface IMouseWheelZoomModifierOptions extends IChartModifierBaseOptions {
/**
* Modifies the speed of mousewheel zoom, for example growFactor = 0.001 means each mousewheel 'click'
* zooms the chart 0.1%
*/
growFactor?: number;
/**
* Defines whether the Mouse Wheel zooms or pans. See {@link EActionType} for options
*/
actionType?: EActionType;
/**
* Whether the modifier applies when the mouse is over the chart area (ie not over the axes). Default true.
*/
applyToSeriesViewRect?: boolean;
/**
* Whether the modifier applies when the mouse is over the axes. Default true.
*/
applyToAxes?: boolean;
}
/**
* Defines enumeration constants for the zoom or pan action on {@link MouseWheelZoomModifier}
*/
export declare enum EActionType {
/**
* Zooms in and out when the Mouse Wheel event occurs
*/
Zoom = "Zoom",
/**
* Pans when the Mouse Wheel event occurs
*/
Pan = "Pan"
}
/**
* The MouseWheelZoomModifier provides Mouse wheel zooming behavior on a 2D {@link SciChartSurface}
* within SciChart - High Performance {@link https://www.scichart.com/javascript-chart-features | JavaScript Charts}
* @remarks
*
* To apply the MouseWheelZoomModifier to a {@link SciChartSurface} and add Mouse-wheel zoom behavior,
* use the following code:
*
* ```ts
* const sciChartSurface: SciChartSurface;
* sciChartSurface.chartModifiers.add(new MouseWheelZoomModifier());
* ```
*
* The speed of mouse-wheel zoom can be modified via the {@link MouseWheelZoomModifier.growFactor} property.
*
* ---
* 📚 Docs: {@link https://www.scichart.com/documentation/js/v4/2d-charts/chart-modifier-api/zooming-and-panning/mouse-wheel-zoom-modifier/}
*/
export declare class MouseWheelZoomModifier extends ChartModifierBase2D {
readonly type: EChart2DModifierType;
/**
* Modifies the speed of mousewheel zoom, for example growFactor = 0.001 means each mousewheel 'click'
* zooms the chart 0.1%
*/
growFactor: number;
/**
* Defines whether the Mouse Wheel zooms or pans. See {@link EActionType} for options
*/
actionType: EActionType;
/**
* Whether the modifier applies when the mouse is over the area where series are drawn (ie not over the axes). Default true.
*/
applyToSeriesViewRect: boolean;
/**
* Whether the modifier applies when the mouse is over the axes. Default true.
*/
applyToAxes: boolean;
/**
* Creates an instance of MouseWheelZoomModifier
* @param options Optional parameters to configure the modifier via {@link IMouseWheelZoomModifierOptions}
*
* ---
* 📚 Docs: {@link https://www.scichart.com/documentation/js/v4/2d-charts/chart-modifier-api/zooming-and-panning/mouse-wheel-zoom-modifier/}
*/
constructor(options?: IMouseWheelZoomModifierOptions);
/**
* @inheritDoc
*/
modifierMouseWheel(args: ModifierMouseArgs): void;
/**
* Performs the zoom operation around the mouse point
* @param mousePoint The X,Y location of the mouse at the time of the zoom
* @param wheelDelta the MouseWheel delta
*/
performZoom(mousePoint: Point, wheelDelta: number): boolean;
/**
* Performs a pan operation
* @param wheelDelta the MouseWheel delta
*/
performPan(wheelDelta: number): boolean;
toJSON(): {
type: string;
options: Required<Omit<IChartModifierBaseOptions, never>>;
};
/**
* Gets the axis size for scroll calculations
* @param axis
* @protected
*/
protected getAxisSize(axis: AxisBase2D): number;
}