UNPKG

scichart

Version:

Fast WebGL JavaScript Charting Library and Framework

152 lines (151 loc) 5.76 kB
import { TEasingFn } from "../../../Core/Animations/EasingFunctions"; import { Point } from "../../../Core/Point"; import { EChart2DModifierType } from "../../../types/ChartModifierType"; import { EModifierType } from "../../../types/ModifierType"; import { IThemeProvider } from "../../Themes/IThemeProvider"; import { PolarArcAnnotation } from "../../Visuals/Annotations/PolarArcAnnotation"; import { ChartModifierBase2D, IChartModifierBaseOptions } from "../ChartModifierBase2D"; import { ModifierMouseArgs } from "../ModifierMouseArgs"; declare type TArcZoomParams = { angleStart: number; angleEnd: number; radiusInner: number; radiusOuter: number; }; /** * Optional parameters used to configure a {@link PolarArcZoomModifier} at construct time */ export interface IPolarArcZoomModifierOptions extends IChartModifierBaseOptions { /** * Sets the fill of {@link PolarArcAnnotation} used for segment selection */ fill?: string; /** * Sets the stroke of {@link PolarArcAnnotation} used for segment selection */ stroke?: string; /** * Sets the strokeThickness of {@link PolarArcAnnotation} used for segment selection */ strokeThickness?: number; /** * When true, the Zoom operations are animated. See also {@link animationDuration} and {@link easingFunction} */ isAnimated?: boolean; /** * Defines the duration of animations when zooming in milliseconds */ animationDuration?: number; /** * Defines the easing function for animation. See {@link TEasingFn} for a range of functions */ easingFunction?: TEasingFn | string; } /** * The PolarArcZoomModifier provides drag-arc segment to zoom behavior on a 2D {@link SciChartPolarSurface} * within SciChart - High Performance {@link https://www.scichart.com/javascript-chart-features | JavaScript Charts} * Supports flipped and not flipped X Axis * @remarks * * To apply the PolarArcZoomModifier to a {@link SciChartPolarSurface} and add drag to zoom behavior, * use the following code: * * ```ts * const sciChartSurface: SciChartPolarSurface; * sciChartSurface.chartModifiers.add(new PolarArcZoomModifier()); * ``` * * Animation of the zoom may be controlled via the {@link PolarArcZoomModifier.isAnimated}, * {@link PolarArcZoomModifier.animationDuration} and {@link PolarArcZoomModifier.easingFunction} properties. * * --- * 📚 Docs: {@link https://www.scichart.com/documentation/js/v4/2d-charts/chart-modifier-api/polar-modifiers/polar-arc-zoom-modifier/} */ export declare class PolarArcZoomModifier extends ChartModifierBase2D { static readonly MIN_DRAG_SENSITIVITY = 5; readonly type = EChart2DModifierType.PolarArcZoom; /** * When true, the Zoom operations are animated. See also {@link animationDuration} and {@link easingFunction} */ isAnimated: boolean; /** * Defines the duration of animations when zooming in milliseconds */ animationDuration: number; /** * Defines the easing function for animation. See {@link TEasingFn} for a range of functions */ easingFunction: TEasingFn; protected pointFrom: Point | undefined; protected polarPointFrom: Point | undefined; protected pointTo: Point | undefined; protected polarPointTo: Point | undefined; protected isClicked: boolean; protected arcAnnotation: PolarArcAnnotation | undefined; private fillProperty; private strokeProperty; private strokeThicknessProperty; /** * Creates an instance of a PolarArcZoomModifier * @param options Optional parameters of type {@link IPolarArcZoomModifierOptions} used to configure the modifier * * --- * 📚 Docs: {@link https://www.scichart.com/documentation/js/v4/2d-charts/chart-modifier-api/polar-modifiers/polar-arc-zoom-modifier/} */ constructor(options?: IPolarArcZoomModifierOptions); /** @inheritDoc */ get modifierType(): EModifierType; /** @inheritDoc */ applyTheme(themeProvider: IThemeProvider): void; /** @inheritDoc */ onAttach(): void; /** @inheritDoc */ onDetach(): void; /** @inheritDoc */ modifierMouseDown(args: ModifierMouseArgs): void; /** * used internally, caps polar coordinates to be within visible range of angular & radial axes * @param polarPoint * @returns */ private capPolarCoordinates; private getArcParams; private updateArcAnnotation; /** @inheritDoc */ modifierMouseMove(args: ModifierMouseArgs): void; private clear; /** @inheritDoc */ modifierMouseUp(args: ModifierMouseArgs): void; /** * Gets or sets the stroke thickness for the arc segment */ get strokeThickness(): number; set strokeThickness(value: number); /** * Gets or sets the stroke for arc segment */ get stroke(): string; set stroke(value: string); /** * Gets or sets the fill color for the arc segment */ get fill(): string; set fill(value: string); /** @inheritDoc */ toJSON(): { type: string; options: Required<Omit<IChartModifierBaseOptions, never>>; }; /** @inheritDoc */ delete(): void; /** * Performs the zoom operation on the parent Surface, using the mouse points from & to, which * define the corners of the arc segment */ protected performZoom(arcZoomParams: TArcZoomParams): void; protected calculateDraggedDistance(): number; private calculateArcOrigin; private handleAddArcAnnotation; private handleRemoveArcAnnotation; } export {};