Skip to content

Annotated Time Line

mwarnock edited this page Sep 12, 2010 · 6 revisions

In order to use any of the visualizations be sure you’ve followed the steps in Getting Started

The annotated time line is a well interfaced time line visualization with the added feature of displaying annotations. It does not allow the editing of annotations. But it’s pretty cool nonetheless.

Using the Annotated Time Line

The annotated time line is used as a block helper. The main helper requires a list (array) of dates. The helper yields the AnnotatedTimeLine templater to the block. There is only one method that should be called on the templator: add_line(). This method can be called for each line you would like to add to the time line visualization. It takes as its parameters the title of the line, a list (array) of items, and a hash of symbols representing the methods to be called on the items of the collection. The three hash keys that should be declared are: :value, :title, :notes. Of these on the :value key must be present for the time line to render. Here is the code:

<% annotated_timeline_for(@dates, :width => 800, :height => 200) do |atl| %>
  <% atl.add_line("My First Line", @line_1, :value => :method_name_for_value, :title => :method_name_for_title, :notes => :method_name_for_notes) %>
  <% atl.add_line("My Other Line", @line_2, :value => :method_name_for_value) %>
<% end %>

Also of note is the ability to specify the height and width of the annotated time line on the page. As with using the google api directly, titles and notes for items within a line collection can be nil and all will render accordingly.

Clone this wiki locally