class GerbilCharts::Surfaces::LinkPivots

Link Pivots

When time is selected, we show custom links to Jump to other places

Attributes

just[RW]

Public Class Methods

new(opts={}) click to toggle source
# File lib/gerbilcharts/surfaces/link_pivots.rb, line 10
def initialize(opts={})
  @class = "linkpivots"
  super(opts)
end

Public Instance Methods

align_to_anchor(anc) click to toggle source
# File lib/gerbilcharts/surfaces/link_pivots.rb, line 49
def align_to_anchor(anc)
  super
  @bounds.deflate_h(40,40)
  @bounds.top = @bounds.bottom - 40
end
int_render(g) click to toggle source
# File lib/gerbilcharts/surfaces/link_pivots.rb, line 15
def int_render(g)
  opts = {:class => "linkpivots", 'text-anchor' => 'middle' }

      win = g.newwin( "linkpivots", {:class => 'linkpivots' , :visibility => 'hidden' })
      g.setactivewindow(win)
  
  # count determines the bounds
  @bounds.top = @bounds.bottom - 20 * parent.modelgroup.count  - 10 
      if @bounds.top < 0  
           @bounds.top =0
      end 


  g.rectangle_r(@bounds)

      # start
      x = @bounds.left + @bounds.width/2 
      y = @bounds.top + 15

  parent.modelgroup.each_model_with_index do | mod, i|

            if mod.hasHrefPivot? 
                    opts.store(:href, mod.href_pivot)
                    opts.store(:base_href, mod.href_pivot)
            end

            opts.merge!( :class  => "legendtext")
            g.textout(x,y, "Drill down into #{mod.name}",opts)

            y += 20;
  
      end
    end