Skip to content

Keep a copy of starting positions in label[i].sx & label[i].sy#6

Open
Fil wants to merge 3 commits into
tinker10:masterfrom
Fil:keep-copy-of-starting-positions
Open

Keep a copy of starting positions in label[i].sx & label[i].sy#6
Fil wants to merge 3 commits into
tinker10:masterfrom
Fil:keep-copy-of-starting-positions

Conversation

@Fil

@Fil Fil commented Mar 11, 2014

Copy link
Copy Markdown

Makes it easier to draw lines from the starting point to the label, or do some computations with distances moved.

Fil added 3 commits March 11, 2014 09:20
`label_array[i].sx` and `label_array[i].sy` are a copy of the initial positions; makes it easy to use the distance moved to change the label or the label class

Basic example:

```
.text(function(d) { return d.name + ' ' + Math.ceil(Math.sqrt((d.x-d.sx)*(d.x-d.sx) + (d.y-d.sy)*(d.y-d.sy))) });
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant