Sha256: 297caff9b04f267eb14619119aeb443001b2018b78f50cc453ca04614190fe7a
Contents?: true
Size: 1.54 KB
Versions: 3
Compression:
Stored size: 1.54 KB
Contents
module Obst class Chart class DailyCount def initialize(**opts) @daily_gauge = Obst::DailyGauge.new(C: opts[:C]).lazy end def to_s labels, data = [], [] @daily_gauge.take(28 * 3).each do |time_count| labels << time_count.time.strftime('%F %a') data << time_count.count end <<~EOF # Daily count ```chart type: line width: 98% legendPosition: bottom labels: #{labels.reverse!} series: - title: current #{data[0]} data: #{data.reverse!} ``` EOF end end class DailyChange def initialize(**opts) @daily = Obst::GroupByDays.new(C: opts[:C]).lazy end def to_s labels = [] datas = {a: [], m: [], d: [], nil => []} @daily.take(28 * 3).each do |record| labels << record.date_wday datas.each_value{ |data| data << 0 } record.file_changes.each_value do |changes| datas[changes.final][-1] += 1 end end <<~EOF # Daily change ```chart type: line width: 98% legendPosition: bottom labels: #{labels.reverse!} series: - title: del data: #{datas[:d].reverse!} - title: nil data: #{datas[nil].reverse!} - title: mod data: #{datas[:m].reverse!} - title: new data: #{datas[:a].reverse!} ``` EOF end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
obst-0.1.7 | lib/obst/chart.rb |
obst-0.1.6 | lib/obst/chart.rb |
obst-0.1.5 | lib/obst/chart.rb |