Sha256: 6d64eb1c667cd9bc0899f0c07d7dafdacf3b00c880e9d5b567a87e2c89ca0622

Contents?: true

Size: 1.34 KB

Versions: 28

Compression:

Stored size: 1.34 KB

Contents

#!/usr/bin/ruby

$:.unshift( "../lib" );
require "graphviz"

GraphViz::new( "ER", :type => "graph", :use => "neato" ) { |graph|
  graph.node[:shape] = "box"
  graph.course; graph.institute; graph.student
  
  graph.node[:shape] = "ellipse"
  graph.name0(:label => "name")
  graph.name1(:label => "name")
  graph.name2(:label => "name")
  graph.code; graph.grade; graph.number
  
  graph.node[:shape] = "diamond"
  graph.node[:style] = "filled"
  graph.node[:color] = "lightgrey"
  graph.ci( :label => "C-I" )
  graph.sc( :label => "S-C" )
  graph.si( :label => "S-I" )

  graph.name0 << graph.course;
  graph.code << graph.course;
  
  (graph.course << graph.ci).set { |e|
    e.label = "n"
    e.len = "1.00"
  }
  
  e = (graph.ci << graph.institute)
  e.label = "1"
  e[:len] = "1.00"
  
  graph.institute << graph.name1;
  
  e = (graph.institute << graph.si)
  e[:label] = "1"
  e[:len] = "1.00"
  
  e = (graph.si << graph.student)
  e[:label] = "n"
  e[:len] = "1.00"
  
  graph.student << graph.grade
  graph.student << graph.name2
  graph.student << graph.number
  
  e = (graph.student << graph.sc)
  e[:label] = "m"
  e[:len] = "1.00"
  
  e = (graph.sc << graph.course)
  e[:label] = "n"
  e[:len] = "1.00"

  graph[:label] = "\\n\\nEntity Relation Diagram\\ndrawn by NEATO";
  graph[:fontsize] = "20";
}.output( :path => '/usr/local/bin/', :png => "#{$0}.png" )

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
ruby-graphviz-1.0.7 examples/sample19.rb
ruby-graphviz-1.0.6 examples/sample19.rb
ruby-graphviz-1.0.5 examples/sample19.rb
ruby-graphviz-1.0.4 examples/sample19.rb
ruby-graphviz-1.0.3 examples/sample19.rb
ruby-graphviz-1.0.2 examples/sample19.rb
ruby-graphviz-1.0.1 examples/sample19.rb
ruby-graphviz-1.0.0 examples/sample19.rb
ruby-graphviz-0.9.21 examples/sample19.rb
ruby-graphviz-0.9.20 examples/sample19.rb
ruby-graphviz-0.9.19 examples/sample19.rb
ruby-graphviz-0.9.18 examples/sample19.rb
ruby-graphviz-0.9.17 examples/sample19.rb
ruby-graphviz-0.9.16 examples/sample19.rb
ruby-graphviz-0.9.15 examples/sample19.rb
ruby-graphviz-0.9.14 examples/sample19.rb
ruby-graphviz-0.9.13 examples/sample19.rb
ruby-graphviz-0.9.12 examples/sample19.rb
ruby-graphviz-0.9.11 examples/sample19.rb
ruby-graphviz-0.9.10 examples/sample19.rb