diff --git a/types/d3-array/index.d.ts b/types/d3-array/index.d.ts index ccd2d568bb..8f5d4eab2e 100644 --- a/types/d3-array/index.d.ts +++ b/types/d3-array/index.d.ts @@ -153,8 +153,8 @@ export function bisectRight(array: Date[], x: Date, lo?: number, hi?: number): n export const bisect: typeof bisectRight; export interface Bisector { - left: (array: T[], x: U, lo?: number, hi?: number) => number; - right: (array: T[], x: U, lo?: number, hi?: number) => number; + left(array: T[], x: U, lo?: number, hi?: number): number; + right(array: T[], x: U, lo?: number, hi?: number): number; } export function bisector(comparator: (a: T, b: U) => number): Bisector; diff --git a/types/d3-axis/index.d.ts b/types/d3-axis/index.d.ts index 4a65952070..9cee537067 100644 --- a/types/d3-axis/index.d.ts +++ b/types/d3-axis/index.d.ts @@ -61,10 +61,10 @@ export interface Axis { (context: Selection): void; /** - * Render the axis to the given context. - * - * @param context A transition defined on SVG containers (either SVG or G elements). - */ + * Render the axis to the given context. + * + * @param context A transition defined on SVG containers (either SVG or G elements). + */ (context: TransitionLike): void; /** @@ -142,10 +142,10 @@ export interface Axis { tickArguments(args: [AxisTimeInterval, string]): this; /** - * Sets the arguments that will be passed to scale.ticks and scale.tickFormat when the axis is rendered, and returns the axis generator. - * - * @param args An array with arguments suitable for the scale to be used for tick generation - */ + * Sets the arguments that will be passed to scale.ticks and scale.tickFormat when the axis is rendered, and returns the axis generator. + * + * @param args An array with arguments suitable for the scale to be used for tick generation + */ tickArguments(args: any[]): this; /** diff --git a/types/d3-drag/d3-drag-tests.ts b/types/d3-drag/d3-drag-tests.ts index deb5a6dc55..4283cb259f 100644 --- a/types/d3-drag/d3-drag-tests.ts +++ b/types/d3-drag/d3-drag-tests.ts @@ -55,7 +55,6 @@ let circleDrag: d3Drag.DragBehavior; - // create new drag behavior ------------------------------------------ circleDrag = d3Drag.drag(); // Use short form method @@ -99,7 +98,6 @@ filterFn = function(d) { // chainable circleDrag = circleDrag.filter(function(d, i, group) { - return (d.color !== 'green' && this.r.baseVal.value < 10) ? !event.button : true; // 'this' is SVGCircleElement and d is CircleDatum }); @@ -192,10 +190,8 @@ const wrongSelection: Selection = select = event; - circleDrag = e.target; // target return drag behavior const type: string = e.type; @@ -224,7 +220,6 @@ handler = e.on('dragged'); // fails, handler with wrong datum type // let wrongHandler4: ((this:SVGCircleElement, d:{test: number}, i: number, group: SVGCircleElement[] | NodeListOf)=> void) | undefined = e.on('dragged'); - // ----------------------------------------------------------------------------- // Test dragDisable() and dragEnable() // ----------------------------------------------------------------------------- diff --git a/types/d3-drag/index.d.ts b/types/d3-drag/index.d.ts index d49e0bbc02..d3a65fb377 100644 --- a/types/d3-drag/index.d.ts +++ b/types/d3-drag/index.d.ts @@ -7,12 +7,10 @@ import { ArrayLike, Selection, ValueFn } from 'd3-selection'; - // -------------------------------------------------------------------------- // Shared Type Definitions and Interfaces // -------------------------------------------------------------------------- - /** * DraggedElementBaseType serves as an alias for the 'minimal' data type which can be selected * without 'd3-drag' (and related code in 'd3-selection') trying to use properties internally which would otherwise not @@ -20,7 +18,6 @@ import { ArrayLike, Selection, ValueFn } from 'd3-selection'; */ export type DraggedElementBaseType = Element; - /** * Container element type usable for mouse/touch functions */ diff --git a/types/d3-dsv/v0/index.d.ts b/types/d3-dsv/v0/index.d.ts index 82ccd0f87f..18701f64ea 100644 --- a/types/d3-dsv/v0/index.d.ts +++ b/types/d3-dsv/v0/index.d.ts @@ -4,11 +4,11 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /** A parser and formatter for DSV (CSV and TSV) files. Extracted from D3. */ -declare var loader: ( - /** the symbol used to seperate cells in the row.*/ +declare function loader( + /** the symbol used to seperate cells in the row. */ delimiter: string, /** example: "text/plain" */ - encoding?: string) => D3Dsv; + encoding?: string): D3Dsv; export = loader; export as namespace d3_dsv; @@ -16,21 +16,21 @@ export as namespace d3_dsv; /** A parser and formatter for DSV (CSV and TSV) files. Extracted from D3. */ interface D3Dsv { /** - Parses the specified string, which is the contents of a CSV file, returning an array of objects representing the parsed rows. - The string is assumed to be RFC4180-compliant. - Unlike the parseRows method, this method requires that the first line of the CSV file contains a comma-separated list of column names; - these column names become the attributes on the returned objects. - For example, consider the following CSV file: - - Year,Make,Model,Length - 1997,Ford,E350,2.34 - 2000,Mercury,Cougar,2.38 - - The resulting JavaScript array is: - - [ {"Year": "1997", "Make": "Ford", "Model": "E350", "Length": "2.34"}, - {"Year": "2000", "Make": "Mercury", "Model": "Cougar", "Length": "2.38"} ] - */ + * Parses the specified string, which is the contents of a CSV file, returning an array of objects representing the parsed rows. + * The string is assumed to be RFC4180-compliant. + * Unlike the parseRows method, this method requires that the first line of the CSV file contains a comma-separated list of column names; + * these column names become the attributes on the returned objects. + * For example, consider the following CSV file: + * + * Year,Make,Model,Length + * 1997,Ford,E350,2.34 + * 2000,Mercury,Cougar,2.38 + * + * The resulting JavaScript array is: + * + * [ {"Year": "1997", "Make": "Ford", "Model": "E350", "Length": "2.34"}, + * {"Year": "2000", "Make": "Mercury", "Model": "Cougar", "Length": "2.38"} ] + */ parse( table: string, /** coerce cells (strings) into different types or modify them. return null to strip this row from the output results. */ @@ -38,42 +38,42 @@ interface D3Dsv { ): TRow[]; /** - Parses the specified string, which is the contents of a CSV file, returning an array of arrays representing the parsed rows. - The string is assumed to be RFC4180-compliant. - Unlike the parse method, this method treats the header line as a standard row, and should be used whenever the CSV file does not contain a header. - Each row is represented as an array rather than an object. - Rows may have variable length. - For example, consider the following CSV file: - - 1997,Ford,E350,2.34 - 2000,Mercury,Cougar,2.38 - The resulting JavaScript array is: - - [ ["1997", "Ford", "E350", "2.34"], - ["2000", "Mercury", "Cougar", "2.38"] ] - Note that the values themselves are always strings; they will not be automatically converted to numbers. See parse for details. - */ + * Parses the specified string, which is the contents of a CSV file, returning an array of arrays representing the parsed rows. + * The string is assumed to be RFC4180-compliant. + * Unlike the parse method, this method treats the header line as a standard row, and should be used whenever the CSV file does not contain a header. + * Each row is represented as an array rather than an object. + * Rows may have variable length. + * For example, consider the following CSV file: + * + * 1997,Ford,E350,2.34 + * 2000,Mercury,Cougar,2.38 + * The resulting JavaScript array is: + * + * [ ["1997", "Ford", "E350", "2.34"], + * ["2000", "Mercury", "Cougar", "2.38"] ] + * Note that the values themselves are always strings; they will not be automatically converted to numbers. See parse for details. + */ parseRows( table: string, - /** coerce cells (strings) into different types or modify them. return null to strip this row from the output results.*/ + /** coerce cells (strings) into different types or modify them. return null to strip this row from the output results. */ accessor?: (row: string[]) => TRow ): TRow[]; /** - Converts the specified array of rows into comma-separated values format, returning a string. - This operation is the reverse of parse. - Each row will be separated by a newline (\n), and each column within each row will be separated by a comma (,). - Values that contain either commas, double-quotes (") or newlines will be escaped using double-quotes. - - Each row should be an object, and all object properties will be converted into fields. - For greater control over which properties are converted, convert the rows into arrays containing only the properties that should be converted and use formatRows. - */ + * Converts the specified array of rows into comma-separated values format, returning a string. + * This operation is the reverse of parse. + * Each row will be separated by a newline (\n), and each column within each row will be separated by a comma (,). + * Values that contain either commas, double-quotes (") or newlines will be escaped using double-quotes. + * + * Each row should be an object, and all object properties will be converted into fields. + * For greater control over which properties are converted, convert the rows into arrays containing only the properties that should be converted and use formatRows. + */ format(rows: any[]): string; /** - Converts the specified array of rows into comma-separated values format, returning a string. - This operation is the reverse of parseRows. Each row will be separated by a newline (\n), and each column within each row will be separated by a comma (,). - Values that contain either commas, double-quotes (") or newlines will be escaped using double-quotes. - */ + * Converts the specified array of rows into comma-separated values format, returning a string. + * This operation is the reverse of parseRows. Each row will be separated by a newline (\n), and each column within each row will be separated by a comma (,). + * Values that contain either commas, double-quotes (") or newlines will be escaped using double-quotes. + */ formatRows(rows: any[]): string; } diff --git a/types/d3-ease/d3-ease-tests.ts b/types/d3-ease/d3-ease-tests.ts index b50ceba9a4..67a0f32b1b 100644 --- a/types/d3-ease/d3-ease-tests.ts +++ b/types/d3-ease/d3-ease-tests.ts @@ -23,7 +23,6 @@ t_out = d3Ease.easeCubicIn(t_in); t_out = d3Ease.easeCubicOut(t_in); t_out = d3Ease.easeCubicInOut(t_in); - let easePolyFactory: d3Ease.PolynomialEasingFactory; easePolyFactory = d3Ease.easePoly; diff --git a/types/d3-ease/index.d.ts b/types/d3-ease/index.d.ts index 704b55e5e0..3de6fd2e87 100644 --- a/types/d3-ease/index.d.ts +++ b/types/d3-ease/index.d.ts @@ -94,25 +94,24 @@ export interface PolynomialEasingFactory { * Symmetric polynomial easing/easing factory; scales polyIn for t in [0, 0.5] and polyOut for t in [0.5, 1]. * If the exponent is not specified, it defaults to 3, equivalent to cubic. */ -export var easePoly: PolynomialEasingFactory; +export const easePoly: PolynomialEasingFactory; /** * Polynomial easing/easing factory; raises t to the specified exponent. * If the exponent is not specified, it defaults to 3, equivalent to cubicIn. */ -export var easePolyIn: PolynomialEasingFactory; +export const easePolyIn: PolynomialEasingFactory; /** * Reverse polynomial easing/easing factory; equivalent to 1 - polyIn(1 - t). * If the exponent is not specified, it defaults to 3, equivalent to cubicOut. */ -export var easePolyOut: PolynomialEasingFactory; +export const easePolyOut: PolynomialEasingFactory; /** * Symmetric polynomial easing/easing factory; scales polyIn for t in [0, 0.5] and polyOut for t in [0.5, 1]. * If the exponent is not specified, it defaults to 3, equivalent to cubic. */ -export var easePolyInOut: PolynomialEasingFactory; - +export const easePolyInOut: PolynomialEasingFactory; /** * Symmetric sinusoidal easing; scales sinIn for t in [0, 0.5] and sinOut for t in [0.5, 1]. @@ -226,7 +225,6 @@ export function easeBounceOut(normalizedTime: number): number; */ export function easeBounceInOut(normalizedTime: number): number; - /** * Anticipatory easing function factory */ @@ -249,26 +247,25 @@ export interface BackEasingFactory { * Symmetric anticipatory easing; scales backIn for t in [0, 0.5] and backOut for t in [0.5, 1]. * The degree of overshoot is configurable; it not specified, it defaults to 1.70158. */ -export var easeBack: BackEasingFactory; +export const easeBack: BackEasingFactory; /** * Anticipatory easing, like a dancer bending his knees before jumping off the floor. * The degree of overshoot is configurable; it not specified, it defaults to 1.70158. */ -export var easeBackIn: BackEasingFactory; +export const easeBackIn: BackEasingFactory; /** * Reverse anticipatory easing; equivalent to 1 - backIn(1 - t). * The degree of overshoot is configurable; it not specified, it defaults to 1.70158. */ -export var easeBackOut: BackEasingFactory; +export const easeBackOut: BackEasingFactory; /** * Symmetric anticipatory easing; scales backIn for t in [0, 0.5] and backOut for t in [0.5, 1]. * The degree of overshoot is configurable; it not specified, it defaults to 1.70158. */ -export var easeBackInOut: BackEasingFactory; - +export const easeBackInOut: BackEasingFactory; /** * Elastic easing function factory @@ -287,11 +284,11 @@ export interface ElasticEasingFactory { */ amplitude(a: number): ElasticEasingFactory; /** - * Returns a new elastic easing with the specified amplitude a. - * Defaults to 0.3,if not specified. - * - * @param p Period for elastic easing. - */ + * Returns a new elastic easing with the specified amplitude a. + * Defaults to 0.3,if not specified. + * + * @param p Period for elastic easing. + */ period(p: number): ElasticEasingFactory; } @@ -300,25 +297,25 @@ export interface ElasticEasingFactory { * The amplitude and period of the oscillation are configurable; * if not specified, they default to 1 and 0.3, respectively. */ -export var easeElastic: ElasticEasingFactory; +export const easeElastic: ElasticEasingFactory; /** * Elastic easing, like a rubber band. * The amplitude and period of the oscillation are configurable; * if not specified, they default to 1 and 0.3, respectively. */ -export var easeElasticIn: ElasticEasingFactory; +export const easeElasticIn: ElasticEasingFactory; /** * Reverse elastic easing; equivalent to 1 - elasticIn(1 - t). * The amplitude and period of the oscillation are configurable; * if not specified, they default to 1 and 0.3, respectively. */ -export var easeElasticOut: ElasticEasingFactory; +export const easeElasticOut: ElasticEasingFactory; /** * Symmetric elastic easing; scales elasticIn for t in [0, 0.5] and elasticOut for t in [0.5, 1]. * The amplitude and period of the oscillation are configurable; * if not specified, they default to 1 and 0.3, respectively. */ -export var easeElasticInOut: ElasticEasingFactory; +export const easeElasticInOut: ElasticEasingFactory; diff --git a/types/d3-force/d3-force-tests.ts b/types/d3-force/d3-force-tests.ts index 0ecd7555d3..c08e1b5cee 100644 --- a/types/d3-force/d3-force-tests.ts +++ b/types/d3-force/d3-force-tests.ts @@ -6,7 +6,6 @@ * are not intended as functional tests. */ - import * as d3Force from 'd3-force'; // ------------------------------------------------------------------------------------- @@ -30,7 +29,6 @@ interface Graph { links: SimLink[]; } - const graph: Graph = { nodes: [ { id: 'Myriel', group: 1, r: 5 }, @@ -112,7 +110,6 @@ forceCollide = d3Force.forceCollide((node, index, nodes) => { return n.r; }); - // Configure Collision force ----------------------------------------------------------- let radiusAccessor: (node: SimNode, i: number, nodes: SimNode[]) => number; @@ -139,7 +136,6 @@ num = forceCollide.strength(); forceCollide = forceCollide.iterations(10); num = forceCollide.iterations(); - // Use Collision force ----------------------------------------------------------------- forceCollide.initialize(graph.nodes); @@ -157,7 +153,6 @@ forceLink = d3Force.forceLink(); // with link data forceLink = d3Force.forceLink(graph.links); - // Configure Link force ----------------------------------------------------------- let linkNumberAccessor: (link: SimLink, i: number, links: SimLink[]) => number; @@ -181,7 +176,6 @@ num = simLink.value; num = simLink.d; num = simLink.s; - // id (node id accessor) forceLink = forceLink.id((node, index, nodes) => { @@ -220,13 +214,11 @@ linkNumberAccessor = forceLink.strength(); forceLink = forceLink.iterations(10); num = forceLink.iterations(); - // Use Link force ----------------------------------------------------------------- forceLink.initialize(graph.nodes); forceLink(0.1); // alpha - // ManyBody ============================================================================ // create ManyBody force -------------------------------------------------------------- @@ -255,7 +247,6 @@ simNodeNumberAccessor = forceCharge.strength(); forceCharge = forceCharge.theta(0.8); num = forceCharge.theta(); - // distanceMin forceCharge = forceCharge.distanceMin(1); @@ -266,13 +257,11 @@ num = forceCharge.distanceMin(); forceCharge = forceCharge.distanceMax(1000); num = forceCharge.distanceMax(); - // Use ManyBody force ----------------------------------------------------------------- forceCharge.initialize(graph.nodes); forceCharge(0.1); // alpha - // ForceX ============================================================================== // create ForceX force -------------------------------------------------------------- @@ -327,7 +316,6 @@ simNodeNumberAccessor = forcePosX.x(); forcePosX.initialize(graph.nodes); forcePosX(0.1); // alpha - // ForceY ============================================================================== // create ForceY force -------------------------------------------------------------- @@ -388,7 +376,6 @@ forcePosY(0.1); // alpha // Create Force Simulation ============================================================= - let nodeSimulation: d3Force.Simulation; let nodeLinkSimulation: d3Force.Simulation; @@ -435,7 +422,6 @@ num = nodeLinkSimulation.alphaTarget(); nodeLinkSimulation = nodeLinkSimulation.velocityDecay(0.4); num = nodeLinkSimulation.velocityDecay(); - // force() ----------------------------------------------------------------------------- nodeSimulation = nodeSimulation.force('posx', forcePosX); @@ -444,7 +430,6 @@ nodeSimulation.force('posy', forcePosY); // Remove force nodeSimulation = nodeSimulation.force('posx', null); - nodeLinkSimulation = nodeLinkSimulation.force('link', forceLink); nodeLinkSimulation @@ -480,7 +465,6 @@ simLinks = nodeLinkSimulation.force>('link') // fLink = nodeLinkSimulation.force('link')!; // fails, as ForceLink specific properties are missing from 'generic' force - // on() -------------------------------------------------------------------------------- function drawLink(d: SimLink) { @@ -502,7 +486,6 @@ function drawNode(d: SimNode) { } nodeLinkSimulation = nodeLinkSimulation.on('tick', function ticked() { - const that: d3Force.Simulation = this; if (context) { diff --git a/types/d3-force/index.d.ts b/types/d3-force/index.d.ts index 6faa27449a..23f83c7ea3 100644 --- a/types/d3-force/index.d.ts +++ b/types/d3-force/index.d.ts @@ -3,7 +3,6 @@ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - // Last module patch version validated against: 1.0.4 // ----------------------------------------------------------------------- @@ -356,7 +355,6 @@ export interface Force {} } = d3Geo.geoTransform({}); +const transformFunction: { stream(s: d3Geo.GeoStream): {} } = d3Geo.geoTransform({}); interface CustomTranformProto extends d3Geo.GeoTransformPrototype { a: number; @@ -612,7 +612,7 @@ customTransformProto = { a: 10 }; -const t: { stream: (s: d3Geo.GeoStream) => (CustomTranformProto & d3Geo.GeoStream) } = d3Geo.geoTransform(customTransformProto); +const t: { stream(s: d3Geo.GeoStream): CustomTranformProto & d3Geo.GeoStream } = d3Geo.geoTransform(customTransformProto); // geoIdentity() ======================================================== diff --git a/types/d3-geo/index.d.ts b/types/d3-geo/index.d.ts index 1e9fed9b92..f6e4fa150d 100644 --- a/types/d3-geo/index.d.ts +++ b/types/d3-geo/index.d.ts @@ -699,14 +699,14 @@ export interface GeoProjection extends GeoStreamWrapper { */ fitExtent(extent: [[number, number], [number, number]], object: ExtendedFeature): this; /** - * Sets the projection’s scale and translate to fit the specified geographic feature collection in the center of the given extent. - * Returns the projection. - * - * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. - * - * @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom. - * @param object A geographic feature collection supported by d3-geo (An extension of GeoJSON feature collection). - */ + * Sets the projection’s scale and translate to fit the specified geographic feature collection in the center of the given extent. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom. + * @param object A geographic feature collection supported by d3-geo (An extension of GeoJSON feature collection). + */ fitExtent(extent: [[number, number], [number, number]], object: ExtendedFeatureCollection>): this; /** * Sets the projection’s scale and translate to fit the specified geographic geometry object in the center of the given extent. @@ -719,14 +719,14 @@ export interface GeoProjection extends GeoStreamWrapper { */ fitExtent(extent: [[number, number], [number, number]], object: GeoGeometryObjects): this; /** - * Sets the projection’s scale and translate to fit the specified geographic geometry collection in the center of the given extent. - * Returns the projection. - * - * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. - * - * @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom. - * @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection). - */ + * Sets the projection’s scale and translate to fit the specified geographic geometry collection in the center of the given extent. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom. + * @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection). + */ fitExtent(extent: [[number, number], [number, number]], object: ExtendedGeometryCollection): this; /** @@ -1340,7 +1340,7 @@ export interface GeoTransformPrototype { * * @param methods An object with custom method implementations, which are used to create a transform projection. */ -export function geoTransform(methods: T): { stream: (s: GeoStream) => (T & GeoStream) }; +export function geoTransform(methods: T): { stream(s: GeoStream): T & GeoStream }; // geoIdentity() ================================================================= @@ -1382,14 +1382,14 @@ export interface GeoIdentityTranform extends GeoStreamWrapper { */ fitExtent(extent: [[number, number], [number, number]], object: ExtendedFeature): this; /** - * Sets the projection’s scale and translate to fit the specified geographic feature collection in the center of the given extent. - * Returns the projection. - * - * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. - * - * @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom. - * @param object A geographic feature collection supported by d3-geo (An extension of GeoJSON feature collection). - */ + * Sets the projection’s scale and translate to fit the specified geographic feature collection in the center of the given extent. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom. + * @param object A geographic feature collection supported by d3-geo (An extension of GeoJSON feature collection). + */ fitExtent(extent: [[number, number], [number, number]], object: ExtendedFeatureCollection>): this; /** * Sets the projection’s scale and translate to fit the specified geographic geometry object in the center of the given extent. @@ -1402,14 +1402,14 @@ export interface GeoIdentityTranform extends GeoStreamWrapper { */ fitExtent(extent: [[number, number], [number, number]], object: GeoGeometryObjects): this; /** - * Sets the projection’s scale and translate to fit the specified geographic geometry collection in the center of the given extent. - * Returns the projection. - * - * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. - * - * @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom. - * @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection). - */ + * Sets the projection’s scale and translate to fit the specified geographic geometry collection in the center of the given extent. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom. + * @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection). + */ fitExtent(extent: [[number, number], [number, number]], object: ExtendedGeometryCollection): this; /** diff --git a/types/d3-scale/d3-scale-tests.ts b/types/d3-scale/d3-scale-tests.ts index c1feb4766a..f317e342ec 100644 --- a/types/d3-scale/d3-scale-tests.ts +++ b/types/d3-scale/d3-scale-tests.ts @@ -92,7 +92,6 @@ linearScaleNumString = linearScaleNumString.domain(domainNumeric); linearScaleNumString = linearScaleNumString.domain(domainNumbers); domainNumbers = linearScaleNumString.domain(); - // range(...) ----------------------------------------------------------------- linearScaleNumber = linearScaleNumber.range(rangeNumbers); @@ -138,7 +137,6 @@ linearScaleNumString = linearScaleNumber.interpolate((a, b) => { // nice(...) ----------------------------------------------------------------------- - // chainable linearScaleNumber = linearScaleNumber.nice(); linearScaleNumber = linearScaleNumber.nice(5); @@ -180,7 +178,6 @@ powerScaleNumber = d3Scale.scalePow(); powerScaleString = d3Scale.scalePow(); powerScaleNumString = d3Scale.scalePow(); - let squarerootScaleNumber: d3Scale.ScalePower; let squarerootScaleString: d3Scale.ScalePower; let squarerootScaleNumString: d3Scale.ScalePower; @@ -211,7 +208,6 @@ powerScaleNumString = powerScaleNumString.domain(domainNumeric); powerScaleNumString = powerScaleNumString.domain(domainNumbers); domainNumbers = powerScaleNumString.domain(); - // range(...) ----------------------------------------------------------------- powerScaleNumber = powerScaleNumber.range(rangeNumbers); @@ -282,7 +278,6 @@ const copiedPowerScale: d3Scale.ScalePower = powerScaleNumString // Logarithmic Scale Factory // ------------------------------------------------------------------------------- - // scaleLog() --------------------------------------------------------------------- let logScaleNumber: d3Scale.ScaleLogarithmic; @@ -293,7 +288,6 @@ logScaleNumber = d3Scale.scaleLog(); logScaleString = d3Scale.scaleLog(); logScaleNumString = d3Scale.scaleLog(); - // ScaleLogarithmic Interface ======================================================== // base -------------------------------------------------------------------- @@ -316,7 +310,6 @@ logScaleNumString = logScaleNumString.domain(domainNumeric); logScaleNumString = logScaleNumString.domain(domainNumbers); domainNumbers = logScaleNumString.domain(); - // range(...) ----------------------------------------------------------------- logScaleNumber = logScaleNumber.range(rangeNumbers); @@ -393,10 +386,8 @@ let identityScale: d3Scale.ScaleIdentity; identityScale = d3Scale.scaleIdentity(); - // ScaleIdentity Interface ======================================================== - // domain(...) ----------------------------------------------------------------- identityScale = identityScale.domain(domainNumeric); @@ -434,12 +425,10 @@ tickFormatNumberFn = identityScale.tickFormat(5, '+%'); outputNumber = identityScale(10); - // copy(...) ----------------------------------------------------------------- const copiedIdentityScale: d3Scale.ScaleIdentity = identityScale.copy(); - // ------------------------------------------------------------------------------- // Time Scale Factories // ------------------------------------------------------------------------------- @@ -454,7 +443,6 @@ localTimeScaleNumber = d3Scale.scaleTime(); localTimeScaleString = d3Scale.scaleTime(); localTimeScaleNumString = d3Scale.scaleTime(); - let utcScaleNumber: d3Scale.ScaleTime; let utcScaleString: d3Scale.ScaleTime; let utcScaleNumString: d3Scale.ScaleTime; @@ -475,7 +463,6 @@ domainDates = localTimeScaleString.domain(); localTimeScaleNumString = localTimeScaleNumString.domain(domainDates); domainDates = localTimeScaleNumString.domain(); - // range(...) ----------------------------------------------------------------- localTimeScaleNumber = localTimeScaleNumber.range(rangeNumbers); @@ -534,7 +521,6 @@ if (timeInterval !== null) { ticksDates = localTimeScaleNumString.ticks(timeInterval); } - // tickFormat(...) ----------------------------------------------------------------- tickFormatDateFn = localTimeScaleNumber.tickFormat(); @@ -543,7 +529,6 @@ if (timeInterval !== null) { tickFormatDateFn = localTimeScaleNumber.tickFormat(timeInterval, '%I %p'); } - // (...) value mapping from domain to output ----------------------------------- outputNumber = localTimeScaleNumber(new Date(2016, 6, 4)); @@ -595,8 +580,6 @@ outputString = sequentialScaleColorString(10); const copiedSequentialScale: d3Scale.ScaleSequential = sequentialScaleColorString.copy(); - - // ------------------------------------------------------------------------------- // Color Interpolators for Sequential Scale Factory // ------------------------------------------------------------------------------- @@ -619,7 +602,6 @@ colorInterpolator = d3Scale.interpolateCool; colorInterpolator = d3Scale.interpolateCubehelixDefault; - // ------------------------------------------------------------------------------- // Quantize Scale Factory // ------------------------------------------------------------------------------- @@ -632,7 +614,6 @@ let quantizeScaleString: d3Scale.ScaleQuantize; quantizeScaleNumber = d3Scale.scaleQuantize(); quantizeScaleString = d3Scale.scaleQuantize(); - // ScaleQuantize Interface ======================================================== // domain(...) ----------------------------------------------------------------- @@ -649,7 +630,6 @@ rangeNumbers = quantizeScaleNumber.range(); quantizeScaleString = quantizeScaleString.range(['steelblue', 'brown']); rangeStrings = quantizeScaleString.range(); - // invertExtent(...) ----------------------------------------------------------------- numExtent = quantizeScaleNumber.invertExtent(500); @@ -681,12 +661,10 @@ outputNumber = quantizeScaleNumber(0.51); const copiedQuantizeScale: d3Scale.ScaleQuantize = quantizeScaleNumber.copy(); - // ------------------------------------------------------------------------------- // Quantile Scale Factory // ------------------------------------------------------------------------------- - // scaleQuantile() ----------------------------------------------------------------- let quantileScaleNumber: d3Scale.ScaleQuantile; @@ -695,7 +673,6 @@ let quantileScaleString: d3Scale.ScaleQuantile; quantileScaleNumber = d3Scale.scaleQuantile(); quantileScaleString = d3Scale.scaleQuantile(); - // ScaleQuantile Interface ======================================================== // domain(...) ----------------------------------------------------------------- @@ -714,7 +691,6 @@ rangeNumbers = quantileScaleNumber.range(); quantileScaleString = quantileScaleString.range(['q25', 'q50', 'q75']); rangeStrings = quantileScaleString.range(); - // invertExtent(...) ----------------------------------------------------------------- numExtent = quantileScaleNumber.invertExtent(2); @@ -733,7 +709,6 @@ outputNumber = quantileScaleNumber(0.51); const copiedQuantileScale: d3Scale.ScaleQuantile = quantileScaleNumber.copy(); - // ------------------------------------------------------------------------------- // Threshold Scale Factory // ------------------------------------------------------------------------------- @@ -746,7 +721,6 @@ let thresholdScaleNumberString: d3Scale.ScaleThreshold; thresholdScaleNumberNumber = d3Scale.scaleThreshold(); thresholdScaleNumberString = d3Scale.scaleThreshold(); - // ScaleThreshold Interface ======================================================== // domain(...) ----------------------------------------------------------------- @@ -764,7 +738,6 @@ rangeNumbers = thresholdScaleNumberNumber.range(); thresholdScaleNumberString = thresholdScaleNumberString.range(['steelblue', 'seagreen', 'brown']); rangeStrings = thresholdScaleNumberString.range(); - // invertExtent(...) ----------------------------------------------------------------- numOrUndefinedExtent = thresholdScaleNumberNumber.invertExtent(100); @@ -781,7 +754,6 @@ outputString = thresholdScaleNumberString(0.9); const copiedThresholdScale: d3Scale.ScaleThreshold = thresholdScaleNumberString.copy(); - // ------------------------------------------------------------------------------- // Ordinal Scale Factory // ------------------------------------------------------------------------------- @@ -794,7 +766,6 @@ let ordinalScaleStringNumber: d3Scale.ScaleOrdinal; ordinalScaleStringString = d3Scale.scaleOrdinal(); ordinalScaleStringNumber = d3Scale.scaleOrdinal(); - // ScaleOrdinal Interface ======================================================== // domain(...) ----------------------------------------------------------------- @@ -812,7 +783,6 @@ rangeStrings = ordinalScaleStringString.range(); ordinalScaleStringNumber = ordinalScaleStringNumber.range([-1, 0, 1]); rangeNumbers = ordinalScaleStringNumber.range(); - // unknown(...) and d3Scale.scaleImplicit -------------------------------------- const implicit: { name: 'implicit' } = d3Scale.scaleImplicit; @@ -839,7 +809,6 @@ outputNumber = ordinalScaleStringNumber('negative'); const copiedOrdinalScale: d3Scale.ScaleOrdinal = ordinalScaleStringNumber.copy(); - // ------------------------------------------------------------------------------- // Band Scale Factory // ------------------------------------------------------------------------------- @@ -852,7 +821,6 @@ let bandScaleCoercible: d3Scale.ScaleBand; bandScaleString = d3Scale.scaleBand(); bandScaleCoercible = d3Scale.scaleBand(); - // ScaleBand Interface ======================================================== // domain(...) ----------------------------------------------------------------- @@ -870,12 +838,10 @@ let rangeExtent: [number, number] = bandScaleString.range(); bandScaleCoercible = bandScaleCoercible.range([0, 300]); rangeExtent = bandScaleCoercible.range(); - // rangeRound(...) ----------------------------------------------------------------- bandScaleString = bandScaleString.rangeRound([0, 300]); - // round(...) ----------------------------------------------------------------- bandScaleCoercible = bandScaleCoercible.round(true); @@ -891,7 +857,6 @@ num = bandScaleString.paddingInner(); bandScaleString = bandScaleString.paddingOuter(0.1); num = bandScaleString.paddingOuter(); - // padding(...) ----------------------------------------------------------------- bandScaleString = bandScaleString.padding(0.1); @@ -910,7 +875,6 @@ num = bandScaleString.bandwidth(); num = bandScaleString.step(); - // (...) value mapping from domain to output ----------------------------------- outputNumberMaybe = bandScaleString('neutral'); @@ -921,7 +885,6 @@ outputNumberMaybe = bandScaleCoercible(new StringCoercible('negative')); const copiedBandScale: d3Scale.ScaleBand = bandScaleCoercible.copy(); - // ------------------------------------------------------------------------------- // Point Scale Factory // ------------------------------------------------------------------------------- @@ -934,7 +897,6 @@ let pointScaleCoercible: d3Scale.ScalePoint; pointScaleString = d3Scale.scalePoint(); pointScaleCoercible = d3Scale.scalePoint(); - // ScalePoint Interface ======================================================== // domain(...) ----------------------------------------------------------------- @@ -952,18 +914,15 @@ rangeExtent = pointScaleString.range(); pointScaleCoercible = pointScaleCoercible.range([0, 300]); rangeExtent = pointScaleCoercible.range(); - // rangeRound(...) ----------------------------------------------------------------- pointScaleString = pointScaleString.rangeRound([0, 300]); - // round(...) ----------------------------------------------------------------- pointScaleCoercible = pointScaleCoercible.round(true); roundingFlag = pointScaleCoercible.round(); - // padding(...) ----------------------------------------------------------------- pointScaleString = pointScaleString.padding(0.1); diff --git a/types/d3-scale/index.d.ts b/types/d3-scale/index.d.ts index 2ba9eeec8a..8a114d90e1 100644 --- a/types/d3-scale/index.d.ts +++ b/types/d3-scale/index.d.ts @@ -33,16 +33,15 @@ export interface InterpolatorFactory { * A helper interface for a continuous scale defined over a numeric domain. */ export interface ScaleContinuousNumeric { - /** - * Given a value from the domain, returns the corresponding value from the range, subject to interpolation, if any. - * - * If the given value is outside the domain, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the range. - * - * Note: The interpolation function applied by the scale may change the output type from the range type as part of the interpolation. - * - * @param value A numeric value from the domain. - */ + * Given a value from the domain, returns the corresponding value from the range, subject to interpolation, if any. + * + * If the given value is outside the domain, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the range. + * + * Note: The interpolation function applied by the scale may change the output type from the range type as part of the interpolation. + * + * @param value A numeric value from the domain. + */ (value: number | { valueOf(): number }): Output; /** @@ -163,7 +162,6 @@ export interface ScaleContinuousNumeric { * Returns an exact copy of this scale. Changes to this scale will not affect the returned scale, and vice versa. */ copy(): this; - } // ------------------------------------------------------------------------------- @@ -188,7 +186,6 @@ export interface ScaleContinuousNumeric { * convert the interpolated range element to a corresponding output element. */ export interface ScaleLinear extends ScaleContinuousNumeric { - /** * Returns the scale’s current interpolator factory, which defaults to interpolate. */ @@ -222,7 +219,6 @@ export interface ScaleLinear extends ScaleContinuousNumeric(interpolate: InterpolatorFactory): ScaleLinear; - } /** @@ -281,7 +277,6 @@ export function scaleLinear(): ScaleLinear; * convert the interpolated range element to a corresponding output element. */ export interface ScalePower extends ScaleContinuousNumeric { - /** * Returns the scale’s current interpolator factory, which defaults to interpolate. */ @@ -428,7 +423,6 @@ export function scaleSqrt(): ScalePower; * convert the interpolated range element to a corresponding output element. */ export interface ScaleLogarithmic extends ScaleContinuousNumeric { - /** * Returns a copy of the scale’s current domain. */ @@ -578,16 +572,15 @@ export function scaleLog(): ScaleLogarithmic; * These scales are occasionally useful when working with pixel coordinates, say in conjunction with an axis or brush. */ export interface ScaleIdentity { - /** - * Given a value from the domain, returns the corresponding value from the range, subject to interpolation, if any. - * - * If the given value is outside the domain, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the range. - * - * Note: The interpolation function applied by the scale may change the output type from the range type as part of the interpolation. - * - * @param value A numeric value from the domain. - */ + * Given a value from the domain, returns the corresponding value from the range, subject to interpolation, if any. + * + * If the given value is outside the domain, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the range. + * + * Note: The interpolation function applied by the scale may change the output type from the range type as part of the interpolation. + * + * @param value A numeric value from the domain. + */ (value: number | { valueOf(): number }): number; /** @@ -688,7 +681,6 @@ export interface ScaleIdentity { */ export function scaleIdentity(): ScaleIdentity; - // ------------------------------------------------------------------------------- // Time Scale Factories // ------------------------------------------------------------------------------- @@ -710,16 +702,15 @@ export function scaleIdentity(): ScaleIdentity; * convert the interpolated range element to a corresponding output element. */ export interface ScaleTime { - /** - * Given a value from the domain, returns the corresponding value from the range, subject to interpolation, if any. - * - * If the given value is outside the domain, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the range. - * - * Note: The interpolation function applied by the scale may change the output type from the range type as part of the interpolation. - * - * @param value A temporal value from the domain. If the value is not a Date, it will be coerced to Date. - */ + * Given a value from the domain, returns the corresponding value from the range, subject to interpolation, if any. + * + * If the given value is outside the domain, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the range. + * + * Note: The interpolation function applied by the scale may change the output type from the range type as part of the interpolation. + * + * @param value A temporal value from the domain. If the value is not a Date, it will be coerced to Date. + */ (value: Date | number | { valueOf(): number }): Output; /** @@ -1022,14 +1013,13 @@ export function scaleUtc(): ScaleTime; * The generic corresponds to the data type of the output of the interpolator underlying the scale. */ export interface ScaleSequential { - /** - * Given a value from the domain, returns the corresponding value from the output range, subject to interpolation. - * - * If the given value is outside the domain, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the range. - * - * @param value A numeric value from the domain. - */ + * Given a value from the domain, returns the corresponding value from the output range, subject to interpolation. + * + * If the given value is outside the domain, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the range. + * + * @param value A numeric value from the domain. + */ (value: number | { valueOf(): number }): Output; /** @@ -1209,7 +1199,7 @@ export interface ScaleQuantize { */ range(range: Range[]): this; - /** + /** * Returns approximately count representative values from the scale’s domain. * * If count is not specified, it defaults to 10. @@ -1282,7 +1272,6 @@ export function scaleQuantize(): ScaleQuantize; * The generic correponds to the data type of range elements. */ export interface ScaleQuantile { - /** * Given a value in the input domain, returns the corresponding value in the output range. * @@ -1542,7 +1531,6 @@ export function scaleOrdinal(range */ export const scaleImplicit: { name: 'implicit' }; - // ------------------------------------------------------------------------------- // Band Scale Factory // ------------------------------------------------------------------------------- @@ -1828,7 +1816,6 @@ export function scalePoint(): ScalePoint; */ export function scalePoint(): ScalePoint; - // ------------------------------------------------------------------------------- // Categorical Color Schemas for Ordinal Scales // ------------------------------------------------------------------------------- diff --git a/types/d3-selection/index.d.ts b/types/d3-selection/index.d.ts index b007573b1f..34196f755e 100644 --- a/types/d3-selection/index.d.ts +++ b/types/d3-selection/index.d.ts @@ -552,17 +552,17 @@ interface Selection; /** - * Filters the selection, returning a new selection that contains only the elements for - * which the specified filter is true. - * - * The returned filtered selection preserves the parents of this selection, but like array.filter, - * it does not preserve indexes as some elements may be removed; use selection.select to preserve the index, if needed. - * - * The generic refers to the type of element which will be selected after applying the filter, i.e. if the element types - * contained in a pre-filter selection are narrowed to a subset as part of the filtering. - * - * @param selector A CSS selector string to match when filtering. - */ + * Filters the selection, returning a new selection that contains only the elements for + * which the specified filter is true. + * + * The returned filtered selection preserves the parents of this selection, but like array.filter, + * it does not preserve indexes as some elements may be removed; use selection.select to preserve the index, if needed. + * + * The generic refers to the type of element which will be selected after applying the filter, i.e. if the element types + * contained in a pre-filter selection are narrowed to a subset as part of the filtering. + * + * @param selector A CSS selector string to match when filtering. + */ filter(selector: string): Selection; /** * Filter the selection, returning a new selection that contains only the elements for diff --git a/types/d3-shape/index.d.ts b/types/d3-shape/index.d.ts index e1d80b6786..517f84e501 100644 --- a/types/d3-shape/index.d.ts +++ b/types/d3-shape/index.d.ts @@ -1990,14 +1990,14 @@ export interface Symbol { /** * Constructs a new symbol generator with the default settings. */ -export function symbol(): Symbol; +export function symbol(): Symbol; // 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. */ -export function symbol(): Symbol; +export function symbol(): Symbol; // tslint:disable-line ban-types /** * Constructs a new symbol generator with the default settings. @@ -2005,7 +2005,7 @@ export function symbol(): Symbol; * 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. */ -export function symbol(): Symbol; +export function symbol(): Symbol; // tslint:disable-line ban-types /** * An array containing the set of all built-in symbol types: circle, cross, diamond, square, star, triangle, and wye.