-%%{init: { "logLevel": 1, "journey": {"useMaxWidth": false }} }%%
-journey
- title My working day
- section Go to work
- Make tea: 5: Me
- Go upstairs: 3: Me
- Do work: 1: Me, Cat
- section Go home
- Go downstairs: 5: Me
- Sit down: 5: Me
+
+%%{init: { "logLevel": 1, "gantt": {"sectionFontSize": 6, "fontSize": 16 }} }%%
+gantt
+ dateFormat :YYYY-MM-DD
+ title Adding GANTT diagram functionality to mermaid
+ excludes :excludes the named dates/days from being included in a charted task..
+ section A section
+ Active task :done, des2, 2014-01-09, 3d
+ Completed task :done, des1, 2014-01-06, 5d
+ Future task : des3, after des2, 5d
+ Future task2 : des4, after des3, 5d
+
+ section Critical tasks
+ Completed task in the critical line :crit, done, 2014-01-06,24h
+ Implement parser and jison :crit, done, after des1, 2d
+ Create tests for parser :crit, active, 3d
+ Future task in critical line :crit, 5d
+ Create tests for renderer :2d
+ Add to mermaid :1d
+
+ section Documentation
+ Describe gantt syntax :active, a1, after des1, 3d
+ Add gantt diagram to demo page :after a1 , 20h
+ Add another diagram to demo page :doc1, after a1 , 48h
+
+ section Last section
+ Describe gantt syntax :after doc1, 3d
+ Add gantt diagram to demo page :20h
+ Add another diagram to demo page :48h
flowchart TD
@@ -116,13 +134,12 @@ A --> B
flowchart: { nodeSpacing: 10, curve: 'cardinal', htmlLabels: true },
htmlLabels: true,
// gantt: { axisFormat: '%m/%d/%Y' },
- sequence: { actorFontFamily: 'courier',actorMargin: 50, showSequenceNumbers: true },
+ sequence: { actorFontFamily: 'courier',actorMargin: 50, showSequenceNumbers: false },
// sequenceDiagram: { actorMargin: 300 } // deprecated
fontFamily: '"arial", sans-serif',
fontFamily: 'courier',
curve: 'cardinal',
securityLevel: 'loose',
- sequence:{mirrorActors:false}
});
function callback(){alert('It worked');}
diff --git a/src/defaultConfig.js b/src/defaultConfig.js
index ad18c6875..773beebb5 100644
--- a/src/defaultConfig.js
+++ b/src/defaultConfig.js
@@ -537,7 +537,7 @@ const config = {
***Default value 50**.
*/
topPadding: 50,
-
+ rightPadding: 75,
/**
*| Parameter | Description |Type | Required | Values|
*| --- | --- | --- | --- | --- |
@@ -567,6 +567,15 @@ const config = {
***Default value 11**.
*/
fontSize: 11,
+ /**
+ *| Parameter | Description |Type | Required | Values|
+ *| --- | --- | --- | --- | --- |
+ *| sectionFontSize | Font size for secions| Integer | Required | Any Positive Value |
+ *
+ ***Notes:**
+ ***Default value 11**.
+ */
+ sectionFontSize: 11,
/**
*| Parameter | Description |Type | Required | Values|
diff --git a/src/diagrams/gantt/ganttRenderer.js b/src/diagrams/gantt/ganttRenderer.js
index 82e5634fc..e359c9093 100644
--- a/src/diagrams/gantt/ganttRenderer.js
+++ b/src/diagrams/gantt/ganttRenderer.js
@@ -11,11 +11,12 @@ import {
import { parser } from './parser/gantt';
import common from '../common/common';
import ganttDb from './ganttDb';
+import { getConfig } from '../../config';
import { configureSvgSize } from '../../utils';
parser.yy = ganttDb;
-const conf = {
+const conf2 = {
titleTopMargin: 25,
barHeight: 20,
barGap: 4,
@@ -26,15 +27,15 @@ const conf = {
fontSize: 11,
fontFamily: '"Open-Sans", "sans-serif"'
};
-export const setConf = function(cnf) {
- const keys = Object.keys(cnf);
-
- keys.forEach(function(key) {
- conf[key] = cnf[key];
- });
+export const setConf = function() {
+ // const keys = Object.keys(cnf);
+ // keys.forEach(function(key) {
+ // conf[key] = cnf[key];
+ // });
};
let w;
export const draw = function(text, id) {
+ const conf = getConfig().gantt;
parser.yy.clear();
parser.parse(text);
@@ -412,6 +413,8 @@ export const draw = function(text, id) {
return (d[1] * theGap) / 2 + theTopPad;
}
})
+ .attr('font-size', conf.sectionFontSize)
+ .attr('font-size', conf.sectionFontSize)
.attr('class', function(d) {
for (let i = 0; i < categories.length; i++) {
if (d[0] === categories[i]) {
diff --git a/src/diagrams/gantt/styles.js b/src/diagrams/gantt/styles.js
index 8d0c2d0f2..b76728a4c 100644
--- a/src/diagrams/gantt/styles.js
+++ b/src/diagrams/gantt/styles.js
@@ -42,8 +42,8 @@ const getStyles = options =>
.sectionTitle {
text-anchor: start;
- font-size: 11px;
- text-height: 14px;
+ // font-size: ${options.ganttFontSize};
+ // text-height: 14px;
font-family: 'trebuchet ms', verdana, arial, sans-serif;
font-family: var(--mermaid-font-family);
@@ -90,14 +90,14 @@ const getStyles = options =>
font-family: var(--mermaid-font-family);
}
- .taskText:not([font-size]) {
- font-size: 11px;
- }
+ // .taskText:not([font-size]) {
+ // font-size: ${options.ganttFontSize};
+ // }
.taskTextOutsideRight {
fill: ${options.taskTextDarkColor};
text-anchor: start;
- font-size: 11px;
+ // font-size: ${options.ganttFontSize};
font-family: 'trebuchet ms', verdana, arial, sans-serif;
font-family: var(--mermaid-font-family);
@@ -106,7 +106,7 @@ const getStyles = options =>
.taskTextOutsideLeft {
fill: ${options.taskTextDarkColor};
text-anchor: end;
- font-size: 11px;
+ // font-size: ${options.ganttFontSize};
}
/* Special case clickable */
diff --git a/src/diagrams/user-journey/journeyRenderer.js b/src/diagrams/user-journey/journeyRenderer.js
index 328039347..38c8e5b04 100644
--- a/src/diagrams/user-journey/journeyRenderer.js
+++ b/src/diagrams/user-journey/journeyRenderer.js
@@ -178,7 +178,6 @@ export const bounds = {
cnt++;
// The loop sequenceItems is a stack so the biggest margins in the beginning of the sequenceItems
const n = _self.sequenceItems.length - cnt + 1;
-
_self.updateVal(item, 'starty', starty - n * conf.boxMargin, Math.min);
_self.updateVal(item, 'stopy', stopy + n * conf.boxMargin, Math.max);