Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Scott Glover](https://secure.gravatar.com/avatar/70e693eb38bb6cb9011f069eb2ba2957?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Scott Glover
1,879 PointsChange the stroke of the circles
what am i doing wrong? i used the existing code from the fill style to model the stroke function but now task 1 isnt passing
// height and width of the svg
var height = 800, width = 500;
var padding = 50;
var viz = d3.select("#viz-wrapper")
.append('svg')
.attr('id', 'viz')
.attr('height', height)
.attr('width', width);
d3.csv('app/climate_data_truncated.csv', function(data) {
dots = viz.selectAll('circle')
.data(data)
.enter()
.append('circle');
dots.attr('r', function(d) {return Math.abs(d.TMAX) / 10})
.attr('cx', function(d) {return Math.max(0 + padding, Math.random() * width - padding)})
.attr('cy', function(d) {return Math.max(0 + padding, Math.random() * height - padding )})
.style('stroke', function(d) {
year = d.DATE.substring(0,3)
if (year === "1973") {
return "red"
}
else {
return "#ff00f5"
}
});
.style('fill', function(d) {
year = d.DATE.substring(0,4)
if (year === "1973") {
return "blue"
}
else {
return "#ff00f5"
}
});
});
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Requests</title>
</head>
<body>
<div id="viz-wrapper">
</div>
</body>
<script src="js/d3.min.js" charset="utf-8"></script>
<script src="js/app.js" charset="utf-8"></script>
</html>
1 Answer
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsThere's a few issues with the code change:
- somehow you managed to un-do task 1 (where you changed the radius to use TMIN) which must be re-done
- the arguments to substring got modified and are incorrect in the copy
- there's now a stray extra semicolon between the two style method calls