diff options
author | Chris Schlaeger <chris@linux.com> | 2016-09-20 17:01:46 +0200 |
---|---|---|
committer | Chris Schlaeger <chris@linux.com> | 2016-09-20 17:01:46 +0200 |
commit | 4f03769a7df1055674e3c9469565f9b952e3ed38 (patch) | |
tree | d6da026c57c9b54836acf8d8a323c09bdb444ecc /lib | |
parent | 77f6ec45eedad67257df2d053247410d67414c9a (diff) | |
download | postrunner-4f03769a7df1055674e3c9469565f9b952e3ed38.zip |
New: Limit HRV data graph to +/-30.
Larger values are typically caused the measurement errors.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/postrunner/ChartView.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/postrunner/ChartView.rb b/lib/postrunner/ChartView.rb index ccf4a7d..806ded3 100644 --- a/lib/postrunner/ChartView.rb +++ b/lib/postrunner/ChartView.rb @@ -63,7 +63,9 @@ module PostRunner :unit => 'ms', :graph => :line_graph, :colors => '#900000', - :show => @hrv_analyzer.has_hrv_data? + :show => @hrv_analyzer.has_hrv_data?, + :min_y => -30, + :max_y => 30 }, { :id => 'hrv_score', @@ -327,7 +329,14 @@ EOT " inverseTransform: function (v) { return -v; } }" else # Set the minimum slightly below the lowest found value. - s << ", yaxis: { min: #{0.9 * min_value} }" if min_value > 0.0 + if min_value > 0.0 && !chart[:min_y] + s << ", yaxis: { min: #{0.9 * min_value} }" + end + end + if chart[:min_y] + s << ", yaxis: { #{chart[:min_y] ? "min: #{chart[:min_y]}" : '' } " + + "#{chart[:min_y] && chart[:max_y] ? ', ' : ''}" + + "#{chart[:max_y] ? "max: #{chart[:max_y]}" : '' } }" end s << "});\n" s << lap_mark_labels(chart_id, start_time) |