Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hard to customize font-size for gantt charts #783

Closed
fabiospampinato opened this issue Jan 17, 2019 · 9 comments
Closed

Hard to customize font-size for gantt charts #783

fabiospampinato opened this issue Jan 17, 2019 · 9 comments
Labels
Close after 30 days Close issue if no response after 30 days Graph: Gantt Status: Awaiting Reply Type: Bug / Error Something isn't working or is incorrect

Comments

@fabiospampinato
Copy link
Contributor

The default themes set a default font-size:

https://github.com/knsv/mermaid/blob/7d3578b31aeea3bc9bbc618dcda57d82574eaffb/src/themes/gantt.scss#L78

But if I override that via the settings then a font-size attribute gets added to the text element, but the CSS has the priority here and my setting is not used:

screen shot 2019-01-17 at 16 36 27

Basically the font-size becomes unless.

I think the selector should include a :not([font-size]), so that the property doesn't get overridden.

@fabiospampinato
Copy link
Contributor Author

fabiospampinato commented Jan 17, 2019

I'm using the following workaround:

 .mermaid text[font-size="14"] { 
   font-size: 14px !important; 
 } 

It's pretty ugly and will break at the first chance, but it in some cases it leads to better results.

I think the other text on the chart should scale accordingly with the set fontSize, which I don't think it's the case currently.

@stale
Copy link

stale bot commented Jun 29, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Type: New Shape Request for new shape label Jun 29, 2019
@fabiospampinato
Copy link
Contributor Author

@knsv can you label this issue so that the stupid bot won't close it?

@stale stale bot removed the Type: New Shape Request for new shape label Jun 29, 2019
@light0x00
Copy link

i have the same problem!

@IOrlandoni
Copy link
Member

Classified as a bug. I assumed the behaviour was not intentional.

@KoljaTM
Copy link

KoljaTM commented Oct 15, 2019

I have trouble reproducing this bug, could you give me an example?
fwiw, I was able to change the text size in a gantt chart with the themeCSS parameter
https://mermaidjs.github.io/mermaid-live-editor/#/edit/eyJjb2RlIjoiICAgIGdhbnR0XG4gICAgICB0aXRsZSBFeGNsdXNpdmUgZW5kIGRhdGVzIChNYW51YWwgZGF0ZSBzaG91bGQgZW5kIG9uIDNkKVxuICAgICAgZGF0ZUZvcm1hdCBZWVlZLU1NLUREXG4gICAgICBheGlzRm9ybWF0ICVkXG4gICAgICBzZWN0aW9uIFNlY3Rpb24xXG4gICAgICAgMiBEYXlzOiAxLCAyMDE5LTAxLTAxLDJkXG4gICAgICAgTWFudWFsIERhdGU6IDIsIDIwMTktMDEtMDEsMjAxOS0wMS0wMyIsIm1lcm1haWQiOnsidGhlbWUiOiJkZWZhdWx0IiwidGhlbWVDU1MiOiIudGFza1RleHQgeyBmb250LXNpemU6MTRweDsgfSJ9fQ

Is that not what you were looking for or did you run into problems with the specificity of the css styles? In my browser (Chrome) the themeCSS overrides the default from gantt.sccs, although both have the same selectors, so I guess it's loaded later.

@fabiospampinato
Copy link
Contributor Author

fabiospampinato commented Oct 15, 2019

@KoljaTM This is about the "gantt.fontSize" setting, no the "themeCSS" setting. Here you go.

KoljaTM pushed a commit to edekadigital/mermaid that referenced this issue Oct 15, 2019
- deselect theme style if font-size is set on the taskText element (e.g. via gantt-config)
@KoljaTM
Copy link

KoljaTM commented Oct 15, 2019

I added the :not([font-size]) to the theme scss, but if you now want to overwrite the theme property, you will have to use something like

      "themeCSS": ".taskText:not([font-size]), .taskText[font-size] { font-size:8px; }",

do reach a higher specificity

KoljaTM pushed a commit to edekadigital/mermaid that referenced this issue Oct 15, 2019
- deselect theme style if font-size is set on the taskText element (e.g. via gantt-config)
knsv added a commit that referenced this issue Oct 15, 2019
#783 Hard to customize font-size for gantt charts
@jgreywolf
Copy link
Contributor

Is this still an issue after the commit mentioned above?

@jgreywolf jgreywolf added Close after 30 days Close issue if no response after 30 days and removed Area: Development labels Feb 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Close after 30 days Close issue if no response after 30 days Graph: Gantt Status: Awaiting Reply Type: Bug / Error Something isn't working or is incorrect
Projects
None yet
Development

No branches or pull requests

7 participants
@jgreywolf @IOrlandoni @fabiospampinato @KoljaTM @knsv @light0x00 and others