Sha256: 56a39dc5aea59f97253bc6a422ad740b4e9d88e0df3d3df963281ce7bd3f1f4a

Contents?: true

Size: 884 Bytes

Versions: 6

Compression:

Stored size: 884 Bytes

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, 30, 60, 365, "TODAY", "MTD", "QTD", "YTD", "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

6 entries across 6 versions & 1 rubygems

Version Path
avo-2.7.1.pre.1 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.7.0 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.6.1.pre.2 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.6.1.pre.1 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.6.0 lib/generators/avo/templates/cards/chartkick_card_sample.tt
avo-2.5.2.pre.1 lib/generators/avo/templates/cards/chartkick_card_sample.tt