WIP - able to draw circles now.

This commit is contained in:
Raghu Rajagopalan
2016-03-29 20:55:22 +05:30
parent 2fee6e62aa
commit 65140f6b3f
5 changed files with 259 additions and 20019 deletions

View File

@@ -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();