mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-27 03:09:43 +02:00
Making the font size being configurable and addting the ability set the section font size
This commit is contained in:
@@ -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|
|
||||
|
@@ -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]) {
|
||||
|
@@ -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 */
|
||||
|
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user