strathausen / dracula

JavaScript layout and representation of connected graphs.
https://www.graphdracula.net
MIT License
834 stars 132 forks source link

Error in documentation #44

Closed Tiagoperes closed 6 years ago

Tiagoperes commented 7 years ago

The documentation states that the settings of an edge must be passed in an object as the 3rd parameter of the addEdge function. See the example below extracted from the website:

/* a directed connection, using an arrow */
g.addEdge("id34", "cherry", { directed : true } );

/* customize the colors of that edge */
g.addEdge("id35", "apple", { stroke : "#bfa" , fill : "#56f", label : "Label" });

I couldn't get this to work. Looking at the source code, I found out that every edge setting is retrieved from the parameter "style", so I changed my approach to the following:

g.addEdge("id34", "cherry", { style: {directed : true} } );
g.addEdge("id35", "apple", { style: {stroke : "#bfa" , fill : "#56f", label : "Label" }});

Now it works fine. It would be great for new users if the docs could be updated.

strathausen commented 6 years ago

Thanks for reporting!

I've corrected the docs here https://www.graphdracula.net/documentation/ does it seem right?

Tiagoperes commented 6 years ago

Thanks for answering. The documentation for "customize the colors of that edge" is fine now. The first part, "a directed connection, using an arrow", still needs correction though, "directed" also needs to be inside "style".

Unless it has changed since last time I used the lib...

strathausen commented 6 years ago

The fix mentioned here should make both versions work in the latest version (with and without style) https://github.com/strathausen/dracula/issues/48 let me know if that fixed it!