Class: PostRunner::ChartView

Inherits:
Object
  • Object
show all
Includes:
ViewWidgets
Defined in:
lib/postrunner/ChartView.rb

Instance Method Summary collapse

Methods included from ViewWidgets

#button, #footer, #frame, #titlebar, #view_widgets_style

Constructor Details

#initialize(activity, unit_system) ⇒ ChartView

Returns a new instance of ChartView.



21
22
23
24
25
# File 'lib/postrunner/ChartView.rb', line 21

def initialize(activity, unit_system)
  @activity = activity
  @unit_system = unit_system
  @empty_charts = {}
end

Instance Method Details

#div(doc) ⇒ Object



37
38
39
40
41
42
43
44
45
# File 'lib/postrunner/ChartView.rb', line 37

def div(doc)
  chart_div(doc, 'pace', "Pace (#{select_unit('min/km')})")
  chart_div(doc, 'altitude', "Elevation (#{select_unit('m')})")
  chart_div(doc, 'heart_rate', 'Heart Rate (bpm)')
  chart_div(doc, 'run_cadence', 'Run Cadence (spm)')
  chart_div(doc, 'vertical_oscillation',
            "Vertical Oscillation (#{select_unit('cm')})")
  chart_div(doc, 'stance_time', 'Ground Contact Time (ms)')
end

#head(doc) ⇒ Object



27
28
29
30
31
32
33
34
35
# File 'lib/postrunner/ChartView.rb', line 27

def head(doc)
  [ 'jquery/jquery-2.1.1.min.js', 'flot/jquery.flot.js',
    'flot/jquery.flot.time.js' ].each do |js|
    doc.script({ 'language' => 'javascript', 'type' => 'text/javascript',
                 'src' => js })
  end
  doc.style(style)
  doc.script(java_script)
end