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.15.2.pre.1 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.15.1 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.15.0 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.14.3.pre.7.polytranslations1 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.14.3.pre.6.nosprockets lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.14.3.pre.5.nosprockets lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.14.3.pre.4.tosqlfix lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.14.3.pre.3.jsbundling lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.14.3.pre.2.tailwindcss lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.14.3.pre.1.branding lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.14.2 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.14.2.pre.1 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.14.1 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.14.1.pre.1 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.14.0 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.13.6.pre.2 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.13.6.pre.1 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.13.5.pre.2 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.13.5.pre.1 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.13.4.pre.1 lib/generators/avo/templates/cards/chartkick_card_sample.tt