Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set text color for my d3 chart title?

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?

like image 229
jhyap Avatar asked Mar 20 '14 03:03

jhyap


1 Answers

All the while I was doing .style("fill", "darkOrange")

Then I found out the correct answer is

.style('fill', 'darkOrange')

like image 96
jhyap Avatar answered Sep 18 '22 15:09

jhyap