Class: TaskJuggler::GanttTaskBar
- Includes:
- HTMLGraphics
- Defined in:
- lib/taskjuggler/reports/GanttTaskBar.rb
Overview
The GanttTaskBar represents a normal task that is part of a GanttChart.
Constant Summary collapse
- @@size =
The size of the bar in pixels from center to top/bottom.
6
Instance Method Summary collapse
- #addBlockedZones(router) ⇒ Object
-
#endDepLineEnd ⇒ Object
Return the point [ x, y ] where task end dependency lines should end at.
-
#endDepLineStart ⇒ Object
Return the point [ x, y ] where task end dependency lines should start from.
-
#initialize(query, lineHeight, xStart, xEnd, y) ⇒ GanttTaskBar
constructor
Create a GanttContainer object based on the following information: line is a reference to the GanttLine.
-
#startDepLineEnd ⇒ Object
Return the point [ x, y ] where task start dependency lines should end at.
-
#startDepLineStart ⇒ Object
Return the point [ x, y ] where task start dependency lines should start from.
-
#to_html ⇒ Object
Convert the abstact representation of the GanttTaskBar into HTML elements.
Methods included from HTMLGraphics
#arrowHeadToHTML, #diamondToHTML, #jagToHTML, #lineToHTML, #rectToHTML
Constructor Details
#initialize(query, lineHeight, xStart, xEnd, y) ⇒ GanttTaskBar
Create a GanttContainer object based on the following information: line is a reference to the GanttLine. xStart is the left edge of the task in chart coordinates. xEnd is the right edge.
30 31 32 33 34 35 36 |
# File 'lib/taskjuggler/reports/GanttTaskBar.rb', line 30 def initialize(query, lineHeight, xStart, xEnd, y) @query = query @lineHeight = lineHeight @start = xStart @end = xEnd @y = y end |
Instance Method Details
#addBlockedZones(router) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/taskjuggler/reports/GanttTaskBar.rb', line 60 def addBlockedZones(router) # Horizontal block for whole bar. router.addZone(@start, @y + (@lineHeight / 2) - @@size - 1, @end - @start + 1, 2 * @@size + 3, true, false) # Block for arrowhead. router.addZone(@start - 9, @y + (@lineHeight / 2) - 7, 10, 15, true, true) # Vertical block for end cap router.addZone(@start - 2, @y, 5, @lineHeight, false, true) router.addZone(@end - 2, @y, 5, @lineHeight, false, true) end |
#endDepLineEnd ⇒ Object
Return the point [ x, y ] where task end dependency lines should end at.
56 57 58 |
# File 'lib/taskjuggler/reports/GanttTaskBar.rb', line 56 def endDepLineEnd [ @end - 1, @y + @lineHeight / 2 ] end |
#endDepLineStart ⇒ Object
Return the point [ x, y ] where task end dependency lines should start from.
51 52 53 |
# File 'lib/taskjuggler/reports/GanttTaskBar.rb', line 51 def endDepLineStart [ @end + 1, @y + @lineHeight / 2 ] end |
#startDepLineEnd ⇒ Object
Return the point [ x, y ] where task start dependency lines should end at.
45 46 47 |
# File 'lib/taskjuggler/reports/GanttTaskBar.rb', line 45 def startDepLineEnd [ @start - 1, @y + @lineHeight / 2 ] end |
#startDepLineStart ⇒ Object
Return the point [ x, y ] where task start dependency lines should start from.
40 41 42 |
# File 'lib/taskjuggler/reports/GanttTaskBar.rb', line 40 def startDepLineStart [ @start + 1, @y + @lineHeight / 2 ] end |
#to_html ⇒ Object
Convert the abstact representation of the GanttTaskBar into HTML elements.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/taskjuggler/reports/GanttTaskBar.rb', line 74 def to_html xStart = @start.to_i yCenter = (@lineHeight / 2).to_i width = @end.to_i - @start.to_i + 1 html = [] # Invisible trigger frame for tooltips. html << rectToHTML(xStart, 0, width, @lineHeight, 'tj_gantt_frame') # First we draw the task frame. html << rectToHTML(xStart, yCenter - @@size, width, 2 * @@size, 'taskbarframe') # The we draw the filling. html << rectToHTML(xStart + 1, yCenter - @@size + 1, width - 2, 2 * @@size - 2, 'taskbar') # And then the progress bar. If query is null we assume 50% completion. if @query @query.attributeId = 'complete' @query.process res = @query.result completion = res ? res / 100.0 : 0.0 else completion = 0.5 end html << rectToHTML(xStart + 1, yCenter - @@size / 2, (width - 2) * completion, @@size, 'progressbar') end |