Coder Social home page Coder Social logo

node-graphviz's People

Contributors

blakmatrix avatar bridgear avatar daniel347x avatar dariusk avatar glejeune avatar i404788 avatar joscha avatar mathieuravaux avatar miparnisari avatar pahen avatar papandreou avatar pooriaazimi avatar rogelio-meza-t avatar sebastienelet avatar tolotrasam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-graphviz's Issues

Headport and tailport are not rendering accordingly

The documentation for "headport" and "tailport" says that it Indicates where on the head/tail node to attach the head/tail of the edge. In the default case, the edge is aimed towards the center of the node, and then clipped at the node boundary.
The code given below -
`digraph {
rankdir=LR;
node [ shape=record ];

struct1 [
label = "a|b|<port1> c";
];
struct2 [
label = "a|{ <port2> b1|b2}|c";
];
struct1->struct2 [ label="xyz", headport="port1", tailport="port2" ];
}`
should generate an edge from node:struct1 port "c" to node:struct2 port "b1" like this -
image
however it generates an edge like this , using default behavior.
image

I understand that struct1:port1 -> struct2:port2 [ label="xyz" ]; can be used for the purpose ,but I don't know how to use addEdge method to generate such a dot string (open to suggestions ).

I request you to please help me out , to generate an edge like in image 1.
I have also tried other versions of port attribute argument such as such , "c","port0:c" etc yet no use.

class attr is not implemented in attributs.js

I try to change the class of the edges in the rendered SVG. So I pass the class property as attribute.

After that, the error TypeError: Cannot read property 'type' of undefined occurs in the mustBeQuoted function (graphviz\lib\deps\attributs.js:191:42)

Reason is that class attribute is not implemented in attributs.js (graphviz\lib\deps\attributs.js)

var attrs = {
  "Damping" :            { "usage" : "G",    "type" : "double" },
  "K" :                  { "usage" : "GC",   "type" : "double" },
  "URL" :                { "usage" : "ENGC", "type" : "escString" },
  "area" :               { "usage" : "NC",   "type" : "double" },
  "arrowhead" :          { "usage" : "E",    "type" : "arrowType" },
  "arrowsize" :          { "usage" : "E",    "type" : "double" },
  "arrowtail" :          { "usage" : "E",    "type" : "arrowType" },
  "aspect" :             { "usage" : "G",    "type" : "aspectType" },
  "bb" :                 { "usage" : "G",    "type" : "rect" },
  "bgcolor" :            { "usage" : "GC",   "type" : "color" },
  "center" :             { "usage" : "G",    "type" : "bool" },
  "charset" :            { "usage" : "G",    "type" : "string" },
  "clusterrank" :        { "usage" : "G",    "type" : "clusterMode" },
  "color" :              { "usage" : "ENC",  "type" : "color" },
  "colorscheme" :        { "usage" : "ENCG", "type" : "string" },
...

Is it possible to add class attribute as feature?

Error: EPIPE, Broken pipe

After I finished install of Graphviz app & npm package of node-graphviz,,
when I type this command "node hello_world.js" at Mac terminal, I've noticed under error message.

I use Graphviz ver 1.13 , node.js ver 0.3.1, npm ver 0.2.10-1.

If you know how to solve this error, tell me solution, please.

node.js:50
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: EPIPE, Broken pipe
at Stream._writeImpl (net.js:139:14)
at Stream._writeOut (net.js:558:25)
at Stream.write (net.js:491:17)
at [object Object].render (/usr/local/lib/node/.npm/graphviz/0.0.3/package/lib/deps/graph.js:330:18)
at [object Object].output (/usr/local/lib/node/.npm/graphviz/0.0.3/package/lib/deps/graph.js:335:8)
at Object. (/Users/user/Documents/workspace/testNodeJS/graphviz-0.0.3/tests/hello_world.js:20:3)
at Module._compile (node.js:329:23)
at Object..js (node.js:337:12)
at Module.load (node.js:260:25)

at Array. (node.js:351:24)

Add imagepos to Attributes.js

I can't seem to find imagepos for nodes.
I manually updated my Attributes.js file and it appears to work fine.
This will position the image in the node where you would like it.
Options are as follows;

  • tl | Top Left
  • tc | Top Centered
  • tr | Top Right
  • ml | Middle Left
  • mc | Middle Centered (the default)
  • mr | Middle Right
  • bl | Bottom Left
  • bc | Bottom Centered
  • br | Bottom Right

"imagepos" : { "usage" : "N", "type" : "string" }

Reference: https://www.graphviz.org/doc/info/attrs.html#d:height

Thanks,

Graph.prototype.getNodeAttribut

line 222 of lib/deps/graph.js you have Graph.prototype.getNodeAttribut, I believe it should be Graph.prototype.getEdgeAttribut. Keep up the good work.

rank expression

I would like to express "{rank=same; node1 node2}", but could not find any sample.
Is it possible to do this with node-graphviz?

Thank you.

graph.removeNode is not a function

I think you need to release the last changes in the repository, in the current code there is a removeNode function on the graph object but the npm version is missing that feature

missing attribute

The attribute 'newrank' is missing in the list of available attributes.

"newrank" : { "usage" : "G", "type" : "bool" },

And it would be great to get an error message like:
Error: The attribute 'newrank' is not support.
or something like this.

Documentation cannot be generated

This might be just an issue I have come across, but it appears that dox no longer supports generating documentation from a list of files or directories but instead operates only over stdio. I'm working on fixing Jakefile.js to use dox properly, but if you know why this doesn't build I would be greatly appreciative!

Issue in creating HTML-like labels.

Dot specification has HTML-like labels.

They are generally like:
label=<<FONT POINT-SIZE='12'>Some Text</FONT>>

The issue is that Graphviz doesn't understand it if that html label is quoted like this:
label="<<FONT POINT-SIZE='12'>Some Text</FONT>>"

In the attributes js file, lbl is of type lblString, which means it would be quoted.
https://github.com/glejeune/node-graphviz/blob/master/lib/deps/attributs.js#L59

We need a way to say if our label is a string or an html markup. Based on that it must be quoted or not.

I don't know what would be an elegant solution to this.

Any fixes (or even ideas) would be awesome?

Clarify license

The license field in the package.json says this module is licensed under the GPL v3 but there's an MIT LICENSE file in the root of the repo.

Can you clarify the license of this module and update one or the other location?

Thanks!

P.S. It would be wonderful if this were licensed as MIT :)

