Sha256: 71f874fb1b56239b7c1be2d9eafbcc18bfb868a2f0d5bd460aea0beb86282998
Contents?: true
Size: 1.39 KB
Versions: 1
Compression:
Stored size: 1.39 KB
Contents
# Author:: A.K.M. Ashrafuzzaman (mailto:ashrafuzzaman.g2@gmail.com) # License:: MIT-LICENSE # The purpose of the filter module is adapt the chart features form chartify require 'chartify/factory' module QueryReport module ChartAdapterModule def chart(chart_type, chart_title, &block) chart_adapter = ChartAdapter.new(filtered_query, chart_type, chart_title) block.call(chart_adapter) @charts << chart_adapter.chart ap chart_adapter.chart.data ap chart_adapter.chart end class ChartAdapter attr_accessor :query, :chart_type, :chart delegate :data, :data=, :columns, :columns=, :label_column, :label_column=, to: :chart def initialize(query, chart_type, chart_title) @query = query @chart_type = chart_type @chart = "Chartify::#{chart_type.to_s.camelize}Chart".constantize.new @chart.title = chart_title # do |chart| # chart.data = [{hours_remain: 100, estimated_hours_remain: 100, day: 3.days.ago.to_date}, # {hours_remain: 50, estimated_hours_remain: 45, day: 2.days.ago.to_date}, # {hours_remain: 5, estimated_hours_remain: 10, day: 1.days.ago.to_date}] # chart.columns = {hours_remain: 'Hours remaining', estimated_hours_remain: 'Estimated hours remaining'} # chart.label_column = :day # end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
query_report-1.1.0 | lib/query_report/chart_adapter.rb |