How to set text color for my d3 chart title?
57,530
All the while I was doing .style("fill", "darkOrange")
Then I found out the correct answer is
.style('fill', 'darkOrange')
Author by
jhyap
present) Software QA Lead Python language intermediate level C language intermediate level ex) Software Development Engineer (Data Visualization) Data visualization and Analysis advance level C# winsform programming intermediate level JavaScript intermediate level GrADS beginner-intermediate level jqplot - intermediate-advance level online map api - intermediate-advance level d3.js - beginner level GIS newbie
Updated on July 09, 2022Comments
-
jhyap almost 2 years
I have my d3 chart title, text append on the svg as per below:
svg.append("text") .attr("x", (width / 2)) .attr("y", 0) .attr("text-anchor", "middle") .style("font-size", "14px") .text(text);
reference here
But I would like to set the text color to some other color. Is that possible?
-
Nevin Madhukar K about 10 yearsaww.. was writing that out just now. Glad you found the ans. :)
-
jhyap about 10 yearsThanks you very much :)
-
Felix Kling about 10 yearsYeah, SVG is weird like that.
-
Admin almost 5 yearswhat the heck? why does it even matter?
-
Dev over 2 yearsits still not working for me