Class: MetricFu::Grapher

Inherits:
Object
  • Object
show all
Includes:
GchartGrapher
Defined in:
lib/graphs/grapher.rb,
lib/graphs/engines/bluff.rb,
lib/graphs/engines/gchart.rb

Constant Summary collapse

BLUFF_GRAPH_SIZE =
"1000x600"
BLUFF_DEFAULT_OPTIONS =
<<-EOS
  var g = new Bluff.Line('graph', "#{BLUFF_GRAPH_SIZE}");
  g.theme_37signals();
  g.tooltips = true;
  g.title_font_size = "24px"
  g.legend_font_size = "12px"
  g.marker_font_size = "10px"
EOS

Constants included from GchartGrapher

MetricFu::GchartGrapher::COLORS, MetricFu::GchartGrapher::GCHART_GRAPH_SIZE, MetricFu::GchartGrapher::NUMBER_OF_TICKS

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from GchartGrapher

#determine_y_axis_scale

Constructor Details

#initializeGrapher

Returns a new instance of Grapher.


5
6
7
8
# File 'lib/graphs/grapher.rb', line 5

def initialize
  self.class.require_graphing_gem
  @labels = {}
end

Instance Attribute Details

#labelsObject

Returns the value of attribute labels


3
4
5
# File 'lib/graphs/grapher.rb', line 3

def labels
  @labels
end

Class Method Details

.require_graphing_gemObject


10
11
12
# File 'lib/graphs/grapher.rb', line 10

def self.require_graphing_gem
  # to be overridden by charting engines
end

Instance Method Details

#get_metrics(metrics, date) ⇒ Object


14
15
16
# File 'lib/graphs/grapher.rb', line 14

def get_metrics(metrics, date)
  @labels.update( { @labels.size => date })
end