Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <div class="container">
	<div class="header">
		<h1>National Contiguity</h1>
		<h3>using Force Directed Graph</h3>
	<div class="graph">
		<div class="flagbox">
	<div id="tooltip">



                @import url('')

	background-color: #FAEBD7
	font-family: 'Abril Fatface', cursive

	margin-bottom: 0px
	text-shadow: 2px 1px 3px #40E0D0
	margin-top: 5px

	text-align: center

	position: absolute
	border: 1px solid #00ced1

	position: absolute

	display: none
	padding: 3px
	border-radius: 2px
	box-shadow: -2px 2px 10px black
	z-index: 1
	color: #fff
	position: absolute
	background-color: #000

	width: 900px
	height: 800px
	margin: auto
	box-shadow: -3px 3px 20px blac
	background-color: #483d8b

	stroke-width: 1px
	stroke: #00ced1


                const animationStep = 200;
const nodeRadius = 4;
const forceCharge = -100;
const linkDistance = 50;

var graph ='.graph')

let width = parseInt("width"));
let height = parseInt("height"));

var svg = graph.append('svg')
	.attr("width", width)
	.attr("height", height);

var tooltip ="#tooltip")

let request = new XMLHttpRequest();
request.addEventListener("load", loaded);

function loaded() {
	const data = JSON.parse(request.responseText);

	var force = d3.layout.force()
		.size([width, height])

	var link = svg.selectAll('.link')
		.attr('class', 'link');

	var node ='.flagbox').selectAll('.node')
		.attr('class', d => 'flag flag-' + d.code)
		.on("mouseover", (d) => {"display", "block");
				.style("left", d3.event.pageX + "px")
				.style("top", (d3.event.pageY - 28) + "px");
		.on("mouseout", (d) => {"display", "none");
	force.on('tick', function() {'left', d => (d.x - 8) + "px")
			.style('top', d => (d.y - 5) + "px");
			link.attr('x1', d => d.source.x)
			.attr('x2', d =>
			.attr('y1', d => d.source.y)
			.attr('y2', d =>;

};'GET', "", true);