mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-14 06:43:25 +08:00
Fix for issue #150 this change makes gant diagram autoscale.
This commit is contained in:
parent
6864652b80
commit
3f0ead3e0a
@ -30,7 +30,7 @@ module.exports.draw = function (text, id) {
|
|||||||
w = elem.offsetWidth;
|
w = elem.offsetWidth;
|
||||||
|
|
||||||
if (typeof w === 'undefined') {
|
if (typeof w === 'undefined') {
|
||||||
w = 800;
|
w = 1200;
|
||||||
}
|
}
|
||||||
|
|
||||||
var taskArray = gantt.yy.getTasks();
|
var taskArray = gantt.yy.getTasks();
|
||||||
@ -38,11 +38,14 @@ module.exports.draw = function (text, id) {
|
|||||||
// Set height based on number of tasks
|
// Set height based on number of tasks
|
||||||
var h = taskArray.length * (conf.barHeight + conf.barGap) + 2 * conf.topPadding;
|
var h = taskArray.length * (conf.barHeight + conf.barGap) + 2 * conf.topPadding;
|
||||||
|
|
||||||
elem.style.height = h + 'px';
|
elem.setAttribute('height', "100%");
|
||||||
elem.setAttribute('height', h);
|
// Set viewBox
|
||||||
|
elem.setAttribute('viewBox','0 0 '+w+' '+h);
|
||||||
var svg = d3.select('#' + id);
|
var svg = d3.select('#' + id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var dateFormat = d3.time.format("%Y-%m-%d");
|
var dateFormat = d3.time.format("%Y-%m-%d");
|
||||||
|
|
||||||
var startDate = d3.min(taskArray, function (d) {
|
var startDate = d3.min(taskArray, function (d) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user