Skip to content

Question: Titles make me crazy / sorry #3964

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

Open
Phil353556 opened this issue Mar 13, 2025 · 9 comments
Open

Question: Titles make me crazy / sorry #3964

Phil353556 opened this issue Mar 13, 2025 · 9 comments
Labels

Comments

@Phil353556
Copy link

Hello,

I tried without success, I didn't success to have several graphics on a single webpage with a title in bold for each. What I'm missing?

Is there a specific order to include
.bb-title tspan:first-child { font-size: 17px; font-weight: bold; }

is it correct to put tspan:first-child or is it another parameter ?

testtitle.html.txt

Thanks
Phil

@Phil353556
Copy link
Author

FYI. I noticed on the webpage https://d3js.org/d3.v6.min.js however the v7 is available: https://d3js.org/d3.v7.min.js
Image

The goal, is to have on a same webpage several graphics (type lines and type gauge) with the first line of the title in 17px and bold and the second line if any in 14px not bold
I found the 17px is not there and overridden by 14px.
see screenshots
Image
Image

After several tries, I detect that adding a second line to each title for each graphic solve the problem.
othertest.html.txt
othertest_with_secondline.html.txt

I will be happy to read you @netil
Best regards
Phil

@netil
Copy link
Member

netil commented Mar 17, 2025

You need to deal with some css styling and specify correct css selector for this.

first line of the title in 17px and bold and the second line if any in 14px not bold

@Phil353556. do

/* style for the first line of title */
.bb-title tspan:first-child {
    font-size: 17px;
    font-weight: bold;
}

/* style for the second line of title */
.bb-title tspan:nth-child(2) {
    font-size: 14px;
}

@Phil353556
Copy link
Author

hello @netil,
Thanks
It is Ok for graphics of type "Lines"
Does it should work in the same way for graphic of type "gauge" ?
Phil

@netil
Copy link
Member

netil commented Mar 18, 2025

@Phil353556, the css rules selects "titles" regardless the chart type.

@Phil353556
Copy link
Author

Hello @netil
I followed your advise and the .bb instruction, but sorry no success, only the fist line of the first graph is correct, no the others graphs.

Here attached is an example,
testbb.php.txt

I will be happy to read you
Phil

@heppa
Copy link

heppa commented Apr 4, 2025

Hello @Phil353556, Please always create a jsfiddle or something similar for easy checking. (https://jsfiddle.net/)

I have created one for this now:
https://jsfiddle.net/wjLdrmn8/2/

This is a CSS /HTML issue more than a library issue.

When there is only one line of title, billboard does not create any tspan elements, but only one text element with the class "bb-title". You could have easily checked that by inspecting with eg. chrome. (right-click the title and click inspect).

replace your css with this:

/* style for the first line or only line of title */
text.bb-title tspan:first-child, text.bb-title{
    font-size: 17px;
    font-weight: bold;
}

/* style for the second line of title */
text.bb-title tspan:nth-child(2) {
    font-size: 14px;
    font-weight: normal;
}

you also need the text.bb-title as it only takes precedence like that due to the order of style loading.

@Phil353556
Copy link
Author

@heppa
noted for https://jsfiddle.net/

You're incredible!
You're the best!

Thank you so much for your answer

Have a good day
Phil

@heppa
Copy link

heppa commented Apr 4, 2025

@heppa noted for https://jsfiddle.net/

You're incredible! You're the best!

Thanks but nope, @netil is for providing this incredible library ! ;)

Have a good day Phil

You too and good luck!

@Phil353556
Copy link
Author

Hello @heppa
Yes you're right of course. I already wrote and said that @netil is incredible. I made publicy for this library.
THIS is the graphic library to use. The best one

But you saved my day on these titles .. ok this is not a library issue but .bb css topic, anyway, thanks again
Phil

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants