Sha256: f53d19df769db9922b791c43f173abb1b4d6bd4b0b46ac890a16e5fe8cde0a44

Contents?: true

Size: 1.04 KB

Versions: 93

Compression:

Stored size: 1.04 KB

Contents

class Avo::Cards::<%= class_name.camelize %> < Avo::Cards::ChartkickCard
  self.id = "<%= name.underscore %>"
  self.label = "<%= name.underscore.humanize %>"
  self.chart_type = :area_chart
  # self.description = "Some tiny description"
  # self.cols = 2
  # self.initial_range = 30
  # self.ranges = {
  #   "7 days": 7,
  #   "30 days": 30,
  #   "60 days": 60,
  #   "365 days": 365,
  #   Today: "TODAY",
  #   "Month to date": "MTD",
  #   "Quarter to date": "QTD",
  #   "Year to date": "YTD",
  #   All: "ALL",
  # }
  # self.chart_options = { library: { plugins: { legend: { display: true } } } }
  # self.flush = true

  def query
    points = 16
    i = Time.new.year.to_i - points
    base_data = Array.new(points).map do
      i += 1
      [i.to_s, rand(0..20)]
    end.to_h

    result [
      { name: "batch 1", data: base_data.map { |k, v| [k, rand(0..20)] }.to_h },
      { name: "batch 2", data: base_data.map { |k, v| [k, rand(0..40)] }.to_h },
      { name: "batch 3", data: base_data.map { |k, v| [k, rand(0..10)] }.to_h }
    ]
  end
end

Version data entries

93 entries across 93 versions & 1 rubygems

Version Path
avo-3.5.6 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-3.5.6.beta1 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-3.5.5 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-3.5.4 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-3.5.3 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-3.5.2 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-3.5.1 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-3.5.0 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-3.4.4 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-3.4.3 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-3.4.2 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-3.4.1 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-3.4.0 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-3.3.6 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-3.3.5 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-3.3.4 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-3.3.3 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-3.3.2 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-3.3.1 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-3.3.0 lib/generators/avo/templates/cards/chartkick_card_sample.tt