Skip to content

Commit

Permalink
[d3-sankey] Update to Minor Version 0.6 (#16923)
Browse files Browse the repository at this point in the history
* [BREAKING] Changes to Sankey node and link related interfaces. Added attributes and re-defined attributes.
  • Loading branch information
tomwanzek authored and Andy committed Jun 2, 2017
1 parent a6c6caa commit c3597f9
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 23 deletions.
17 changes: 10 additions & 7 deletions types/d3-sankey/d3-sankey-tests.ts
Expand Up @@ -260,11 +260,13 @@ str = sNode.name;

// Sankey Layout calculated (if layout has been run, otherwise undefined):

numMaybe = sNode.dx;
numMaybe = sNode.x;
numMaybe = sNode.dy;
numMaybe = sNode.y;
numMaybe = sNode.x0;
numMaybe = sNode.x1;
numMaybe = sNode.y0;
numMaybe = sNode.y1;
numMaybe = sNode.value;
numMaybe = sNode.index;
numMaybe = sNode.depth;

let linksArrMaybe: SLink[] | undefined;

Expand Down Expand Up @@ -295,6 +297,7 @@ numOrSankeyNode = sLink.target;

// Sankey Layout calculated (if layout has been run, otherwise undefined):

numMaybe = sLink.sy;
numMaybe = sLink.ty;
numMaybe = sLink.dy;
numMaybe = sLink.y0;
numMaybe = sLink.y1;
numMaybe = sLink.width;
numMaybe = sLink.index;
44 changes: 28 additions & 16 deletions types/d3-sankey/index.d.ts
@@ -1,9 +1,9 @@
// Type definitions for D3JS d3-sankey module 0.5
// Type definitions for D3JS d3-sankey module 0.6
// Project: https://github.com/d3/d3-sankey/
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

// Last module patch version validated against: 0.5
// Last module patch version validated against: 0.6

import { Link } from 'd3-shape';

Expand Down Expand Up @@ -43,21 +43,29 @@ export interface SankeyNodeMinimal<N extends SankeyExtraProperties, L extends Sa
*/
value?: number;
/**
* Node's horizontal position (derived from the graph topology) calculated by Sankey layout generator.
* Node’s zero-based index within the array of nodes calculated by Sankey layout generator.
*/
x?: number;
index?: number;
/**
* Node's node width calculated by Sankey layout generator.
* Node’s zero-based graph depth, derived from the graph topology calculated by Sankey layout generator.
*/
dx?: number;
depth?: number;
/**
* Node's vertical position calculated by Sankey layout generator.
* Node's minimum horizontal position (derived from the node.depth) calculated by Sankey layout generator.
*/
y?: number;
x0?: number;
/**
* Node's height (proportional to its value) calculated by Sankey layout generator.
* Node’s maximum horizontal position (node.x0 + sankey.nodeWidth) calculated by Sankey layout generator.
*/
dy?: number;
x1?: number;
/**
* Node's minimum vertical position calculated by Sankey layout generator.
*/
y0?: number;
/**
* Node's maximum vertical position (node.y1 - node.y0 is proportional to node.value) calculated by Sankey layout generator.
*/
y1?: number;
}

/**
Expand Down Expand Up @@ -109,18 +117,22 @@ export interface SankeyLinkMinimal<N extends SankeyExtraProperties, L extends Sa
* Link's numeric value
*/
value: number;
/**
* Link breadth (proportional to its value) calculated by Sankey layout generator.
*/
dy?: number;
/**
* Link's vertical starting position (at source node) calculated by Sankey layout generator.
*/
sy?: number;
y0?: number;
/**
* Link's vertical end position (at target node) calculated by Sankey layout generator.
*/
ty?: number;
y1?: number;
/**
* Link's width (proportional to its value) calculated by Sankey layout generator.
*/
width?: number;
/**
* Link's zero-based index within the array of links calculated by Sankey layout generator.
*/
index?: number;
}

/**
Expand Down

0 comments on commit c3597f9

Please sign in to comment.