Permalink
Browse files

[#27601841] Thermometer: always draw first sample

  • Loading branch information...
1 parent c55b640 commit 5a9754e56ee9c512cd8364c4c294f360b26b4703 @stepheneb stepheneb committed Apr 10, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/lab/components/thermometer.coffee
@@ -3,7 +3,8 @@ class Thermometer
constructor: (@dom_id="#thermometer", @max) ->
@dom_element = $(@dom_id)
@dom_element.addClass('thermometer')
- @samples = [0]
+ @samples = []
+ @first_sample = true
@last_draw_time = new Date().getTime()
@sample_interval_ms = 250
@last_draw_time -= @sample_interval_ms
@@ -43,7 +44,8 @@ class Thermometer
add_value: (new_value) ->
@samples.push new_value
- if this.time_to_redraw()
+ if this.time_to_redraw() || @first_sample
+ @first_sample = false
this.redraw()
@samples = []

0 comments on commit 5a9754e

Please sign in to comment.