Sha256: 4477d1ff991e533aa435ef59fe00f4bab77d07822cfef69927b4c5f65552c35e

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

module Rawbotz
  class ChartMonthDataset
    attr_accessor :date, :value, :length, :darkness
    def initialize date, value, length, darkness
      @date   = date
      @value  = value
      @length = length
      @darkness = darkness
    end

    def to_s
      monthname = Date::MONTHNAMES[@date.month]
      <<-eos
      {
      label: "Sales #{monthname[0..2]} #{@date.year}",
      fill: true,
      lineTension: 0.2,
      backgroundColor: "rgba(175,155,155,0)",
      borderColor: "rgba(35,42,102,#{@darkness})",
      borderCapStyle: 'round',
      pointBorderColor: "rgba(0,0,0,#{@darkness})",
      pointBackgroundColor: "#fff",
      pointBorderWidth: 1,
      pointHoverRadius: 8,
      pointHoverBackgroundColor: "rgba(99,102,152,1)",
      pointHoverBorderColor: "rgba(210,210,210,1)",
      pointHoverBorderWidth: 2,
      pointRadius: 2,
      pointHitRadius: 10,
      data : [#{([@value] * @length).join(',')}]
      },
      eos
      #/*data : [#{plot_data.values.map{|v| v[:stock].to_i}.join(',')}]*/
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rawbotz-0.2.0 lib/rawbotz/chart_month_dataset.rb
rawbotz-0.1.5 lib/rawbotz/chart_month_dataset.rb
rawbotz-0.1.4 lib/rawbotz/chart_month_dataset.rb