Javascript D3JS散点图不一致行为

Javascript D3JS散点图不一致行为,javascript,d3.js,scatter-plot,auto-update,Javascript,D3.js,Scatter Plot,Auto Update,这是我最初问题的延续,可以在中找到(并包含完整代码) 现在我有了一个代码,它在某些场景中似乎运行良好,但在其他场景中却不行。让我解释一下 这是我数据库的快照 Dtg |温度 2016-04-03 10:28:07 26.4 2016-04-03 10:25:06 26.4 2016-04-03 10:22:05 26.4 2016-04-03 10:19:05 26.2 2016-04-03 10:16:04 26 如果下一张唱片是这样的 2016-04-03 18:00:00 25 一切正常。

这是我最初问题的延续,可以在中找到(并包含完整代码)

现在我有了一个代码,它在某些场景中似乎运行良好,但在其他场景中却不行。让我解释一下

这是我数据库的快照

Dtg |温度

2016-04-03 10:28:07 26.4
2016-04-03 10:25:06 26.4
2016-04-03 10:22:05 26.4
2016-04-03 10:19:05 26.2
2016-04-03 10:16:04 26

如果下一张唱片是这样的

2016-04-03 18:00:00 25

一切正常。整个图形得到更新,散点图也随之移动

但是,如果下一个记录是

2016-04-03 10:37:11 26.4
2016-04-03 10:34:08 26.3
2016-04-03 10:31:07 26.4

然后在同一点上绘制散点图,同时更新图形的其余部分

任何帮助都将不胜感激。谢谢

守则:

// ** Update data section (Called from the onclick)
function updateData() {

// Get the data again
data = d3.json("2301data.php", function(error, data) {
data.forEach(function(d) {
    d.dtg = parseDate(d.dtg);
    d.temperature = +d.temperature;
   // d.hum = +d.hum; // Addon 9 part 3
});


// Scale the range of the data again 
 x.domain(d3.extent(data, function(d) { return d.dtg; }));
 y.domain([0, 60]); // Addon 9 part 4

 var svg = d3.select("#chart1")
 var circle = svg.selectAll("circle").data(data)

svg.select(".x.axis") // change the x axis
        .transition()
        .duration(750)
        .call(xAxis);
    svg.select(".y.axis") // change the y axis
        .transition()
        .duration(750)
        .call(yAxis);
    svg.select(".line")   // change the line
        .transition()
        .duration(750)
        .attr("d", valueline(data));

circle.transition()
        .duration(750)
        .attr("cx", function(d) { return x(d.dtg); })

    // enter new circles
    circle.enter()
        .append("circle")
        .filter(function(d) { return d.temperature > 30 })
        .style("fill", "red")   
        .attr("r", 3.5) 
        .attr("cx", function(d) { return x(d.dtg); })

    // remove old circles
    circle.exit().remove()


});
}

控制台有错误吗?没有。完全没有错误。。。