class Stepdown::BluffGraph

Constants

BLUFF_DEFAULT_OPTIONS
BLUFF_GRAPH_SIZE

Public Class Methods

create_graph() click to toggle source
# File lib/stepdown/bluff_graph.rb, line 19
    def self.create_graph
      stats, labels = self.collect_stats
      label_set = {}
      labels.each_with_index do |label, i|
        label_set.update({i => label})
      end

      content = <<-EOS
        #{BLUFF_DEFAULT_OPTIONS}
        g.title = 'Stepdown';
        g.data('Total scenarios', [#{stats[:number_scenarios].join(',')}]);
        g.data('Total steps', [#{stats[:total_steps].join(',')}]);
        g.data('Total steps per scenario', [#{stats[:steps_per_scenario].join(',')}]);
        g.data('Total unused steps', [#{stats[:unused_steps].join(',')}]);
        g.labels = #{label_set.to_json};
        g.draw();
      EOS

      File.open(File.join(Stepdown.output_directory, 'stepdown.js'), 'w') do 
        |f| f << content 
      end
    end