Fix for issues with generating diagrams using the cli: default style for clusters and fixes for autoscaling side effects

This commit is contained in:
knsv
2015-06-21 17:25:58 +02:00
parent 4ed345101a
commit 50219cf2d9
8 changed files with 27 additions and 13 deletions

View File

@@ -217,6 +217,7 @@ exports.getClasses = function (text, isDot) {
if(typeof(classes.default) === 'undefined') {
classes.default = {id:'default'};
classes.default.styles = ['fill:#ffa','stroke:#666','stroke-width:3px'];
classes.default.clusterStyles = ['rx:4px','fill: rgb(255, 255, 222)','rx: 4px','stroke: rgb(170, 170, 51)','stroke-width: 1px'];
classes.default.nodeLabelStyles = ['fill:#000','stroke:none','font-weight:300','font-family:"Helvetica Neue",Helvetica,Arial,sans-serf','font-size:14px'];
classes.default.edgeLabelStyles = ['fill:#000','stroke:none','font-weight:300','font-family:"Helvetica Neue",Helvetica,Arial,sans-serf','font-size:14px'];
}

View File

@@ -83,7 +83,7 @@ var getStartDate = function(prevTime, dateFormat, str){
}else{
console.log('Invalid date:'+str);
console.log('With date format:'+dateFormat.trim());
console.log('----');
//console.log('----');
}
// Default date - now

View File

@@ -26,16 +26,18 @@ var w;
module.exports.draw = function (text, id) {
gantt.yy.clear();
gantt.parse(text);
var elem = document.getElementById(id);
w = elem.parentElement.offsetWidth;
console.log('id='+id,' w='+w);
console.log(elem.parentElement);
if (typeof w === 'undefined') {
w = 1200;
}
if(typeof conf.useWidth !== 'undefined'){
w = conf.useWidth;
}
var taskArray = gantt.yy.getTasks();
// Set height based on number of tasks
@@ -83,6 +85,10 @@ module.exports.draw = function (text, id) {
makeGant(taskArray, w, h);
if(typeof conf.useWidth !== 'undefined'){
elem.setAttribute('width', w);
}
var title = svg.append("text")
.text(gantt.yy.getTitle())

View File

@@ -189,7 +189,6 @@ var drawMessage = function(elem, startx, stopx, verticalPos, msg){
textWidth = textElem[0][0].getBBox().width;
}
else{
console.log(textElem[0][0].getBoundingClientRect());
//textWidth = getBBox(textElem).width; //.getComputedTextLength()
textWidth = textElem[0][0].getBoundingClientRect();
//textWidth = textElem[0][0].getComputedTextLength();

View File

@@ -11,10 +11,10 @@
}
.cluster rect{
fill: @secondBkg;
rx:40;
stroke: @clusterBorder;
stroke-width: 1px;
fill: @secondBkg !important;
rx:4 !important;
stroke: @clusterBorder !important;
stroke-width: 1px !important;
}
.cluster text {

View File

@@ -15,10 +15,10 @@ color:#333
}
.cluster rect{
fill: @secondBkg;
rx:4;
stroke: @clusterBorder;
stroke-width: 1px;
fill: @secondBkg !important;
rx:4 !important;
stroke: @clusterBorder !important;
stroke-width: 1px !important;
}
.cluster text {

View File

@@ -49,6 +49,11 @@ var init = function () {
if(typeof mermaid_config !== 'undefined'){
mermaidAPI.initialize(mermaid_config);
}
if(typeof mermaid.ganttConfig !== 'undefined'){
mermaidAPI.initialize({gantt:mermaid.ganttConfig});
}
var insertSvg = function(svgCode){

View File

@@ -90,6 +90,9 @@ module.exports.cloneCssStyles = function(svg, classes){
if (classes.default.edgeLabelStyles instanceof Array) {
defaultStyles += "#" + svg.id.trim() + ' .edgeLabel text ' + ' { ' + classes[className].edgeLabelStyles.join("; ") + '; }\n';
}
if (classes.default.clusterStyles instanceof Array) {
defaultStyles += "#" + svg.id.trim() + ' .cluster rect ' + ' { ' + classes[className].clusterStyles.join("; ") + '; }\n';
}
} else {
if (classes[className].styles instanceof Array) {
embeddedStyles += "#" + svg.id.trim() + ' .' + className + ' { ' + classes[className].styles.join("; ") + '; }\n';