Class TaskJuggler::GanttHeader
In: lib/taskjuggler/reports/GanttHeader.rb
Parent: Object

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

Methods

new   to_html  

Attributes

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

Public Class methods

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

[Source]

# File lib/taskjuggler/reports/GanttHeader.rb, line 28
    def initialize(chart)
      @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

Convert the header into an HTML format.

[Source]

# 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

[Validate]