D3.extent() 没有给出正确的范围

D3.extent() does not give the right range

我是 D3 新手。我刚开始从 csv 文件创建散点图。但是,我发现 d3.extent 给出了错误的范围,如下所述。我不知道我做错了什么。

数据(在Python中创建的csv格式)具有以下范围:

In [56]: min(x), max(x)
Out[56]: (-10, 14)

In [57]: min(y), max(y)
Out[57]: (-5, 1)

但是,当我使用 d3.extent 时,我得到以下范围:

完整代码位于:bl.ocks.org,这里是代码片段:

        // Get the data
        d3.csv("hip_fake_data.csv", function(error, data) {
        data.forEach(function(d) {
        x_value = d.x_hip;
        y_value = d.y_hip;
        });

        // Scale the range of the data
        x.domain(d3.extent(data, function(d) {return d.x_hip;}));
        y.domain([d3.max(data, function(d) { return d.y_hip; }), -5]);

console.log(d3.extent(data, function(d) {return d.x_hip;}))
console.log(d3.extent(data, function(d) {return d.y_hip;}))
d3.csv("hip_fake_data.csv", function(error, data) {
    data.forEach(function(d) {
    x_value = +d.x_hip; // convert to number
    y_value = +d.y_hip;
    });