javascript - All data is in enter() placeholder (D3) -


i've got update function code:

// actualy fetched server. array of js objects parsed right type var xdata = [{     id: 234234 // parsed integer     date: 15/11/2001 // parsed date     price: 6512 // parsed integer }];  // triggred user function updatesvg() {   // fetch new data ther server  xdata = [];  xdata = [{     id: 234234 // parsed integer     data: 15/11/2001 // parsed date     price: 6512 // parsed integer }];   // join data  var x = svg.selectall(".x-class")      .data(xdata, function(d) { return d.id; });   // new data  x.enter().append("image")      .attr('class', 'x-class')      .attr("xlink:href", "x-image.png")      .attr("width", 16)      .attr("height", 19)      .attr('y', 0);   // current , new data  x.transition()      .attr("x", function(d) { return x(d.date); })      .attr("y", function(d) { return y(d.date); });   /// old data  x.exit().remove();  } 

what expect when run function second or third time, of data update (i.e. not in enter), , few of data in enter() , exit().

but data in enter(). no matter what. d.id unique sure. works expected issue. when inspect x object before , after fetche new data, data in enter() placeholder.

any ideas? missing?

code problems (let know if of these help):

  1. what x in case of x(d.date)? mean xdata here?

    x.attr("x", function(d) { return x(d.date); })

  2. what doing? haven't defined data, or y. (or arrayobjectindexof , yoffset suspect implied)

    return y(data[arrayobjectindexof(data, d.date, 'date')].price) - yoffset;

also, since d3 data manipulation library, it's more difficult when don't know data looks like. idea (d.date) important here (since you're apparently finding price elsewhere instead of doing d.price)


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -