infer svg height, width from # of nodes

This commit is contained in:
Raghu Rajagopalan
2016-04-27 10:05:50 +05:30
parent 1d8d42ad08
commit b634439765

View File

@@ -266,6 +266,13 @@ exports.draw = function(txt, id, ver) {
renderLines(svg, v.commit, direction); renderLines(svg, v.commit, direction);
branchNum++; branchNum++;
}); });
svg.attr('height', function() {
if (direction === 'BT') return Object.keys(allCommitsDict).length * config.nodeSpacing;
return branches.length * config.branchOffset;
});
svg.attr('width', function() {
return Object.keys(allCommitsDict).length * config.nodeSpacing;
});
} catch (e) { } catch (e) {
log.error('Error while rendering gitgraph'); log.error('Error while rendering gitgraph');
log.error(e.message); log.error(e.message);