score:1
The lag can be easily explained. You forgot to change this:
for (var i = 0; i < dataSet.length; ++i) simulation.tick();
In my original code I had approximately 190 countries. However, you have 440 data points, and that takes more time to compute.
Thus, simply change the number of calls to tick
to something between 100 and 300:
for (var i = 0; i < 150; ++i) simulation.tick();
// ^-------- tweak this number
The greater this number the smaller the chance of overlapping circles, but the greater the lag. In a "normal" D3 force directed chart with the default settings, tick
runs 300 times before the simulation stops.
If you want to keep the ticks as dataset.lenght
, introducing a delay
in the transitions reduces the visual effect of the lag.
Here is your updated fiddle: https://jsfiddle.net/oo20pdnk/
Regarding the other browsers, I couldn't reproduce the problem: It is working in Firefox and IE to me. However, you have some jQuery code at the bottom (which I removed anyway, mixing D3 with jQuery gives me headache).
PS: When using someone else's code, I believe it's a good idea changing the variable names. Right now you have something like africaColor
, europeColor
, countriesCircles
etc, which makes sense in my code, but not in yours!
Source: stackoverflow.com
Related Query
- d3 transitions not working in multiple browsers
- D3.js v4.0.0-alpha.35 Transitions not working
- D3 transitions not working
- Rickshaw : data for multiple series not working
- D3.js Pie Chart Dynamic Update Transitions not Working as Expected
- d3.js Bar Chart transitions not working properly
- Multiple line chart not working with date format
- D3 .remove() method not working when chained with transitions
- Adding color dynamically to a multiple line chart but it is not working in d3.js
- Mutiple force layouts in multiple svg in single page not working
- D3 Graph working in chromium, but not in other browsers
- D3 Functions Not Working When Multiple Data Sources Are Used
- d3 .data() function not working as expected multiple data sources
- Dimple.js chart not working in browsers
- d3 classed() not working as expected with multiple classes?
- d3 multiple graph not working
- D3 sunburst with updated data: multiple transitions still snap, not smooth
- D3.js multiple area chart not working
- font size is not working in my d3.js code
- d3.select("#element") not working when code above the html element
- Title Attribute not working for an SVG Rect on Safari
- d3.js - mouseover event not working properly on svg group
- D3 - Positioning tooltip on SVG element not working
- d3.select method not working
- D3 Bar Graph example not working locally
- d3.js transition() not working when browser is minimised
- d3 transition for transform translate not working for DIV
- $location not working in AngularJS using d3.js
- Exit not working properly
- Simplest D3.js example not working
More Query from same tag
- axis scale shift in d3.js
- d3.selectAll only elements with classes in element
- Spacing Bars on Chart using JavaScript/D3
- How to create a decision tree / flow chart in D3/dagre-D3/javascript?
- Modify Keen.io donut chart using c3.js (Javascript SDK)
- How to add a single data point to a line graph in D3 without redrawing
- Is it possible to create a focus chart for Area with NVD3?
- Wrapping Text Inside SVG Circle
- d3.js Sankey using named nodes
- How to create a bar chart in D3?
- how to create pie chart using dc.js
- ES6 modules and decorator pattern
- d3.js transition() not working when browser is minimised
- d3 getting invert value of Band Scales
- Calculate grid layout based on connections?
- How in d3.js pass current selection to .each() callback?
- Eliminate decimal strings displaying in HTML tables (via poshytip mouseover)
- How do I prevent graph elements from reaching the axis of my graph in D3 and scale properly?
- d3 - required help in brush extent()
- Ordering chords based on some property of the source data
- D3JS Appended Text and Mouse Behaviors Won't Appear
- d3.js custom layout exit() not working
- Append text to animated bar chart in d3js
- Centered labels in D3 tree
- Getting Screen Positions of D3 Nodes After Transform
- Meteor, where to put d3 code?
- Processing JSON data with D3
- Angular 2 definition file
- Filter JavaScript Array Based on Multiple Values
- Using check box to enable call drag