@suntree/lwc-plugin-rectangle
Version:
147 lines (143 loc) • 4.62 kB
text/typescript
// Generated by dts-bundle-generator v8.1.2
import { CanvasRenderingTarget2D } from 'fancy-canvas';
import { AutoscaleInfo, Coordinate, DataChangedScope, IChartApi, ISeriesApi, ISeriesPrimitive, ISeriesPrimitiveAxisView, ISeriesPrimitivePaneRenderer, ISeriesPrimitivePaneView, Logical, SeriesAttachedParameter, SeriesOptionsMap, SeriesPrimitivePaneViewZOrder, Time } from 'lightweight-charts';
export interface RectangleOptions {
fillColor?: string;
borderColor?: string;
/**
* 边框宽度
*/
borderWidth?: number;
labelColor: string;
labelTextColor: string;
showLabels: boolean;
/**
* 是否显示到X轴
*/
showAxis?: boolean;
priceLabelFormatter: (price: number) => string;
timeLabelFormatter: (time: Time) => string;
}
declare class RectangleAxisPaneRenderer implements ISeriesPrimitivePaneRenderer {
_p1: number | null;
_p2: number | null;
_options: RectangleOptions;
_vertical?: boolean;
constructor(p1: number | null, p2: number | null, vertical: boolean, options: RectangleOptions);
draw(target: CanvasRenderingTarget2D): void;
}
export interface Point {
time: Time;
price: number;
}
export interface RectangleDataSource {
chart: IChartApi;
series: ISeriesApi<keyof SeriesOptionsMap>;
options: RectangleOptions;
p1: Point;
p2: Point;
}
declare abstract class RectangleAxisPaneView implements ISeriesPrimitivePaneView {
_source: RectangleDataSource;
_p1: number | null;
_p2: number | null;
_vertical: boolean;
constructor(source: RectangleDataSource, vertical: boolean);
abstract getPoints(): [
Coordinate | null,
Coordinate | null
];
update(): void;
renderer(): RectangleAxisPaneRenderer;
zOrder(): SeriesPrimitivePaneViewZOrder;
}
declare class RectanglePriceAxisPaneView extends RectangleAxisPaneView {
getPoints(): [
Coordinate | null,
Coordinate | null
];
}
declare class RectangleTimeAxisPaneView extends RectangleAxisPaneView {
getPoints(): [
Coordinate | null,
Coordinate | null
];
}
declare abstract class RectangleAxisView implements ISeriesPrimitiveAxisView {
_source: RectangleDataSource;
_p: Point;
_pos: Coordinate | null;
constructor(source: RectangleDataSource, p: Point);
abstract update(): void;
abstract text(): string;
coordinate(): Coordinate | -1;
visible(): boolean;
tickVisible(): boolean;
textColor(): string;
backColor(): string;
movePoint(p: Point): void;
}
declare class RectangleTimeAxisView extends RectangleAxisView {
update(): void;
text(): string;
}
declare class RectanglePriceAxisView extends RectangleAxisView {
update(): void;
text(): string;
}
declare class RectanglePaneRenderer implements ISeriesPrimitivePaneRenderer {
_p1: ViewPoint;
_p2: ViewPoint;
_options: RectangleOptions;
constructor(p1: ViewPoint, p2: ViewPoint, options: RectangleOptions);
draw(target: CanvasRenderingTarget2D): void;
}
export interface ViewPoint {
x: Coordinate | null;
y: Coordinate | null;
}
declare class RectanglePaneView implements ISeriesPrimitivePaneView {
_source: RectangleDataSource;
_p1: ViewPoint;
_p2: ViewPoint;
constructor(source: RectangleDataSource);
update(): void;
renderer(): RectanglePaneRenderer;
}
declare abstract class PluginBase implements ISeriesPrimitive<Time> {
private _chart;
private _series;
protected dataUpdated?(scope: DataChangedScope): void;
protected requestUpdate(): void;
private _requestUpdate?;
attached({ chart, series, requestUpdate, }: SeriesAttachedParameter<Time>): void;
detached(): void;
get chart(): IChartApi;
get series(): ISeriesApi<keyof SeriesOptionsMap>;
private _fireDataUpdated;
}
export declare class Rectangle extends PluginBase implements RectangleDataSource {
_options: RectangleOptions;
_p1: Point;
_p2: Point;
_paneViews: RectanglePaneView[];
_timeAxisViews: RectangleTimeAxisView[];
_priceAxisViews: RectanglePriceAxisView[];
_priceAxisPaneViews: RectanglePriceAxisPaneView[];
_timeAxisPaneViews: RectangleTimeAxisPaneView[];
constructor(p1: Point, p2: Point, options?: Partial<RectangleOptions>);
updateAllViews(): void;
priceAxisViews(): RectanglePriceAxisView[];
timeAxisViews(): RectangleTimeAxisView[];
paneViews(): RectanglePaneView[];
priceAxisPaneViews(): RectanglePriceAxisPaneView[];
timeAxisPaneViews(): RectangleTimeAxisPaneView[];
autoscaleInfo(startTimePoint: Logical, endTimePoint: Logical): AutoscaleInfo | null;
dataUpdated(_scope: DataChangedScope): void;
_timeCurrentlyVisible(time: Time, startTimePoint: Logical, endTimePoint: Logical): boolean;
get options(): RectangleOptions;
applyOptions(options: Partial<RectangleOptions>): void;
get p1(): Point;
get p2(): Point;
}
export {};