Skip to content

Commit

Permalink
Update changelog, doco and reason for using name rather than id
Browse files Browse the repository at this point in the history
  • Loading branch information
rhelms committed Apr 7, 2017
1 parent 5641ba1 commit 26aa521
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ This file is a manually maintained list of changes for each release. Feel free
to add your changes here when sending pull requests. Also send corrections if
you spot any mistakes.

## 0.2.2 (2017-04-07)

* Allow setting of graph name via graphviz.name attribute
([#20](https://github.com/graphp/graphviz/pull/20))

## 0.2.1 (2015-03-08)

* Support graph v0.9 (while keeping BC)
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Once [installed](#install), let's build and display a sample graph:

````php
$graph = new Fhaculty\Graph\Graph();
// Set graph name to blank to hide default G tooltip for SVG output
$graph->setAttribute('graphviz.name', '');

$blue = $graph->createVertex('blue');
$blue->setAttribute('graphviz.color', 'blue');
Expand Down
5 changes: 5 additions & 0 deletions src/GraphViz.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ public function createScript(Graph $graph)
$alg = new Directed($graph);
$directed = $alg->hasDirected();

/*
* The website [http://www.graphviz.org/content/dot-language] uses the term `ID` when displaying
* the abstract grammar for the DOT language.
* But the man pages for dot use the term `name` when describing the graph file language.
*/
$name = $graph->getAttribute('graphviz.name');
if ($name === null || $name === 'G') {
// don't escape a name of G to maintain default behavior
Expand Down

0 comments on commit 26aa521

Please sign in to comment.