Sha256: 0ccf304501254eb5b452969ef33e5ca821322c87190282e76167762d2204d3c6
Contents?: true
Size: 821 Bytes
Versions: 2
Compression:
Stored size: 821 Bytes
Contents
# path setting magic for example directory only $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require "chart_js" require "willow_run" require "sinatra" get "/update_source", provides: 'text/event-stream' do stream(:keep_open) do |out| loop do out << ChartJS.data do { label: Time.now.strftime("%r"), data: WillowRun::Status.new.getinfo.agrctlrssi } end sleep 2 end end end get "/" do chart = ChartJS.line do data do labels Array.new dataset WillowRun::Status.new.getinfo.ssid do color :random data Array.new point do radius 0 hit_radius 2 end line do tension :false end end end event_stream "/update_source" do push end end chart.to_html end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
chart_js-1.1.1 | examples/wifi_signal_chart.rb |
chart_js-1.1.0 | examples/wifi_signal_chart.rb |