Merge pull request #1943 from asgerf/master

various bugfixes in d3.d.ts
This commit is contained in:
Bart van der Schoor
2014-04-02 20:01:01 +02:00

132
d3/d3.d.ts vendored
View File

@@ -528,7 +528,7 @@ declare module D3 {
/**
* gets the touch positions relative to a specified container.
*/
touches(container: any): Array<number>;
touches(container: any): Array<Array<number>>;
/**
* If the specified value is a function, returns the specified value.
@@ -1031,7 +1031,7 @@ declare module D3 {
ceil: (date: Date) => Date;
range: Range;
offset: (date: Date, step: number) => Date;
utc: Interval;
utc?: Interval;
}
export interface TimeFormat {
@@ -1066,7 +1066,7 @@ declare module D3 {
histogram(): HistogramLayout;
pack(): PackLayout;
partition(): PartitionLayout;
treeMap(): TreeMapLayout;
treemap(): TreeMapLayout;
}
export interface StackLayout {
@@ -1266,7 +1266,7 @@ declare module D3 {
}
export interface BundleLayout{
(links: Array<GraphLink>): Array<GraphNode>;
(links: Array<GraphLink>): Array<Array<GraphNode>>;
}
export interface ChordLayout {
@@ -1279,15 +1279,15 @@ declare module D3 {
(padding: number): ChordLayout;
}
sortGroups: {
(): Array<number>;
(): (a: number, b: number) => number;
(comparator: (a: number, b: number) => number): ChordLayout;
}
sortSubgroups: {
(): Array<number>;
(): (a: number, b: number) => number;
(comparator: (a: number, b: number) => number): ChordLayout;
}
sortChords: {
(): Array<GraphLink>;
(): (a: number, b: number) => number;
(comparator: (a: number, b: number) => number): ChordLayout;
}
chords(): Array<GraphLink>;
@@ -2480,7 +2480,7 @@ declare module D3 {
(values: any[]): Scale;
(): any[];
};
invertExtent(y: any): any[];
invertExtent?(y: any): any[];
copy(): Scale;
}
@@ -2579,13 +2579,31 @@ declare module D3 {
(value: number): number;
}
export interface IdentityScale extends QuantitiveScale {
export interface IdentityScale extends Scale {
/**
* Get the range value corresponding to a given domain value.
*
* @param value Domain Value
*/
(value: number): number;
/**
* Get the domain value corresponding to a given range value.
*
* @param value Range Value
*/
invert(value: number): number;
/**
* get representative values from the input domain.
*
* @param count Aproximate representative values to return.
*/
ticks(count: number): any[];
/**
* get a formatter for displaying tick values
*
* @param count Aproximate representative values to return
*/
tickFormat(count: number): (n: number) => string;
}
export interface SqrtScale extends QuantitiveScale {
@@ -2910,11 +2928,11 @@ declare module D3 {
/**
* create a standard projection from a raw projection.
*/
projection(raw: (lambda: any, phi: any) => any): Projection;
projection(raw: RawProjection): Projection;
/**
* create a standard projection from a mutable raw projection.
*/
projectionMutator(rawFactory: (lambda: number, phi: number) => Array<number>): Projection;
projectionMutator(rawFactory: RawProjection): ProjectionMutator;
/**
* the Albers equal-area conic projection.
*/
@@ -2928,82 +2946,82 @@ declare module D3 {
*/
azimuthalEqualArea: {
(): Projection;
raw(): Projection;
raw: RawProjection;
}
/**
* the azimuthal equidistant projection.
*/
azimuthalEquidistant: {
(): Projection;
raw(): Projection;
raw: RawProjection;
}
/**
* the conic conformal projection.
*/
conicConformal: {
(): Projection;
raw(): Projection;
raw(phi1:number, phi2:number): RawProjection;
}
/**
* the conic equidistant projection.
*/
conicEquidistant: {
(): Projection;
raw(): Projection;
raw(phi1:number, phi2:number): RawProjection;
}
/**
* the conic equal-area (a.k.a. Albers) projection.
*/
conicEqualArea: {
(): Projection;
raw(): Projection;
raw(phi1:number, phi2:number): RawProjection;
}
/**
* the equirectangular (plate carreé) projection.
*/
equirectangular: {
(): Projection;
raw(): Projection;
raw: RawProjection;
}
/**
* the gnomonic projection.
*/
gnomonic: {
(): Projection;
raw(): Projection;
raw: RawProjection;
}
/**
* the spherical Mercator projection.
*/
mercator: {
(): Projection;
raw(): Projection;
raw: RawProjection;
}
/**
* the azimuthal orthographic projection.
*/
othographic: {
orthographic: {
(): Projection;
raw(): Projection;
raw: RawProjection;
}
/**
* the azimuthal stereographic projection.
*/
stereographic: {
(): Projection;
raw(): Projection;
raw: RawProjection;
}
/**
* the transverse Mercator projection.
*/
transverseMercator: {
(): Projection;
raw(): Projection;
raw: RawProjection;
}
/**
* convert a GeoJSON object to a geometry stream.
*/
stream(object: GeoJSON, listener: any): Stream;
stream(object: GeoJSON, listener: Stream): void;
/**
*
*/
@@ -3011,7 +3029,7 @@ declare module D3 {
/**
*
*/
greatArc: GreatArc;
greatArc(): GreatArc;
/**
*
*/
@@ -3107,7 +3125,7 @@ declare module D3 {
export interface Graticule{
(): GeoJSON;
lines(): GeoJSON;
lines(): Array<GeoJSON>;
outline(): GeoJSON;
extent: {
(): Array<Array<number>>;
@@ -3161,9 +3179,14 @@ declare module D3 {
type: string;
}
export interface RawProjection {
(lambda: number, phi: number): Array<number>;
invert?(x: number, y: number): Array<number>;
}
export interface Projection {
(coordinates: Array<number>): Array<number>;
invert(point: Array<number>): Array<number>;
invert?(point: Array<number>): Array<number>;
rotate: {
(): Array<number>;
(rotation: Array<number>): Projection;
@@ -3196,7 +3219,7 @@ declare module D3 {
(): number;
(precision: number): Projection;
};
stream(listener?: any): Stream;
stream(listener?: Stream): Stream;
}
export interface Stream {
@@ -3212,6 +3235,10 @@ declare module D3 {
(location: Array<number>): Rotation;
invert(location: Array<number>): Rotation;
}
export interface ProjectionMutator {
(lambda: number, phi: number): Projection;
}
}
// Geometry
@@ -3229,15 +3256,25 @@ declare module D3 {
/**
* constructs a quadtree for an array of points.
*/
quadtree: Quadtree;
quadtree(): QuadtreeFactory;
/**
* constructs a polygon
* Constructs a new quadtree for the specified array of points.
*/
polygon: Polygon;
quadtree(points: Array<Point>, x1: number, y1: number, x2: number, y2: number): Quadtree;
/**
* Constructs a new quadtree for the specified array of points.
*/
quadtree(points: Array<Point>, width: number, height: number): Quadtree;
/**
* Returns the input array of vertices with additional methods attached
*/
polygon(vertices:Array<Vertice>): Polygon;
/**
* creates a new hull layout with the default settings.
*/
hull: Hull;
hull(): Hull;
hull(vertices:Array<Vertice>): Array<Vertice>;
}
export interface Vertice extends Array<number> {
@@ -3248,10 +3285,6 @@ declare module D3 {
}
export interface Polygon extends Array<Vertice> {
/**
* Returns the input array of vertices with additional methods attached
*/
(vertices: Array<Vertice>): Polygon;
/**
* Returns the signed area of this polygon
*/
@@ -3266,7 +3299,7 @@ declare module D3 {
clip(subject: Polygon): Polygon;
}
export interface Quadtree {
export interface QuadtreeFactory {
/**
* Constructs a new quadtree for the specified array of points.
*/
@@ -3279,22 +3312,29 @@ declare module D3 {
* Constructs a new quadtree for the specified array of points.
*/
(points: Array<Point>, width: number, height: number): Quadtree;
/**
* Adds a new point to the quadtree.
*/
add(point: Point): Quadtree;
visit(callback: any): Quadtree;
x: {
(): (d: any) => any;
(accesor: (d: any) => any): Quadtree;
(accesor: (d: any) => any): QuadtreeFactory;
}
y: {
(): (d: any) => any;
(accesor: (d: any) => any): Quadtree;
(accesor: (d: any) => any): QuadtreeFactory;
}
size(size: Array<number>): Quadtree;
size(): Array<number>;
size(size: Array<number>): QuadtreeFactory;
extent(): Array<Array<number>>;
extent(points: Array<Array<number>>): QuadtreeFactory;
}
export interface Quadtree {
/**
* Adds a new point to the quadtree.
*/
add(point: Point): void;
visit(callback: any): void;
}
export interface Point {
@@ -3382,7 +3422,7 @@ declare module D3 {
}
export interface Hull {
(vertices: Array<Vertice>): Hull;
(vertices: Array<Vertice>): Array<Vertice>;
x: {
(): (d: any) => any;
(accesor: (d: any) => any): any;