How to use d3.min and d3.max within a d3.json command

后端 未结 3 944
借酒劲吻你
借酒劲吻你 2020-12-03 00:53

I\'m new to d3 and Javascript. I have played around with the choropleth example but would like to now make some more detailed changes. One of which is to find the max and mi

3条回答
  •  Happy的楠姐
    2020-12-03 01:40

    I'm new to d3 and JavaScript as well but I found a workaround to find the min and max of three lines with objects, using d3.extent and .concat:

    y.domain(
      d3.extent(
        d3.extent(data, function(d) {
          return d.line1;     })
        .concat(d3.extent(data, function(d) {
          return d.line2;     })
                .concat(d3.extent(data, function(d) {
          return d.line3;     })
                       ))
      ));

提交回复
热议问题