Sankey Helper: Sankey diagrams in Excel

 

Upcoming: programming of SankeyHelper diagrams with SankeyTurtle

An outline of the coming concept for SankeyTurtle – comments, criticism, and suggestions are welcome: send to sankey >at> doka.ch

The idea of SankeyTurtle code is to give each Sankey flux – each data cell – an accompagning instruction how to draw the flux exactly in terms of path and geometry. The SankeyTurtle Syntax is based on the vintage Logo TurtleGraphics External Link: drawing language, where you tell an imaginary turtle with a pen attached to it's tail commands like "Move Forward" and "Turn Right 90°" and record the trail of the pen.

A rather basic example of an Excel data table prepared for SankeyTurtle and the resulting Sankey diagram could look like this:

Below is apreliminary list of the proposed SankeyTurtle syntax. SankeyTurtle is under GNU Free Documentation License External Link:. Most of this is already in beta testing (Feb 2010), but I'd like to hear reactions from SankeyHelper users on this.

Command

Description

SKT

Initial command declaring SankeyTurtle code is in this cell

[space]

Delimiter between commands

 

Straight line movement

M

advance default distance (initiates or continues line drawing)

M-

move back default distance (initiates or continues line drawing)

M50

move forward 50 units (initiates or continues line drawing). Units are the same units as employed in the data table (i.e. not screen pixels)

M-50

move backward 50 units (initiates or continues line drawing)

M%0.8

move forward 80% of the flux width (initiates or continues line drawing)

M%-0.8

move backward 80% of the flux width (initiates or continues line drawing)

DD50

set default advance distance to 50 units

DD%0.8

set default advance distance to 80% of the flux width

WS30

temporarily set width of this flux to 30 units. (Will be superseded by true flux value, but helpful for spaced drawings)

AD50

Advance 50 units (in set direction) without drawing (only before line drawing has begun or ended)

AD%0.8

Advance pen up forward 80% of the flux width

 

Make flux bends

+

rotate 90° right (clockwise) (initiates or continues line drawing). A Sankey bend consists of two vertices of a polyline, with control nodes adjusted so that a nice bend results (this is unlike LogoTurtle's turning on the spot)

-

rotate 90° left (counter-clockwise) (initiates or continues line drawing). Please note that there is no syntax to draw backward BENDS

+60

rotate 60° right

-60

rotate 60° left

IR60

set default inner radius to 60 units

IR%0.3

set adaptive inner radius to 30% of flow width

 

 

 

Absolute orientation

T90

turn to absolute 90° orientation (0° is 12'o'clock) (default at start is 90°). This does NOT produce a good Sankey bend.

 

 

 

Arrowheads

AH

Draw arrowhead at current position and orientation. Arrowheads at the beginning and at the end of a Sankey line are automatic.

AH-

Draw reverse oriented arrowhead at current position

 

 

HS60

Set default height of arrowhead to 60 units

HS%0.5

Set default height of arrowhead to 50% of the flux width

 

 

 

Labels

LC

Create label (with text left of data cell) at current position, align center

LR

Create label at current position, align to the right.

LL

Create label at current position, align to the left. If text gets longer in subsequent updates of the diagram, the left alignment (relative to the flux center) can be lost.

LP

Create label on port side (left side when looking in flux direction)

LS

Create label on starboard side Label (right side when looking in flux direction)

LU

Create label in upstream direction

LD

Create label in downstream direction

LC'Losses'

Create label with specified, constant text. Here center aligned [LC] – all other label orientations are possible too. (The parser will replace any spaces in label text with option-spaces (ASCII No. 202))

FS12

set label font size of any future labels

 

Line drawing colour

CRE120

set red color channel to 120 (0-255)

CGR120

set green color channel to 120 (0-255)

CBL120

set blue color channel to 120 (0-255)

CXX

random line color

 

Label font colour

FC16

set font colour of any future labels (using index colour palette of Excel, Nr. 1-56)

 

Relating to other flows

HHB3 or HHE3
HWB3
HVB3
HGB3
WHB3
WWB3
WVB3
WGB3
VHB3
VWB3
VVB3
VGB3
GHB3
GWB3
GVB3
GGB3

Set current drawing point in the vicinity of an arrowhead of an already drawn flux (i.e. flux from a previous cell) so that the edges of the two fluxes are co-linear or adjacent.

Alignment is indicated by the first two letters and uses the Thames orientation scheme (cf. below).

Target arrowhead is indicated by the letter [B] for beginning arrowhead and [E] for end arrowhead. The number indicates the flux number (row number in the data table). If a number is omitted, a referral to the previous cell is assumed.

The Thames orientation scheme defines four diagonal directions relative to a flow direction. It is based on the east-bound river Thames in London and the relative location of four popular parks in London – Hyde, Victoria, Wimbledon, and Greenwich or H,V,W,G for short:

   

Alignment of two arrowheads

Sixteen possibilities to align two arrowheads are defined by two diagonal movements in the Thames orientation scheme, leading to the two first letters in this type of SankeyTurtle command:

The original LogoTurtleGraphics "Pen up" and "Pen down" are not implemented, since each data cell shall lead to only one flux with only one beginning arrowhead and one end arrowhead (used for the flux neighbouring explained above). Flux paths however can be quite complex. Also it is possible to have two or more data cells in the data table representing the same flux.

Send suggestions/questions/complaints to sankey >at> doka.ch

SankeyTurtle by Gabor Doka, Zurich, Switzerland, © 2009-2010, GNU Free Documentation License External Link:

 
Logo 

DOKA LCA