¶exampleRenderer.js |
|
|
Created by knut on 14-12-11. |
var db = require('./exampleDb');
var exampleParser = require('./parser/example.js');
var d3 = require('../../d3');
var log = require('../../logger').create();
|
|
Draws a an info picture in the tag with id: id based on the graph definition in text. Params
text
id
|
exports.draw = function (txt, id, ver) {
var parser;
parser = exampleParser.parser;
parser.yy = db;
|
|
Parse the graph definition |
parser.parse(txt);
|
|
Fetch the default direction, use TD if none was found |
var svg = d3.select('#'+id);
var textstring = "mermaid!";
var g = svg.append("g");
g.append("text") // text label for the x axis
.attr("x", 100)
.attr("y", 40)
.attr('class','version')
.attr('font-size','32px')
.style("text-anchor", "middle")
.text('mermaid '+ ver);
|
|
var box = exports.bounds.getBounds(); var height = box.stopy-box.starty+2conf.diagramMarginY; var width = box.stopx-box.startx+2conf.diagramMarginX; |
svg.attr("height",100);
svg.attr("width", 400 );
|
|
svg.attr("viewBox", '0 0 300 150'); |
};
|