Class: PostRunner::ChartView

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

Instance Method Summary collapse

Methods included from ViewWidgets

#frame, #view_widgets_style

Constructor Details

#initialize(activity) ⇒ ChartView

Returns a new instance of ChartView.



9
10
11
# File 'lib/postrunner/ChartView.rb', line 9

def initialize(activity)
  @activity = activity
end

Instance Method Details

#div(doc) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/postrunner/ChartView.rb', line 23

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

#head(doc) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/postrunner/ChartView.rb', line 13

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