Sha256: 2c05ec21fbe03508500dac4daa8a8bafaf96a83d2aeb8d76371c93edce80e2bc
Contents?: true
Size: 726 Bytes
Versions: 3
Compression:
Stored size: 726 Bytes
Contents
require "vifi/version" require 'willow_run' require 'chart_js' module Vifi def self.build_chart chart = ChartJS.line do data do labels [] dataset WillowRun::Status.new.getinfo.ssid do color :random data [] end end end chart.to_html end def self.build_updater(source: '/update_source', chart_obj: 'line_chart') # why not "<script> var source = new EventSource('#{source}'); var json; source.onmessage = function(e) { json = JSON.parse(e.data); #{chart_obj}.data.datasets[0].data.push(json.value); #{chart_obj}.data.labels.push(json.label); #{chart_obj}.update(); }; </script> " end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
vifi-1.0.6 | lib/vifi.rb |
vifi-1.0.5 | lib/vifi.rb |
vifi-1.0.4 | lib/vifi.rb |