Sha256: 0fa5b3b18af73e88a166f8e82cb6c28bdea5c532d7ce61649d9159ae28b3b50c

Contents?: true

Size: 675 Bytes

Versions: 1

Compression:

Stored size: 675 Bytes

Contents

require 'rubygems'
require 'active_record'
require 'active_support'
require 'spec/test_model'

$LOAD_PATH << File.expand_path("../lib", File.dirname(__FILE__))
require 'db_graph/line'

1000.times{Product.create!(:created_at=>Time.parse('2008-01-01')+rand(1.year),  :updated_at=>Time.parse('2008-01-01')+rand(1.year))}
500.times{Product.create!(:created_at=>Time.parse('2008-10-01')+rand(2.months), :updated_at=>Time.parse('2008-10-01')+rand(2.months))}

[:weeks, :months].each do |interval|
  g = DBGraph::Line.new(interval, :size=>'445x400', :show_legend=>(interval!=:weeks))
  g.add Product, :created_at
  g.add Product, :updated_at
  puts "![#{interval}](#{g.to_url})"
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
db_graph-0.1.6 exmaples/multi_line_graph.rb