Class: BigBench::PostProcessor::Graphs::LineGraph
- Inherits:
-
Object
- Object
- BigBench::PostProcessor::Graphs::LineGraph
- Defined in:
- lib/bigbench/post_processor/graphs.rb
Overview
Encapsules the gruff line graph
Instance Attribute Summary collapse
-
#graph ⇒ Object
readonly
Returns the value of attribute graph.
-
#labels ⇒ Object
Returns the value of attribute labels.
Instance Method Summary collapse
- #add(title, x, y) ⇒ Object
-
#initialize(title, options = {}) ⇒ LineGraph
constructor
A new instance of LineGraph.
- #open ⇒ Object
- #write(file) ⇒ Object
Constructor Details
#initialize(title, options = {}) ⇒ LineGraph
Returns a new instance of LineGraph.
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/bigbench/post_processor/graphs.rb', line 29 def initialize title, = {} @graph = Gruff::Line.new([:size] || DEFAULT[:size]) @graph.title = title @graph.theme = [:theme] || DEFAULT[:theme] @graph.line_width = [:line_width] || DEFAULT[:line_width] @graph.dot_radius = [:dot_radius] || DEFAULT[:dot_radius] @graph.y_axis_label = [:y_axis_label] || DEFAULT[:y_axis_label] @graph.x_axis_label = [:x_axis_label] || DEFAULT[:x_axis_label] @x_axis_label_amount = [:x_axis_label_amount] || DEFAULT[:x_axis_label_amount] @folder = [:folder] || DEFAULT[:folder] Dir.mkdir @folder unless File.directory?(@folder) end |
Instance Attribute Details
#graph ⇒ Object (readonly)
Returns the value of attribute graph.
26 27 28 |
# File 'lib/bigbench/post_processor/graphs.rb', line 26 def graph @graph end |
#labels ⇒ Object
Returns the value of attribute labels.
27 28 29 |
# File 'lib/bigbench/post_processor/graphs.rb', line 27 def labels @labels end |
Instance Method Details
#add(title, x, y) ⇒ Object
43 44 45 46 |
# File 'lib/bigbench/post_processor/graphs.rb', line 43 def add title, x, y @x = x @graph.data(title, y) end |
#open ⇒ Object
54 55 56 |
# File 'lib/bigbench/post_processor/graphs.rb', line 54 def open `open #{File.join(@folder, @file)}` end |
#write(file) ⇒ Object
48 49 50 51 52 |
# File 'lib/bigbench/post_processor/graphs.rb', line 48 def write file @graph.labels = @labels || calculate_x_labels puts "Writing Graph to #{File.join(@folder, @file = file)}" @graph.write File.join(@folder, @file = file) end |