Skip to content

Commit

Permalink
[d3-sankey] Missing Iterations (DefinitelyTyped#16916)
Browse files Browse the repository at this point in the history
* [Fix] Adds missing `iterations` setter and getter for `SankeyLayout`
  • Loading branch information
tomwanzek authored and Andy committed Jun 2, 2017
1 parent 4b35f5c commit e353d9b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
13 changes: 13 additions & 0 deletions types/d3-sankey/d3-sankey-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,19 @@ slgDAG = slgDAG.size([1200, 800]);

size = slgDAG.size();

// ---------------------------------------------------------------------------
// Iterations
// ---------------------------------------------------------------------------

// Set -----------------------------------------------------------------------

// test return type for chainability
slgDAG = slgDAG.iterations(40);

// Get -----------------------------------------------------------------------

num = slgDAG.iterations();

// ---------------------------------------------------------------------------
// Nodes
// ---------------------------------------------------------------------------
Expand Down
11 changes: 11 additions & 0 deletions types/d3-sankey/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,17 @@ export interface SankeyLayout<Data, N extends SankeyExtraProperties, L extends S
* @param size A two element array of [width, height] in pixels which defaults to [1, 1].
*/
size(size: [number, number]): this;

/**
* Return the current number of relaxation iterations, which defaults to 32.
*/
iterations(): number;
/**
* 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.
*/
iterations(iterations: number): this;
}

/**
Expand Down

0 comments on commit e353d9b

Please sign in to comment.