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).
Create a GanttHeader object and generate the scales for the header.
# File lib/taskjuggler/reports/GanttHeader.rb, line 26 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 # 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
Convert the header into an HTML format.
# File lib/taskjuggler/reports/GanttHeader.rb, line 50 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