Sha256: 3123a65fae0e2a724972ffac2987961083ea3b06e10fbac3e8c02ace5529879c

Contents?: true

Size: 1.03 KB

Versions: 154

Compression:

Stored size: 1.03 KB

Contents

class <%= class_name.camelize %> < Avo::Dashboards::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

154 entries across 154 versions & 1 rubygems

Version Path
avo-2.11.0 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.10.3.pre.1 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.10.2 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.9.2.pre1 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.10.0 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.9.1.pre7 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.9.1.pre6 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.9.1.pre5 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.9.1.pre4 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.9.1.pre3 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.9.1.pre2 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.9.1.pre1 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.9.0 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.8.0 lib/generators/avo/templates/cards/chartkick_card_sample.tt