rozetko
3 years ago
10 changed files with 36 additions and 467 deletions
@ -1,48 +0,0 @@
|
||||
declare const _default: { |
||||
props: { |
||||
id: { |
||||
type: StringConstructor; |
||||
required: boolean; |
||||
}; |
||||
series: { |
||||
type: ArrayConstructor; |
||||
required: boolean; |
||||
default: () => any[]; |
||||
}; |
||||
options: { |
||||
type: ObjectConstructor; |
||||
required: boolean; |
||||
default: () => {}; |
||||
}; |
||||
}; |
||||
watch: { |
||||
id(): void; |
||||
series(): void; |
||||
options(): void; |
||||
}; |
||||
mounted(): void; |
||||
destroyed(): void; |
||||
methods: { |
||||
render(): void; |
||||
renderSharedCrosshair(values: { |
||||
x?: number; |
||||
y?: number; |
||||
}): void; |
||||
hideSharedCrosshair(): void; |
||||
onPanningRescale(event: any): void; |
||||
renderChart(): void; |
||||
appendEvents(): void; |
||||
zoomIn(range: any): void; |
||||
zoomOut(centers: any): void; |
||||
mouseMove(evt: any): void; |
||||
mouseOut(): void; |
||||
onLegendClick(idx: any): void; |
||||
panningEnd(range: any): void; |
||||
panning(range: any): void; |
||||
contextMenu(evt: any): void; |
||||
sharedCrosshairMove(event: any): void; |
||||
renderStart(): void; |
||||
renderEnd(): void; |
||||
}; |
||||
}; |
||||
export default _default; |
@ -1,14 +0,0 @@
|
||||
import { GridOptions, SvgElParams } from '../types'; |
||||
import * as d3 from 'd3'; |
||||
export declare class Grid { |
||||
private _d3; |
||||
private _svgEl; |
||||
private _svgElParams; |
||||
protected gridOptions: GridOptions; |
||||
constructor(_d3: typeof d3, _svgEl: d3.Selection<SVGElement, unknown, null, undefined>, _svgElParams: SvgElParams, _gridOptions: GridOptions); |
||||
protected setOptionDefaults(gridOptions: GridOptions): GridOptions; |
||||
render(): void; |
||||
renderGridLinesX(): void; |
||||
renderGridLinesY(): void; |
||||
updateStylesOfTicks(): void; |
||||
} |
@ -1,112 +0,0 @@
|
||||
/// <reference types="lodash" />
|
||||
import VueChartwerkPodMixin from './VueChartwerkPodMixin'; |
||||
import { PodState } from './state'; |
||||
import { Grid } from './components/grid'; |
||||
import { Margin, TimeSerie, Options, TickOrientation, TimeFormat, BrushOrientation, AxisFormat, CrosshairOrientation, SvgElementAttributes, KeyEvent, PanOrientation, yAxisOrientation, ScrollPanOrientation, ScrollPanDirection, AxisOption } from './types'; |
||||
import { palette } from './colors'; |
||||
import * as d3 from 'd3'; |
||||
declare abstract class ChartwerkPod<T extends TimeSerie, O extends Options> { |
||||
protected readonly el: HTMLElement; |
||||
protected d3Node?: d3.Selection<HTMLElement, unknown, null, undefined>; |
||||
protected customOverlay?: d3.Selection<SVGRectElement, unknown, null, undefined>; |
||||
protected crosshair?: d3.Selection<SVGGElement, unknown, null, undefined>; |
||||
protected brush?: d3.BrushBehavior<unknown>; |
||||
protected zoom?: any; |
||||
protected svg?: d3.Selection<SVGElement, unknown, null, undefined>; |
||||
protected state: PodState<T, O>; |
||||
protected pan?: d3.ZoomBehavior<Element, unknown>; |
||||
protected clipPath?: any; |
||||
protected isPanning: boolean; |
||||
protected isBrushing: boolean; |
||||
protected brushStartSelection: [number, number] | null; |
||||
protected initScaleX?: d3.ScaleLinear<any, any>; |
||||
protected initScaleY?: d3.ScaleLinear<any, any>; |
||||
protected initScaleY1?: d3.ScaleLinear<any, any>; |
||||
protected xAxisElement?: d3.Selection<SVGGElement, unknown, null, undefined>; |
||||
protected yAxisElement?: d3.Selection<SVGGElement, unknown, null, undefined>; |
||||
protected y1AxisElement?: d3.Selection<SVGGElement, unknown, null, undefined>; |
||||
protected yAxisTicksColors?: string[]; |
||||
private _clipPathUID; |
||||
protected series: T[]; |
||||
protected options: O; |
||||
protected readonly d3: typeof d3; |
||||
protected deltaYTransform: number; |
||||
protected debouncedRender: import("lodash").DebouncedFunc<any>; |
||||
protected chartContainer: d3.Selection<SVGGElement, unknown, null, undefined>; |
||||
protected metricContainer: d3.Selection<SVGGElement, unknown, null, undefined>; |
||||
protected grid: Grid; |
||||
constructor(_d3: typeof d3, el: HTMLElement, _series: T[], _options: O); |
||||
protected addEventListeners(): void; |
||||
protected removeEventListeners(): void; |
||||
render(): void; |
||||
updateData(series?: T[], options?: O, shouldRerender?: boolean): void; |
||||
forceRerender(): void; |
||||
protected updateOptions(newOptions: O): void; |
||||
protected updateSeries(newSeries: T[]): void; |
||||
protected abstract renderMetrics(): void; |
||||
protected abstract onMouseOver(): void; |
||||
protected abstract onMouseOut(): void; |
||||
protected abstract onMouseMove(): void; |
||||
abstract renderSharedCrosshair(values: { |
||||
x?: number; |
||||
y?: number; |
||||
}): void; |
||||
abstract hideSharedCrosshair(): void; |
||||
protected initPodState(): void; |
||||
protected initComponents(): void; |
||||
protected renderMetricsContainer(): void; |
||||
protected createSvg(): void; |
||||
protected renderGrid(): void; |
||||
protected renderAxes(): void; |
||||
protected renderXAxis(): void; |
||||
protected renderYAxis(): void; |
||||
protected renderY1Axis(): void; |
||||
protected renderCrosshair(): void; |
||||
protected addEvents(): void; |
||||
protected initBrush(): void; |
||||
protected filterByKeyEvent(key: KeyEvent): () => boolean; |
||||
protected isD3EventKeyEqualOption(event: d3.D3ZoomEvent<any, any>, optionsKeyEvent: KeyEvent): boolean; |
||||
protected initPan(): void; |
||||
protected renderClipPath(): void; |
||||
protected renderLegend(): void; |
||||
protected renderYLabel(): void; |
||||
protected renderXLabel(): void; |
||||
protected renderNoDataPointsMessage(): void; |
||||
private disableScrollForward; |
||||
private disableScrollBackward; |
||||
protected onPanning(): void; |
||||
rescaleMetricAndAxis(event: d3.D3ZoomEvent<any, any>): void; |
||||
protected onPanningRescale(event: d3.D3ZoomEvent<any, any>): void; |
||||
rescaleAxisX(transformX: number): void; |
||||
rescaleAxisY(transformY: number): void; |
||||
protected onScrollPanningRescale(event: d3.D3ZoomEvent<any, any>): void; |
||||
protected onPanningEnd(): void; |
||||
protected onBrush(): void; |
||||
protected getSelectionAttrs(selection: number[][]): SvgElementAttributes | undefined; |
||||
protected onBrushStart(): void; |
||||
protected onBrushEnd(): void; |
||||
protected zoomOut(): void; |
||||
get absXScale(): d3.ScaleLinear<number, number>; |
||||
get absYScale(): d3.ScaleLinear<number, number>; |
||||
get xScale(): d3.ScaleLinear<number, number>; |
||||
get yScale(): d3.ScaleLinear<number, number>; |
||||
protected get y1Scale(): d3.ScaleLinear<number, number>; |
||||
getd3TimeRangeEvery(count: number): d3.TimeInterval; |
||||
get serieTimestampRange(): number | undefined; |
||||
getAxisTicksFormatter(axisOptions: AxisOption): (d: any, i: number) => any; |
||||
get timeInterval(): number; |
||||
get xTickTransform(): string; |
||||
get extraMargin(): Margin; |
||||
get width(): number; |
||||
get height(): number; |
||||
get legendRowPositionY(): number; |
||||
get margin(): Margin; |
||||
formattedBound(alias: string, target: string): string; |
||||
protected clearState(): void; |
||||
protected getSerieColor(idx: number): string; |
||||
protected get seriesTargetsWithBounds(): any[]; |
||||
protected get visibleSeries(): any[]; |
||||
protected get rectClipId(): string; |
||||
isOutOfChart(): boolean; |
||||
} |
||||
export { ChartwerkPod, VueChartwerkPodMixin, Margin, TimeSerie, Options, TickOrientation, TimeFormat, BrushOrientation, PanOrientation, AxisFormat, yAxisOrientation, CrosshairOrientation, ScrollPanOrientation, ScrollPanDirection, KeyEvent, palette }; |
File diff suppressed because one or more lines are too long
@ -1,55 +0,0 @@
|
||||
import { TimeSerie, Options, yAxisOrientation } from './types'; |
||||
import * as d3 from 'd3'; |
||||
export declare class PodState<T extends TimeSerie, O extends Options> { |
||||
protected _d3: typeof d3; |
||||
protected boxParams: { |
||||
height: number; |
||||
width: number; |
||||
}; |
||||
protected series: T[]; |
||||
protected options: O; |
||||
private _xValueRange; |
||||
private _yValueRange; |
||||
private _y1ValueRange; |
||||
private _transform; |
||||
private _xScale; |
||||
private _yScale; |
||||
private _y1Scale; |
||||
constructor(_d3: typeof d3, boxParams: { |
||||
height: number; |
||||
width: number; |
||||
}, series: T[], options: O); |
||||
protected setInitialRanges(): void; |
||||
protected initScales(): void; |
||||
protected setYScale(): void; |
||||
protected setXScale(): void; |
||||
protected setY1Scale(): void; |
||||
clearState(): void; |
||||
get yScale(): d3.ScaleLinear<number, number>; |
||||
get xScale(): d3.ScaleLinear<number, number>; |
||||
get y1Scale(): d3.ScaleLinear<number, number>; |
||||
get xValueRange(): [number, number] | undefined; |
||||
get yValueRange(): [number, number] | undefined; |
||||
get y1ValueRange(): [number, number] | undefined; |
||||
get transform(): { |
||||
x?: number; |
||||
y?: number; |
||||
k?: number | string; |
||||
}; |
||||
set xValueRange(range: [number, number]); |
||||
set yValueRange(range: [number, number]); |
||||
set y1ValueRange(range: [number, number]); |
||||
set transform(transform: { |
||||
x?: number; |
||||
y?: number; |
||||
k?: number | string; |
||||
}); |
||||
getMinValueY(): number; |
||||
getMaxValueY(): number; |
||||
getMinValueX(): number; |
||||
getMaxValueX(): number; |
||||
getMinValueY1(): number; |
||||
getMaxValueY1(): number; |
||||
get isSeriesUnavailable(): boolean; |
||||
protected filterSerieByYAxisOrientation(serie: T, orientation: yAxisOrientation): boolean; |
||||
} |
@ -1,194 +0,0 @@
|
||||
export declare type Margin = { |
||||
top: number; |
||||
right: number; |
||||
bottom: number; |
||||
left: number; |
||||
}; |
||||
export declare type Timestamp = number; |
||||
export declare type TimeSerie = { |
||||
target: string; |
||||
datapoints: [Timestamp, number][]; |
||||
alias?: string; |
||||
visible?: boolean; |
||||
color?: string; |
||||
yOrientation?: yAxisOrientation; |
||||
}; |
||||
export declare type Options = { |
||||
margin?: Margin; |
||||
confidence?: number; |
||||
eventsCallbacks?: { |
||||
zoomIn?: (range: AxisRange[]) => void; |
||||
panning?: (event: { |
||||
ranges: AxisRange[]; |
||||
d3Event: any; |
||||
}) => void; |
||||
panningEnd?: (range: AxisRange[]) => void; |
||||
zoomOut?: (centers: { |
||||
x: number; |
||||
y: number; |
||||
}) => void; |
||||
mouseMove?: (evt: any) => void; |
||||
mouseOut?: () => void; |
||||
onLegendClick?: (idx: number) => void; |
||||
onLegendLabelClick?: (idx: number) => void; |
||||
contextMenu?: (evt: any) => void; |
||||
sharedCrosshairMove?: (event: any) => void; |
||||
renderStart?: () => void; |
||||
renderEnd?: () => void; |
||||
}; |
||||
axis?: { |
||||
x?: AxisOption; |
||||
y?: AxisOption; |
||||
y1?: AxisOption; |
||||
}; |
||||
grid?: GridOptions; |
||||
crosshair?: { |
||||
orientation?: CrosshairOrientation; |
||||
color?: string; |
||||
}; |
||||
timeInterval?: { |
||||
timeFormat?: TimeFormat; |
||||
count?: number; |
||||
}; |
||||
tickFormat?: { |
||||
xAxis?: string; |
||||
xTickOrientation?: TickOrientation; |
||||
}; |
||||
labelFormat?: { |
||||
xAxis?: string; |
||||
yAxis?: string; |
||||
}; |
||||
bounds?: { |
||||
upper: string; |
||||
lower: string; |
||||
}; |
||||
timeRange?: { |
||||
from: number; |
||||
to: number; |
||||
}; |
||||
zoomEvents?: { |
||||
mouse?: { |
||||
zoom?: { |
||||
isActive: boolean; |
||||
keyEvent?: KeyEvent; |
||||
orientation?: BrushOrientation; |
||||
}; |
||||
pan?: { |
||||
isActive: boolean; |
||||
keyEvent?: KeyEvent; |
||||
orientation?: PanOrientation; |
||||
}; |
||||
doubleClick?: { |
||||
isActive: boolean; |
||||
keyEvent?: KeyEvent; |
||||
}; |
||||
}; |
||||
scroll?: { |
||||
zoom?: { |
||||
isActive: boolean; |
||||
keyEvent?: KeyEvent; |
||||
orientation?: PanOrientation; |
||||
}; |
||||
pan?: { |
||||
isActive: boolean; |
||||
keyEvent?: KeyEvent; |
||||
panStep?: number; |
||||
orientation?: ScrollPanOrientation; |
||||
direction?: ScrollPanDirection; |
||||
}; |
||||
}; |
||||
}; |
||||
renderTicksfromTimestamps?: boolean; |
||||
renderLegend?: boolean; |
||||
}; |
||||
export declare type GridOptions = { |
||||
x?: { |
||||
enabled?: boolean; |
||||
ticksCount?: number; |
||||
}; |
||||
y?: { |
||||
enabled?: boolean; |
||||
ticksCount?: number; |
||||
}; |
||||
}; |
||||
export declare type AxisOption = { |
||||
isActive?: boolean; |
||||
ticksCount?: number; |
||||
format?: AxisFormat; |
||||
range?: [number, number]; |
||||
invert?: boolean; |
||||
valueFormatter?: (value: number, i: number) => string; |
||||
colorFormatter?: (value: number, i: number) => string; |
||||
}; |
||||
export declare type AxisRange = [number, number] | undefined; |
||||
export declare type VueOptions = Omit<Options, 'eventsCallbacks'>; |
||||
export declare enum TickOrientation { |
||||
VERTICAL = "vertical", |
||||
HORIZONTAL = "horizontal", |
||||
DIAGONAL = "diagonal" |
||||
} |
||||
export declare enum TimeFormat { |
||||
SECOND = "second", |
||||
MINUTE = "minute", |
||||
HOUR = "hour", |
||||
DAY = "day", |
||||
MONTH = "month", |
||||
YEAR = "year" |
||||
} |
||||
export declare enum BrushOrientation { |
||||
VERTICAL = "vertical", |
||||
HORIZONTAL = "horizontal", |
||||
RECTANGLE = "rectangle", |
||||
SQUARE = "square" |
||||
} |
||||
export declare enum PanOrientation { |
||||
VERTICAL = "vertical", |
||||
HORIZONTAL = "horizontal", |
||||
BOTH = "both" |
||||
} |
||||
export declare enum ScrollPanOrientation { |
||||
VERTICAL = "vertical", |
||||
HORIZONTAL = "horizontal" |
||||
} |
||||
export declare enum ScrollPanDirection { |
||||
FORWARD = "forward", |
||||
BACKWARD = "backward", |
||||
BOTH = "both" |
||||
} |
||||
export declare enum AxisFormat { |
||||
TIME = "time", |
||||
NUMERIC = "numeric", |
||||
STRING = "string", |
||||
CUSTOM = "custom" |
||||
} |
||||
export declare enum CrosshairOrientation { |
||||
VERTICAL = "vertical", |
||||
HORIZONTAL = "horizontal", |
||||
BOTH = "both" |
||||
} |
||||
export declare type SvgElementAttributes = { |
||||
x: number; |
||||
y: number; |
||||
width: number; |
||||
height: number; |
||||
}; |
||||
export declare enum KeyEvent { |
||||
MAIN = "main", |
||||
SHIFT = "shift" |
||||
} |
||||
export declare enum xAxisOrientation { |
||||
TOP = "top", |
||||
BOTTOM = "bottom", |
||||
BOTH = "both" |
||||
} |
||||
export declare enum yAxisOrientation { |
||||
LEFT = "left", |
||||
RIGHT = "right", |
||||
BOTH = "both" |
||||
} |
||||
export declare type SvgElParams = { |
||||
height: number; |
||||
width: number; |
||||
xScale: d3.ScaleLinear<number, number>; |
||||
yScale: d3.ScaleLinear<number, number>; |
||||
}; |
Loading…
Reference in new issue