mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Spelling correction
This commit is contained in:
parent
9028a63234
commit
09c94e3e87
6
types/d3-brush/index.d.ts
vendored
6
types/d3-brush/index.d.ts
vendored
@ -195,21 +195,21 @@ export interface BrushBehavior<Datum> {
|
||||
* Create a new two-dimensional brush.
|
||||
*
|
||||
* The generic "Datum" refers to the type of the data of the selected svg:g element to
|
||||
* which the returned BrushBEhavoir will be applied.
|
||||
* which the returned BrushBehavior will be applied.
|
||||
*/
|
||||
export function brush<Datum>(): BrushBehavior<Datum>;
|
||||
/**
|
||||
* Creates a new one-dimensional brush along the x-dimension.
|
||||
*
|
||||
* The generic "Datum" refers to the type of the data of the selected svg:g element to
|
||||
* which the returned BrushBEhavoir will be applied.
|
||||
* which the returned BrushBehavior will be applied.
|
||||
*/
|
||||
export function brushX<Datum>(): BrushBehavior<Datum>;
|
||||
/**
|
||||
* Creates a new one-dimensional brush along the y-dimension.
|
||||
*
|
||||
* The generic "Datum" refers to the type of the data of the selected svg:g element to
|
||||
* which the returned BrushBEhavoir will be applied.
|
||||
* which the returned BrushBehavior will be applied.
|
||||
*/
|
||||
export function brushY<Datum>(): BrushBehavior<Datum>;
|
||||
|
||||
|
||||
@ -180,7 +180,7 @@ canvasRibbon(ribbon); // render ribbon for first chord
|
||||
|
||||
// The below fails explicitly, as standard ChordSubgroup objects for source and target are missing "radius" property assumed in default
|
||||
// radius accessor. Given the internals of d3 this would lead to a "NaN" radius. So using static typing to raise this to
|
||||
// awareness seems appropriate. The alternative, is to create RibbonGenerator using the generics to explictly set the types and
|
||||
// awareness seems appropriate. The alternative, is to create RibbonGenerator using the generics to explicitly set the types and
|
||||
// then set the radius. Or, one could map a radius property into the Chords returned by the ChordLayout.
|
||||
|
||||
// canvasRibbon(chords[0]); // fails, see above
|
||||
|
||||
6
types/d3-chord/index.d.ts
vendored
6
types/d3-chord/index.d.ts
vendored
@ -44,7 +44,7 @@ export interface ChordSubgroup {
|
||||
*/
|
||||
export interface Chord {
|
||||
/**
|
||||
* Chord subgroup constituting the sodurce of Chord
|
||||
* Chord subgroup constituting the source of Chord
|
||||
*/
|
||||
source: ChordSubgroup;
|
||||
/**
|
||||
@ -122,7 +122,7 @@ export interface ChordLayout {
|
||||
*
|
||||
* The default is zero.
|
||||
*
|
||||
* @param angle Pad angle between adjecent groups in radians.
|
||||
* @param angle Pad angle between adjacent groups in radians.
|
||||
*/
|
||||
padAngle(angle: number): this;
|
||||
|
||||
@ -233,7 +233,7 @@ export interface Ribbon {
|
||||
|
||||
/**
|
||||
*
|
||||
* A ribbon generator to suport rendering of chords in a chord diagram.
|
||||
* A ribbon generator to support rendering of chords in a chord diagram.
|
||||
*
|
||||
* The first generic corresponds to the type of the "this" context within which the ribbon generator and its accessor functions will be invoked.
|
||||
*
|
||||
|
||||
14
types/d3-collection/index.d.ts
vendored
14
types/d3-collection/index.d.ts
vendored
@ -7,7 +7,7 @@
|
||||
// Last module patch version validated against: 1.0.4
|
||||
|
||||
/**
|
||||
* Reference type things that can be coerced to string implicitely
|
||||
* Reference type things that can be coerced to string implicitly
|
||||
*/
|
||||
export interface Stringifiable {
|
||||
toString(): string;
|
||||
@ -64,7 +64,7 @@ export function entries(obj: object): Array<{ key: string, value: any }>;
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* A datastructure similar to ES6 Maps, but with a few differences:
|
||||
* A data structure similar to ES6 Maps, but with a few differences:
|
||||
* - Keys are coerced to strings.
|
||||
* - map.each, not map.forEach. (Also, no thisArg.)
|
||||
* - map.remove, not map.delete.
|
||||
@ -194,7 +194,7 @@ export function map(obj: object): Map<any>;
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* A datastructure similar to ES6 Sets, but with a few differences:
|
||||
* A data structure similar to ES6 Sets, but with a few differences:
|
||||
*
|
||||
* - Values are coerced to strings.
|
||||
* - set.each, not set.forEach. (Also, no thisArg.)
|
||||
@ -282,11 +282,11 @@ export function set<T>(array: T[], key: (value: T, index: number, array: T[]) =>
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* A more formal defintion of the nested array returned by Nest.entries(...). This data structure is intended as a reference only.
|
||||
* A more formal definition of the nested array returned by Nest.entries(...). This data structure is intended as a reference only.
|
||||
*
|
||||
* As the union types cannot be ex ante simplified without knowledge
|
||||
* of the nesting level (number of key(...) operations) and whether the data were rolled-up, this data structure becomes cumbersome
|
||||
* to use in practice. This is particularly true for discrimiation of array element types.
|
||||
* to use in practice. This is particularly true for discrimination of array element types.
|
||||
* The use of the rollup function, or lack thereof, also determines whether NestedArray has the 'values' property
|
||||
* with an array of type Datum at leaf level, or has a rolled-up 'value' property.
|
||||
*/
|
||||
@ -294,7 +294,7 @@ export function set<T>(array: T[], key: (value: T, index: number, array: T[]) =>
|
||||
export interface NestedArray<Datum, RollupType> extends Array<{ key: string, values: NestedArray<Datum, RollupType> | Datum[] | undefined, value: RollupType | undefined }> { }
|
||||
|
||||
/**
|
||||
* A more formal defintion of the nested array returned by Nest.map(...). This data structure is intended as a reference only.
|
||||
* A more formal definition of the nested array returned by Nest.map(...). This data structure is intended as a reference only.
|
||||
*
|
||||
* As the union types cannot be ex ante simplified without knowledge
|
||||
* of the nesting level (number of key(...) operations) and whether the data were rolled-up, this data structure becomes cumbersome
|
||||
@ -304,7 +304,7 @@ export interface NestedArray<Datum, RollupType> extends Array<{ key: string, val
|
||||
export interface NestedMap<Datum, RollupType> extends Map<NestedMap<Datum, RollupType> | Datum[] | RollupType> { }
|
||||
|
||||
/**
|
||||
* A more formal defintion of the nested array returned by Nest.object(...). This data structure is intended as a reference only.
|
||||
* A more formal definition of the nested array returned by Nest.object(...). This data structure is intended as a reference only.
|
||||
*
|
||||
* As the union types cannot be ex ante simplified without knowledge
|
||||
* of the nesting level (number of key(...) operations) and whether the data were rolled-up, this data structure becomes cumbersome
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
import * as d3Drag from 'd3-drag';
|
||||
import { event, select, Selection } from 'd3-selection';
|
||||
|
||||
// NB: Consider alternative approachto getting live event-binding
|
||||
// NB: Consider alternative approach to getting live event-binding
|
||||
// when using webpack as suggested by @ocombe in response to
|
||||
// event binding question https://github.com/d3/d3-zoom/issues/32#issuecomment-229889310
|
||||
// d3.getEvent = () => require("d3-selection").event;
|
||||
@ -234,7 +234,7 @@ const sourceEvent: any = e.sourceEvent;
|
||||
// As always, the below tests are for signature only, no functional purpose
|
||||
|
||||
// remove event listeners for a given event type
|
||||
e = e.on('start.tmp', null); // chainability test through reassigment
|
||||
e = e.on('start.tmp', null); // chainability test through reassignment
|
||||
|
||||
e = e.on('drag', dragged);
|
||||
// e = e.on('drag', wrongDragHandler1); // fails, wrong datum type in handler
|
||||
|
||||
2
types/d3-drag/index.d.ts
vendored
2
types/d3-drag/index.d.ts
vendored
@ -199,7 +199,7 @@ export interface DragBehavior<GElement extends DraggedElementBaseType, Datum, Su
|
||||
/**
|
||||
* Set the maximum distance that the mouse can move between mousedown and mouseup that will trigger
|
||||
* a subsequent click event. If at any point between mousedown and mouseup the mouse is greater than or equal to
|
||||
* distance from its position on mousedown, the click event follwing mouseup will be suppressed.
|
||||
* distance from its position on mousedown, the click event following mouseup will be suppressed.
|
||||
*
|
||||
* @param distance The distance threshold between mousedown and mouseup measured in client coordinates (event.clientX and event.clientY).
|
||||
* The default is zero.
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
import * as d3Dsv from 'd3-dsv';
|
||||
|
||||
// ------------------------------------------------------------------------------------------
|
||||
// Preperatory Steps
|
||||
// Preparatory Steps
|
||||
// ------------------------------------------------------------------------------------------
|
||||
|
||||
const csvTestString = '1997,Ford,E350,2.34\n2000,Mercury,Cougar,2.38';
|
||||
|
||||
12
types/d3-dsv/index.d.ts
vendored
12
types/d3-dsv/index.d.ts
vendored
@ -67,7 +67,7 @@ export function csvParse(csvString: string): DSVParsedArray<DSVRowString>;
|
||||
* @param csvString A string, which must be in the comma-separated values format.
|
||||
* @param row A row conversion function which is invoked for each row, being passed an object representing the current row (d),
|
||||
* the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined,
|
||||
* the row is skipped and will be ommitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object.
|
||||
* the row is skipped and will be omitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object.
|
||||
* In effect, row is similar to applying a map and filter operator to the returned rows.
|
||||
*/
|
||||
export function csvParse<ParsedRow extends DSVRowAny>(
|
||||
@ -102,7 +102,7 @@ export function csvParseRows(csvString: string): string[][];
|
||||
* @param csvString A string, which must be in the comma-separated values format.
|
||||
* @param row A row conversion function which is invoked for each row, being passed an array representing the current row (d), the index (i)
|
||||
* starting at zero for the first row, and the array of column names. If the returned value is null or undefined,
|
||||
* the row is skipped and will be ommitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object.
|
||||
* the row is skipped and will be omitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object.
|
||||
* In effect, row is similar to applying a map and filter operator to the returned rows.
|
||||
*/
|
||||
export function csvParseRows<ParsedRow extends DSVRowAny>(
|
||||
@ -177,7 +177,7 @@ export function tsvParse(tsvString: string): DSVParsedArray<DSVRowString>;
|
||||
* @param tsvString A string, which must be in the tab-separated values format.
|
||||
* @param row A row conversion function which is invoked for each row, being passed an object representing the current row (d),
|
||||
* the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined,
|
||||
* the row is skipped and will be ommitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object.
|
||||
* the row is skipped and will be omitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object.
|
||||
* In effect, row is similar to applying a map and filter operator to the returned rows.
|
||||
*/
|
||||
export function tsvParse<MappedRow extends DSVRowAny>(
|
||||
@ -212,7 +212,7 @@ export function tsvParseRows(tsvString: string): string[][];
|
||||
* @param tsvString A string, which must be in the tab-separated values format.
|
||||
* @param row A row conversion function which is invoked for each row, being passed an array representing the current row (d), the index (i)
|
||||
* starting at zero for the first row, and the array of column names. If the returned value is null or undefined,
|
||||
* the row is skipped and will be ommitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object.
|
||||
* the row is skipped and will be omitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object.
|
||||
* In effect, row is similar to applying a map and filter operator to the returned rows.
|
||||
*/
|
||||
export function tsvParseRows<MappedRow extends DSVRowAny>(
|
||||
@ -285,7 +285,7 @@ export interface DSV {
|
||||
* @param dsvString A string, which must be in the delimiter-separated values format with the appropriate delimiter.
|
||||
* @param row A row conversion function which is invoked for each row, being passed an object representing the current row (d),
|
||||
* the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined,
|
||||
* the row is skipped and will be ommitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object.
|
||||
* the row is skipped and will be omitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object.
|
||||
* In effect, row is similar to applying a map and filter operator to the returned rows.
|
||||
*/
|
||||
parse<ParsedRow extends DSVRowAny>(
|
||||
@ -314,7 +314,7 @@ export interface DSV {
|
||||
* @param dsvString A string, which must be in the delimiter-separated values format with the appropriate delimiter.
|
||||
* @param row A row conversion function which is invoked for each row, being passed an array representing the current row (d), the index (i)
|
||||
* starting at zero for the first row, and the array of column names. If the returned value is null or undefined,
|
||||
* the row is skipped and will be ommitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object.
|
||||
* the row is skipped and will be omitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object.
|
||||
* In effect, row is similar to applying a map and filter operator to the returned rows.
|
||||
*/
|
||||
parseRows<ParsedRow extends DSVRowAny>(
|
||||
|
||||
2
types/d3-dsv/v0/index.d.ts
vendored
2
types/d3-dsv/v0/index.d.ts
vendored
@ -5,7 +5,7 @@
|
||||
|
||||
/** A parser and formatter for DSV (CSV and TSV) files. Extracted from D3. */
|
||||
declare function loader(
|
||||
/** the symbol used to seperate cells in the row. */
|
||||
/** the symbol used to separate cells in the row. */
|
||||
delimiter: string,
|
||||
/** example: "text/plain" */
|
||||
encoding?: string): D3Dsv;
|
||||
|
||||
12
types/d3-fetch/index.d.ts
vendored
12
types/d3-fetch/index.d.ts
vendored
@ -52,7 +52,7 @@ export function csv(
|
||||
* @param url A valid URL string.
|
||||
* @param row A row conversion function which is invoked for each row, being passed an object representing the current row (d),
|
||||
* the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined,
|
||||
* the row is skipped and will be ommitted from the array returned by dsv.csvParse; otherwise, the returned value defines the corresponding row object.
|
||||
* the row is skipped and will be omitted from the array returned by dsv.csvParse; otherwise, the returned value defines the corresponding row object.
|
||||
* In effect, row is similar to applying a map and filter operator to the returned rows.
|
||||
*/
|
||||
export function csv<ParsedRow extends DSVRowAny>(
|
||||
@ -74,7 +74,7 @@ export function csv<ParsedRow extends DSVRowAny>(
|
||||
* @param init An request initialization object.
|
||||
* @param row A row conversion function which is invoked for each row, being passed an object representing the current row (d),
|
||||
* the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined,
|
||||
* the row is skipped and will be ommitted from the array returned by dsv.csvParse; otherwise, the returned value defines the corresponding row object.
|
||||
* the row is skipped and will be omitted from the array returned by dsv.csvParse; otherwise, the returned value defines the corresponding row object.
|
||||
* In effect, row is similar to applying a map and filter operator to the returned rows.
|
||||
*/
|
||||
export function csv<ParsedRow extends DSVRowAny>(
|
||||
@ -112,7 +112,7 @@ export function dsv(
|
||||
* @param url A valid URL string.
|
||||
* @param row A row conversion function which is invoked for each row, being passed an object representing the current row (d),
|
||||
* the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined,
|
||||
* the row is skipped and will be ommitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object.
|
||||
* the row is skipped and will be omitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object.
|
||||
* In effect, row is similar to applying a map and filter operator to the returned rows.
|
||||
*/
|
||||
export function dsv<ParsedRow extends DSVRowAny>(
|
||||
@ -136,7 +136,7 @@ export function dsv<ParsedRow extends DSVRowAny>(
|
||||
* @param init An request initialization object.
|
||||
* @param row A row conversion function which is invoked for each row, being passed an object representing the current row (d),
|
||||
* the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined,
|
||||
* the row is skipped and will be ommitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object.
|
||||
* the row is skipped and will be omitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object.
|
||||
* In effect, row is similar to applying a map and filter operator to the returned rows.
|
||||
*/
|
||||
export function dsv<ParsedRow extends DSVRowAny>(
|
||||
@ -224,7 +224,7 @@ export function tsv(
|
||||
* @param url A valid URL string.
|
||||
* @param row A row conversion function which is invoked for each row, being passed an object representing the current row (d),
|
||||
* the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined,
|
||||
* the row is skipped and will be ommitted from the array returned by dsv.tsvParse; otherwise, the returned value defines the corresponding row object.
|
||||
* the row is skipped and will be omitted from the array returned by dsv.tsvParse; otherwise, the returned value defines the corresponding row object.
|
||||
* In effect, row is similar to applying a map and filter operator to the returned rows.
|
||||
*/
|
||||
export function tsv<ParsedRow extends DSVRowAny>(
|
||||
@ -246,7 +246,7 @@ export function tsv<ParsedRow extends DSVRowAny>(
|
||||
* @param init An request initialization object.
|
||||
* @param row A row conversion function which is invoked for each row, being passed an object representing the current row (d),
|
||||
* the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined,
|
||||
* the row is skipped and will be ommitted from the array returned by dsv.tsvParse; otherwise, the returned value defines the corresponding row object.
|
||||
* the row is skipped and will be omitted from the array returned by dsv.tsvParse; otherwise, the returned value defines the corresponding row object.
|
||||
* In effect, row is similar to applying a map and filter operator to the returned rows.
|
||||
*/
|
||||
export function tsv<ParsedRow extends DSVRowAny>(
|
||||
|
||||
6
types/d3-force/index.d.ts
vendored
6
types/d3-force/index.d.ts
vendored
@ -55,7 +55,7 @@ export interface SimulationNodeDatum {
|
||||
/**
|
||||
* The base data structure for the datum of a Simulation Link, as used by ForceLink.
|
||||
* The optional properties contained in this data structure are internally assigned
|
||||
* by when initializating with ForceLink.links(...)
|
||||
* by when initializing with ForceLink.links(...)
|
||||
*
|
||||
*
|
||||
* IMPORTANT: The source and target properties may be internally mutated in type during the
|
||||
@ -634,7 +634,7 @@ export interface ForceLink<NodeDatum extends SimulationNodeDatum, LinkDatum exte
|
||||
*/
|
||||
strength(): (link: LinkDatum, i: number, links: LinkDatum[]) => number;
|
||||
/**
|
||||
* Set the strenght accessor to use the specified constant number for all links,
|
||||
* Set the strength accessor to use the specified constant number for all links,
|
||||
* re-evaluates the strength accessor for each link, and returns this force.
|
||||
*
|
||||
* The constant is internally wrapped into a strength accessor function.
|
||||
@ -647,7 +647,7 @@ export interface ForceLink<NodeDatum extends SimulationNodeDatum, LinkDatum exte
|
||||
*/
|
||||
strength(strength: number): this;
|
||||
/**
|
||||
* Set the strenght accessor to use the specified function,
|
||||
* Set the strength accessor to use the specified function,
|
||||
* re-evaluates the strength accessor for each link, and returns this force.
|
||||
*
|
||||
* The strength accessor is invoked for each link, being passed the link, its zero-based index and the complete array of links.
|
||||
|
||||
@ -372,7 +372,7 @@ const mercatorRaw: d3Geo.GeoRawProjection = d3Geo.geoMercatorRaw();
|
||||
const orthographicRaw: d3Geo.GeoRawProjection = d3Geo.geoOrthographicRaw();
|
||||
const stereographicRaw: d3Geo.GeoRawProjection = d3Geo.geoStereographicRaw();
|
||||
const transverseMercatorRaw: d3Geo.GeoRawProjection = d3Geo.geoTransverseMercatorRaw();
|
||||
const naturalEart1Raw: d3Geo.GeoRawProjection = d3Geo.geoNaturalEarth1Raw();
|
||||
const naturalEarth1Raw: d3Geo.GeoRawProjection = d3Geo.geoNaturalEarth1Raw();
|
||||
|
||||
// Use Raw Projection =====================================================
|
||||
|
||||
@ -393,13 +393,13 @@ const azimuthalEquidistant: d3Geo.GeoProjection = d3Geo.geoAzimuthalEquidistant(
|
||||
let conicConformal: d3Geo.GeoConicProjection = d3Geo.geoConicConformal();
|
||||
const conicEqualArea: d3Geo.GeoConicProjection = d3Geo.geoConicEqualArea();
|
||||
const conicEquidistant: d3Geo.GeoConicProjection = d3Geo.geoConicEquidistant();
|
||||
const cquirectangular: d3Geo.GeoProjection = d3Geo.geoEquirectangular();
|
||||
const equirectangular: d3Geo.GeoProjection = d3Geo.geoEquirectangular();
|
||||
const gnomonic: d3Geo.GeoProjection = d3Geo.geoGnomonic();
|
||||
const mercator: d3Geo.GeoProjection = d3Geo.geoMercator();
|
||||
const orthographic: d3Geo.GeoProjection = d3Geo.geoOrthographic();
|
||||
const stereographic: d3Geo.GeoProjection = d3Geo.geoStereographic();
|
||||
const transverseMercator: d3Geo.GeoProjection = d3Geo.geoTransverseMercator();
|
||||
const natualEarth1: d3Geo.GeoProjection = d3Geo.geoNaturalEarth1();
|
||||
const naturalEarth1: d3Geo.GeoProjection = d3Geo.geoNaturalEarth1();
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Create New Projections
|
||||
@ -558,7 +558,7 @@ const geoPathProjection: d3Geo.GeoProjection = geoPathCanvas.projection<d3Geo.Ge
|
||||
|
||||
geoPathSVG = geoPathSVG.projection(conicConformal);
|
||||
const geoPathConicProjection: d3Geo.GeoConicProjection = geoPathSVG.projection<d3Geo.GeoConicProjection>();
|
||||
// geoPathConicProjection = geoPathSVG.projection(); // fails without casting to GeoConicProjection, or alternatively custom typeguard
|
||||
// geoPathConicProjection = geoPathSVG.projection(); // fails without casting to GeoConicProjection, or alternatively custom type guard
|
||||
// geoPathConicProjection = geoPathSVG.projection<SampleProperties1>(); // fails as SampleProperties does not extend minimal interface
|
||||
|
||||
// context(...) ------------------------------------------------------
|
||||
@ -719,11 +719,11 @@ const context: d3Geo.GeoContext = {
|
||||
|
||||
const transformFunction: { stream(s: d3Geo.GeoStream): {} } = d3Geo.geoTransform({});
|
||||
|
||||
interface CustomTranformProto extends d3Geo.GeoTransformPrototype {
|
||||
interface CustomTransformProto extends d3Geo.GeoTransformPrototype {
|
||||
a: number;
|
||||
}
|
||||
|
||||
let customTransformProto: CustomTranformProto;
|
||||
let customTransformProto: CustomTransformProto;
|
||||
|
||||
customTransformProto = {
|
||||
point(x, y) {
|
||||
@ -732,11 +732,11 @@ customTransformProto = {
|
||||
a: 10
|
||||
};
|
||||
|
||||
const t: { stream(s: d3Geo.GeoStream): CustomTranformProto & d3Geo.GeoStream } = d3Geo.geoTransform(customTransformProto);
|
||||
const t: { stream(s: d3Geo.GeoStream): CustomTransformProto & d3Geo.GeoStream } = d3Geo.geoTransform(customTransformProto);
|
||||
|
||||
// geoIdentity() ========================================================
|
||||
|
||||
let identityTransform: d3Geo.GeoIdentityTranform;
|
||||
let identityTransform: d3Geo.GeoIdentityTransform;
|
||||
|
||||
identityTransform = d3Geo.geoIdentity();
|
||||
|
||||
|
||||
15
types/d3-geo/index.d.ts
vendored
15
types/d3-geo/index.d.ts
vendored
@ -976,7 +976,7 @@ export interface GeoConicProjection extends GeoProjection {
|
||||
export interface GeoContext {
|
||||
/**
|
||||
* Adds an arc to the path with center point (x, y) and radius r starting at startAngle and ending at endAngle.
|
||||
* The arc is drawn in clockwise directio by default.
|
||||
* The arc is drawn in clockwise direction by default.
|
||||
*
|
||||
* @param x x-coordinate of arc center point.
|
||||
* @param y y-coordinate of arc center point.
|
||||
@ -1046,7 +1046,7 @@ export interface GeoPath<This = any, DatumObject extends GeoPermissibleObjects =
|
||||
* IMPORTANT: If the rendering context of the geoPath generator is null,
|
||||
* then the geoPath is returned as an SVG path data string.
|
||||
*
|
||||
* Separate path elements are typically slower than a single path element. However, distinct path elements are useful for styling and interation (e.g., click or mouseover).
|
||||
* Separate path elements are typically slower than a single path element. However, distinct path elements are useful for styling and interaction (e.g., click or mouseover).
|
||||
* Canvas rendering (see path.context) is typically faster than SVG, but requires more effort to implement styling and interaction.
|
||||
*
|
||||
* The first generic type of the GeoPath generator used, must correspond to the "this" context bound to the function upon invocation.
|
||||
@ -1075,7 +1075,7 @@ export interface GeoPath<This = any, DatumObject extends GeoPermissibleObjects =
|
||||
* IMPORTANT: If the geoPath generator has been configured with a rendering context,
|
||||
* then the geoPath is rendered to this context as a sequence of path method calls and this function returns void.
|
||||
*
|
||||
* Separate path elements are typically slower than a single path element. However, distinct path elements are useful for styling and interation (e.g., click or mouseover).
|
||||
* Separate path elements are typically slower than a single path element. However, distinct path elements are useful for styling and interaction (e.g., click or mouseover).
|
||||
* Canvas rendering (see path.context) is typically faster than SVG, but requires more effort to implement styling and interaction.
|
||||
*
|
||||
* The first generic type of the GeoPath generator used, must correspond to the "this" context bound to the function upon invocation.
|
||||
@ -1501,10 +1501,15 @@ export function geoTransform<T extends GeoTransformPrototype>(methods: T): { str
|
||||
|
||||
// geoIdentity() =================================================================
|
||||
|
||||
/**
|
||||
* @deprecated Misspelled name. Use GeoIdentityTransform.
|
||||
*/
|
||||
export type GeoIdentityTranform = GeoIdentityTransform;
|
||||
|
||||
/**
|
||||
* Geo Identity Transform
|
||||
*/
|
||||
export interface GeoIdentityTranform extends GeoStreamWrapper {
|
||||
export interface GeoIdentityTransform extends GeoStreamWrapper {
|
||||
/**
|
||||
* Returns the current viewport clip extent which defaults to null.
|
||||
*/
|
||||
@ -1667,7 +1672,7 @@ export interface GeoIdentityTranform extends GeoStreamWrapper {
|
||||
/**
|
||||
* Returns the identity transform which can be used to scale, translate and clip planar geometry.
|
||||
*/
|
||||
export function geoIdentity(): GeoIdentityTranform;
|
||||
export function geoIdentity(): GeoIdentityTransform;
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Clipping Functions
|
||||
|
||||
@ -568,7 +568,7 @@ hierarchyRectangularNode = rectangularNodeDescendants[rectangularNodeDescendants
|
||||
|
||||
const treemapPath: Array<d3Hierarchy.HierarchyRectangularNode<HierarchyDatumWithParentId>> = treemapRootNode.path(hierarchyRectangularNode);
|
||||
|
||||
// links() and HierarchyRectangulerLink<...> ------------------------------------------
|
||||
// links() and HierarchyRectangularLink<...> ------------------------------------------
|
||||
|
||||
let rectangularLinks: Array<d3Hierarchy.HierarchyRectangularLink<HierarchyDatumWithParentId>>;
|
||||
|
||||
@ -747,7 +747,7 @@ hierarchyCircularNode = circularNodeDescendants[circularNodeDescendants.length -
|
||||
|
||||
const packPath: Array<d3Hierarchy.HierarchyCircularNode<HierarchyDatumWithParentId>> = packRootNode.path(hierarchyCircularNode);
|
||||
|
||||
// links() and HierarchyRectangulerLink<...> ------------------------------------------
|
||||
// links() and HierarchyRectangularLink<...> ------------------------------------------
|
||||
|
||||
let circularLinks: Array<d3Hierarchy.HierarchyCircularLink<HierarchyDatumWithParentId>>;
|
||||
|
||||
|
||||
2
types/d3-hierarchy/index.d.ts
vendored
2
types/d3-hierarchy/index.d.ts
vendored
@ -50,7 +50,7 @@ export function hierarchy<Datum>(data: Datum, children?: (d: Datum) => (Datum[]
|
||||
// Stratify
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
// TODO: Review the comment in the API documentation related to 'reserved properties': id, parentId, children. If this is refering to the element on node, it should be 'parent'?
|
||||
// TODO: Review the comment in the API documentation related to 'reserved properties': id, parentId, children. If this is referring to the element on node, it should be 'parent'?
|
||||
|
||||
export interface StratifyOperator<Datum> {
|
||||
(data: Datum[]): HierarchyNode<Datum>;
|
||||
|
||||
@ -51,7 +51,7 @@ cString = cHSV.toString();
|
||||
console.log('Channels = (h : %d, s: %d, v: %d)', cHSV.h, cHSV.s, cHSV.v);
|
||||
console.log('Opacity = %d', cHSV.opacity);
|
||||
|
||||
// Interpolater
|
||||
// Interpolator
|
||||
|
||||
iString = interpolateHsv('seagreen', 'steelblue');
|
||||
iString = interpolateHsv(rgb('seagreen'), hcl('steelblue'));
|
||||
@ -61,7 +61,7 @@ iString = interpolateHsvLong('seagreen', 'steelblue');
|
||||
iString = interpolateHsvLong(rgb('seagreen'), hcl('steelblue'));
|
||||
iString = interpolateHsvLong(rgb('seagreen'), hsv('steelblue'));
|
||||
|
||||
// Prototype, instanceof and typeguard
|
||||
// Prototype, instanceof and type guard
|
||||
|
||||
declare let color: RGBColor | HSVColor | null;
|
||||
|
||||
|
||||
@ -123,7 +123,7 @@ arrNum = iArrayNum(0.5);
|
||||
iArrayStr = d3Interpolate.interpolateArray<string[]>(['1', '2'], ['4', '8']); // explicit typing
|
||||
arrStr = iArrayStr(0.5);
|
||||
|
||||
iArrayStr = d3Interpolate.interpolateArray([1, 2], ['4', '8']); // infered typing <string>
|
||||
iArrayStr = d3Interpolate.interpolateArray([1, 2], ['4', '8']); // inferred typing <string>
|
||||
arrStr = iArrayStr(0.5);
|
||||
|
||||
// two element array with first element date and second element string
|
||||
@ -156,7 +156,7 @@ console.log('Recommended transition duration = %d', iZoom.duration);
|
||||
|
||||
// test quantize(interpolator, n) signature ------------------------------------------------
|
||||
|
||||
arrNum = d3Interpolate.quantize(d3Interpolate.interpolateRound(-1, 2), 4); // infered template parameter type
|
||||
arrNum = d3Interpolate.quantize(d3Interpolate.interpolateRound(-1, 2), 4); // inferred template parameter type
|
||||
arrStr = d3Interpolate.quantize<string>(d3Interpolate.interpolateString('-1', '2'), 4); // explicit template parameter typing
|
||||
|
||||
// arrStr = d3Interpolate.quantize<string>(d3Interpolate.interpolateRound(-1, 2), 4); // test fails, due to explicit typing v argument type mismatch
|
||||
|
||||
2
types/d3-path/index.d.ts
vendored
2
types/d3-path/index.d.ts
vendored
@ -95,7 +95,7 @@ export interface Path {
|
||||
rect(x: number, y: number, w: number, h: number): void;
|
||||
|
||||
/**
|
||||
* Returns the string representation of this path according to SVG’s path data specficiation.
|
||||
* Returns the string representation of this path according to SVG’s path data specification.
|
||||
*/
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ qNoResult = qNoResult.defer(delayedHello, 'Alice', 250);
|
||||
|
||||
qNoResult.defer(delayedHello, 'Bob', 500);
|
||||
|
||||
// Task with Reuslts -------------------------------------------------
|
||||
// Task with Results -------------------------------------------------
|
||||
|
||||
function getFileStats(path: string, callback: (error: any | null, stats?: any) => void) {
|
||||
// magically get file stats and behave like fs.stat when invoking the callback
|
||||
@ -57,7 +57,7 @@ qNoResult = qNoResult.await((error) => {
|
||||
console.log('Goodbye!');
|
||||
});
|
||||
|
||||
// Task with Reuslts -------------------------------------------------
|
||||
// Task with Results -------------------------------------------------
|
||||
|
||||
// await
|
||||
qWithResults
|
||||
|
||||
4
types/d3-queue/index.d.ts
vendored
4
types/d3-queue/index.d.ts
vendored
@ -29,7 +29,7 @@ export interface Queue {
|
||||
/**
|
||||
* Sets the callback to be invoked when all deferred tasks have finished (individual result arguments).
|
||||
*
|
||||
* @param callback Callback function to be executed, when error occured or all deferred tasks
|
||||
* @param callback Callback function to be executed, when error occurred or all deferred tasks
|
||||
* have completed. The first argument to the callback is the first error that occurred, or null if no error occurred.
|
||||
* If an error occurred, there are no additional arguments to the callback. Otherwise,
|
||||
* the callback is passed each result as an additional argument.
|
||||
@ -38,7 +38,7 @@ export interface Queue {
|
||||
/**
|
||||
* Sets the callback to be invoked when all deferred tasks have finished (results array).
|
||||
*
|
||||
* @param callback Callback function to be executed, when error occured or all deferred tasks
|
||||
* @param callback Callback function to be executed, when error occurred or all deferred tasks
|
||||
* have completed. The first argument to the callback is the first error that occurred,
|
||||
* or null if no error occurred. If an error occurred, there are no additional arguments to the callback.
|
||||
* Otherwise, the callback is also passed an array of results as the second argument.
|
||||
|
||||
2
types/d3-random/index.d.ts
vendored
2
types/d3-random/index.d.ts
vendored
@ -57,7 +57,7 @@ export const randomNormal: RandomNormal;
|
||||
*/
|
||||
export interface RandomLogNormal extends RandomNumberGenerationSource {
|
||||
/**
|
||||
* Returns a function for generating random numbers with a log-normal distribution. The expected value of the random variable’s natural logrithm is mu,
|
||||
* Returns a function for generating random numbers with a log-normal distribution. The expected value of the random variable’s natural logarithm is mu,
|
||||
* with the given standard deviation sigma. If mu is not specified, it defaults to 0; if sigma is not specified, it defaults to 1.
|
||||
*
|
||||
* @param mu Expected value, defaults to 0.
|
||||
|
||||
4
types/d3-sankey/index.d.ts
vendored
4
types/d3-sankey/index.d.ts
vendored
@ -333,7 +333,7 @@ export interface SankeyLayout<Data, N extends SankeyExtraProperties, L extends S
|
||||
/**
|
||||
* Set the number of relaxation iterations when generating the layout and return this Sankey layout generator.
|
||||
*
|
||||
* @param iterations Number of relaxation iterations, which defaluts to 32.
|
||||
* @param iterations Number of relaxation iterations, which defaults to 32.
|
||||
*/
|
||||
iterations(iterations: number): this;
|
||||
}
|
||||
@ -365,7 +365,7 @@ export function sankey<N extends SankeyExtraProperties, L extends SankeyExtraPro
|
||||
* Get a Sankey layout generator.
|
||||
*
|
||||
* The nodes/links accessors need to be configured to work with the data type of the first argument passed
|
||||
* in when invoking the Sankey lyout generator.
|
||||
* in when invoking the Sankey layout generator.
|
||||
*
|
||||
* The first generic corresponds to the data type of the first argument passed in when invoking the Sankey layout generator,
|
||||
* and its nodes/links accessors.
|
||||
|
||||
84
types/d3-scale/index.d.ts
vendored
84
types/d3-scale/index.d.ts
vendored
@ -14,7 +14,7 @@ import { CountableTimeInterval, TimeInterval } from 'd3-time';
|
||||
/**
|
||||
* An Interpolator factory returns an interpolator function.
|
||||
*
|
||||
* The first generic correponds to the data type of the interpolation boundaries.
|
||||
* The first generic corresponds to the data type of the interpolation boundaries.
|
||||
* The second generic corresponds to the data type of the return type of the interpolator.
|
||||
*/
|
||||
export interface InterpolatorFactory<T, U> {
|
||||
@ -180,7 +180,7 @@ export interface ScaleContinuousNumeric<Range, Output> {
|
||||
*
|
||||
* The second generic corresponds to the data type of the output elements generated by the scale.
|
||||
*
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behavior and
|
||||
* convert the interpolated range element to a corresponding output element.
|
||||
*/
|
||||
export interface ScaleLinear<Range, Output> extends ScaleContinuousNumeric<Range, Output> {
|
||||
@ -197,9 +197,9 @@ export interface ScaleLinear<Range, Output> extends ScaleContinuousNumeric<Range
|
||||
* If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance);
|
||||
* however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate.
|
||||
*
|
||||
* As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value.
|
||||
* As part of the interpolation process the interpolated value from the range may be converted to a corresponding output value.
|
||||
*
|
||||
* @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale.
|
||||
* @param interpolate An interpolation factory. The generics for Range and Output of the scale must correspond to the interpolation factory applied to the scale.
|
||||
*/
|
||||
interpolate(interpolate: InterpolatorFactory<Range, Output>): this;
|
||||
/**
|
||||
@ -210,11 +210,11 @@ export interface ScaleLinear<Range, Output> extends ScaleContinuousNumeric<Range
|
||||
* If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance);
|
||||
* however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate.
|
||||
*
|
||||
* As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value.
|
||||
* As part of the interpolation process the interpolated value from the range may be converted to a corresponding output value.
|
||||
*
|
||||
* The generic "NewOutput" can be used to change the scale to have a different output element type corresponding to the new interpolation factory.
|
||||
*
|
||||
* @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale.
|
||||
* @param interpolate An interpolation factory. The generics for Range and Output of the scale must correspond to the interpolation factory applied to the scale.
|
||||
*/
|
||||
interpolate<NewOutput>(interpolate: InterpolatorFactory<Range, NewOutput>): ScaleLinear<Range, NewOutput>;
|
||||
}
|
||||
@ -228,9 +228,9 @@ export function scaleLinear(): ScaleLinear<number, number>;
|
||||
/**
|
||||
* Constructs a new continuous linear scale with the unit domain [0, 1], the default interpolator and clamping disabled.
|
||||
*
|
||||
* The generic correponds to the data type of the range and output elements to be used.
|
||||
* The generic corresponds to the data type of the range and output elements to be used.
|
||||
*
|
||||
* As range type and output type are the same, the interpolator factory used with the scale must match this behaviour.
|
||||
* As range type and output type are the same, the interpolator factory used with the scale must match this behavior.
|
||||
* The range must be set in accordance with the range element type.
|
||||
*
|
||||
* The interpolator factory may be set using the interpolate(...) method of the scale.
|
||||
@ -242,7 +242,7 @@ export function scaleLinear<Output>(): ScaleLinear<Output, Output>;
|
||||
* The first generic corresponds to the data type of the range elements.
|
||||
* The second generic corresponds to the data type of the output elements generated by the scale.
|
||||
*
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behavior and
|
||||
* convert the interpolated range element to a corresponding output element.
|
||||
*
|
||||
* The range must be set in accordance with the range element type.
|
||||
@ -271,7 +271,7 @@ export function scaleLinear<Range, Output>(): ScaleLinear<Range, Output>;
|
||||
*
|
||||
* The second generic corresponds to the data type of the output elements generated by the scale.
|
||||
*
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behavior and
|
||||
* convert the interpolated range element to a corresponding output element.
|
||||
*/
|
||||
export interface ScalePower<Range, Output> extends ScaleContinuousNumeric<Range, Output> {
|
||||
@ -288,9 +288,9 @@ export interface ScalePower<Range, Output> extends ScaleContinuousNumeric<Range,
|
||||
* If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance);
|
||||
* however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate.
|
||||
*
|
||||
* As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value.
|
||||
* As part of the interpolation process the interpolated value from the range may be converted to a corresponding output value.
|
||||
*
|
||||
* @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale.
|
||||
* @param interpolate An interpolation factory. The generics for Range and Output of the scale must correspond to the interpolation factory applied to the scale.
|
||||
*/
|
||||
interpolate(interpolate: InterpolatorFactory<Range, Output>): this;
|
||||
/**
|
||||
@ -301,11 +301,11 @@ export interface ScalePower<Range, Output> extends ScaleContinuousNumeric<Range,
|
||||
* If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance);
|
||||
* however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate.
|
||||
*
|
||||
* As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value.
|
||||
* As part of the interpolation process the interpolated value from the range may be converted to a corresponding output value.
|
||||
*
|
||||
* The generic "NewOutput" can be used to change the scale to have a different output element type corresponding to the new interpolation factory.
|
||||
*
|
||||
* @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale.
|
||||
* @param interpolate An interpolation factory. The generics for Range and Output of the scale must correspond to the interpolation factory applied to the scale.
|
||||
*/
|
||||
interpolate<NewOutput>(interpolate: InterpolatorFactory<Range, NewOutput>): ScalePower<Range, NewOutput>;
|
||||
|
||||
@ -332,9 +332,9 @@ export function scalePow(): ScalePower<number, number>;
|
||||
* Constructs a new continuous power scale with the unit domain [0, 1], the exponent 1, the default interpolator and clamping disabled.
|
||||
* (Note that this is effectively a linear scale until you set a different exponent.)
|
||||
*
|
||||
* The generic correponds to the data type of the range and output elements to be used.
|
||||
* The generic corresponds to the data type of the range and output elements to be used.
|
||||
*
|
||||
* As range type and output type are the same, the interpolator factory used with the scale must match this behaviour.
|
||||
* As range type and output type are the same, the interpolator factory used with the scale must match this behavior.
|
||||
*
|
||||
* The range must be set in accordance with the range element type.
|
||||
*
|
||||
@ -348,7 +348,7 @@ export function scalePow<Output>(): ScalePower<Output, Output>;
|
||||
* The first generic corresponds to the data type of the range elements.
|
||||
* The second generic corresponds to the data type of the output elements generated by the scale.
|
||||
*
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behavior and
|
||||
* convert the interpolated range element to a corresponding output element.
|
||||
*
|
||||
* The range must be set in accordance with the range element type.
|
||||
@ -368,9 +368,9 @@ export function scaleSqrt(): ScalePower<number, number>;
|
||||
* Constructs a new continuous power scale with the unit domain [0, 1], the exponent 0.5, the default interpolator and clamping disabled.
|
||||
* This is a convenience method equivalent to d3.scalePow().exponent(0.5).
|
||||
*
|
||||
* The generic correponds to the data type of the range and output elements to be used.
|
||||
* The generic corresponds to the data type of the range and output elements to be used.
|
||||
*
|
||||
* As range type and output type are the same, the interpolator factory used with the scale must match this behaviour.
|
||||
* As range type and output type are the same, the interpolator factory used with the scale must match this behavior.
|
||||
*
|
||||
* The range must be set in accordance with the range element type.
|
||||
*
|
||||
@ -384,7 +384,7 @@ export function scaleSqrt<Output>(): ScalePower<Output, Output>;
|
||||
* The first generic corresponds to the data type of the range elements.
|
||||
* The second generic corresponds to the data type of the output elements generated by the scale.
|
||||
*
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behavior and
|
||||
* convert the interpolated range element to a corresponding output element.
|
||||
*
|
||||
* The range must be set in accordance with the range element type.
|
||||
@ -417,7 +417,7 @@ export function scaleSqrt<Range, Output>(): ScalePower<Range, Output>;
|
||||
*
|
||||
* The second generic corresponds to the data type of the output elements generated by the scale.
|
||||
*
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behavior and
|
||||
* convert the interpolated range element to a corresponding output element.
|
||||
*/
|
||||
export interface ScaleLogarithmic<Range, Output> extends ScaleContinuousNumeric<Range, Output> {
|
||||
@ -456,9 +456,9 @@ export interface ScaleLogarithmic<Range, Output> extends ScaleContinuousNumeric<
|
||||
* If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance);
|
||||
* however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate.
|
||||
*
|
||||
* As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value.
|
||||
* As part of the interpolation process the interpolated value from the range may be converted to a corresponding output value.
|
||||
*
|
||||
* @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale.
|
||||
* @param interpolate An interpolation factory. The generics for Range and Output of the scale must correspond to the interpolation factory applied to the scale.
|
||||
*/
|
||||
interpolate(interpolate: InterpolatorFactory<Range, Output>): this;
|
||||
/**
|
||||
@ -469,11 +469,11 @@ export interface ScaleLogarithmic<Range, Output> extends ScaleContinuousNumeric<
|
||||
* If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance);
|
||||
* however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate.
|
||||
*
|
||||
* As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value.
|
||||
* As part of the interpolation process the interpolated value from the range may be converted to a corresponding output value.
|
||||
*
|
||||
* The generic "NewOutput" can be used to change the scale to have a different output element type corresponding to the new interpolation factory.
|
||||
*
|
||||
* @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale.
|
||||
* @param interpolate An interpolation factory. The generics for Range and Output of the scale must correspond to the interpolation factory applied to the scale.
|
||||
*/
|
||||
interpolate<NewOutput>(interpolate: InterpolatorFactory<Range, NewOutput>): ScaleLogarithmic<Range, NewOutput>;
|
||||
|
||||
@ -537,9 +537,9 @@ export function scaleLog(): ScaleLogarithmic<number, number>;
|
||||
/**
|
||||
* Constructs a new continuous logarithmic scale with the domain [1, 10], the base 10, the default interpolator and clamping disabled.
|
||||
*
|
||||
* The generic correponds to the data type of the range and output elements to be used.
|
||||
* The generic corresponds to the data type of the range and output elements to be used.
|
||||
*
|
||||
* As range type and output type are the same, the interpolator factory used with the scale must match this behaviour.
|
||||
* As range type and output type are the same, the interpolator factory used with the scale must match this behavior.
|
||||
*
|
||||
* The range must be set in accordance with the range element type.
|
||||
*
|
||||
@ -552,7 +552,7 @@ export function scaleLog<Output>(): ScaleLogarithmic<Output, Output>;
|
||||
* The first generic corresponds to the data type of the range elements.
|
||||
* The second generic corresponds to the data type of the output elements generated by the scale.
|
||||
*
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behavior and
|
||||
* convert the interpolated range element to a corresponding output element.
|
||||
*
|
||||
* The range must be set in accordance with the range element type.
|
||||
@ -696,7 +696,7 @@ export function scaleIdentity(): ScaleIdentity;
|
||||
*
|
||||
* The second generic corresponds to the data type of the output elements generated by the scale.
|
||||
*
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behavior and
|
||||
* convert the interpolated range element to a corresponding output element.
|
||||
*/
|
||||
export interface ScaleTime<Range, Output> {
|
||||
@ -798,9 +798,9 @@ export interface ScaleTime<Range, Output> {
|
||||
* If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance);
|
||||
* however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate.
|
||||
*
|
||||
* As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value.
|
||||
* As part of the interpolation process the interpolated value from the range may be converted to a corresponding output value.
|
||||
*
|
||||
* @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale.
|
||||
* @param interpolate An interpolation factory. The generics for Range and Output of the scale must correspond to the interpolation factory applied to the scale.
|
||||
*/
|
||||
interpolate(interpolate: InterpolatorFactory<Range, Output>): this;
|
||||
/**
|
||||
@ -811,11 +811,11 @@ export interface ScaleTime<Range, Output> {
|
||||
* If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance);
|
||||
* however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate.
|
||||
*
|
||||
* As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value.
|
||||
* As part of the interpolation process the interpolated value from the range may be converted to a corresponding output value.
|
||||
*
|
||||
* The generic "NewOutput" can be used to change the scale to have a different output element type corresponding to the new interpolation factory.
|
||||
*
|
||||
* @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale.
|
||||
* @param interpolate An interpolation factory. The generics for Range and Output of the scale must correspond to the interpolation factory applied to the scale.
|
||||
*/
|
||||
interpolate<NewOutput>(interpolate: InterpolatorFactory<Range, NewOutput>): ScaleTime<Range, NewOutput>;
|
||||
|
||||
@ -942,9 +942,9 @@ export function scaleTime(): ScaleTime<number, number>;
|
||||
/**
|
||||
* Constructs a new time scale using local time with the domain [2000-01-01, 2000-01-02], the default interpolator and clamping disabled.
|
||||
*
|
||||
* The generic correponds to the data type of the range and output elements to be used.
|
||||
* The generic corresponds to the data type of the range and output elements to be used.
|
||||
*
|
||||
* As range type and output type are the same, the interpolator factory used with the scale must match this behaviour.
|
||||
* As range type and output type are the same, the interpolator factory used with the scale must match this behavior.
|
||||
*
|
||||
* The range must be set in accordance with the range element type.
|
||||
*
|
||||
@ -957,7 +957,7 @@ export function scaleTime<Output>(): ScaleTime<Output, Output>;
|
||||
* The first generic corresponds to the data type of the range elements.
|
||||
* The second generic corresponds to the data type of the output elements generated by the scale.
|
||||
*
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behavior and
|
||||
* convert the interpolated range element to a corresponding output element.
|
||||
*
|
||||
* The range must be set in accordance with the range element type.
|
||||
@ -975,9 +975,9 @@ export function scaleUtc(): ScaleTime<number, number>;
|
||||
/**
|
||||
* Constructs a new time scale using Coordinated Universal Time (UTC) with the domain [2000-01-01, 2000-01-02], the default interpolator and clamping disabled.
|
||||
*
|
||||
* The generic correponds to the data type of the range and output elements to be used.
|
||||
* The generic corresponds to the data type of the range and output elements to be used.
|
||||
*
|
||||
* As range type and output type are the same, the interpolator factory used with the scale must match this behaviour.
|
||||
* As range type and output type are the same, the interpolator factory used with the scale must match this behavior.
|
||||
*
|
||||
* The range must be set in accordance with the range element type.
|
||||
*
|
||||
@ -990,7 +990,7 @@ export function scaleUtc<Output>(): ScaleTime<Output, Output>;
|
||||
* The first generic corresponds to the data type of the range elements.
|
||||
* The second generic corresponds to the data type of the output elements generated by the scale.
|
||||
*
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behavior and
|
||||
* convert the interpolated range element to a corresponding output element.
|
||||
*
|
||||
* The range must be set in accordance with the range element type.
|
||||
@ -1202,7 +1202,7 @@ export function scaleQuantize<Range>(): ScaleQuantize<Range>;
|
||||
* The number of values in (the cardinality of) the output range determines the number of quantiles that will be computed from the domain.
|
||||
* To compute the quantiles, the domain is sorted, and treated as a population of discrete values; see d3-array’s quantile.
|
||||
*
|
||||
* The generic correponds to the data type of range elements.
|
||||
* The generic corresponds to the data type of range elements.
|
||||
*/
|
||||
export interface ScaleQuantile<Range> {
|
||||
/**
|
||||
@ -1272,7 +1272,7 @@ export function scaleQuantile(): ScaleQuantile<number>;
|
||||
* Constructs a new quantile scale with an empty domain and an empty range.
|
||||
* The quantile scale is invalid until both a domain and range are specified.
|
||||
*
|
||||
* The generic correponds to the data type of range elements.
|
||||
* The generic corresponds to the data type of range elements.
|
||||
*/
|
||||
export function scaleQuantile<Range>(): ScaleQuantile<Range>;
|
||||
|
||||
@ -1613,7 +1613,7 @@ export function scaleBand(): ScaleBand<string>;
|
||||
/**
|
||||
* Constructs a new band scale with the empty domain, the unit range [0, 1], no padding, no rounding and center alignment.
|
||||
*
|
||||
* The generic correponds to the data type of domain elements.
|
||||
* The generic corresponds to the data type of domain elements.
|
||||
*/
|
||||
export function scaleBand<Domain extends { toString(): string }>(): ScaleBand<Domain>;
|
||||
|
||||
|
||||
84
types/d3-scale/v1/index.d.ts
vendored
84
types/d3-scale/v1/index.d.ts
vendored
@ -14,7 +14,7 @@ import { CountableTimeInterval, TimeInterval } from 'd3-time';
|
||||
/**
|
||||
* An Interpolator factory returns an interpolator function.
|
||||
*
|
||||
* The first generic correponds to the data type of the interpolation boundaries.
|
||||
* The first generic corresponds to the data type of the interpolation boundaries.
|
||||
* The second generic corresponds to the data type of the return type of the interpolator.
|
||||
*/
|
||||
export interface InterpolatorFactory<T, U> {
|
||||
@ -180,7 +180,7 @@ export interface ScaleContinuousNumeric<Range, Output> {
|
||||
*
|
||||
* The second generic corresponds to the data type of the output elements generated by the scale.
|
||||
*
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behavior and
|
||||
* convert the interpolated range element to a corresponding output element.
|
||||
*/
|
||||
export interface ScaleLinear<Range, Output> extends ScaleContinuousNumeric<Range, Output> {
|
||||
@ -197,9 +197,9 @@ export interface ScaleLinear<Range, Output> extends ScaleContinuousNumeric<Range
|
||||
* If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance);
|
||||
* however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate.
|
||||
*
|
||||
* As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value.
|
||||
* As part of the interpolation process the interpolated value from the range may be converted to a corresponding output value.
|
||||
*
|
||||
* @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale.
|
||||
* @param interpolate An interpolation factory. The generics for Range and Output of the scale must correspond to the interpolation factory applied to the scale.
|
||||
*/
|
||||
interpolate(interpolate: InterpolatorFactory<Range, Output>): this;
|
||||
/**
|
||||
@ -210,11 +210,11 @@ export interface ScaleLinear<Range, Output> extends ScaleContinuousNumeric<Range
|
||||
* If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance);
|
||||
* however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate.
|
||||
*
|
||||
* As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value.
|
||||
* As part of the interpolation process the interpolated value from the range may be converted to a corresponding output value.
|
||||
*
|
||||
* The generic "NewOutput" can be used to change the scale to have a different output element type corresponding to the new interpolation factory.
|
||||
*
|
||||
* @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale.
|
||||
* @param interpolate An interpolation factory. The generics for Range and Output of the scale must correspond to the interpolation factory applied to the scale.
|
||||
*/
|
||||
interpolate<NewOutput>(interpolate: InterpolatorFactory<Range, NewOutput>): ScaleLinear<Range, NewOutput>;
|
||||
}
|
||||
@ -228,9 +228,9 @@ export function scaleLinear(): ScaleLinear<number, number>;
|
||||
/**
|
||||
* Constructs a new continuous linear scale with the unit domain [0, 1], the default interpolator and clamping disabled.
|
||||
*
|
||||
* The generic correponds to the data type of the range and output elements to be used.
|
||||
* The generic corresponds to the data type of the range and output elements to be used.
|
||||
*
|
||||
* As range type and output type are the same, the interpolator factory used with the scale must match this behaviour.
|
||||
* As range type and output type are the same, the interpolator factory used with the scale must match this behavior.
|
||||
* The range must be set in accordance with the range element type.
|
||||
*
|
||||
* The interpolator factory may be set using the interpolate(...) method of the scale.
|
||||
@ -242,7 +242,7 @@ export function scaleLinear<Output>(): ScaleLinear<Output, Output>;
|
||||
* The first generic corresponds to the data type of the range elements.
|
||||
* The second generic corresponds to the data type of the output elements generated by the scale.
|
||||
*
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behavior and
|
||||
* convert the interpolated range element to a corresponding output element.
|
||||
*
|
||||
* The range must be set in accordance with the range element type.
|
||||
@ -271,7 +271,7 @@ export function scaleLinear<Range, Output>(): ScaleLinear<Range, Output>;
|
||||
*
|
||||
* The second generic corresponds to the data type of the output elements generated by the scale.
|
||||
*
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behavior and
|
||||
* convert the interpolated range element to a corresponding output element.
|
||||
*/
|
||||
export interface ScalePower<Range, Output> extends ScaleContinuousNumeric<Range, Output> {
|
||||
@ -288,9 +288,9 @@ export interface ScalePower<Range, Output> extends ScaleContinuousNumeric<Range,
|
||||
* If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance);
|
||||
* however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate.
|
||||
*
|
||||
* As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value.
|
||||
* As part of the interpolation process the interpolated value from the range may be converted to a corresponding output value.
|
||||
*
|
||||
* @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale.
|
||||
* @param interpolate An interpolation factory. The generics for Range and Output of the scale must correspond to the interpolation factory applied to the scale.
|
||||
*/
|
||||
interpolate(interpolate: InterpolatorFactory<Range, Output>): this;
|
||||
/**
|
||||
@ -301,11 +301,11 @@ export interface ScalePower<Range, Output> extends ScaleContinuousNumeric<Range,
|
||||
* If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance);
|
||||
* however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate.
|
||||
*
|
||||
* As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value.
|
||||
* As part of the interpolation process the interpolated value from the range may be converted to a corresponding output value.
|
||||
*
|
||||
* The generic "NewOutput" can be used to change the scale to have a different output element type corresponding to the new interpolation factory.
|
||||
*
|
||||
* @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale.
|
||||
* @param interpolate An interpolation factory. The generics for Range and Output of the scale must correspond to the interpolation factory applied to the scale.
|
||||
*/
|
||||
interpolate<NewOutput>(interpolate: InterpolatorFactory<Range, NewOutput>): ScalePower<Range, NewOutput>;
|
||||
|
||||
@ -332,9 +332,9 @@ export function scalePow(): ScalePower<number, number>;
|
||||
* Constructs a new continuous power scale with the unit domain [0, 1], the exponent 1, the default interpolator and clamping disabled.
|
||||
* (Note that this is effectively a linear scale until you set a different exponent.)
|
||||
*
|
||||
* The generic correponds to the data type of the range and output elements to be used.
|
||||
* The generic corresponds to the data type of the range and output elements to be used.
|
||||
*
|
||||
* As range type and output type are the same, the interpolator factory used with the scale must match this behaviour.
|
||||
* As range type and output type are the same, the interpolator factory used with the scale must match this behavior.
|
||||
*
|
||||
* The range must be set in accordance with the range element type.
|
||||
*
|
||||
@ -348,7 +348,7 @@ export function scalePow<Output>(): ScalePower<Output, Output>;
|
||||
* The first generic corresponds to the data type of the range elements.
|
||||
* The second generic corresponds to the data type of the output elements generated by the scale.
|
||||
*
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behavior and
|
||||
* convert the interpolated range element to a corresponding output element.
|
||||
*
|
||||
* The range must be set in accordance with the range element type.
|
||||
@ -368,9 +368,9 @@ export function scaleSqrt(): ScalePower<number, number>;
|
||||
* Constructs a new continuous power scale with the unit domain [0, 1], the exponent 0.5, the default interpolator and clamping disabled.
|
||||
* This is a convenience method equivalent to d3.scalePow().exponent(0.5).
|
||||
*
|
||||
* The generic correponds to the data type of the range and output elements to be used.
|
||||
* The generic corresponds to the data type of the range and output elements to be used.
|
||||
*
|
||||
* As range type and output type are the same, the interpolator factory used with the scale must match this behaviour.
|
||||
* As range type and output type are the same, the interpolator factory used with the scale must match this behavior.
|
||||
*
|
||||
* The range must be set in accordance with the range element type.
|
||||
*
|
||||
@ -384,7 +384,7 @@ export function scaleSqrt<Output>(): ScalePower<Output, Output>;
|
||||
* The first generic corresponds to the data type of the range elements.
|
||||
* The second generic corresponds to the data type of the output elements generated by the scale.
|
||||
*
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behavior and
|
||||
* convert the interpolated range element to a corresponding output element.
|
||||
*
|
||||
* The range must be set in accordance with the range element type.
|
||||
@ -417,7 +417,7 @@ export function scaleSqrt<Range, Output>(): ScalePower<Range, Output>;
|
||||
*
|
||||
* The second generic corresponds to the data type of the output elements generated by the scale.
|
||||
*
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behavior and
|
||||
* convert the interpolated range element to a corresponding output element.
|
||||
*/
|
||||
export interface ScaleLogarithmic<Range, Output> extends ScaleContinuousNumeric<Range, Output> {
|
||||
@ -456,9 +456,9 @@ export interface ScaleLogarithmic<Range, Output> extends ScaleContinuousNumeric<
|
||||
* If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance);
|
||||
* however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate.
|
||||
*
|
||||
* As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value.
|
||||
* As part of the interpolation process the interpolated value from the range may be converted to a corresponding output value.
|
||||
*
|
||||
* @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale.
|
||||
* @param interpolate An interpolation factory. The generics for Range and Output of the scale must correspond to the interpolation factory applied to the scale.
|
||||
*/
|
||||
interpolate(interpolate: InterpolatorFactory<Range, Output>): this;
|
||||
/**
|
||||
@ -469,11 +469,11 @@ export interface ScaleLogarithmic<Range, Output> extends ScaleContinuousNumeric<
|
||||
* If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance);
|
||||
* however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate.
|
||||
*
|
||||
* As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value.
|
||||
* As part of the interpolation process the interpolated value from the range may be converted to a corresponding output value.
|
||||
*
|
||||
* The generic "NewOutput" can be used to change the scale to have a different output element type corresponding to the new interpolation factory.
|
||||
*
|
||||
* @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale.
|
||||
* @param interpolate An interpolation factory. The generics for Range and Output of the scale must correspond to the interpolation factory applied to the scale.
|
||||
*/
|
||||
interpolate<NewOutput>(interpolate: InterpolatorFactory<Range, NewOutput>): ScaleLogarithmic<Range, NewOutput>;
|
||||
|
||||
@ -537,9 +537,9 @@ export function scaleLog(): ScaleLogarithmic<number, number>;
|
||||
/**
|
||||
* Constructs a new continuous logarithmic scale with the domain [1, 10], the base 10, the default interpolator and clamping disabled.
|
||||
*
|
||||
* The generic correponds to the data type of the range and output elements to be used.
|
||||
* The generic corresponds to the data type of the range and output elements to be used.
|
||||
*
|
||||
* As range type and output type are the same, the interpolator factory used with the scale must match this behaviour.
|
||||
* As range type and output type are the same, the interpolator factory used with the scale must match this behavior.
|
||||
*
|
||||
* The range must be set in accordance with the range element type.
|
||||
*
|
||||
@ -552,7 +552,7 @@ export function scaleLog<Output>(): ScaleLogarithmic<Output, Output>;
|
||||
* The first generic corresponds to the data type of the range elements.
|
||||
* The second generic corresponds to the data type of the output elements generated by the scale.
|
||||
*
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behavior and
|
||||
* convert the interpolated range element to a corresponding output element.
|
||||
*
|
||||
* The range must be set in accordance with the range element type.
|
||||
@ -696,7 +696,7 @@ export function scaleIdentity(): ScaleIdentity;
|
||||
*
|
||||
* The second generic corresponds to the data type of the output elements generated by the scale.
|
||||
*
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behavior and
|
||||
* convert the interpolated range element to a corresponding output element.
|
||||
*/
|
||||
export interface ScaleTime<Range, Output> {
|
||||
@ -798,9 +798,9 @@ export interface ScaleTime<Range, Output> {
|
||||
* If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance);
|
||||
* however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate.
|
||||
*
|
||||
* As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value.
|
||||
* As part of the interpolation process the interpolated value from the range may be converted to a corresponding output value.
|
||||
*
|
||||
* @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale.
|
||||
* @param interpolate An interpolation factory. The generics for Range and Output of the scale must correspond to the interpolation factory applied to the scale.
|
||||
*/
|
||||
interpolate(interpolate: InterpolatorFactory<Range, Output>): this;
|
||||
/**
|
||||
@ -811,11 +811,11 @@ export interface ScaleTime<Range, Output> {
|
||||
* If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance);
|
||||
* however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate.
|
||||
*
|
||||
* As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value.
|
||||
* As part of the interpolation process the interpolated value from the range may be converted to a corresponding output value.
|
||||
*
|
||||
* The generic "NewOutput" can be used to change the scale to have a different output element type corresponding to the new interpolation factory.
|
||||
*
|
||||
* @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale.
|
||||
* @param interpolate An interpolation factory. The generics for Range and Output of the scale must correspond to the interpolation factory applied to the scale.
|
||||
*/
|
||||
interpolate<NewOutput>(interpolate: InterpolatorFactory<Range, NewOutput>): ScaleTime<Range, NewOutput>;
|
||||
|
||||
@ -942,9 +942,9 @@ export function scaleTime(): ScaleTime<number, number>;
|
||||
/**
|
||||
* Constructs a new time scale using local time with the domain [2000-01-01, 2000-01-02], the default interpolator and clamping disabled.
|
||||
*
|
||||
* The generic correponds to the data type of the range and output elements to be used.
|
||||
* The generic corresponds to the data type of the range and output elements to be used.
|
||||
*
|
||||
* As range type and output type are the same, the interpolator factory used with the scale must match this behaviour.
|
||||
* As range type and output type are the same, the interpolator factory used with the scale must match this behavior.
|
||||
*
|
||||
* The range must be set in accordance with the range element type.
|
||||
*
|
||||
@ -957,7 +957,7 @@ export function scaleTime<Output>(): ScaleTime<Output, Output>;
|
||||
* The first generic corresponds to the data type of the range elements.
|
||||
* The second generic corresponds to the data type of the output elements generated by the scale.
|
||||
*
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behavior and
|
||||
* convert the interpolated range element to a corresponding output element.
|
||||
*
|
||||
* The range must be set in accordance with the range element type.
|
||||
@ -975,9 +975,9 @@ export function scaleUtc(): ScaleTime<number, number>;
|
||||
/**
|
||||
* Constructs a new time scale using Coordinated Universal Time (UTC) with the domain [2000-01-01, 2000-01-02], the default interpolator and clamping disabled.
|
||||
*
|
||||
* The generic correponds to the data type of the range and output elements to be used.
|
||||
* The generic corresponds to the data type of the range and output elements to be used.
|
||||
*
|
||||
* As range type and output type are the same, the interpolator factory used with the scale must match this behaviour.
|
||||
* As range type and output type are the same, the interpolator factory used with the scale must match this behavior.
|
||||
*
|
||||
* The range must be set in accordance with the range element type.
|
||||
*
|
||||
@ -990,7 +990,7 @@ export function scaleUtc<Output>(): ScaleTime<Output, Output>;
|
||||
* The first generic corresponds to the data type of the range elements.
|
||||
* The second generic corresponds to the data type of the output elements generated by the scale.
|
||||
*
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and
|
||||
* If range element and output element type differ, the interpolator factory used with the scale must match this behavior and
|
||||
* convert the interpolated range element to a corresponding output element.
|
||||
*
|
||||
* The range must be set in accordance with the range element type.
|
||||
@ -1267,7 +1267,7 @@ export function scaleQuantize<Range>(): ScaleQuantize<Range>;
|
||||
* The number of values in (the cardinality of) the output range determines the number of quantiles that will be computed from the domain.
|
||||
* To compute the quantiles, the domain is sorted, and treated as a population of discrete values; see d3-array’s quantile.
|
||||
*
|
||||
* The generic correponds to the data type of range elements.
|
||||
* The generic corresponds to the data type of range elements.
|
||||
*/
|
||||
export interface ScaleQuantile<Range> {
|
||||
/**
|
||||
@ -1337,7 +1337,7 @@ export function scaleQuantile(): ScaleQuantile<number>;
|
||||
* Constructs a new quantile scale with an empty domain and an empty range.
|
||||
* The quantile scale is invalid until both a domain and range are specified.
|
||||
*
|
||||
* The generic correponds to the data type of range elements.
|
||||
* The generic corresponds to the data type of range elements.
|
||||
*/
|
||||
export function scaleQuantile<Range>(): ScaleQuantile<Range>;
|
||||
|
||||
@ -1678,7 +1678,7 @@ export function scaleBand(): ScaleBand<string>;
|
||||
/**
|
||||
* Constructs a new band scale with the empty domain, the unit range [0, 1], no padding, no rounding and center alignment.
|
||||
*
|
||||
* The generic correponds to the data type of domain elements.
|
||||
* The generic corresponds to the data type of domain elements.
|
||||
*/
|
||||
export function scaleBand<Domain extends { toString(): string }>(): ScaleBand<Domain>;
|
||||
|
||||
|
||||
@ -162,8 +162,8 @@ const svgEl: d3Selection.Selection<SVGSVGElement, SVGDatum, HTMLElement, any> =
|
||||
|
||||
let firstG: d3Selection.Selection<SVGGElement, SVGDatum, HTMLElement, any> = svgEl.select<SVGGElement>('g');
|
||||
// let firstG_2: d3Selection.Selection<SVGGElement, SVGDatum, SVGSVGElement, any> = svgEl.select<SVGGElement>('g'); // fails, parent element of selection does not change with .select(...)
|
||||
// firstG = svgEl.select('g'); // fails, element type defaults to 'BaseType', but SVGGElement expexted on left-hand side
|
||||
// firstG = svgEl.select<SVGSVGElement>('svg'); // fails, element type of SVGSVGElement provided, but SVGGElement expexted on left-hand side (silly test to begin with)
|
||||
// firstG = svgEl.select('g'); // fails, element type defaults to 'BaseType', but SVGGElement expected on left-hand side
|
||||
// firstG = svgEl.select<SVGSVGElement>('svg'); // fails, element type of SVGSVGElement provided, but SVGGElement expected on left-hand side (silly test to begin with)
|
||||
|
||||
// test, when it is not certain, whether an element of the type to be selected exists
|
||||
let maybeG: d3Selection.Selection<SVGGElement | null, SVGDatum, HTMLElement, any>;
|
||||
@ -173,7 +173,7 @@ maybeG = svgEl.select<SVGGElement | null>('g');
|
||||
// Using select(...) sub-selection with a selector function argument.
|
||||
|
||||
function svgGroupSelector(this: SVGSVGElement, d: SVGDatum, i: number, groups: SVGSVGElement[] | ArrayLike<SVGSVGElement>): SVGGElement {
|
||||
return this.querySelector('g')!; // this-type compatible with group element-type to which the selector function will be appplied
|
||||
return this.querySelector('g')!; // this-type compatible with group element-type to which the selector function will be applied
|
||||
}
|
||||
|
||||
firstG = svgEl.select(svgGroupSelector);
|
||||
@ -224,7 +224,7 @@ let gElementsOldData: d3Selection.Selection<SVGGElement, CircleDatum, SVGSVGElem
|
||||
// Using selectAll(...) sub-selection with a selector function argument.
|
||||
|
||||
function svgGroupSelectorAll(this: SVGSVGElement, d: SVGDatum, i: number, groups: SVGSVGElement[] | d3Selection.ArrayLike<SVGSVGElement>): NodeListOf<SVGGElement> {
|
||||
return this.querySelectorAll('g'); // this-type compatible with group element-type to which the selector function will be appplied
|
||||
return this.querySelectorAll('g'); // this-type compatible with group element-type to which the selector function will be applied
|
||||
}
|
||||
|
||||
gElementsOldData = svgEl.selectAll<SVGGElement, CircleDatum>(svgGroupSelectorAll);
|
||||
@ -302,11 +302,11 @@ gElementsOldData = svgEl.selectAll<SVGGElement, CircleDatum>(d3Selection.selecto
|
||||
|
||||
// Scenario 1: Filter retaining the element type of the select group (i.e. no type narrowing during filtering)
|
||||
|
||||
let filterdGElements: d3Selection.Selection<SVGGElement, CircleDatum, SVGSVGElement, SVGDatum>;
|
||||
let filteredGElements: d3Selection.Selection<SVGGElement, CircleDatum, SVGSVGElement, SVGDatum>;
|
||||
|
||||
filterdGElements = gElementsOldData.filter('.top-level');
|
||||
filteredGElements = gElementsOldData.filter('.top-level');
|
||||
|
||||
filterdGElements = gElementsOldData.filter(function(d, i, g) {
|
||||
filteredGElements = gElementsOldData.filter(function(d, i, g) {
|
||||
const that: SVGGElement = this;
|
||||
// const that2: HTMLElement = this; // fails, type mismatch
|
||||
const datum: CircleDatum = d;
|
||||
@ -322,23 +322,23 @@ filterdGElements = gElementsOldData.filter(function(d, i, g) {
|
||||
// Scenario 2: Filtering narrows the type of selected elements in a known way
|
||||
|
||||
// assume the class ".any-svg-type" can only be assigned to SVGElements in the DOM
|
||||
let filterdGElements2: d3Selection.Selection<SVGGElement, any, HTMLElement, any>;
|
||||
let filteredGElements2: d3Selection.Selection<SVGGElement, any, HTMLElement, any>;
|
||||
|
||||
filterdGElements2 = d3Selection.selectAll<SVGElement, any>('.any-svg-type').filter<SVGGElement>('g');
|
||||
// filterdGElements2 = d3Selection.selectAll('.any-type').filter('g'); // fails without using narrowing generic on filter method
|
||||
filteredGElements2 = d3Selection.selectAll<SVGElement, any>('.any-svg-type').filter<SVGGElement>('g');
|
||||
// filteredGElements2 = d3Selection.selectAll('.any-type').filter('g'); // fails without using narrowing generic on filter method
|
||||
|
||||
filterdGElements2 = d3Selection.selectAll<SVGElement, any>('.any-svg-type').filter<SVGGElement>(function() {
|
||||
filteredGElements2 = d3Selection.selectAll<SVGElement, any>('.any-svg-type').filter<SVGGElement>(function() {
|
||||
const that: SVGElement = this;
|
||||
return that.tagName === 'g' || that.tagName === 'G';
|
||||
});
|
||||
// filterdGElements2 = d3Selection.selectAll<SVGElement, any>('.any-svg-type').filter(function(){
|
||||
// filteredGElements2 = d3Selection.selectAll<SVGElement, any>('.any-svg-type').filter(function(){
|
||||
// const that: SVGElement = this;
|
||||
// return that.tagName === 'g'|| that.tagName === 'G';
|
||||
// }); // fails without using narrowing generic on filter method
|
||||
|
||||
// matcher() -----------------------------------------------------------------------------
|
||||
|
||||
filterdGElements = gElementsOldData.filter(d3Selection.matcher('.top-level'));
|
||||
filteredGElements = gElementsOldData.filter(d3Selection.matcher('.top-level'));
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// Tests of Modification
|
||||
@ -644,7 +644,7 @@ let circles2: d3Selection.Selection<SVGCircleElement, CircleDatumAlternative, SV
|
||||
|
||||
// Test creating initial data-driven circle selection
|
||||
// and append materialized SVGCircleElement per enter() selection element
|
||||
// - use data(...) with array-signature and infer data type from arrray type passed into data(...)
|
||||
// - use data(...) with array-signature and infer data type from array type passed into data(...)
|
||||
// - use enter() to obtain enter selection
|
||||
// - materialize svg circles using append(...) with type-parameter and string argument
|
||||
|
||||
@ -699,7 +699,7 @@ exitCircles
|
||||
})
|
||||
.remove();
|
||||
|
||||
// Note: the alternative using only .exit() without typing, will fail, if access to datum properties is attemped.
|
||||
// Note: the alternative using only .exit() without typing, will fail, if access to datum properties is attempted.
|
||||
// If access to d is not required, the short-hand is acceptable e.g. circles2.exit().remove();
|
||||
|
||||
// let exitCircles2 = circles2.exit(); // Note: Without explicit re-typing to the old data type, the data type default to '{}'
|
||||
|
||||
4
types/d3-selection/index.d.ts
vendored
4
types/d3-selection/index.d.ts
vendored
@ -78,7 +78,7 @@ export type ValueFn<T extends BaseType, Datum, Result> = (this: T, datum: Datum,
|
||||
|
||||
/**
|
||||
* TransitionLike is a helper interface to represent a quasi-Transition, without specifying the full Transition interface in this file.
|
||||
* For example, whereever d3-zoom allows a Transition to be passed in as an argument, it internally immediately invokes its `selection()`
|
||||
* For example, wherever d3-zoom allows a Transition to be passed in as an argument, it internally immediately invokes its `selection()`
|
||||
* method to retrieve the underlying Selection object before proceeding.
|
||||
* d3-brush uses a subset of Transition methods internally.
|
||||
* The use of this interface instead of the full imported Transition interface is [referred] to achieve
|
||||
@ -480,7 +480,7 @@ export interface Selection<GElement extends BaseType, Datum, PElement extends Ba
|
||||
*/
|
||||
append<ChildElement extends BaseType>(type: string): Selection<ChildElement, Datum, PElement, PDatum>;
|
||||
/**
|
||||
* Appends a new element of the type provided by the element creator functionas the last child of each selected element,
|
||||
* Appends a new element of the type provided by the element creator function as the last child of each selected element,
|
||||
* or before the next following sibling in the update selection if this is an enter selection.
|
||||
* The latter behavior for enter selections allows you to insert elements into the DOM in an order consistent with the new bound data;
|
||||
* however, note that selection.order may still be required if updating elements change order
|
||||
|
||||
24
types/d3-shape/index.d.ts
vendored
24
types/d3-shape/index.d.ts
vendored
@ -32,7 +32,7 @@ export interface DefaultArcObject {
|
||||
*/
|
||||
endAngle: number;
|
||||
/**
|
||||
* Optional. Pad angle of arcin radians.
|
||||
* Optional. Pad angle of arc in radians.
|
||||
*/
|
||||
padAngle?: number;
|
||||
}
|
||||
@ -741,7 +741,7 @@ export interface Line<Datum> {
|
||||
/**
|
||||
* Returns the current curve factory, which defaults to curveLinear.
|
||||
*
|
||||
* The generic allows to cast the curve factory to a specifc type, if known.
|
||||
* The generic allows to cast the curve factory to a specific type, if known.
|
||||
*/
|
||||
curve<C extends CurveFactory | CurveFactoryLineOnly>(): C;
|
||||
/**
|
||||
@ -916,7 +916,7 @@ export interface LineRadial<Datum> {
|
||||
/**
|
||||
* Returns the current curve factory, which defaults to curveLinear.
|
||||
*
|
||||
* The generic allows to cast the curve factory to a specifc type, if known.
|
||||
* The generic allows to cast the curve factory to a specific type, if known.
|
||||
*/
|
||||
curve<C extends CurveFactory | CurveFactoryLineOnly>(): C;
|
||||
/**
|
||||
@ -1213,7 +1213,7 @@ export interface Area<Datum> {
|
||||
/**
|
||||
* Returns the current curve factory, which defaults to curveLinear.
|
||||
*
|
||||
* The generic allows to cast the curve factory to a specifc type, if known.
|
||||
* The generic allows to cast the curve factory to a specific type, if known.
|
||||
*/
|
||||
curve<C extends CurveFactory>(): C;
|
||||
/**
|
||||
@ -1518,7 +1518,7 @@ export interface AreaRadial<Datum> {
|
||||
/**
|
||||
* Returns the current curve factory, which defaults to curveLinear.
|
||||
*
|
||||
* The generic allows to cast the curve factory to a specifc type, if known.
|
||||
* The generic allows to cast the curve factory to a specific type, if known.
|
||||
*/
|
||||
curve<C extends CurveFactory>(): C;
|
||||
/**
|
||||
@ -2280,7 +2280,7 @@ export interface SymbolType {
|
||||
* use a transform (see: SVG, Canvas) to move the arc to a different position.
|
||||
*
|
||||
* The first generic corresponds to the "this" context within which the symbol generator is invoked.
|
||||
* The second generic corrsponds to the data type of the datum underlying the symbol.
|
||||
* The second generic corresponds to the data type of the datum underlying the symbol.
|
||||
*/
|
||||
export interface Symbol<This, Datum> {
|
||||
/**
|
||||
@ -2382,7 +2382,7 @@ export function symbol(): Symbol<any, any>; // tslint:disable-line ban-types
|
||||
/**
|
||||
* Constructs a new symbol generator with the default settings.
|
||||
*
|
||||
* The generic corrsponds to the data type of the datum underlying the symbol.
|
||||
* The generic corresponds to the data type of the datum underlying the symbol.
|
||||
*/
|
||||
export function symbol<Datum>(): Symbol<any, Datum>; // tslint:disable-line ban-types
|
||||
|
||||
@ -2390,7 +2390,7 @@ export function symbol<Datum>(): Symbol<any, Datum>; // tslint:disable-line ban-
|
||||
* Constructs a new symbol generator with the default settings.
|
||||
*
|
||||
* The first generic corresponds to the "this" context within which the symbol generator is invoked.
|
||||
* The second generic corrsponds to the data type of the datum underlying the symbol.
|
||||
* The second generic corresponds to the data type of the datum underlying the symbol.
|
||||
*/
|
||||
export function symbol<This, Datum>(): Symbol<This, Datum>; // tslint:disable-line ban-types
|
||||
|
||||
@ -2460,11 +2460,11 @@ export function pointRadial(angle: number, radius: number): [number, number];
|
||||
*/
|
||||
export interface SeriesPoint<Datum> extends Array<number> {
|
||||
/**
|
||||
* Correponds to y0, the lower value (baseline).
|
||||
* Corresponds to y0, the lower value (baseline).
|
||||
*/
|
||||
0: number;
|
||||
/**
|
||||
* Correponds to y1, the upper value (topline).
|
||||
* Corresponds to y1, the upper value (topline).
|
||||
*/
|
||||
1: number;
|
||||
/**
|
||||
@ -2565,7 +2565,7 @@ export interface Stack<This, Datum, Key> {
|
||||
value(value: (d: Datum, key: Key, j: number, data: Datum[]) => number): this;
|
||||
|
||||
/**
|
||||
* Returns the current order acccesor, which defaults to stackOrderNone; this uses the order given by the key accessor.
|
||||
* Returns the current order accessor, which defaults to stackOrderNone; this uses the order given by the key accessor.
|
||||
*/
|
||||
order(): (series: Series<Datum, Key>) => number[];
|
||||
/**
|
||||
@ -2596,7 +2596,7 @@ export interface Stack<This, Datum, Key> {
|
||||
order(order: (series: Series<Datum, Key>) => number[]): this;
|
||||
|
||||
/**
|
||||
* Returns the current offset acccesor, which defaults to stackOffsetNone; this uses a zero baseline.
|
||||
* Returns the current offset accessor, which defaults to stackOffsetNone; this uses a zero baseline.
|
||||
*/
|
||||
offset(): (series: Series<Datum, Key>, order: number[]) => void;
|
||||
/**
|
||||
|
||||
36
types/d3-time/index.d.ts
vendored
36
types/d3-time/index.d.ts
vendored
@ -22,7 +22,7 @@ export interface TimeInterval {
|
||||
* This function is idempotent: if the specified date is already floored to the current interval,
|
||||
* a new date with an identical time is returned.
|
||||
* Furthermore, the returned date is the minimum expressible value of the associated interval,
|
||||
* such that interval.floor(interval.floor(date) - 1) returns the preceeding interval boundary date.
|
||||
* such that interval.floor(interval.floor(date) - 1) returns the preceding interval boundary date.
|
||||
*
|
||||
* Note that the == and === operators do not compare by value with Date objects,
|
||||
* and thus you cannot use them to tell whether the specified date has already been floored.
|
||||
@ -42,7 +42,7 @@ export interface TimeInterval {
|
||||
* This method is idempotent: if the specified date is already floored to the current interval,
|
||||
* a new date with an identical time is returned.
|
||||
* Furthermore, the returned date is the minimum expressible value of the associated interval,
|
||||
* such that interval.floor(interval.floor(date) - 1) returns the preceeding interval boundary date.
|
||||
* such that interval.floor(interval.floor(date) - 1) returns the preceding interval boundary date.
|
||||
*
|
||||
* Note that the == and === operators do not compare by value with Date objects,
|
||||
* and thus you cannot use them to tell whether the specified date has already been floored.
|
||||
@ -165,7 +165,7 @@ export interface CountableTimeInterval extends TimeInterval {
|
||||
/**
|
||||
* Constructs a new custom interval given the specified floor and offset functions.
|
||||
*
|
||||
* The returned custom interval is not countable, i.e. does not exposee the methods "count(..)" and "every(...)".
|
||||
* The returned custom interval is not countable, i.e. does not expose the methods "count(..)" and "every(...)".
|
||||
*
|
||||
* @param floor A floor function which takes a single date as an argument and rounds it down to the nearest interval boundary.
|
||||
* @param offset An offset function which takes a date and an integer step as arguments and advances
|
||||
@ -447,12 +447,12 @@ export function timeYears(start: Date, stop: Date, step?: number): Date[];
|
||||
// utc Universal Coordinated Time ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Milliseconds Interval in Univarsal Coordinated Time (UTC); the shortest available time unit.
|
||||
* Milliseconds Interval in Universal Coordinated Time (UTC); the shortest available time unit.
|
||||
*/
|
||||
export const utcMillisecond: CountableTimeInterval;
|
||||
|
||||
/**
|
||||
* This is a convenience alias for utcMilliesecond.range(...).
|
||||
* This is a convenience alias for utcMillisecond.range(...).
|
||||
*
|
||||
* @param start A start date object for the range.
|
||||
* @param stop A stop date object for the range.
|
||||
@ -461,7 +461,7 @@ export const utcMillisecond: CountableTimeInterval;
|
||||
export function utcMilliseconds(start: Date, stop: Date, step?: number): Date[];
|
||||
|
||||
/**
|
||||
* Seconds Interval in Univarsal Coordinated Time (UTC); seconds (e.g., 01:23:45.0000 AM); 1,000 milliseconds.
|
||||
* Seconds Interval in Universal Coordinated Time (UTC); seconds (e.g., 01:23:45.0000 AM); 1,000 milliseconds.
|
||||
*/
|
||||
export const utcSecond: CountableTimeInterval;
|
||||
|
||||
@ -475,7 +475,7 @@ export const utcSecond: CountableTimeInterval;
|
||||
export function utcSeconds(start: Date, stop: Date, step?: number): Date[];
|
||||
|
||||
/**
|
||||
* Minutes Interval in Univarsal Coordinated Time (UTC); minutes (e.g., 01:02:00 AM); 60 seconds.
|
||||
* Minutes Interval in Universal Coordinated Time (UTC); minutes (e.g., 01:02:00 AM); 60 seconds.
|
||||
* Note that ECMAScript ignores leap seconds.
|
||||
*/
|
||||
export const utcMinute: CountableTimeInterval;
|
||||
@ -490,7 +490,7 @@ export const utcMinute: CountableTimeInterval;
|
||||
export function utcMinutes(start: Date, stop: Date, step?: number): Date[];
|
||||
|
||||
/**
|
||||
* Hours Interval in Univarsal Coordinated Time (UTC); Hours (e.g., 01:00 AM); 60 minutes.
|
||||
* Hours Interval in Universal Coordinated Time (UTC); Hours (e.g., 01:00 AM); 60 minutes.
|
||||
*/
|
||||
export const utcHour: CountableTimeInterval;
|
||||
|
||||
@ -504,7 +504,7 @@ export const utcHour: CountableTimeInterval;
|
||||
export function utcHours(start: Date, stop: Date, step?: number): Date[];
|
||||
|
||||
/**
|
||||
* Days Interval in Univarsal Coordinated Time (UTC); days (e.g., February 7, 2012 at 12:00 AM); 24 hours.
|
||||
* Days Interval in Universal Coordinated Time (UTC); days (e.g., February 7, 2012 at 12:00 AM); 24 hours.
|
||||
*/
|
||||
export const utcDay: CountableTimeInterval;
|
||||
|
||||
@ -533,7 +533,7 @@ export const utcWeek: CountableTimeInterval;
|
||||
export function utcWeeks(start: Date, stop: Date, step?: number): Date[];
|
||||
|
||||
/**
|
||||
* Week Interval for Sunday-based weeks in Univarsal Coordinated Time (UTC) (e.g., February 5, 2012 at 12:00 AM).
|
||||
* Week Interval for Sunday-based weeks in Universal Coordinated Time (UTC) (e.g., February 5, 2012 at 12:00 AM).
|
||||
* 7 days and 168 hours.
|
||||
*/
|
||||
export const utcSunday: CountableTimeInterval;
|
||||
@ -548,7 +548,7 @@ export const utcSunday: CountableTimeInterval;
|
||||
export function utcSundays(start: Date, stop: Date, step?: number): Date[];
|
||||
|
||||
/**
|
||||
* Week Interval for Monday-based weeks in Univarsal Coordinated Time (UTC) (e.g., February 6, 2012 at 12:00 AM).
|
||||
* Week Interval for Monday-based weeks in Universal Coordinated Time (UTC) (e.g., February 6, 2012 at 12:00 AM).
|
||||
* 7 days and 168 hours.
|
||||
*/
|
||||
export const utcMonday: CountableTimeInterval;
|
||||
@ -563,7 +563,7 @@ export const utcMonday: CountableTimeInterval;
|
||||
export function utcMondays(start: Date, stop: Date, step?: number): Date[];
|
||||
|
||||
/**
|
||||
* Week Interval for Tuesday-based weeks in Univarsal Coordinated Time (UTC) (e.g., February 7, 2012 at 12:00 AM).
|
||||
* Week Interval for Tuesday-based weeks in Universal Coordinated Time (UTC) (e.g., February 7, 2012 at 12:00 AM).
|
||||
* 7 days and 168 hours.
|
||||
*/
|
||||
export const utcTuesday: CountableTimeInterval;
|
||||
@ -578,7 +578,7 @@ export const utcTuesday: CountableTimeInterval;
|
||||
export function utcTuesdays(start: Date, stop: Date, step?: number): Date[];
|
||||
|
||||
/**
|
||||
* Week Interval for Wednesday-based weeks in Univarsal Coordinated Time (UTC) (e.g., February 8, 2012 at 12:00 AM).
|
||||
* Week Interval for Wednesday-based weeks in Universal Coordinated Time (UTC) (e.g., February 8, 2012 at 12:00 AM).
|
||||
* 7 days and 168 hours.
|
||||
*/
|
||||
export const utcWednesday: CountableTimeInterval;
|
||||
@ -593,7 +593,7 @@ export const utcWednesday: CountableTimeInterval;
|
||||
export function utcWednesdays(start: Date, stop: Date, step?: number): Date[];
|
||||
|
||||
/**
|
||||
* Week Interval for Thursday-based weeks in Univarsal Coordinated Time (UTC) (e.g., February 9, 2012 at 12:00 AM).
|
||||
* Week Interval for Thursday-based weeks in Universal Coordinated Time (UTC) (e.g., February 9, 2012 at 12:00 AM).
|
||||
* 7 days and 168 hours.
|
||||
*/
|
||||
export const utcThursday: CountableTimeInterval;
|
||||
@ -608,7 +608,7 @@ export const utcThursday: CountableTimeInterval;
|
||||
export function utcThursdays(start: Date, stop: Date, step?: number): Date[];
|
||||
|
||||
/**
|
||||
* Week Interval for Friday-based weeks in Univarsal Coordinated Time (UTC) (e.g., February 10, 2012 at 12:00 AM).
|
||||
* Week Interval for Friday-based weeks in Universal Coordinated Time (UTC) (e.g., February 10, 2012 at 12:00 AM).
|
||||
* 7 days and 168 hours.
|
||||
*/
|
||||
export const utcFriday: CountableTimeInterval;
|
||||
@ -623,7 +623,7 @@ export const utcFriday: CountableTimeInterval;
|
||||
export function utcFridays(start: Date, stop: Date, step?: number): Date[];
|
||||
|
||||
/**
|
||||
* Week Interval for Saturday-based weeks in Univarsal Coordinated Time (UTC) (e.g., February 11, 2012 at 12:00 AM).
|
||||
* Week Interval for Saturday-based weeks in Universal Coordinated Time (UTC) (e.g., February 11, 2012 at 12:00 AM).
|
||||
* 7 days and 168 hours.
|
||||
*/
|
||||
export const utcSaturday: CountableTimeInterval;
|
||||
@ -638,7 +638,7 @@ export const utcSaturday: CountableTimeInterval;
|
||||
export function utcSaturdays(start: Date, stop: Date, step?: number): Date[];
|
||||
|
||||
/**
|
||||
* Month Interval in Univarsal Coordinated Time (UTC); months (e.g., February 1, 2012 at 12:00 AM); ranges from 28 to 31 days.
|
||||
* Month Interval in Universal Coordinated Time (UTC); months (e.g., February 1, 2012 at 12:00 AM); ranges from 28 to 31 days.
|
||||
*/
|
||||
export const utcMonth: CountableTimeInterval;
|
||||
|
||||
@ -652,7 +652,7 @@ export const utcMonth: CountableTimeInterval;
|
||||
export function utcMonths(start: Date, stop: Date, step?: number): Date[];
|
||||
|
||||
/**
|
||||
* Year Interval in Univarsal Coordinated Time (UTC); years (e.g., January 1, 2012 at 12:00 AM); ranges from 365 to 366 days.
|
||||
* Year Interval in Universal Coordinated Time (UTC); years (e.g., January 1, 2012 at 12:00 AM); ranges from 365 to 366 days.
|
||||
*/
|
||||
export const utcYear: CountableTimeInterval;
|
||||
|
||||
|
||||
@ -142,13 +142,13 @@ let newEnterTransition: d3Transition.Transition<SVGCircleElement, CircleDatum, S
|
||||
newEnterTransition = enterCircles.transition(enterTransition);
|
||||
|
||||
let differentElementTypeTransition: d3Transition.Transition<SVGSVGElement, CircleDatum, HTMLBodyElement, any>;
|
||||
let differentDatumTypeTransition: d3Transition.Transition<SVGCircleElement, { differrent: string }, SVGSVGElement, any>;
|
||||
let differentDatumTypeTransition: d3Transition.Transition<SVGCircleElement, { different: string }, SVGSVGElement, any>;
|
||||
|
||||
// Comparable use cases arise e.g. when using an existing transition to generate a new transition
|
||||
// on a different selection to synchronize them (see e.g. Mike Bostock's Brush & Zoom II Example https://bl.ocks.org/mbostock/f48fcdb929a620ed97877e4678ab15e6)
|
||||
differentElementTypeTransition = select<HTMLBodyElement, any>('body').selectAll<SVGSVGElement, CircleDatum>('svg').transition();
|
||||
newEnterTransition = enterCircles.transition(differentElementTypeTransition);
|
||||
differentDatumTypeTransition = select<SVGSVGElement, any>('svg').selectAll<SVGCircleElement, { differrent: string }>('circle').transition();
|
||||
differentDatumTypeTransition = select<SVGSVGElement, any>('svg').selectAll<SVGCircleElement, { different: string }>('circle').transition();
|
||||
newEnterTransition = enterCircles.transition(differentDatumTypeTransition);
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
@ -234,18 +234,18 @@ exitTransition = exitTransition.filter(function(d, i, g) {
|
||||
const index: number = i;
|
||||
const group: SVGCircleElement[] | ArrayLike<SVGCircleElement> = g;
|
||||
// console.log(this.x) // fails, x property not defined on SVGCircleElement
|
||||
return this.r.baseVal.value < i * d.r; // this-type SVGCircleElement, datum tpye CircleDatum
|
||||
return this.r.baseVal.value < i * d.r; // this-type SVGCircleElement, datum type CircleDatum
|
||||
});
|
||||
|
||||
// Scenario 2: Filtering narrows the type of selected elements in a known way
|
||||
|
||||
// assume the class ".any-svg-type" can only be assigned to SVGElements in the DOM
|
||||
let filterdGElements2: d3Transition.Transition<SVGGElement, any, HTMLElement, any>;
|
||||
let filteredGElements2: d3Transition.Transition<SVGGElement, any, HTMLElement, any>;
|
||||
|
||||
filterdGElements2 = selectAll<SVGElement, any>('.any-svg-type').transition().filter<SVGGElement>('g');
|
||||
// filterdGElements2 = selectAll('.any-type').transition().filter('g'); // fails without using narrowing generic on filter method
|
||||
filteredGElements2 = selectAll<SVGElement, any>('.any-svg-type').transition().filter<SVGGElement>('g');
|
||||
// filteredGElements2 = selectAll('.any-type').transition().filter('g'); // fails without using narrowing generic on filter method
|
||||
|
||||
filterdGElements2 = selectAll<SVGElement, any>('.any-svg-type').transition().filter<SVGGElement>(function(d, i, g) {
|
||||
filteredGElements2 = selectAll<SVGElement, any>('.any-svg-type').transition().filter<SVGGElement>(function(d, i, g) {
|
||||
const that: SVGElement = this;
|
||||
// const that2: HTMLElement = this; // fails, type mismatch
|
||||
const datum: CircleDatum = d;
|
||||
@ -253,7 +253,7 @@ filterdGElements2 = selectAll<SVGElement, any>('.any-svg-type').transition().fil
|
||||
const group: SVGElement[] | ArrayLike<SVGElement> = g;
|
||||
return that.tagName === 'g' || that.tagName === 'G';
|
||||
});
|
||||
// filterdGElements2 = selectAll<SVGElement, any>('.any-svg-type').transition().filter(function(){
|
||||
// filteredGElements2 = selectAll<SVGElement, any>('.any-svg-type').transition().filter(function(){
|
||||
// const that: SVGElement = this;
|
||||
// return that.tagName === 'g'|| that.tagName === 'G';
|
||||
// }); // fails without using narrowing generic on filter method
|
||||
|
||||
@ -84,7 +84,7 @@ interface GroupDatum {
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Test Define ZoomBehaviour
|
||||
// Test Define ZoomBehavior
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
// Canvas Example -----------------------------------------------------------
|
||||
@ -235,7 +235,7 @@ const duration: number = svgZoom.duration();
|
||||
|
||||
// interpolate() --------------------------------------------------------------
|
||||
|
||||
// chainable setter accepts interpoateZoom, interpolate and interpolateArray
|
||||
// chainable setter accepts interpolateZoom, interpolate and interpolateArray
|
||||
svgZoom = svgZoom.interpolate(interpolateZoom);
|
||||
svgZoom = svgZoom.interpolate(interpolate);
|
||||
svgZoom = svgZoom.interpolate(interpolateArray);
|
||||
@ -269,7 +269,7 @@ if (zoomHandler) {
|
||||
svgZoom.on('zoom', zoomHandler);
|
||||
}
|
||||
// --------------------------------------------------------------------------
|
||||
// Test Attach ZoomBehaviour
|
||||
// Test Attach ZoomBehavior
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
// Canvas Example -----------------------------------------------------------
|
||||
@ -290,14 +290,14 @@ const svgOverlay: Selection<SVGRectElement, SVGDatum, HTMLElement, any> = svg.ap
|
||||
const svgOverlayTransition = svgOverlay.transition();
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Test Use ZoomBehaviour
|
||||
// Test Use ZoomBehavior
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
// transform() -------------------------------------------------------------------------------------
|
||||
|
||||
// use on selection
|
||||
svgZoom.transform(svgOverlay, d3Zoom.zoomIdentity);
|
||||
// svgZoom.transform(groupsSelection, d3Zoom.zoomIdentity); // fails, as groupSelection mismachtes DOM Element type and datum type
|
||||
// svgZoom.transform(groupsSelection, d3Zoom.zoomIdentity); // fails, as groupSelection mismatches DOM Element type and datum type
|
||||
|
||||
svgZoom.transform(svgOverlay, function(datum, index, groups) {
|
||||
const that: SVGRectElement = this;
|
||||
@ -310,7 +310,7 @@ svgZoom.transform(svgOverlay, function(datum, index, groups) {
|
||||
});
|
||||
// use on transition
|
||||
svgOverlayTransition.call(svgZoom.transform, d3Zoom.zoomIdentity);
|
||||
// svgZoom.transform(groupsTransition, d3Zoom.zoomIdentity); // fails, as groupTransition mismachtes DOM Element type and datum type
|
||||
// svgZoom.transform(groupsTransition, d3Zoom.zoomIdentity); // fails, as groupTransition mismatches DOM Element type and datum type
|
||||
|
||||
svgZoom.transform(svgOverlayTransition, d3Zoom.zoomIdentity);
|
||||
svgZoom.transform(svgOverlayTransition, function(datum, index, groups) {
|
||||
@ -327,7 +327,7 @@ svgZoom.transform(svgOverlayTransition, function(datum, index, groups) {
|
||||
|
||||
// use on selection
|
||||
svgZoom.translateBy(svgOverlay, 20, 50);
|
||||
// svgZoom.translateBy(groupsSelection, 20, 50); // fails, as groupSelection mismachtes DOM Element type and datum type
|
||||
// svgZoom.translateBy(groupsSelection, 20, 50); // fails, as groupSelection mismatches DOM Element type and datum type
|
||||
|
||||
svgZoom.translateBy(
|
||||
svgOverlay,
|
||||
@ -376,7 +376,7 @@ svgZoom.translateBy(
|
||||
|
||||
// use on transition
|
||||
svgZoom.translateBy(svgOverlayTransition, 20, 50);
|
||||
// svgZoom.translateBy(groupsTransition, 20, 50); // fails, as groupTransition mismachtes DOM Element type and datum type
|
||||
// svgZoom.translateBy(groupsTransition, 20, 50); // fails, as groupTransition mismatches DOM Element type and datum type
|
||||
|
||||
svgZoom.translateBy(
|
||||
svgOverlayTransition,
|
||||
@ -427,7 +427,7 @@ svgZoom.translateBy(
|
||||
|
||||
// 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(groupsSelection, 20, 50); // fails, as groupSelection mismatches DOM Element type and datum type
|
||||
|
||||
svgZoom.translateTo(
|
||||
svgOverlay,
|
||||
@ -476,7 +476,7 @@ svgZoom.translateTo(
|
||||
|
||||
// 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(groupsTransition, 20, 50); // fails, as groupTransition mismatches DOM Element type and datum type
|
||||
|
||||
svgZoom.translateTo(
|
||||
svgOverlayTransition,
|
||||
@ -527,7 +527,7 @@ svgZoom.translateTo(
|
||||
|
||||
// use on selection
|
||||
svgZoom.scaleBy(svgOverlay, 3);
|
||||
// svgZoom.scaleBy(groupsSelection, 3); // fails, as groupSelection mismachtes DOM Element type and datum type
|
||||
// svgZoom.scaleBy(groupsSelection, 3); // fails, as groupSelection mismatches DOM Element type and datum type
|
||||
|
||||
svgZoom.scaleBy(svgOverlay, function(datum, index, groups) {
|
||||
const that: SVGRectElement = this;
|
||||
@ -540,7 +540,7 @@ svgZoom.scaleBy(svgOverlay, function(datum, index, groups) {
|
||||
});
|
||||
// use on transition
|
||||
svgZoom.scaleBy(svgOverlayTransition, 3);
|
||||
// svgZoom.scaleBy(groupsTransition, 3); // fails, as groupTransition mismachtes DOM Element type and datum type
|
||||
// svgZoom.scaleBy(groupsTransition, 3); // fails, as groupTransition mismatches DOM Element type and datum type
|
||||
|
||||
svgZoom.scaleBy(svgOverlayTransition, function(datum, index, groups) {
|
||||
const that: SVGRectElement = this;
|
||||
@ -556,7 +556,7 @@ svgZoom.scaleBy(svgOverlayTransition, function(datum, index, groups) {
|
||||
|
||||
// use on selection
|
||||
svgZoom.scaleTo(svgOverlay, 3);
|
||||
// svgZoom.scaleBy(groupsSelection, 3); // fails, as groupSelection mismachtes DOM Element type and datum type
|
||||
// svgZoom.scaleBy(groupsSelection, 3); // fails, as groupSelection mismatches DOM Element type and datum type
|
||||
|
||||
svgZoom.scaleTo(svgOverlay, function(datum, index, groups) {
|
||||
const that: SVGRectElement = this;
|
||||
@ -569,7 +569,7 @@ svgZoom.scaleTo(svgOverlay, function(datum, index, groups) {
|
||||
});
|
||||
// use on transition
|
||||
svgZoom.scaleTo(svgOverlayTransition, 3);
|
||||
// svgZoom.scaleBy(groupsTransition, 3); // fails, as groupTransition mismachtes DOM Element type and datum type
|
||||
// svgZoom.scaleBy(groupsTransition, 3); // fails, as groupTransition mismatches DOM Element type and datum type
|
||||
|
||||
svgZoom.scaleTo(svgOverlayTransition, function(datum, index, groups) {
|
||||
const that: SVGRectElement = this;
|
||||
|
||||
4
types/d3-zoom/index.d.ts
vendored
4
types/d3-zoom/index.d.ts
vendored
@ -693,7 +693,7 @@ export interface ZoomBehavior<ZoomRefElement extends ZoomedElementBaseType, Datu
|
||||
* Each view is defined as an array of three numbers: cx, cy and width. The first two coordinates cx, cy represent the center of the viewport;
|
||||
* the last coordinate width represents the size of the viewport.
|
||||
*
|
||||
* @param interpolatorFactory An interpolator factory to be used to generate interpolators beetween zooms for transitions.
|
||||
* @param interpolatorFactory An interpolator factory to be used to generate interpolators between zooms for transitions.
|
||||
*/
|
||||
interpolate(interpolatorFactory: (a: ZoomView, b: ZoomView) => ((t: number) => ZoomView)): this;
|
||||
|
||||
@ -921,7 +921,7 @@ export interface ZoomTransform {
|
||||
*
|
||||
* For details see {@link https://github.com/d3/d3-zoom#zoom-transforms}
|
||||
*
|
||||
* @param node An element for which to retrieve its current zoomt transform.
|
||||
* @param node An element for which to retrieve its current zoom transform.
|
||||
*/
|
||||
export function zoomTransform(node: ZoomedElementBaseType): ZoomTransform;
|
||||
|
||||
|
||||
@ -2,6 +2,6 @@ import * as d3 from 'd3';
|
||||
|
||||
const version: string = d3.version;
|
||||
|
||||
// NOTE: Tests for all re-exports of consituent D3 modules are omitted as excessive.
|
||||
// NOTE: Tests for all re-exports of constituent D3 modules are omitted as excessive.
|
||||
// The standard bundle definition is a straightforward pass-through with the exception of the
|
||||
// above tested "version" property.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user