1

Topic: Seer

Hi, I'm using Seer gem to make graphics.
It works fine, but i can't change the content of the tooltip that shows up when i click on some bar (in this case, I'm using a bar chart)
Here's my code:

View:

<div id="chart"></div>
<% if !@tarA.empty? %>

<% unless @tarA.empty? %>
<%= Seer::visualize(
      @tarA,
      :as => :column_chart,
      :in_element =>'chart',
      :series => {:series_label => 'name' , :data_label => 'situation', :data_method => 'Days', :data_series => @series},
      :chart_options => {
        :height => 300,
        :width => 70 * @tarA.size,
        :is_3_d => true,
        :legend => 'none',
        :colors => "[{color:'#990000', darker:'#660000'}]",
        :title => "Late taks",
        :title_x => 'Tasks',
        :title_y => 'Days'
      }
    )  %>
<% end %>

<% else %>
There are no tasks
<% end %>

Controller:

  def something
    
    @tarA = Task.all(:conditions => ["project_id  = ? and situation = ?", params[:id], "Late"])

    @series = @tarA.map{|w| w.situation}

  end

Modelo:

 def Days
    if self.amount_days.nil?
      self.amount_days = self.date_end - Date.current
    end
    if self.amount_days > 0
      (self.amount_days).to_s
    else
      (-self.amount_days).to_s
    end
  end

  def situation
    self.situation
  end

In the tooltip, it's what shows up:

  • The name of the task (as i choose in :series_label)

  • The name of the method (that, in this case, is Days)

  • The result of the method (the result of the Days method)

The problem is that I want that other information shows up in the tooltip, without interfering on the graphic.