diff --git a/CHANGELOG.md b/CHANGELOG.md index 016c890..fec7305 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/README.md b/README.md index 1547824..6f56865 100644 --- a/README.md +++ b/README.md @@ -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'); diff --git a/src/GraphViz.php b/src/GraphViz.php index 5f5a83a..df556e4 100644 --- a/src/GraphViz.php +++ b/src/GraphViz.php @@ -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