Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
-3
rated 0 times [  4] [ 7]  / answers: 1 / hits: 16430  / 9 Years ago, wed, january 20, 2016, 12:00:00

I want to specify a font size for the labels of a time axis created with D3. I've tried following this answer with this fiddle, but it doesn't seem to do anything. I've also tried



d3.selectAll(.xAxis>.tick>text)
.each(function(d, i){
d3.select(this).style(font-size,30);
});


to no avail. It can't be that hard...


More From » css

 Answers
29

It turns out that a unitless number is technically not a valid CSS font size specifier and that it may depend on the browser whether it is ignored or not. Therefore, use



d3.select(this).style(font-size,30px);


instead of



d3.select(this).style(font-size,30);

[#63647] Monday, January 18, 2016, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
patienceannel

Total Points: 674
Total Questions: 101
Total Answers: 101

Location: Northern Mariana Islands
Member since Fri, Jan 15, 2021
3 Years ago
patienceannel questions
Fri, Mar 11, 22, 00:00, 2 Years ago
Tue, Oct 20, 20, 00:00, 4 Years ago
Wed, Jul 24, 19, 00:00, 5 Years ago
;