@deltares/fews-web-oc-charts
Version:
FEWS Chart Library
45 lines (44 loc) • 1.36 kB
TypeScript
import { Axes } from '../Axes';
import { Visitor } from './visitor';
export declare const BrushMode: {
X: string;
Y: string;
XY: string;
};
export type BrushMode = (typeof BrushMode)[keyof typeof BrushMode];
export interface BrushHandlerOptions {
brushMode: BrushMode;
domain: Domains;
labelFormatter: (value: number | Date) => string;
}
type Domain = [number, number] | [Date, Date];
type Domains = {
x?: Domain;
y?: Domain;
};
export interface BrushDomainChangeEvent {
old: Domain;
new: Domain;
}
export type BrushHandlerEventType = 'update:x-brush-domain';
export type BrushDomainChangeCallback = (event: BrushDomainChangeEvent) => void;
export declare class BrushHandler implements Visitor {
private labels;
private axis;
private options;
private brush;
private brushGroup;
private lastDomainUpdate;
private domainChangeCallbacks;
constructor(options?: Partial<BrushHandlerOptions>);
visit(axes: Axes): void;
addEventListener(_event: BrushHandlerEventType, callback: BrushDomainChangeCallback): void;
removeEventListener(_event: BrushHandlerEventType, callback: BrushDomainChangeCallback): void;
setBrushDomain(domains: Domains): void;
private createHandler;
private createLabels;
private updateLabels;
private hideLabels;
redraw(): void;
}
export {};