title: Scaling y-axis appropriate to data in multiple line chart display
body: <p>The multiple line chart example at <a href="https://www.d3-graph-gallery.com/graph/line_smallmultiple.html" rel="nofollow noreferrer">https://www.d3-graph-gallery.com/graph/line_smallmultiple.html</a> quite clearly provides the examples I need for what I'm trying to do...</p>
  
  <p>except...</p>
  
  <p>I need the y-axis scale for each of the charts to be appropriate for the data associated with the individual keys.  As is, the example does d3.max on the entire data set, not the filtered data set controlling the individual lines.</p>
  
  <p>I've tried various ways to apply the filter in the y-axis definition and can't get anything to work.</p>
  
  <p>The closest I've been able to get is to make it use the max value from one of the specific keys for all the charts.</p>
  
  <pre><code>  var y = d3.scaleLinear()                                                      
  //  .domain([0, d3.max(data, function(d) { return +d.n; })])                    
      .domain([0, d3.max(data.filter(d =&gt; d.name === "Helen"), e =&gt; +e.n)])       
      .range([ height, 0 ]);                                                      
    svg.append("g")                                                               
      .call(d3.axisLeft(y).ticks(5)); 
  </code></pre>
  
  <p>I think I want it to filter d.name against the CURRENT-CHART key (whatever it might be) rather than a specific one (like "Helen" above), but can't figure out how to do it.  Is it some feature of nesting that I haven't found yet?  Something amazingly simple that I can't see??</p>
  
  <p>Any suggestions?</p>
  
  <p>Thanks in advance</p>