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

JavaScript D3.js Styling and Scaling with Data Using Linear Scales in D3.js

Robert Mews
Robert Mews
11,540 Points

Use of TMAX

Not clear on the TMAX method and why it's being used on both the yMax and yMin variables?

2 Answers

Taylor Ho
Taylor Ho
9,770 Points

TMAX is referring to the maximum temperature property pulled from the data, where "element" is the data variable.

From the Data Binding lesson, around 5:30 — "In our dataset, TMAX is the maximum temperature measured on a given day."

(In that example, they are using "d" as the data variable.)

Because we need to extract maximum and also minimum range of the TMAX, which has all sorts of values in our data object. If you note the difference in code for yMax and yMin is that one has the max() method while the other uses min() method to extract minimum and maximum from TMAX. (name convention of "TMAX" can through you off a bit at first) Just remember that we are using max and min methods on the TMAX values.