Help differentiate between flows in one direction or another

This commit is contained in:
Brad Beattie 2009-04-08 14:54:00 -07:00
parent 1eab499f40
commit d18c66fe4b

View File

@ -13,22 +13,23 @@
%> %>
<svg xmlns="http://www.w3.org/2000/svg" version="1.0" width="400" height="744"> <svg xmlns="http://www.w3.org/2000/svg" version="1.0" width="400" height="744">
<g fill-opacity="0.5" stroke="black"> <g fill-opacity="0.2" stroke="black" stroke-opacity="0.5">
<% @status_changes.each do |status_change| %> <% @status_changes.each do |status_change| %>
<% <%
changes_count = [status_change["changes_count"].to_i,40].min changes_count = [status_change["changes_count"].to_i,40].min
old_status = status_change["old_status"].to_i
new_status = status_change["new_status"].to_i
x1 = points[status_change["old_status"].to_i]["x"] x1 = points[old_status]["x"]
y1 = points[status_change["old_status"].to_i]["y"] y1 = points[old_status]["y"]
x2 = points[status_change["new_status"].to_i]["x"] x2 = points[new_status]["x"]
y2 = points[status_change["new_status"].to_i]["y"] y2 = points[new_status]["y"]
atan2 = -Math.atan2(y1-y2,x1-x2) atan2 = -Math.atan2(y1-y2,x1-x2)
xdiff = Math.sin(atan2)*changes_count xdiff = Math.sin(atan2)*changes_count
ydiff = Math.cos(atan2)*changes_count ydiff = Math.cos(atan2)*changes_count
x1a = x1 + xdiff x1a = x1 + xdiff
y1a = y1 + ydiff y1a = y1 + ydiff
x1b = x1 - xdiff x1b = x1 - xdiff
@ -36,6 +37,7 @@
%> %>
<polygon <polygon
points="<%= x1a %>,<%= y1a %> <%= x1b %>,<%= y1b %> <%= x2 %>,<%= y2 %>" points="<%= x1a %>,<%= y1a %> <%= x1b %>,<%= y1b %> <%= x2 %>,<%= y2 %>"
fill="<%= issue_statuses_by_id[old_status].position > issue_statuses_by_id[new_status].position ? "red" : "green" %>"
/> />
<% end %> <% end %>
</g> </g>

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB