I use d3 to draw a flow chart, very similar to the official example http://bl.ocks.org/mbostock/4060954 :

The only difference is how I updated it with new data. I not only want a vertical transition (y-value), but I also want to add new data points on the right. The entire graph should be compressed in the horizontal direction.
There were no problems to achieve the desired result, the only problem is that the transition between the two states does not look as expected.
You can find a minimal example of the strange transition effect on JSfiddle: http://jsfiddle.net/jaYJ9/4/
Click the refresh button to see the effect.
test_data0 = [{"0": 0.0, "1": 0.0, "-1": 0.0}, {"0": 0.0, "1": 0.6, "-1": 0.0}, {"0": 0.0, "1": 0.3, "-1": 0.0}, {"0": 0.0, "1": 0.0, "-1": 0.6}, {"0": 0.3, "1": 0.0, "-1": 0.0}, {"0": 0.0, "1": 0.3, "-1": 0.3}, {"0": 0.3, "1": 0.0, "-1": 0.0}, {"0": 0.3, "1": 0.0, "-1": 0.0}, {"0": 0.0, "1": 0.0, "-1": 0.0}] test_data1 = [{"0": 0.0, "1": 0.0, "-1": 0.0}, {"0": 0.0, "1": 0.6, "-1": 0.0}, {"0": 0.0, "1": 0.3, "-1": 0.0}, {"0": 0.0, "1": 0.0, "-1": 0.6}, {"0": 0.3, "1": 0.0, "-1": 0.0}, {"0": 0.0, "1": 0.3, "-1": 0.3}, {"0": 0.3, "1": 0.0, "-1": 0.0}, {"0": 0.3, "1": 0.0, "-1": 0.0}, {"0": 0.0, "1": 0.0, "-1": 0.0}, {"0": 0.0, "1": 0.0, "-1": 0.0}] $('#update').click(function(){ streamed_history(test_data1) }); var width = 300, height = 200, colors = {'0': '#6ff500', '1': '#ffad0a', '-1': '#f90035'}, feedbacks = [-1, 0, 1], stack = d3.layout.stack(); var svg = d3.select("#timeline").append("svg") .attr("width", width) .attr("height", height); var y = d3.scale.linear() .domain([0, 1]) .range([height, 0]); streamed_history(test_data0) function streamed_history(data) { data_array = feedbacks.map(function (f) { return data.map(function(element, i) { return {x: i, y: element[f]}; }) }), layers = stack(data_array) layers = feedbacks.map(function (f, i) { return {layer: layers[i], feedback: f, color: colors[f]} }) var x = d3.scale.linear() .domain([0, data.length - 1]) .range([0, width]); var area = d3.svg.area().interpolate("basis") .x(function(d) { return x(dx); }) .y0(function(d) { return y(d.y0); }) .y1(function(d) { return y(d.y0 + dy); });