Sha256: d2ea9afb88e85139939ae899ab9dd7afd55dfc7c6e21513406ebb92cb637cc37
Contents?: true
Size: 1.22 KB
Versions: 3
Compression:
Stored size: 1.22 KB
Contents
class Spree::SalesTaxReport::MonthlySalesTaxComparisonChart def initialize(result) @time_dimension = result.time_dimension @grouped_by_zone_name = result.observations.group_by(&:zone_name) @time_series = [] if @grouped_by_zone_name.first.present? @time_series = @grouped_by_zone_name.values.first.collect { |observation| observation.send(@time_dimension) } end @chart_series = @grouped_by_zone_name.map { |zone_name, observations| { type: 'column', name: zone_name, data: observations.collect(&:sales_tax) } } end def to_h { id: 'sale-tax', json: { chart: { type: 'column' }, title: { useHTML: true, text: "<span class='chart-title'>Monthly Sales Tax Comparison</span><span class='fa fa-question-circle' data-toggle='tooltip' title='Compare the Sales tax collected from different Zones'></span>" }, xAxis: { categories: @time_series }, yAxis: { title: { text: 'Value($)' } }, tooltip: { valuePrefix: '$' }, legend: { layout: 'vertical', align: 'right', verticalAlign: 'middle', borderWidth: 0 }, series: @chart_series } } end end
Version data entries
3 entries across 3 versions & 2 rubygems