-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathplot.ts
More file actions
26 lines (21 loc) · 798 Bytes
/
Copy pathplot.ts
File metadata and controls
26 lines (21 loc) · 798 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import * as d3 from "d3";
import { Inject, Injectable } from "../utils";
import { Margin } from "../app/config";
import { Content } from "../app/global-env";
@Injectable
export abstract class Plot {
readonly svgHeight: number;
readonly svgWidth: number;
readonly margin: Margin;
@Inject(Content) readonly content: d3.Selection<HTMLDivElement, unknown, HTMLElement, any>
svg: d3.Selection<SVGSVGElement, unknown, HTMLElement, any>
g: d3.Selection<SVGGElement, unknown, HTMLElement, any>
abstract init(...args: any[]): Plot;
abstract update(...args: any[]): Promise<Plot>;
get width() {
return this.svgWidth - this.margin.left - this.margin.right;
}
get height() {
return this.svgHeight - this.margin.top - this.margin.bottom;
}
}