mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-14 21:09:50 +02:00
Fix for issues with generating diagrams using the cli: default style for clusters and fixes for autoscaling side effects
This commit is contained in:
@@ -217,6 +217,7 @@ exports.getClasses = function (text, isDot) {
|
|||||||
if(typeof(classes.default) === 'undefined') {
|
if(typeof(classes.default) === 'undefined') {
|
||||||
classes.default = {id:'default'};
|
classes.default = {id:'default'};
|
||||||
classes.default.styles = ['fill:#ffa','stroke:#666','stroke-width:3px'];
|
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.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'];
|
classes.default.edgeLabelStyles = ['fill:#000','stroke:none','font-weight:300','font-family:"Helvetica Neue",Helvetica,Arial,sans-serf','font-size:14px'];
|
||||||
}
|
}
|
||||||
|
@@ -83,7 +83,7 @@ var getStartDate = function(prevTime, dateFormat, str){
|
|||||||
}else{
|
}else{
|
||||||
console.log('Invalid date:'+str);
|
console.log('Invalid date:'+str);
|
||||||
console.log('With date format:'+dateFormat.trim());
|
console.log('With date format:'+dateFormat.trim());
|
||||||
console.log('----');
|
//console.log('----');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default date - now
|
// Default date - now
|
||||||
|
@@ -26,16 +26,18 @@ var w;
|
|||||||
module.exports.draw = function (text, id) {
|
module.exports.draw = function (text, id) {
|
||||||
gantt.yy.clear();
|
gantt.yy.clear();
|
||||||
gantt.parse(text);
|
gantt.parse(text);
|
||||||
|
|
||||||
var elem = document.getElementById(id);
|
var elem = document.getElementById(id);
|
||||||
w = elem.parentElement.offsetWidth;
|
w = elem.parentElement.offsetWidth;
|
||||||
|
|
||||||
console.log('id='+id,' w='+w);
|
|
||||||
console.log(elem.parentElement);
|
|
||||||
|
|
||||||
if (typeof w === 'undefined') {
|
if (typeof w === 'undefined') {
|
||||||
w = 1200;
|
w = 1200;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(typeof conf.useWidth !== 'undefined'){
|
||||||
|
w = conf.useWidth;
|
||||||
|
}
|
||||||
|
|
||||||
var taskArray = gantt.yy.getTasks();
|
var taskArray = gantt.yy.getTasks();
|
||||||
|
|
||||||
// Set height based on number of tasks
|
// Set height based on number of tasks
|
||||||
@@ -83,6 +85,10 @@ module.exports.draw = function (text, id) {
|
|||||||
|
|
||||||
|
|
||||||
makeGant(taskArray, w, h);
|
makeGant(taskArray, w, h);
|
||||||
|
if(typeof conf.useWidth !== 'undefined'){
|
||||||
|
elem.setAttribute('width', w);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
var title = svg.append("text")
|
var title = svg.append("text")
|
||||||
.text(gantt.yy.getTitle())
|
.text(gantt.yy.getTitle())
|
||||||
|
@@ -189,7 +189,6 @@ var drawMessage = function(elem, startx, stopx, verticalPos, msg){
|
|||||||
textWidth = textElem[0][0].getBBox().width;
|
textWidth = textElem[0][0].getBBox().width;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
console.log(textElem[0][0].getBoundingClientRect());
|
|
||||||
//textWidth = getBBox(textElem).width; //.getComputedTextLength()
|
//textWidth = getBBox(textElem).width; //.getComputedTextLength()
|
||||||
textWidth = textElem[0][0].getBoundingClientRect();
|
textWidth = textElem[0][0].getBoundingClientRect();
|
||||||
//textWidth = textElem[0][0].getComputedTextLength();
|
//textWidth = textElem[0][0].getComputedTextLength();
|
||||||
|
@@ -11,10 +11,10 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
.cluster rect{
|
.cluster rect{
|
||||||
fill: @secondBkg;
|
fill: @secondBkg !important;
|
||||||
rx:40;
|
rx:4 !important;
|
||||||
stroke: @clusterBorder;
|
stroke: @clusterBorder !important;
|
||||||
stroke-width: 1px;
|
stroke-width: 1px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cluster text {
|
.cluster text {
|
||||||
|
@@ -15,10 +15,10 @@ color:#333
|
|||||||
|
|
||||||
}
|
}
|
||||||
.cluster rect{
|
.cluster rect{
|
||||||
fill: @secondBkg;
|
fill: @secondBkg !important;
|
||||||
rx:4;
|
rx:4 !important;
|
||||||
stroke: @clusterBorder;
|
stroke: @clusterBorder !important;
|
||||||
stroke-width: 1px;
|
stroke-width: 1px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cluster text {
|
.cluster text {
|
||||||
|
@@ -49,8 +49,13 @@ var init = function () {
|
|||||||
|
|
||||||
if(typeof mermaid_config !== 'undefined'){
|
if(typeof mermaid_config !== 'undefined'){
|
||||||
mermaidAPI.initialize(mermaid_config);
|
mermaidAPI.initialize(mermaid_config);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(typeof mermaid.ganttConfig !== 'undefined'){
|
||||||
|
mermaidAPI.initialize({gantt:mermaid.ganttConfig});
|
||||||
|
}
|
||||||
|
|
||||||
var insertSvg = function(svgCode){
|
var insertSvg = function(svgCode){
|
||||||
element.innerHTML = svgCode;
|
element.innerHTML = svgCode;
|
||||||
};
|
};
|
||||||
|
@@ -90,6 +90,9 @@ module.exports.cloneCssStyles = function(svg, classes){
|
|||||||
if (classes.default.edgeLabelStyles instanceof Array) {
|
if (classes.default.edgeLabelStyles instanceof Array) {
|
||||||
defaultStyles += "#" + svg.id.trim() + ' .edgeLabel text ' + ' { ' + classes[className].edgeLabelStyles.join("; ") + '; }\n';
|
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 {
|
} else {
|
||||||
if (classes[className].styles instanceof Array) {
|
if (classes[className].styles instanceof Array) {
|
||||||
embeddedStyles += "#" + svg.id.trim() + ' .' + className + ' { ' + classes[className].styles.join("; ") + '; }\n';
|
embeddedStyles += "#" + svg.id.trim() + ' .' + className + ' { ' + classes[className].styles.join("; ") + '; }\n';
|
||||||
|
Reference in New Issue
Block a user