Change the Color of an SVG Element

Tell us what’s happening:

can anybody help me with this

Your code so far

    const dataset = [12, 31, 22, 17, 25, 18, 29, 14, 9];
    const w = 500;
    const h = 100;
    const svg ="body")
                  .attr("width", w)
                  .attr("height", h);
       .attr("x", (d, i) => i * 30)
       .attr("y", (d, i) => h - 3 * d)
       .attr("width", 25)
       .attr("height", (d, i) => 3 * d)
       // Add your code below this line
       .attr("color", navy)
       // Add your code above this line

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36.

Link to the challenge:

i have also tried this but it doesnt work

.attr("fill", navy)

you are forgetting " "

Thanks a lot, this worked.

1 Like

I have tried the following and for some reason I am getting an error

// running tests
The bars should all have a fill color of navy.
// tests completed

Can someone, please, help me ?

EDIT: It worked with Chrome.