Class: TaskJuggler::GanttHeader
- Defined in:
- lib/taskjuggler/reports/GanttHeader.rb
Overview
This class stores output format independent information to describe a GanttChart header. A Gantt chart header consists of 2 lines. The top line holds the large scale (e. g. the year or month and year) and the lower line holds the small scale (e. g. week or day).
Instance Attribute Summary collapse
-
#cellStartDates ⇒ Object
readonly
Returns the value of attribute cellStartDates.
-
#gridLines ⇒ Object
readonly
Returns the value of attribute gridLines.
-
#height ⇒ Object
Returns the value of attribute height.
-
#markdateLineX ⇒ Object
readonly
Returns the value of attribute markdateLineX.
-
#nowLineX ⇒ Object
readonly
Returns the value of attribute nowLineX.
Instance Method Summary collapse
-
#initialize(columnDef, chart) ⇒ GanttHeader
constructor
Create a GanttHeader object and generate the scales for the header.
-
#to_html ⇒ Object
Convert the header into an HTML format.
Constructor Details
#initialize(columnDef, chart) ⇒ GanttHeader
Create a GanttHeader object and generate the scales for the header.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/taskjuggler/reports/GanttHeader.rb', line 28 def initialize(columnDef, chart) @columnDef = columnDef @chart = chart @largeScale = [] @smallScale = [] # Positions where chart should be marked with vertical lines that match # the large scale. @gridLines = [] # X coordinate of the "now" line. nil if "now" is off-chart. @nowLineX = nil # X coordinate of the custom "markdate" line with date specified by user. # nil if "markdate" is off-chart. @markdateLineX = nil # The x coordinates and width of the cells created by the small scale. The # values are stored as [ x, w ]. @cellStartDates = [] # The height of the header in pixels. @height = 39 generate end |
Instance Attribute Details
#cellStartDates ⇒ Object (readonly)
Returns the value of attribute cellStartDates.
24 25 26 |
# File 'lib/taskjuggler/reports/GanttHeader.rb', line 24 def cellStartDates @cellStartDates end |
#gridLines ⇒ Object (readonly)
Returns the value of attribute gridLines.
24 25 26 |
# File 'lib/taskjuggler/reports/GanttHeader.rb', line 24 def gridLines @gridLines end |
#height ⇒ Object
Returns the value of attribute height.
25 26 27 |
# File 'lib/taskjuggler/reports/GanttHeader.rb', line 25 def height @height end |
#markdateLineX ⇒ Object (readonly)
Returns the value of attribute markdateLineX.
24 25 26 |
# File 'lib/taskjuggler/reports/GanttHeader.rb', line 24 def markdateLineX @markdateLineX end |
#nowLineX ⇒ Object (readonly)
Returns the value of attribute nowLineX.
24 25 26 |
# File 'lib/taskjuggler/reports/GanttHeader.rb', line 24 def nowLineX @nowLineX end |
Instance Method Details
#to_html ⇒ Object
Convert the header into an HTML format.
56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/taskjuggler/reports/GanttHeader.rb', line 56 def to_html div = XMLElement.new('div', 'class' => 'tabback', 'style' => "margin:0px; padding:0px; " + "position:relative; " + "width:#{@chart.width.to_i}px; " + "height:#{@height.to_i}px; " + "font-size:#{(@height / 4).to_i}px; ") @largeScale.each { |s| div << s.to_html } @smallScale.each { |s| div << s.to_html } div end |