Class: YOWL::GraphvizUtility

Inherits:
Object
  • Object
show all
Defined in:
lib/yowl/util.rb

Class Method Summary collapse

Class Method Details

.embeddableSvg(graph_, log_ = false) ⇒ Object



209
210
211
212
213
214
215
216
217
218
219
# File 'lib/yowl/util.rb', line 209

def GraphvizUtility.embeddableSvg(graph_, log_ = false)
  if log_
    puts "Generated Dot is:"
    puts graph_.output(:dot => String)
  end

  svg = graph_.output(:svg => String)
  index = svg.index("<svg")
  
  return index ? svg[index..-1] : svg
end

.setDefaults(g) ⇒ Object



186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# File 'lib/yowl/util.rb', line 186

def GraphvizUtility.setDefaults(g)
 
  g[:rankdir] = "BT"

  #g.node[:peripheries] = 0
  g.node[:style] = "rounded,filled"
  g.node[:fillcolor] = "#0861DD" 
  g.node[:fontcolor] = "white"
  g.node[:fontname] = "Helvetica" 
  g.node[:shape] = "box"
  g.node[:fontsize] = 8
  g.node[:fixedsize] = false # Classes with long names need wider boxes
  #g.node[:width] = 1
  g.node[:height] = 0.4
    
  g.edge[:fontname] = "Helvetica"
  g.edge[:fontsize] = 7
  g.edge[:fontcolor] = "#0861DD"
  g.edge[:labeldistance] = 1
    
  return g
end