module Droid::Monitor::GoogleApiTemplate

Public Class Methods

create_graph(data_file_path, graph_opts = {}) click to toggle source
# File lib/droid/monitor/report/google_api_template.rb, line 9
def create_graph(data_file_path, graph_opts = {})
  template_path = File.expand_path('templates/template_google_api_format.haml', __dir__)
  default_graph_settings = { miniValue: 0, maxValue: 400, width: 800, height: 480 }

  template = Tilt::HamlTemplate.new(template_path)
  template.render(Object.new,
                  title: graph_opts[:title],
                  header1: graph_opts[:header1],
                  data_file_path: data_file_path,
                  graph_settings: graph_opts[:graph_settings] || default_graph_settings)
end