Skip to content

Commit

Permalink
Fix for issue #150 this change makes gant diagram autoscale.
Browse files Browse the repository at this point in the history
  • Loading branch information
knsv committed May 30, 2015
1 parent 6864652 commit 3f0ead3
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/diagrams/gantt/ganttRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,22 @@ module.exports.draw = function (text, id) {
w = elem.offsetWidth;

if (typeof w === 'undefined') {
w = 800;
w = 1200;
}

var taskArray = gantt.yy.getTasks();

// Set height based on number of tasks
var h = taskArray.length * (conf.barHeight + conf.barGap) + 2 * conf.topPadding;

elem.style.height = h + 'px';
elem.setAttribute('height', h);
elem.setAttribute('height', "100%");
// Set viewBox
elem.setAttribute('viewBox','0 0 '+w+' '+h);
var svg = d3.select('#' + id);





var dateFormat = d3.time.format("%Y-%m-%d");

var startDate = d3.min(taskArray, function (d) {
Expand Down

0 comments on commit 3f0ead3

Please sign in to comment.