glejeune / ruby-graphviz Goto Github PK
View Code? Open in Web Editor NEW[MIRROR] Ruby interface to the GraphViz graphing tool
Home Page: https://gitlab.com/glejeune/ruby-graphviz
License: Other
[MIRROR] Ruby interface to the GraphViz graphing tool
Home Page: https://gitlab.com/glejeune/ruby-graphviz
License: Other
For example, a nodename of "<Foo".
Even though the dot command succeeds, tests treat pango warning as error and makes the tests to fail. I thin pango warning should not be treated as an error. Probably it is just doing a pattern match for "error" keyword.
assert_sample_file_has_no_output' ./test/test_examples.rb:97:in
test_sample69']:(process:14361): Pango-WARNING **: error opening config file
'/root/.pangorc': Permission denied
.
is not true.
Ref http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=676393#24
Is it possible to create graphs with fixed positions and using neato?
If i create nodes and set the pos attribute with values like "10,10!" and in addition pin=true, then the output doesnt use these coordinates except for the canon format.
Is there a way to append the -n value to the call of neato? That would use no layout engine then.
$ ruby2gv -Tpng -
oruby2gv.png lib/ruby-graphviz.rb
/usr/bin/ruby2gv:119:in parseFile': undefined method
each' for "require 'graphviz'\n":String (NoMethodError)
from /usr/bin/ruby2gv:43:in parse' from /usr/bin/ruby2gv:235:in
Version: ruby-graphviz-1.0.8
Hi.
When I try to run git2gv
inside a git repository I get the following output:
GraphViz#add_node is deprecated, please use GraphViz#add_nodes
GraphViz#add_node is deprecated, please use GraphViz#add_nodes
GraphViz#add_node is deprecated, please use GraphViz#add_nodes
GraphViz#add_node is deprecated, please use GraphViz#add_nodes
fatal: ambiguous argument 'master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions
GraphViz#add_edge is deprecated, please use GraphViz#add_edges
GraphViz#add_edge is deprecated, please use GraphViz#add_edges
GraphViz#add_edge is deprecated, please use GraphViz#add_edges
/home/<username>/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- xml/xslt (LoadError)
from /home/<username>/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /home/<username>/.rvm/gems/ruby-1.9.3-p0@global/gems/ruby-graphviz-1.0.4/lib/graphviz/nothugly.rb:11:in `<top (required)>'
from /home/<username>/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /home/<username>/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /home/<username>/.rvm/gems/ruby-1.9.3-p0@global/gems/ruby-graphviz-1.0.4/lib/graphviz.rb:550:in `block in output'
from /home/<username>/.rvm/gems/ruby-1.9.3-p0@global/gems/ruby-graphviz-1.0.4/lib/graphviz.rb:504:in `each'
from /home/<username>/.rvm/gems/ruby-1.9.3-p0@global/gems/ruby-graphviz-1.0.4/lib/graphviz.rb:504:in `output'
from /home/<username>/.rvm/gems/ruby-1.9.3-p0@global/gems/ruby-graphviz-1.0.4/bin/git2gv:53:in `run'
from /home/<username>/.rvm/gems/ruby-1.9.3-p0@global/gems/ruby-graphviz-1.0.4/bin/git2gv:168:in `<top (required)>'
from /home/<username>/.rvm/gems/ruby-1.9.3-p0@global/bin/git2gv:19:in `load'
from /home/<username>/.rvm/gems/ruby-1.9.3-p0@global/bin/git2gv:19:in `<main>'
What is the reason of this issue? How can I force ruby-graphviz to work correctly?
Thanks.
Debian GNU/Linux 6.0.3;
Ruby 1.9.3-p0;
Graphviz 2.26.3;
Ruby-graphviz 1.0.4.
When switching to passenger, we noticed, that our referenced node image paths where empty (white). Strange is, when running that same function via IRB, the images where included into the diagram correctly.
After hours of search, we found out, that Graphviz reads 2 environment variables SERVER_NAME and GV_FILE_PATH.
http://www.graphviz.org/doc/info/command.html#d:GV_FILE_PATH
If SERVER_NAME is present (which apache sets automatically), than graphviz will not load any image from standard path. ->
Warning: file loading is disabled because the environment contains:
and there is no GV_FILE_PATH variable.
Warning: "/tmp/pp-4.png" was not found as a file or as a shape library member
Warning: No or improper image="/tmp/pp-4.png" for node "user1"
We "fixed" that by using a custom shell-out function (instead of using Graphviz#output)
tempfile = Tempfile.new(["graph",".dot"])
tempfile.write graph.to_s
tempfile.close
pngfile = Tempfile.new(["graph",".png"])
pngfile.binmode
cmd = "unset SERVER_NAME; circo #{tempfile.path} -Tpng > #{pngfile.path}"
`#{cmd}`
blob = File.open(pngfile,"rb").read
if there is an option to remove that env var via another switch in Graphviz#output that would be great.
Otherwise, this issue description might save other people some time. :)
hi,
I was trying to convert a dot file into a Graphviz graph object using Graphviz.parse(file).
this error was thrown:
RuntimeError: Error from -f /Library/Ruby/Gems/1.8/gems/ruby-graphviz-0.9.20/lib/ext/gvpr/dot2ruby.g -a "-" /Users/dana/Desktop/trial.dot: sh: - : invalid option Usage: sh [GNU long option] [option] ... sh [GNU long option] [option] script-file ... GNU long options: --debug --debugger --dump-po-strings --dump-strings --help --init-file --login --noediting --noprofile --norc --posix --protected --rcfile --restricted --verbose --version --wordexp Shell options: -irsD or -c command or -O shopt_option (invocation only) -abefhkmnptuvxBCHP or -o option
method output_from_command in utils.rb at line 74
method eval in dot2ruby.rb at line 46
method parse in graphviz.rb at line 681
assert_sample_file_has_no_output' ./test/test_examples.rb:97:in
test_sample43']:84 tests, 221 assertions, 11 failures, 1 errors
Even though dot is already in PATH. Please fix these tests.
$ which dot
/usr/bin/dot
asm = GraphViz::new("My ASM", hOpts = {:output => "png"})
I tried all sorts of combinations to avoid this warning, but none of them worked.
Could you give an example of the "correct" way of doing this?
This is due to a limitation where when run via backquote or execute strings a command should have its complete name with extension. so running dot -Tpng
will fail on windows. Instead dot.exe -Tpng
will work.
Here is a patched find_executable() method that should work on *NIX and Windows (grab it here also: http://gist.github.com/252527 )
def find_executable(bin = @prog, *paths) #:nodoc:
paths = ENV['PATH'].split(File::PATH_SEPARATOR) if paths.empty?
paths.each do |path|
file = File.join(path,bin)
if File.executable?(file) then
return file
elsif RUBY_PLATFORM =~ /mswin|mingw/
found_ext = (ENV['PATHEXT'] || '.exe;.bat;.com').split(";").find {|ext| File.executable?(file + ext) }
return file + found_ext if found_ext
end
end
return nil
end
require 'rubygems'
require 'graphviz'
# Create a new graph
g = GraphViz.new( :G, :type => :digraph )
# Create two nodes
hello = g.add_node( "Hello" )
hello.color = nil
world = g.add_node( "World" )
# Create an edge between the two nodes
g.add_edge( hello, world )
# Generate output image
g.output( :png => "hello_world.png" )
With 0.9.21, this works; with 1.0.4, this raises an exception:
graphviz/attrs.rb:62:in `[]=': Invalide value `` for attribute `color` : undefined method `empty?' for nil:NilClass (AttributeException)
This breaks backward compatibility.
find I need the following modification in order to run on cygwin. Please consider including it.
--- /usr/lib/ruby/gems/1.8/gems/ruby-graphviz-0.9.10/lib/graphviz.rb.orig 2010-03-20 21:54:09.281250000 -0700
+++ /usr/lib/ruby/gems/1.8/gems/ruby-graphviz-0.9.10/lib/graphviz.rb 2010-03-20 22:09:51.109375000 -0700
@@ -470,7 +470,12 @@
if IS_JRUBY
xCmd = "#{cmd} -q#{@errors} #{xExternalLibraries} #{xOutputWithFile} #{xOutputWithoutFile} #{t.path}"
else
cygpath -w #{t.path}
.chomp + "'"end
output_from_command( xCmd )
========end patch
Have Graphvis compile upon gem installation so that getting this gem to run on services such as heroku can be easy =D
obruening sent you a message.
Subject:
hi greg,
ruby-graphiz autogenerates ids for nodes and edges. is it possible to assign ids manually ?
Adding an edge with a numeric label fails with the following error:
ruby-graphviz-1.0.8/lib/graphviz/types/lbl_string.rb:9:in
match': can't convert Fixnum to String (TypeError)`
The last line causes the error in irb:
graph = GraphViz.digraph(:G)
a = graph.add_nodes('a')
b = graph.add_nodes('b')
graph.add_edges(a, b, label: 5)
They're perfectly reasonable names for the (original) special case. Please remove the nagging warnings.
Also, it's considered bad style for a library routine to write to standard output or standard error. Indicate an error with a return value or an exception, but you shouldn't assume that output streams are available for your use.
Using ruby 1.9.2p290 and ruby-graphviz 1.0.3, I noticed that ruby-graphviz
presented the content of graphml tags within square brackets, and with new, escaped quotes.
So
'text'
in graphml became
'["text"]'
in dot and hence
'["text"]'
<node id="n0">
<data key="nm">a</data>
</node>
<node id="n1">
<data key="nm">b</data>
</node>
<edge source="n0" target="n1"/>
This behaviour can easily be corrected by redefining the method graphml_graph_node_data in
GraphViz::GraphML.
class GraphViz
class GraphML
def graphml_graph_node_data( node )
# drop this
#@current_node[@attributs[:nodes][node.attributes['key']][:name]] = node.texts().to_s
# add this
@current_node[@attributs[:nodes][node.attributes['key']][:name]] = node.texts().join(sep='\n',)
end
end
Bye
Ernesto Torresin (EWK)
PS I like this library. Thank you for it.
Debian policy requires every program in /usr/bin to have a man page, so I wrote man pages for these executables. You can see them at http://anonscm.debian.org/gitweb/?p=pkg-ruby-extras/ruby-graphviz.git;a=tree;f=debian;h=131d5d236f5eab223cd98bf07e906aa8d071f318;hb=HEAD
You can convert these to man page by running pod2man. pod2man options I used can be seen at http://anonscm.debian.org/gitweb/?p=pkg-ruby-extras/ruby-graphviz.git;a=blob;f=debian/rules;h=36d91ce6dda36509991107690b03964b3098f64d;hb=HEAD
If you like it, feel free to include it in your gem so that everyone using the gem benefits.
Hi
I was experimenting a bit with colors and colorlist and was wondering if it is possible to define a color list using rgb colors??
e.g.:
node[:color] = "red:white" # works
node[:color] = "#FF0000:#FFFFFF" # raises error
node[:color] = "#FFFFFF:FFFFFF" # raises error
I think according to the documentation of colorlist, the second one should work. Did I misinterpreted the docs (http://www.graphviz.org/doc/info/attrs.html#k:colorlist) or is it not yet supported/bug in ruby-graphviz?
I have a dot output string that I would like to parse into a Ruby GraphViz object and then set graph/node/edge properties on it and add more nodes.
hello_goodnight = GraphViz::new( "" )
hello_goodnight.node[:style] = "rounded"
hello_goodnight.node[:shape] = "box"
hello_world = hello_goodnight.add_graph("hello_world")
hello = hello_world.add_nodes("Hello")
world = hello_world.add_nodes("World")
hello_world.add_edges(hello, world)
goodnight_all = hello_goodnight.add_graph("goodnight_all")
goodnight = goodnight_all.add_nodes("Goodnight")
all = goodnight_all.add_nodes("All")
goodnight_all.add_edges(goodnight, all)
#This gives an output with the style and shape in the global node section
puts hello_goodnight.output( :xdot => String )
#This does not bring in the style and shape
g = GraphViz.parse_string( hello_goodnight.output( :dot => String ) )
#Try setting it again
g.node[:style] = "rounded"
g.node[:shape] = "box"
hello_world = g.get_graph("hello_world")
foo = hello_world.add_nodes('Foo')
bar = hello_world.add_nodes('Bar')
hello_world.add_edges(foo, bar)
# The style and shape are not added to the global node section..
# the style/shape is listed inside the each previously created node
# Hello, World, Goodnight, All are still rounded box style
puts g.output( :xdot => String )
Foo and Bar do not have the rounded box style.
This, however, does work (by putting in the updated subgraph node settings):
g = GraphViz.parse_string( hello_goodnight.output( :dot => String ) )
hello_world = g.get_graph("hello_world")
hello_world.node[:style] = "rounded"
hello_world.node[:shape] = "box"
foo = hello_world.add_nodes('Foo')
bar = hello_world.add_nodes('Bar')
hello_world.add_edges(foo, bar)
puts g.output( :xdot => String )
But I would rather not set rounded box on every single subgraph. I'd rather set it globally.
Any ideas on how to get these properties to show up in the global node section?
I have a graph with one central element and different surrounding elements, all linked to the center element.
My output file is a 10k pixel wide image with two rows. One with the center element, and one with all the surrounding elements.
I can't find any documentation how to change the layout so that the center element is indeed in the center of a circle, built with the surrounding elements.
There is an unflatten preprocessor in the graphviz package, maybe this is the solution, but i can't figure it out how to use it inside my script...
Or is there anything else i do not see?
I am working on generating Statecharts using ruby. One of the important features of these graphs is that sets of nodes can be connected to other sets of nodes with edges. The sets of nodes are themselves drawn in a box (called a superstate sometimes).
Graphviz can be coaxed to accomplish this. This stack overflow article shows the solution: http://stackoverflow.com/questions/2012036/graphviz-how-to-connect-subgraphs
My request is that if the ruby-graphviz user creates subgraphs that are clusters, and connects them together with an edge, the little hack above in the stackoverflow article is used to draw directly from one cluster to another. The ltail and lhead attributes would be generated automatically by ruby-graphviz.
initial = g.subgraph("cluster initial startup")
show_toggle_prompt = initial.add_node( "show_toggle_prompt" )
blink_info = initial.add_node( "blink_info" )
initial.add_edge(show_toggle_prompt, blink_info)
select_prompts = g.subgraph("cluster selector prompts")
g.add_edge(initial, select_prompts) # this creates an edge between the two subgraphs
What do you think?
Best,
John
If the xml file has additional metadata.
See this file for example:
http://pastebin.com/8Tc36DjL
I created this using yEd.
It needs to ignore extra information like the <y:ShapeNode> tags.
I have a ugly hack for another ruby .graphml parser here:
https://github.com/DamianPoor/ruby-graphml/blob/master/lib/ruby-graphml.rb
Perhaps this can be adapted to fix this issue as well.
This should return a dot-format string without executing the dot command:
str = GraphViz.new(:G) {|g| g.hello - g.world }.output("none" => String)
I also asked the question on Stack Overflow:
http://stackoverflow.com/questions/2941162/ruby-graphviz-binary-tree-record
I basically just want to know how to connect to node ports as opposed to just the node in general.
See Section 3 of the DOT guide if you don't know what I'm talking about: http://www.graphviz.org/pdf/dotguide.pdf
You can also see the example in my Stack Overflow question.
Thanks,
Jason
In the .../1.8/gems/ruby-graphviz-0.9.6/lib/graphviz.rb method escape_path_containing_blanks
line 714
def escape_path_containing_blanks(path)
path.gsub!(File::ALT_SEPARATOR, File::SEPARATOR)
throws an Exception on my machine since File::ALT_SEPARATOR
A simple workaround is:
def escape_path_containing_blanks(path)
path.gsub!(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
I'm using ubuntu 9.10, JRuby 1.4.0
Because pipes are opened in text mode by default, the output for binary types like PNG is mangled.
To fix this issue simply call the following line in the output_and_errors_from_command method:
stdin.binmode
Do this for both ways (Open3#popen3 and IO#popen). Note that it will also affect text types but should really not be an issue because \n is a valid newline for SVG and other text formats.
Regards,
Pascal
If you set the path option, the supplied path is never being parsed as a possible location. The find_executable is being called empty, and the *paths hash doesn't exist anywhere, so it's ALWAYS empty.
Replacing line graphviz.rb:383 with fix below the issue for me, but will likely need to be checked and generalized.
FIX
cmd = find_executable( @prog, @path )
EXISTING
cmd = find_executable( )
if cmd == nil
raise StandardError, "GraphViz not installed or #{@prog} not in PATH. Install GraphViz or use the 'path' option"
end
def find_executable(bin = @prog, *paths) #:nodoc:
paths = ENV['PATH'].split(File::PATH_SEPARATOR) if paths.empty?
paths.each do |path|
file = File.join(path,bin)
if File.executable?(file) then
return file
elsif RUBY_PLATFORM =~ /mswin|mingw/
found_ext = (ENV['PATHEXT'] || '.exe;.bat;.com').split(";").find {|ext| File.executable?(file + ext) }
return file + found_ext if found_ext
end
end
return nil
end
I want to add a to an edge, so the string will appear next to the edge, but the documentation does not explain how to do this. The code shows that you can pass in a hash of edge attributes, but I am not sure of how to name those attributes.
Git cloned. Went to examples/. Ran ruby sample01.rb but generated empty sample01.rb.png (no bytes). Same with 02. Did not try the rest. Suggestions?
I've already created an issue in rails for this so creating one here as well to link them together somewhat. Also copying the main body from my initial issue post below.
rails/rails#9355
If ruby-graphviz is in the Gemfile, autoloading of generic ActiveSupport::Concerns fails. By generic I mean ones that aren't namespaced within a class.
I have an example application with instructions on how to exhibit the problem below.
https://github.com/brocktimus/rails_graphviz_example
This shows that with or without ruby-graphviz ActiveSupport::Concerns within a class are fine.
# app/model/post/extras.rb
module Post::Extras
extends ActiveSupport::Concern
end
If they have been required manually first generic ones work (such as in an initializer).
# app/model/concerns/constants.rb
module Constants
extends ActiveSupport::Concern
end
If they have not been required and ruby-graphviz is in the bundle everything explodes when the model is used.
I tried to look into what ruby-graphviz was doing that could cause this, but I couldn't see anything obvious.
I'm making an interactive graph with javascript using Raphael.js, and I haven't been able to find where I can get the locations of the Graphvis DOT nodes...
How do I do that?
Making an edge between a note and a subgraph doesn't seem to work. Instead a new node is generated with the name of the subgraph.
c0 = g.add_graph( "cluster0", "label" => "cluster #1" )
a0 = c0.add_nodes( "a0" )
c1 = g.add_graph( "cluster1", "label" => "cluster #2" )
b0 = c1.add_nodes( "b0" )
g.add_edges(c0,c1)
g.add_edges(c0,b0)
is generated to
digraph G {
subgraph cluster0 {
label = "cluster #1";
a0 [label = "a0"];
}
subgraph cluster1 {
label = "cluster #2";
b0 [label = "b0"];
}
cluster0 [label = "cluster0"];
cluster1 [label = "cluster1"];
cluster0 -> cluster1
cluster0 -> b0
}
I was trying something like this
The escaping code thinks that a colon ":" is a valid dot identifier when it isn't.
(fantastic library btw!)
require "graphviz"
# ok
master = GraphViz::new(:G)
cl1 = master.add_graph('cluster_cl1')
puts master.inspect
# digraph G {
# subgraph cluster_cl1 {
# }
# }
# add_graph fails when passed a GraphViz object
master = GraphViz::new(:G)
cl1 = GraphViz::new('cluster_cl1')
master.add_graph cl1
puts master.inspect
# digraph G {
# digraph cluster_cl1 {
# }
# }
I believe that the output of the two parts should be equivalent, i.e. cluster_cl1
should be subgraph
instead of digraph
.
Hi,
I'm using thin as server. I got this error when using graphviz with it.
is it a way to change the default tmp file ?
RuntimeError (Error from "/usr/bin/dot" -q1 -Tpng -o/home/www/prog/public/images/graph.png /tmp/thin server (10.1.1.83:10204)20100624-12443-grpl3f-0: sh: -c: line 0: syntax error near unexpected token `(' sh: -c: line 0: `"/usr/bin/dot" -q1 -Tpng -o/home/www/prog/public/images/graph.png /tmp/thin server (10.1.1.83:10204)20100624-12443-grpl3f-0' ): ruby-graphviz (0.9.11) lib/graphviz.rb:533:in `output_from_command' ruby-graphviz (0.9.11) lib/graphviz.rb:493:in `output'
Regards,
Teuf
See the reason here : http://stackoverflow.com/questions/2941162/ruby-graphviz-binary-tree-record
Just because GraphViz::Node#name return the node ID !
great library!
would be nice if we could pass in a flag to print the title of the graph at the top of the page
graphviz doc says:
http://www.graphviz.org/doc/info/shapes.html#html
When using this in ruby-graphviz, so setting an edge.label to something like "<some <b>label</b>>"
I just get a "some label" without the markup.
Am I doing something wrong or is this not supported in the current version?
I see some note in the changelog of version 1.0.0 regarding to html labels, but i cant figure out how to use it. Is there an example around?
Having problem with labels that contain dot, did you ever find out why the escaping was added? Dot should be a valid character in label.
Parsing back generated dot file chokes too:
$ cat sample.rb
require 'graphviz'
g = GraphViz.new(:G, :type => :graph)
g.add_nodes("Hello World.")
puts g.to_s
GraphViz.parse_string(g.to_s)
$ RUBYLIB=lib ruby sample.rb
graph G {
"Hello World\." [label = "Hello World."];
}
./lib/graphviz/dot2ruby.rb:47:in `eval': (eval):8:in `eval': compile error (SyntaxError)
(eval):6: syntax error, unexpected $undefined, expecting '}'
node_hello__world\ = graph_g.add_nodes( "Hello W...
^
from ./lib/graphviz/dot2ruby.rb:55:in `eval_string'
from ./lib/graphviz.rb:784:in `parse_string'
from sample.rb:5
And, sample29 which has a dot in the label is generating:
$ grep '<g.*title' ./test/output/sample29.rb.svg
<g id="node1" class="node"><title>"Hello\."\nHow are you ?</title>
Thanks.
Hi,
I was wondering if and how I can combine several graphs.
My usecase is the following:
I have several graphs that are visualized apart from each other.
I now want to show the structure between these graphs by having an 'overview' graph, showing each individual graph inside a cluster
Can I convert them to dot, save them to a file, and then parse them again inside the 'subgraph' of the 'overview' model, or is there an easier way to do this?
Thanks in advance
When outputting my graph (using graphviz-dot, output as svg) dot crashes and doesn't produce a graph.
Everything works in 1.0.8.
Using windows 32-bit ruby 2.0.0. Graphviz 2.30.1
edit:
Here is an example of the code that creates an incorrect graph:
graph.add_edges(graph_reference_table[src_path + condition], graph_reference_table[statement_home + "()"], :lhead=>graph_reference_table[statement_home], :color=>"purple", :style=>"dashed", :constraint=>"false")
The two nodes are references to two nodes. The lhead is a reference to a cluster graph from which to start the head of the edge.
This works in 1.0.8, and I think this was the suggested way of drawing edges from node to a cluster/graph.
If I remove the lhead attribute this is drawn in in 1.0.9 also.
I should add, the graph in question has compound=true set
Calling:
graph = GraphViz.parse_string("")
produces the following error in ubuntu 13.04 with rvm installed ruby 2.0.0. This was called from irb. I also tried it in a rake task
2.0.0p195 :004 > require 'graphviz'
=> true
2.0.0p195 :005 > GraphViz.parse_string("")
RuntimeError: Error from -f /home/me/.rvm/gems/ruby-2.0.0-p195/gems/ruby-graphviz-1.0.9/lib/ext/gvpr/dot2ruby.g -a "-" /tmp/dot2ruby.rb20130626-9878-1xsi51p:
sh: 1: -f: not found
from /home/me/.rvm/gems/ruby-2.0.0-p195/gems/ruby-graphviz-1.0.9/lib/graphviz/utils.rb:77:in `output_from_command'
from /home/me/.rvm/gems/ruby-2.0.0-p195/gems/ruby-graphviz-1.0.9/lib/graphviz/dot2ruby.rb:46:in `eval'
from /home/me/.rvm/gems/ruby-2.0.0-p195/gems/ruby-graphviz-1.0.9/lib/graphviz/dot2ruby.rb:55:in `eval_string'
from /home/me/.rvm/gems/ruby-2.0.0-p195/gems/ruby-graphviz-1.0.9/lib/graphviz.rb:754:in `parse_string'
from (irb):5
hello, i've got a problem with the following method: find_executable(bin, custom_paths) in Ruby-Graphviz / lib / graphviz / utils.rb.
I saw in the file history(change 2 days ago) that the variable declaration was deleted. I think you must have the problem too or I did something wrong.
Thanks for your great work.
I seem to have a problem with utf-8 labels. The following renders fine: a [label="ε"]; however when I pass {:label=>'ε'} to add_node, the output has
[label="\316\265"] which renders as a decimal value.
Autoload will be removed from Ruby. Also, it is causing problems with Bundler:
$ rake dm:doc:graphviz --trace ** Invoke dm:doc:graphviz (first_time) ** Invoke dm:doc:graphviz:relational (first_time) ** Invoke dm:doc:graphviz:relational:png (first_time) ** Execute dm:doc:graphviz:relational:png rake aborted! cannot load such file -- graphviz/utils/colors /home/hal/.rvm/gems/ruby-1.9.3-p194/gems/ruby-graphviz-1.0.8/lib/graphviz/types/color.rb:1:in `require' /home/hal/.rvm/gems/ruby-1.9.3-p194/gems/ruby-graphviz-1.0.8/lib/graphviz/types/color.rb:1:in `' /home/hal/.rvm/gems/ruby-1.9.3-p194/gems/ruby-graphviz-1.0.8/lib/graphviz/types/color_list.rb:8:in `block in check' /home/hal/.rvm/gems/ruby-1.9.3-p194/gems/ruby-graphviz-1.0.8/lib/graphviz/types/color_list.rb:8:in `map' /home/hal/.rvm/gems/ruby-1.9.3-p194/gems/ruby-graphviz-1.0.8/lib/graphviz/types/color_list.rb:8:in `check' /home/hal/.rvm/gems/ruby-1.9.3-p194/gems/ruby-graphviz-1.0.8/lib/graphviz/types.rb:5:in `initialize' /home/hal/.rvm/gems/ruby-1.9.3-p194/gems/ruby-graphviz-1.0.8/lib/graphviz/attrs.rb:62:in `new' /home/hal/.rvm/gems/ruby-1.9.3-p194/gems/ruby-graphviz-1.0.8/lib/graphviz/attrs.rb:62:in `[]=' /home/hal/.rvm/gems/ruby-1.9.3-p194/gems/ruby-graphviz-1.0.8/lib/graphviz/edge.rb:77:in `[]=' /home/hal/.rvm/gems/ruby-1.9.3-p194/gems/ruby-graphviz-1.0.8/lib/graphviz.rb:210:in `block in add_edges' /home/hal/.rvm/gems/ruby-1.9.3-p194/gems/ruby-graphviz-1.0.8/lib/graphviz.rb:209:in `each' /home/hal/.rvm/gems/ruby-1.9.3-p194/gems/ruby-graphviz-1.0.8/lib/graphviz.rb:209:in `add_edges'
What exactly do they all do? I kind of want to dynamically change an edge type from undirected to directed, yet it isn't immediately obvious how to do this, or which attribute I should fiddle around with.
Could you give a hint on how rank tag shall be used - Id like to declare equivalent to dot expression
{ rank = same; "node1"; "node2"; }
Reading the code shows that there is a special handling for Windows, the temp files are created in the current working directory. This is strange, because Tempfile::open() acts well on windows by creating the file in the configured temp directory. It may really be worse to create the file on the cwd because permissions may be restricted.
So I propose to remove this special handling (see graphviz.rb method output near line 367).
When I add a node to my graph with a :href attribute like this:
g.add_node(site, :label => "N", :href => "http://www.website.com", :tooltip => site, :shape => "ellipse", :color => "#FF0000")
This will result in a link like this in the SVG output:
I tested it via the DOT language syntax directly like this and there it works, so this makes me think that it is a problem in Ruby-Graphviz
b [label="N",href="http://www.website.com"]
The same problem applies for the :tooltip I believe.
Any ideas?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.