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.53.0 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.52.0 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.49.0 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.48.0 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.47.0 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.46.0 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.45.0 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.44.0 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.43.0 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.42.2 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.42.1 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.42.0 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.41.0 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.40.0 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.39.0 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.38.0 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.37.2 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.37.1 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.37.0 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.36.3 lib/generators/avo/templates/cards/chartkick_card_sample.tt