markmarkoh / datamaps

Customizable SVG map visualizations for the web in a single Javascript file using D3.js
http://datamaps.github.io
MIT License
3.78k stars 1.01k forks source link

Multiple arcs #412

Open hamza005 opened 7 years ago

hamza005 commented 7 years ago

Hey, multiple arcs can be drawn statically. But in my case, i'm getting the real time data from a socket with latlongs. when a new arcs is drawn, it removes the previous arc weather it is not completed yet. may be its in the air yet.So what should i do to draw multiple arcs at the same time for all latlongs.

RachelLYY commented 6 years ago

I have the same problem. Have you solved it yet? I also want to know what's the function 'Datamap.arc()' returns

hamza005 commented 6 years ago

Yes! Here is the code, you can use it. It will draw multiple arcs at the same time, and will remove them after a given time interval. var arcs: any = []; arcs.push( { origin: { latitude: data.src.lat, longitude: data.src.lng, }, destination: { latitude: data.dst.lat, longitude: data.dst.lng, }, }, ); election.arc(arcs); election.svg.selectAll('path.datamaps-arc').transition() .delay(function (d) { return 50 * 20; }) .duration(800) .remove(); }