Routes dependency arrows between two task bars.
Links are drawn with orthogonal segments, like DHTMLX Gantt: the line leaves the source edge horizontally, travels vertically in a "lane" next to the bars and enters the target edge horizontally, ending with an arrow head. When the target edge is behind the source edge, the line detours through the boundary between rows.
Boxes describe the row of each task: x and width of the bar, y (top
of the row) and the row_height.
iex> source = %{x: 0, width: 100, y: 0}
iex> target = %{x: 150, width: 80, y: 36}
iex> path = GanttEx.LinkPath.route(source, target, :finish_to_start, row_height: 36)
iex> path.points
[{100, 18.0}, {112, 18.0}, {112, 54.0}, {144, 54.0}]
iex> path.d
"M100 18L112 18L112 54L144 54"
iex> source = %{x: 100, width: 100, y: 0}
iex> target = %{x: 50, width: 40, y: 36}
iex> GanttEx.LinkPath.route(source, target, :finish_to_start, row_height: 36).points
[{200, 18.0}, {212, 18.0}, {212, 36}, {38, 36}, {38, 54.0}, {44, 54.0}]
Summary
Functions
Formats a coordinate with at most one decimal.
Computes the path of a link of type from source to target.
Converts points into an SVG path.
Types
Functions
Formats a coordinate with at most one decimal.
iex> GanttEx.LinkPath.format_number(12.0)
"12"
iex> GanttEx.LinkPath.format_number(12.34)
"12.3"
@spec route(box(), box(), GanttEx.Link.type(), keyword()) :: t()
Computes the path of a link of type from source to target.
Options
:row_height- height of a row in pixels. Defaults to36.:gap- horizontal distance between a bar edge and the vertical lane. Defaults to12.:arrow- size of the arrow head. Defaults to6.
Converts points into an SVG path.
iex> GanttEx.LinkPath.to_d([{0, 0}, {10.25, 5}])
"M0 0L10.3 5"