-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #328 from magjac/fix-rotate
Fix rotate=90 graph attribute does not set the rotation
- Loading branch information
Showing
11 changed files
with
363 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,6 +69,7 @@ var basic_data = { | |
"y": 112 | ||
}, | ||
"scale": 1, | ||
"rotation": 0, | ||
"parent": "[Circular ~]", | ||
"children": [ | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import assert from "assert"; | ||
import it from "./it.js"; | ||
import jsdom from "./jsdom.js"; | ||
import * as d3 from "d3-selection"; | ||
import * as d3_graphviz from "../index.js"; | ||
|
||
it("Simple rendering an SVG from graphviz DOT with rotate=90 and zoom disabled.", async () => { | ||
var window = global.window = jsdom('<div id="graph"></div>'); | ||
global.document = window.document; | ||
|
||
var graphviz; | ||
|
||
await new Promise(resolve => { | ||
graphviz = d3_graphviz.graphviz("#graph") | ||
.zoom(false) | ||
.renderDot('digraph {rotate=90; a -> b;}', resolve); | ||
}); | ||
|
||
assert.equal(d3.selectAll('.node').size(), 2, 'Number of nodes'); | ||
assert.equal(d3.selectAll('.edge').size(), 1, 'Number of edges'); | ||
assert.equal(d3.selectAll('ellipse').size(), 2, 'Number of ellipses'); | ||
assert.equal(d3.selectAll('polygon').size(), 2, 'Number of polygons'); | ||
assert.equal(d3.selectAll('path').size(), 1, 'Number of paths'); | ||
|
||
assert.equal(d3.select('#graph0').attr("transform"), "scale(1 1) rotate(-90) translate(-58 112)"); | ||
}); | ||
|
||
it("Simple rendering an SVG from graphviz DOT with rotate=90 and zoom enabled.", async () => { | ||
var window = global.window = jsdom('<div id="graph"></div>'); | ||
global.document = window.document; | ||
|
||
var graphviz; | ||
|
||
await new Promise(resolve => { | ||
graphviz = d3_graphviz.graphviz("#graph") | ||
.zoom(true) | ||
.renderDot('digraph {rotate=90; a -> b;}', resolve); | ||
}); | ||
|
||
assert.equal(d3.selectAll('.node').size(), 2, 'Number of nodes'); | ||
assert.equal(d3.selectAll('.edge').size(), 1, 'Number of edges'); | ||
assert.equal(d3.selectAll('ellipse').size(), 2, 'Number of ellipses'); | ||
assert.equal(d3.selectAll('polygon').size(), 2, 'Number of polygons'); | ||
assert.equal(d3.selectAll('path').size(), 1, 'Number of paths'); | ||
|
||
assert.equal(d3.select('#graph0').attr("transform"), "rotate(-90) translate(-58 112) scale(1)"); | ||
}); |
Oops, something went wrong.