Graph render race condition issues.

Using Graph.render, there are some race conditions with graphviz.on("exit", …), where exit fires before the graphviz.stdout is ended.

So instead of using exit, you can use close in node 0.8. So a solution would be, in graph.js:373

  var version = process.version.split('.')[1]
  graphviz.on(version < 8 ? 'exit' : 'close', function(code) {
  // ...
  });

Bug - Exception in `mustBeQuoted` due to weird use of Array as Hashmap

Hi @glejeune,

trying to use your library with my vscode extension. Problem, the super weird Array hashmap stuff is breaking as the for(var name in this.attributs.items) { will not only return added items but also functionnames. no clue why this does not happen on the console but breaks in vscode (maybe more strict?) but the usage feels a bit strange anyway.

I quickly checked the open PR's and #23 appears to solve that problem with an hasOwnProperty check. I guess there are likely more people having the same issues. #23 is a hack but will probably fix the problem as a short-term solution. Any thoughts on merging it? Otherwise I'll have to switch to a different lib.

TypeError: Cannot read property 'type' of undefined
soljson.js:28
at mustBeQuoted (node_modules/surya/node_modules/graphviz/lib/deps/attributs.js:190:42)
at quoteMe (node_modules/surya/node_modules/graphviz/lib/deps/attributs.js:194:6)
at exports.Attributs.Attributs.to_dot (node_modules/surya/node_modules/graphviz/lib/deps/attributs.js:241:56)
at exports.Graph.Graph.to_dot (node_modules/surya/node_modules/graphviz/lib/deps/graph.js:249:61)
at Object.graph (node_modules/surya/lib/graph.js:462:63)
at Commands.surya (src/features/commands.js:53:29)
at src/extension.js:625:30

it is undefined because the in op returned GetEnumerator which is an array method and not an item. see screenshot. left side contents of the hash-array-thing, right side tooltip contents of name (GetEnumerator). this will later break in mustBeQuoted as GetEnumerator is no valid attrib (was never set by our code).

image

cheers,
tin

How to get x,y coords for a node?

This inst really an issue, but more of a question. How do I get the coordinates of a node? I am using the example provided, but have not been able to find where/if the coordinates are stored.

I explored the graph object but such attributes do not seem to be there.

// Print the dot script
console.log( g.to_dot() );

console.log(g); // There does not seem to be any such info in this object, nor is there any info on an individual node.

Any help on this would be much appreciated. Thank you.

Is it possible to create a stripped down version for browsers that only generates dot code?

Hi,

This is a great Node module for Graphviz diagrams. Unfortunately this can't work in browsers because graphviz isn't available. But what if we could have a browser friendly stripped down version that generates dot code string.
And then I can use https://github.com/mdaines/viz.js to greate diagrams with that dot code in browsers without Node.JS.
Since the author understands his code best, I am requesting you if you can please create a stripped down version that just generates dot code?
Thanks...

Clickable Nodes

Hi,

I tried setting href attribute for nodes like this:

node.set( 'href', 'http://google.com');

but I am getting the following error:

DEBUG: Warning : Invalid attribut `href' for a node

How can we have clickable nodes?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.