bernii / gauge.js

100% native and cool looking JavaScript gauge
MIT License
1.42k stars 391 forks source link

Gauges displaying two pointers #88

Closed mrosendin closed 8 years ago

mrosendin commented 8 years ago

I'm having a rendering issue in my Rails app. The biggest issue is that there's no error message for this unexpected behavior. The issue occurs when I refresh the browser window. I've determined that the issue is not turbolinks-related to Rails.

mrosendin commented 8 years ago

The way to fix this is described here. For me, the issue occurred when the angle was set to 0.05. Also, I am using AJAX requests to set the gauge values. I had to initialize my gauges after making the GET request like so (excuse the poor formatting, which is much needed for this coffeescript):

$.get '/api/participants', (data) -> participantGauge = new Gauge(participantTarget).setOptions(opts1) participantGauge.maxValue = 600 participantGauge.animationSpeed = 32 participantGauge.set data.count

instead of

userGauge = new Gauge(userTarget).setOptions(opts1) userGauge.maxValue = 600 userGauge.animationSpeed = 32 $.get '/api/users', (data) -> userGauge.set data.count

Hope this helps someone.