mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-21 16:29:40 +02:00
WIP - able to draw circles now.
This commit is contained in:
@@ -17,22 +17,37 @@ exports.draw = function (txt, id, ver) {
|
||||
|
||||
log.debug('in gitgraph renderer', txt, id, ver);
|
||||
// Parse the graph definition
|
||||
//log.debug(parser, db);
|
||||
parser.parse(txt + "\n");
|
||||
|
||||
var commits = db.getCommitsArray();
|
||||
log.debug(commits);
|
||||
log.debug("id: " + commits[0].id);
|
||||
log.debug(db.getCommits());
|
||||
log.debug("length:", commits.length);
|
||||
log.debug("length:", Object.keys(db.getCommits()).length);
|
||||
// Fetch the default direction, use TD if none was found
|
||||
var svg = d3.select('#'+id);
|
||||
|
||||
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 raghu'+ ver);
|
||||
//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 raghu'+ ver);
|
||||
|
||||
var circles = svg.selectAll("circle")
|
||||
.data(commits)
|
||||
.enter()
|
||||
.append("circle")
|
||||
.attr("cx", function(d, i){
|
||||
return (i*50) + 25;
|
||||
})
|
||||
.attr("cy", 50)
|
||||
.attr("r", 15)
|
||||
.attr("fill", "yellow")
|
||||
.attr("stroke", "grey");
|
||||
/*
|
||||
var box = exports.bounds.getBounds();
|
||||
|
||||
|
Reference in New Issue
Block a user