d3-timeline icon indicating copy to clipboard operation
d3-timeline copied to clipboard

Is there a way to update the timeline?

Open kohesion opened this issue 6 years ago • 3 comments

Maybe this would be obvious if I knew anything about d3...

If there is a way to update the timeline, could you add it in the documentation?

Thanks!

kohesion avatar May 21 '18 21:05 kohesion

Hi, the only way that I was success to update the timeline was in the next way:

function update(data) {
  // re-init timeline
  if (timelineElement) {
    timelineElement.remove();
  }
  timelineElement = d3.select('#my-id').append('svg');
  
  // add data
  timelineElement.datum(data).call(timeline); // <- catch here
}

The re-init section is the only way that I found that will "update" the timeline without leave the old version of timeline behind new version. But, as commented in this snippet, there is a catch. I've got error in line 599: node(...).attr is not a function

after a few tests I was modified the code in the mention line to: gParentItem.attr("height", height); and the error was disappears.

So @kohesion, there is unofficial weird way to update. @denisemauldin any better solution?

hodbauer avatar Nov 07 '18 13:11 hodbauer

need d3 timeline for angular 2 project help....

aftab-git avatar Dec 14 '18 10:12 aftab-git

@hodbauer This is typically the way you would redraw the chart, yes. :)

denisemauldin avatar Dec 18 '18 05:12 denisemauldin