mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-30 01:47:21 +08:00
[d3] Update to Minor Version 4.10 (#18103)
* [d3-zoom] Update to 1.5 * [Feature] Add `translateTo(...)` * [Doc] Update some JSDoc comments * [Chore] Bump minor version number * [d3-zoom] Bump Minor Version number. * [d3-shape] * [Fix] Change `pointRadius` to `pointRadial` * [d3-shape] Fix test for pointRadial * [d3-axis] * [Doc] Update some comments. * [d3-time] [Doc] Some JSDoc updates. * [d3] [Chore] Bump minor version to 4.10
This commit is contained in:
committed by
Wesley Wigham
parent
3f1a9ccec0
commit
5fb85c244c
38
types/d3-axis/index.d.ts
vendored
38
types/d3-axis/index.d.ts
vendored
@@ -3,7 +3,7 @@
|
||||
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// Last module patch version validated against: 1.0.4
|
||||
// Last module patch version validated against: 1.0.8
|
||||
|
||||
import { Selection, TransitionLike } from 'd3-selection';
|
||||
|
||||
@@ -82,6 +82,10 @@ export interface Axis<Domain> {
|
||||
/**
|
||||
* Sets the arguments that will be passed to scale.ticks and scale.tickFormat when the axis is rendered, and returns the axis generator.
|
||||
*
|
||||
* This method has no effect if the scale does not implement scale.ticks, as with band and point scales.
|
||||
*
|
||||
* This method is also a convenience function for axis.tickArguments.
|
||||
*
|
||||
* @param count Number of ticks that should be rendered
|
||||
* @param specifier An optional format specifier to customize how the tick values are formatted.
|
||||
*/
|
||||
@@ -91,6 +95,8 @@ export interface Axis<Domain> {
|
||||
* Sets the arguments that will be passed to scale.ticks and scale.tickFormat when the axis is rendered, and returns the axis generator.
|
||||
* Use with a TIME SCALE ONLY.
|
||||
*
|
||||
* This method is also a convenience function for axis.tickArguments.
|
||||
*
|
||||
* @param interval A time interval used to generate date-based ticks. This is typically a TimeInterval/CountableTimeInterval as defined
|
||||
* in d3-time. E.g. as obtained by passing in d3.timeMinute.every(15).
|
||||
* @param specifier An optional format specifier to customize how the tick values are formatted.
|
||||
@@ -99,17 +105,31 @@ export interface Axis<Domain> {
|
||||
|
||||
/**
|
||||
* Sets the arguments that will be passed to scale.ticks and scale.tickFormat when the axis is rendered, and returns the axis generator.
|
||||
*
|
||||
* The meaning of the arguments depends on the axis’ scale type: most commonly, the arguments are a suggested count for the number of ticks
|
||||
* (or a time interval for time scales), and an optional format specifier to customize how the tick values are formatted.
|
||||
*
|
||||
* This method has no effect if the scale does not implement scale.ticks, as with band and point scales.
|
||||
*
|
||||
* To set the tick values explicitly, use axis.tickValues. To set the tick format explicitly, use axis.tickFormat.
|
||||
*
|
||||
* This method is also a convenience function for axis.tickArguments.
|
||||
*/
|
||||
ticks(arg0: any, ...args: any[]): this;
|
||||
|
||||
/**
|
||||
* Get an array containing the currently set arguments to be passed into scale.ticks and scale.tickFormat.
|
||||
* Get an array containing the currently set arguments to be passed into scale.ticks and scale.tickFormat, which defaults to the empty array.
|
||||
*/
|
||||
tickArguments(): any[];
|
||||
|
||||
/**
|
||||
* Sets the arguments that will be passed to scale.ticks and scale.tickFormat when the axis is rendered, and returns the axis generator.
|
||||
*
|
||||
* This method has no effect if the scale does not implement scale.ticks, as with band and point scales.
|
||||
* To set the tick values explicitly, use axis.tickValues. To set the tick format explicitly, use axis.tickFormat.
|
||||
*
|
||||
* See also axis.ticks.
|
||||
*
|
||||
* @param args An array containing a single element representing the count, i.e. number of ticks to be rendered.
|
||||
*/
|
||||
tickArguments(args: [number]): this;
|
||||
@@ -117,6 +137,11 @@ export interface Axis<Domain> {
|
||||
/**
|
||||
* Sets the arguments that will be passed to scale.ticks and scale.tickFormat when the axis is rendered, and returns the axis generator.
|
||||
*
|
||||
* This method has no effect if the scale does not implement scale.ticks, as with band and point scales.
|
||||
* To set the tick values explicitly, use axis.tickValues. To set the tick format explicitly, use axis.tickFormat.
|
||||
*
|
||||
* See also axis.ticks.
|
||||
*
|
||||
* @param args An array containing two elements. The first element represents the count, i.e. number of ticks to be rendered. The second
|
||||
* element is a string representing the format specifier to customize how the tick values are formatted.
|
||||
*/
|
||||
@@ -126,6 +151,8 @@ export interface Axis<Domain> {
|
||||
* Sets the arguments that will be passed to scale.ticks and scale.tickFormat when the axis is rendered, and returns the axis generator.
|
||||
* Use with a TIME SCALE ONLY.
|
||||
*
|
||||
* See also axis.ticks.
|
||||
*
|
||||
* @param args An array containing a single element representing a time interval used to generate date-based ticks.
|
||||
* This is typically a TimeInterval/CountableTimeInterval as defined in d3-time. E.g. as obtained by passing in d3.timeMinute.every(15).
|
||||
*/
|
||||
@@ -135,6 +162,8 @@ export interface Axis<Domain> {
|
||||
* Sets the arguments that will be passed to scale.ticks and scale.tickFormat when the axis is rendered, and returns the axis generator.
|
||||
* Use with a TIME SCALE ONLY.
|
||||
*
|
||||
* See also axis.ticks.
|
||||
*
|
||||
* @param args An array containing two elements. The first element represents a time interval used to generate date-based ticks.
|
||||
* This is typically a TimeInterval/CountableTimeInterval as defined in d3-time. E.g. as obtained by passing in d3.timeMinute.every(15).
|
||||
* The second element is a string representing the format specifier to customize how the tick values are formatted.
|
||||
@@ -144,6 +173,11 @@ export interface Axis<Domain> {
|
||||
/**
|
||||
* Sets the arguments that will be passed to scale.ticks and scale.tickFormat when the axis is rendered, and returns the axis generator.
|
||||
*
|
||||
* This method has no effect if the scale does not implement scale.ticks, as with band and point scales.
|
||||
* To set the tick values explicitly, use axis.tickValues. To set the tick format explicitly, use axis.tickFormat.
|
||||
*
|
||||
* See also axis.ticks.
|
||||
*
|
||||
* @param args An array with arguments suitable for the scale to be used for tick generation
|
||||
*/
|
||||
tickArguments(args: any[]): this;
|
||||
|
||||
@@ -1319,10 +1319,10 @@ customSymbol = d3Shape.symbolTriangle;
|
||||
customSymbol = d3Shape.symbolWye;
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
// Test pointRadius
|
||||
// Test pointRadial
|
||||
// -----------------------------------------------------------------------------------
|
||||
|
||||
let coordinatates: [number, number] = d3Shape.pointRadius(0, 12);
|
||||
let coordinatates: [number, number] = d3Shape.pointRadial(0, 12);
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
// Test Stacks
|
||||
|
||||
4
types/d3-shape/index.d.ts
vendored
4
types/d3-shape/index.d.ts
vendored
@@ -2436,7 +2436,7 @@ export const symbolTriangle: SymbolType;
|
||||
export const symbolWye: SymbolType;
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
// pointRadius
|
||||
// pointRadial
|
||||
// -----------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
@@ -2444,7 +2444,7 @@ export const symbolWye: SymbolType;
|
||||
* @param angle Angle in radians, with 0 at -y (12 o’clock) and positive angles proceeding clockwise.
|
||||
* @param radius Radius.
|
||||
*/
|
||||
export function pointRadius(angle: number, radius: number): [number, number];
|
||||
export function pointRadial(angle: number, radius: number): [number, number];
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
// STACKS
|
||||
|
||||
4
types/d3-time/index.d.ts
vendored
4
types/d3-time/index.d.ts
vendored
@@ -3,7 +3,7 @@
|
||||
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// Last module patch version validated against: 1.0.4
|
||||
// Last module patch version validated against: 1.0.7
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Interfaces
|
||||
@@ -151,6 +151,8 @@ export interface CountableTimeInterval extends TimeInterval {
|
||||
*
|
||||
* This method can be used in conjunction with interval.range to ensure that two overlapping ranges are consistent.
|
||||
*
|
||||
* The returned filtered interval does not support interval.count. See also interval.filter.
|
||||
*
|
||||
* @param step Number of steps.
|
||||
*/
|
||||
every(step: number): TimeInterval | null;
|
||||
|
||||
@@ -385,6 +385,106 @@ svgZoom.translateBy(
|
||||
return 30;
|
||||
});
|
||||
|
||||
// translateTo() -------------------------------------------------------------------------------------
|
||||
|
||||
// use on selection
|
||||
svgZoom.translateTo(svgOverlay, 20, 50);
|
||||
// svgZoom.translateTo(groupsSelection, 20, 50); // fails, as groupSelection mismachtes DOM Element type and datum type
|
||||
|
||||
svgZoom.translateTo(
|
||||
svgOverlay,
|
||||
20,
|
||||
function(datum, index, groups) {
|
||||
const that: SVGRectElement = this;
|
||||
const d: SVGDatum = datum;
|
||||
const i: number = index;
|
||||
const g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement
|
||||
console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum
|
||||
return 30;
|
||||
});
|
||||
svgZoom.translateTo(
|
||||
svgOverlay,
|
||||
function(datum, index, groups) {
|
||||
const that: SVGRectElement = this;
|
||||
const d: SVGDatum = datum;
|
||||
const i: number = index;
|
||||
const g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement
|
||||
console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum
|
||||
return 30;
|
||||
},
|
||||
50);
|
||||
svgZoom.translateTo(
|
||||
svgOverlay,
|
||||
function(datum, index, groups) {
|
||||
const that: SVGRectElement = this;
|
||||
const d: SVGDatum = datum;
|
||||
const i: number = index;
|
||||
const g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement
|
||||
console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum
|
||||
return 30;
|
||||
},
|
||||
function(datum, index, groups) {
|
||||
const that: SVGRectElement = this;
|
||||
const d: SVGDatum = datum;
|
||||
const i: number = index;
|
||||
const g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement
|
||||
console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum
|
||||
return 30;
|
||||
});
|
||||
|
||||
// use on transition
|
||||
svgZoom.translateTo(svgOverlayTransition, 20, 50);
|
||||
// svgZoom.translateTo(groupsTransition, 20, 50); // fails, as groupTransition mismachtes DOM Element type and datum type
|
||||
|
||||
svgZoom.translateTo(
|
||||
svgOverlayTransition,
|
||||
20,
|
||||
function(datum, index, groups) {
|
||||
const that: SVGRectElement = this;
|
||||
const d: SVGDatum = datum;
|
||||
const i: number = index;
|
||||
const g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement
|
||||
console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum
|
||||
return 30;
|
||||
});
|
||||
svgZoom.translateTo(
|
||||
svgOverlayTransition,
|
||||
function(datum, index, groups) {
|
||||
const that: SVGRectElement = this;
|
||||
const d: SVGDatum = datum;
|
||||
const i: number = index;
|
||||
const g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement
|
||||
console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum
|
||||
return 30;
|
||||
},
|
||||
50);
|
||||
svgZoom.translateTo(
|
||||
svgOverlayTransition,
|
||||
function(datum, index, groups) {
|
||||
const that: SVGRectElement = this;
|
||||
const d: SVGDatum = datum;
|
||||
const i: number = index;
|
||||
const g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement
|
||||
console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum
|
||||
return 30;
|
||||
},
|
||||
function(datum, index, groups) {
|
||||
const that: SVGRectElement = this;
|
||||
const d: SVGDatum = datum;
|
||||
const i: number = index;
|
||||
const g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement
|
||||
console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum
|
||||
return 30;
|
||||
});
|
||||
|
||||
// scaleBy() -------------------------------------------------------------------------------------
|
||||
|
||||
// use on selection
|
||||
|
||||
198
types/d3-zoom/index.d.ts
vendored
198
types/d3-zoom/index.d.ts
vendored
@@ -1,9 +1,9 @@
|
||||
// Type definitions for d3JS d3-zoom module 1.3
|
||||
// Type definitions for d3JS d3-zoom module 1.5
|
||||
// Project: https://github.com/d3/d3-zoom/
|
||||
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// Last module patch version validated against: 1.3.0
|
||||
// Last module patch version validated against: 1.5.0
|
||||
|
||||
import { ArrayLike, Selection, TransitionLike, ValueFn } from 'd3-selection';
|
||||
import { ZoomView, ZoomInterpolator } from 'd3-interpolate';
|
||||
@@ -127,7 +127,7 @@ export interface ZoomBehavior<ZoomRefElement extends ZoomedElementBaseType, Datu
|
||||
|
||||
/**
|
||||
* Translates the current zoom transform of the selected elements by x and y,
|
||||
* such that the new t(x1) = t(x0) + k × x and t(y1) = t(y0) + k × y.
|
||||
* such that the new t(x1) = t(x0) + kx and t(y1) = t(y0) + ky.
|
||||
*
|
||||
* x is provided as a constant for all elements.
|
||||
* y is provided as a constant for all elements.
|
||||
@@ -139,13 +139,13 @@ export interface ZoomBehavior<ZoomRefElement extends ZoomedElementBaseType, Datu
|
||||
translateBy(selection: Selection<ZoomRefElement, Datum, any, any>, x: number, y: number): void;
|
||||
/**
|
||||
* Translates the current zoom transform of the selected elements by x and y,
|
||||
* such that the new t(x1) = t(x0) + k × x and t(y1) = t(y0) + k × y.
|
||||
* such that the new t(x1) = t(x0) + kx and t(y1) = t(y0) + ky.
|
||||
*
|
||||
* x is provided by a value function evaluated for each element in the selection.
|
||||
* y is provided as a constant for all elements.
|
||||
*
|
||||
* This method is a convenience method for zoom.transform.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExten, and zoom.translateExtent.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExtent, and zoom.translateExtent.
|
||||
*
|
||||
* @param selection A D3 selection of elements.
|
||||
* @param x A value function which is evaluated for each selected element,
|
||||
@@ -156,13 +156,13 @@ export interface ZoomBehavior<ZoomRefElement extends ZoomedElementBaseType, Datu
|
||||
translateBy(selection: Selection<ZoomRefElement, Datum, any, any>, x: ValueFn<ZoomRefElement, Datum, number>, y: number): void;
|
||||
/**
|
||||
* Translates the current zoom transform of the selected elements by x and y,
|
||||
* such that the new t(x1) = t(x0) + k × x and t(y1) = t(y0) + k × y.
|
||||
* such that the new t(x1) = t(x0) + kx and t(y1) = t(y0) + ky.
|
||||
*
|
||||
* x is provided as a constant for all elements.
|
||||
* y is provided by a value function evaluated for each element in the selection.
|
||||
*
|
||||
* This method is a convenience method for zoom.transform.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExten, and zoom.translateExtent.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExtent, and zoom.translateExtent.
|
||||
*
|
||||
* @param selection A D3 selection of elements.
|
||||
* @param x Amount of translation in x-direction.
|
||||
@@ -173,13 +173,13 @@ export interface ZoomBehavior<ZoomRefElement extends ZoomedElementBaseType, Datu
|
||||
translateBy(selection: Selection<ZoomRefElement, Datum, any, any>, x: number, y: ValueFn<ZoomRefElement, Datum, number>): void;
|
||||
/**
|
||||
* Translates the current zoom transform of the selected elements by x and y,
|
||||
* such that the new t(x1) = t(x0) + k × x and t(y1) = t(y0) + k × y.
|
||||
* such that the new t(x1) = t(x0) + kx and t(y1) = t(y0) + ky.
|
||||
*
|
||||
* x is provided by a value function evaluated for each element in the selection.
|
||||
* y is provided by a value function evaluated for each element in the selection.
|
||||
*
|
||||
* This method is a convenience method for zoom.transform.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExten, and zoom.translateExtent.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExtent, and zoom.translateExtent.
|
||||
*
|
||||
* @param selection A D3 selection of elements.
|
||||
* @param x A value function which is evaluated for each selected element,
|
||||
@@ -192,13 +192,13 @@ export interface ZoomBehavior<ZoomRefElement extends ZoomedElementBaseType, Datu
|
||||
translateBy(selection: Selection<ZoomRefElement, Datum, any, any>, x: ValueFn<ZoomRefElement, Datum, number>, y: ValueFn<ZoomRefElement, Datum, number>): void;
|
||||
/**
|
||||
* Defines a “zoom” tween translating the current transform for the transitioning elements by x and y,
|
||||
* such that the new t(x1) = t(x0) + k × x and t(y1) = t(y0) + k × y.
|
||||
* such that the new t(x1) = t(x0) + kx and t(y1) = t(y0) + ky.
|
||||
*
|
||||
* x is provided as a constant for all elements.
|
||||
* y is provided as a constant for all elements.
|
||||
*
|
||||
* This method is a convenience method for zoom.transform.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExten, and zoom.translateExtent.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExtent, and zoom.translateExtent.
|
||||
*
|
||||
* @param transition A D3 transition on elements.
|
||||
* @param x Amount of translation in x-direction.
|
||||
@@ -207,13 +207,13 @@ export interface ZoomBehavior<ZoomRefElement extends ZoomedElementBaseType, Datu
|
||||
translateBy(transition: TransitionLike<ZoomRefElement, Datum>, x: number, y: number): void;
|
||||
/**
|
||||
* Defines a “zoom” tween translating the current transform for the transitioning elements by x and y,
|
||||
* such that the new t(x1) = t(x0) + k × x and t(y1) = t(y0) + k × y.
|
||||
* such that the new t(x1) = t(x0) + kx and t(y1) = t(y0) + ky.
|
||||
*
|
||||
* x is provided by a value function evaluated for each element in the selection.
|
||||
* y is provided as a constant for all elements.
|
||||
*
|
||||
* This method is a convenience method for zoom.transform.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExten, and zoom.translateExtent.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExtent, and zoom.translateExtent.
|
||||
*
|
||||
* @param transition A D3 transition on elements.
|
||||
* @param x A value function which is evaluated for each selected element,
|
||||
@@ -224,13 +224,13 @@ export interface ZoomBehavior<ZoomRefElement extends ZoomedElementBaseType, Datu
|
||||
translateBy(transition: TransitionLike<ZoomRefElement, Datum>, x: ValueFn<ZoomRefElement, Datum, number>, y: number): void;
|
||||
/**
|
||||
* Defines a “zoom” tween translating the current transform for the transitioning elements by x and y,
|
||||
* such that the new t(x1) = t(x0) + k × x and t(y1) = t(y0) + k × y.
|
||||
* such that the new t(x1) = t(x0) + kx and t(y1) = t(y0) + ky.
|
||||
*
|
||||
* x is provided as a constant for all elements.
|
||||
* y is provided by a value function evaluated for each element in the selection.
|
||||
*
|
||||
* This method is a convenience method for zoom.transform.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExten, and zoom.translateExtent.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExtent, and zoom.translateExtent.
|
||||
*
|
||||
* @param transition A D3 transition on elements.
|
||||
* @param x Amount of translation in x-direction.
|
||||
@@ -241,13 +241,13 @@ export interface ZoomBehavior<ZoomRefElement extends ZoomedElementBaseType, Datu
|
||||
translateBy(transition: TransitionLike<ZoomRefElement, Datum>, x: number, y: ValueFn<ZoomRefElement, Datum, number>): void;
|
||||
/**
|
||||
* Defines a “zoom” tween translating the current transform for the transitioning elements by x and y,
|
||||
* such that the new t(x1) = t(x0) + k × x and t(y1) = t(y0) + k × y.
|
||||
* such that the new t(x1) = t(x0) + kx and t(y1) = t(y0) + ky.
|
||||
*
|
||||
* x is provided by a value function evaluated for each element in the selection.
|
||||
* y is provided by a value function evaluated for each element in the selection.
|
||||
*
|
||||
* This method is a convenience method for zoom.transform.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExten, and zoom.translateExtent.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExtent, and zoom.translateExtent.
|
||||
*
|
||||
* @param transition A D3 transition on elements.
|
||||
* @param x A value function which is evaluated for each selected element,
|
||||
@@ -260,24 +260,158 @@ export interface ZoomBehavior<ZoomRefElement extends ZoomedElementBaseType, Datu
|
||||
translateBy(transition: TransitionLike<ZoomRefElement, Datum>, x: ValueFn<ZoomRefElement, Datum, number>, y: ValueFn<ZoomRefElement, Datum, number>): void;
|
||||
|
||||
/**
|
||||
* Scales the current zoom transform of the selected elements by k, such that the new k(1) = k(0) × k.
|
||||
* Translates the current zoom transform of the selected elements such that the specified position ⟨x,y⟩ appears at the center of the viewport extent.
|
||||
* The new tx = cx - kx and ty = cy - ky, where ⟨cx,cy⟩ is the center.
|
||||
*
|
||||
* x is provided as a constant for all elements.
|
||||
* y is provided as a constant for all elements.
|
||||
*
|
||||
* @param selection A D3 selection of elements.
|
||||
* @param x Target x-position of translation.
|
||||
* @param y Target y-position of translation.
|
||||
*/
|
||||
translateTo(selection: Selection<ZoomRefElement, Datum, any, any>, x: number, y: number): void;
|
||||
/**
|
||||
* Translates the current zoom transform of the selected elements such that the specified position ⟨x,y⟩ appears at the center of the viewport extent.
|
||||
* The new tx = cx - kx and ty = cy - ky, where ⟨cx,cy⟩ is the center.
|
||||
*
|
||||
* x is provided by a value function evaluated for each element in the selection.
|
||||
* y is provided as a constant for all elements.
|
||||
*
|
||||
* This method is a convenience method for zoom.transform.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExtent, and zoom.translateExtent.
|
||||
*
|
||||
* @param selection A D3 selection of elements.
|
||||
* @param x A value function which is evaluated for each selected element,
|
||||
* in order, being passed the current datum (d), the current index (i), and the current group (nodes),
|
||||
* with this as the current DOM element.The function returns the target x-position of translation.
|
||||
* @param y Target y-position of translation.
|
||||
*/
|
||||
translateTo(selection: Selection<ZoomRefElement, Datum, any, any>, x: ValueFn<ZoomRefElement, Datum, number>, y: number): void;
|
||||
/**
|
||||
* Translates the current zoom transform of the selected elements such that the specified position ⟨x,y⟩ appears at the center of the viewport extent.
|
||||
* The new tx = cx - kx and ty = cy - ky, where ⟨cx,cy⟩ is the center.
|
||||
*
|
||||
* x is provided as a constant for all elements.
|
||||
* y is provided by a value function evaluated for each element in the selection.
|
||||
*
|
||||
* This method is a convenience method for zoom.transform.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExtent, and zoom.translateExtent.
|
||||
*
|
||||
* @param selection A D3 selection of elements.
|
||||
* @param x Target x-position of translation.
|
||||
* @param y A value function which is evaluated for each selected element,
|
||||
* in order, being passed the current datum (d), the current index (i), and the current group (nodes),
|
||||
* with this as the current DOM element.The function returns the target y-position of translation.
|
||||
*/
|
||||
translateTo(selection: Selection<ZoomRefElement, Datum, any, any>, x: number, y: ValueFn<ZoomRefElement, Datum, number>): void;
|
||||
/**
|
||||
* Translates the current zoom transform of the selected elements such that the specified position ⟨x,y⟩ appears at the center of the viewport extent.
|
||||
* The new tx = cx - kx and ty = cy - ky, where ⟨cx,cy⟩ is the center.
|
||||
*
|
||||
* x is provided by a value function evaluated for each element in the selection.
|
||||
* y is provided by a value function evaluated for each element in the selection.
|
||||
*
|
||||
* This method is a convenience method for zoom.transform.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExtent, and zoom.translateExtent.
|
||||
*
|
||||
* @param selection A D3 selection of elements.
|
||||
* @param x A value function which is evaluated for each selected element,
|
||||
* in order, being passed the current datum (d), the current index (i), and the current group (nodes),
|
||||
* with this as the current DOM element.The function returns the target x-position of translation.
|
||||
* @param y A value function which is evaluated for each selected element,
|
||||
* in order, being passed the current datum (d), the current index (i), and the current group (nodes),
|
||||
* with this as the current DOM element.The function returns the target y-position of translation.
|
||||
*/
|
||||
translateTo(selection: Selection<ZoomRefElement, Datum, any, any>, x: ValueFn<ZoomRefElement, Datum, number>, y: ValueFn<ZoomRefElement, Datum, number>): void;
|
||||
/**
|
||||
* Defines a “zoom” tween translating the current transform for the transitioning elements such that the specified position ⟨x,y⟩ appears at the center of the viewport extent.
|
||||
* The new tx = cx - kx and ty = cy - ky, where ⟨cx,cy⟩ is the center.
|
||||
*
|
||||
* x is provided as a constant for all elements.
|
||||
* y is provided as a constant for all elements.
|
||||
*
|
||||
* This method is a convenience method for zoom.transform.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExtent, and zoom.translateExtent.
|
||||
*
|
||||
* @param transition A D3 transition on elements.
|
||||
* @param x Target x-position of translation.
|
||||
* @param y Target y-position of translation.
|
||||
*/
|
||||
translateTo(transition: TransitionLike<ZoomRefElement, Datum>, x: number, y: number): void;
|
||||
/**
|
||||
* Defines a “zoom” tween translating the current transform for the transitioning elements such that the specified position ⟨x,y⟩ appears at the center of the viewport extent.
|
||||
* The new tx = cx - kx and ty = cy - ky, where ⟨cx,cy⟩ is the center.
|
||||
*
|
||||
* x is provided by a value function evaluated for each element in the selection.
|
||||
* y is provided as a constant for all elements.
|
||||
*
|
||||
* This method is a convenience method for zoom.transform.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExtent, and zoom.translateExtent.
|
||||
*
|
||||
* @param transition A D3 transition on elements.
|
||||
* @param x A value function which is evaluated for each selected element,
|
||||
* in order, being passed the current datum (d), the current index (i), and the current group (nodes),
|
||||
* with this as the current DOM element.The function returns the target x-position of translation.
|
||||
* @param y Target y-position of translation.
|
||||
*/
|
||||
translateTo(transition: TransitionLike<ZoomRefElement, Datum>, x: ValueFn<ZoomRefElement, Datum, number>, y: number): void;
|
||||
/**
|
||||
* Defines a “zoom” tween translating the current transform for the transitioning elements such that the specified position ⟨x,y⟩ appears at the center of the viewport extent.
|
||||
* The new tx = cx - kx and ty = cy - ky, where ⟨cx,cy⟩ is the center.
|
||||
*
|
||||
* x is provided as a constant for all elements.
|
||||
* y is provided by a value function evaluated for each element in the selection.
|
||||
*
|
||||
* This method is a convenience method for zoom.transform.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExtent, and zoom.translateExtent.
|
||||
*
|
||||
* @param transition A D3 transition on elements.
|
||||
* @param x Target x-position of translation.
|
||||
* @param y A value function which is evaluated for each selected element,
|
||||
* in order, being passed the current datum (d), the current index (i), and the current group (nodes),
|
||||
* with this as the current DOM element.The function returns the target y-position of translation.
|
||||
*/
|
||||
translateTo(transition: TransitionLike<ZoomRefElement, Datum>, x: number, y: ValueFn<ZoomRefElement, Datum, number>): void;
|
||||
/**
|
||||
* Defines a “zoom” tween translating the current transform for the transitioning elements such that the specified position ⟨x,y⟩ appears at the center of the viewport extent.
|
||||
* The new tx = cx - kx and ty = cy - ky, where ⟨cx,cy⟩ is the center.
|
||||
*
|
||||
* x is provided by a value function evaluated for each element in the selection.
|
||||
* y is provided by a value function evaluated for each element in the selection.
|
||||
*
|
||||
* This method is a convenience method for zoom.transform.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExtent, and zoom.translateExtent.
|
||||
*
|
||||
* @param transition A D3 transition on elements.
|
||||
* @param x A value function which is evaluated for each selected element,
|
||||
* in order, being passed the current datum (d), the current index (i), and the current group (nodes),
|
||||
* with this as the current DOM element.The function returns the target x-position of translation.
|
||||
* @param y A value function which is evaluated for each selected element,
|
||||
* in order, being passed the current datum (d), the current index (i), and the current group (nodes),
|
||||
* with this as the current DOM element.The function returns the target y-position of translation.
|
||||
*/
|
||||
translateTo(transition: TransitionLike<ZoomRefElement, Datum>, x: ValueFn<ZoomRefElement, Datum, number>, y: ValueFn<ZoomRefElement, Datum, number>): void;
|
||||
|
||||
/**
|
||||
* Scales the current zoom transform of the selected elements by k, such that the new k(1) = k(0)k.
|
||||
*
|
||||
* k is provided as a constant for all elements.
|
||||
*
|
||||
* This method is a convenience method for zoom.transform.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExten, and zoom.translateExtent.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExtent, and zoom.translateExtent.
|
||||
*
|
||||
* @param selection A D3 selection of elements.
|
||||
* @param k Scale factor.
|
||||
*/
|
||||
scaleBy(selection: Selection<ZoomRefElement, Datum, any, any>, k: number): void;
|
||||
/**
|
||||
* Scales the current zoom transform of the selected elements by k, such that the new k(1) = k(0) × k.
|
||||
* Scales the current zoom transform of the selected elements by k, such that the new k(1) = k(0)k.
|
||||
*
|
||||
* k is provided by a value function evaluated for each element in the selection.
|
||||
*
|
||||
* This method is a convenience method for zoom.transform.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExten, and zoom.translateExtent.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExtent, and zoom.translateExtent.
|
||||
*
|
||||
* @param selection A D3 selection of elements.
|
||||
* @param k A value function which is evaluated for each selected element,
|
||||
@@ -286,24 +420,24 @@ export interface ZoomBehavior<ZoomRefElement extends ZoomedElementBaseType, Datu
|
||||
*/
|
||||
scaleBy(selection: Selection<ZoomRefElement, Datum, any, any>, k: ValueFn<ZoomRefElement, Datum, number>): void;
|
||||
/**
|
||||
* Defines a “zoom” tween translating scaling the current transform of the selected elements by k, such that the new k(1) = k(0) × k.
|
||||
* Defines a “zoom” tween translating scaling the current transform of the selected elements by k, such that the new k(1) = k(0)k.
|
||||
*
|
||||
* k is provided as a constant for all elements.
|
||||
*
|
||||
* This method is a convenience method for zoom.transform.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExten, and zoom.translateExtent.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExtent, and zoom.translateExtent.
|
||||
*
|
||||
* @param transition A D3 transition on elements.
|
||||
* @param k Scale factor.
|
||||
*/
|
||||
scaleBy(transition: TransitionLike<ZoomRefElement, Datum>, k: number): void;
|
||||
/**
|
||||
* Defines a “zoom” tween translating scaling the current transform of the selected elements by k, such that the new k(1) = k(0) × k.
|
||||
* Defines a “zoom” tween translating scaling the current transform of the selected elements by k, such that the new k(1) = k(0)k.
|
||||
*
|
||||
* k is provided by a value function evaluated for each element in the selection.
|
||||
*
|
||||
* This method is a convenience method for zoom.transform.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExten, and zoom.translateExtent.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExtent, and zoom.translateExtent.
|
||||
*
|
||||
* @param transition A D3 transition on elements.
|
||||
* @param k A value function which is evaluated for each selected element,
|
||||
@@ -318,7 +452,7 @@ export interface ZoomBehavior<ZoomRefElement extends ZoomedElementBaseType, Datu
|
||||
* k is provided as a constant for all elements.
|
||||
*
|
||||
* This method is a convenience method for zoom.transform.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExten, and zoom.translateExtent.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExtent, and zoom.translateExtent.
|
||||
*
|
||||
* @param selection A D3 selection of elements.
|
||||
* @param k New scale.
|
||||
@@ -330,7 +464,7 @@ export interface ZoomBehavior<ZoomRefElement extends ZoomedElementBaseType, Datu
|
||||
* k is provided by a value function evaluated for each element in the selection.
|
||||
*
|
||||
* This method is a convenience method for zoom.transform.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExten, and zoom.translateExtent.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExtent, and zoom.translateExtent.
|
||||
*
|
||||
* @param selection A D3 selection of elements.
|
||||
* @param k A value function which is evaluated for each selected element,
|
||||
@@ -344,7 +478,7 @@ export interface ZoomBehavior<ZoomRefElement extends ZoomedElementBaseType, Datu
|
||||
* k is provided as a constant for all elements.
|
||||
*
|
||||
* This method is a convenience method for zoom.transform.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExten, and zoom.translateExtent.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExtent, and zoom.translateExtent.
|
||||
*
|
||||
* @param transition A D3 transition on elements.
|
||||
* @param k New scale.
|
||||
@@ -356,7 +490,7 @@ export interface ZoomBehavior<ZoomRefElement extends ZoomedElementBaseType, Datu
|
||||
* k is provided by a value function evaluated for each element in the selection.
|
||||
*
|
||||
* This method is a convenience method for zoom.transform.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExten, and zoom.translateExtent.
|
||||
* In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExtent, and zoom.translateExtent.
|
||||
*
|
||||
* @param transition A D3 transition on elements.
|
||||
* @param k A value function which is evaluated for each selected element,
|
||||
@@ -644,21 +778,21 @@ export interface ZoomTransform {
|
||||
|
||||
/**
|
||||
* Return the transformation of the specified point which is a two-element array of numbers [x, y].
|
||||
* The returned point is equal to [x × k + tx, y × k + ty].
|
||||
* The returned point is equal to [xk + tx, yk + ty].
|
||||
*
|
||||
* @param point Point coordinates [x, y]
|
||||
*/
|
||||
apply(point: [number, number]): [number, number];
|
||||
|
||||
/**
|
||||
* Return the transformation of the specified x-coordinate, x × k + tx.
|
||||
* Return the transformation of the specified x-coordinate, xk + tx.
|
||||
*
|
||||
* @param x Value of x-coordinate.
|
||||
*/
|
||||
applyX(x: number): number;
|
||||
|
||||
/**
|
||||
* Return the transformation of the specified y-coordinate, y × k + ty.
|
||||
* Return the transformation of the specified y-coordinate, yk + ty.
|
||||
*
|
||||
* @param y Value of y-coordinate.
|
||||
*/
|
||||
|
||||
2
types/d3/index.d.ts
vendored
2
types/d3/index.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
// Type definitions for D3JS d3 standard bundle 4.9
|
||||
// Type definitions for D3JS d3 standard bundle 4.10
|
||||
// Project: https://github.com/d3/d3
|
||||
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
Reference in New Issue
Block a user