Feature complete for first release

* added possibility to include numbers in ids
* added graph statement and possibility to set direction of graph from graph statement
* refactured the grammar somewhat
This commit is contained in:
knsv
2014-11-15 21:28:26 +01:00
parent 7ee2b1be45
commit d92c682bbe
11 changed files with 532 additions and 335 deletions

View File

@@ -3,6 +3,11 @@ if (typeof mermaid === 'undefined') {
mermaid = {}
}
/**
* Function used by parser to store vertices/nodes found in graph script.
* @param vert
* @param g
*/
mermaid.addVertices = function (vert, g) {
var keys = Object.keys(vert);
@@ -107,10 +112,19 @@ mermaid.drawChart = function (text, id) {
var keys = Object.keys(vert);
var dir;
dir = mermaid.direction;
if(typeof dir === 'undefined'){
dir='TD';
}
// Create the input mermaid.graph
var g = new dagreD3.graphlib.Graph()
.setGraph({
//rankdir: "LR",
rankdir: dir,
marginx: 20,
marginy: 20
})