class TaskJuggler::GanttHeader

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).

Attributes

cellStartDates[R]
gridLines[R]
height[RW]
nowLineX[R]

Public Class Methods

new(columnDef, chart) click to toggle source

Create a GanttHeader object and generate the scales for the header.

# File lib/taskjuggler/reports/GanttHeader.rb, line 27
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

Public Instance Methods

to_html() click to toggle source

Convert the header into an HTML format.

# File lib/taskjuggler/reports/GanttHeader.rb, line 51
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