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.


                <body >

	  <section class="main-content .u-colorBgMix-5">
			<div class="Label">Ob-bonus i landstingen</div>

			<div id="loadercontainer">
      <div class="loader" id="loader"></div>

	    <div id="chart"></div>






                body {
background-color: #f5f7f7;

div#chart {
	padding-top: 20px;

	    .main-content {
	      width: 442px;
	      margin: 0 auto;

	    .map {
	      display: inline-block;
	      margin: 0 auto;
	      /* overflow: auto; */


			#searchresult {


			h3 {
				margin: 2px 0px 2px 0px;

			/*.Paired .q0-3{fill:rgb(166,206,227)} .Paired .q1-3{fill:rgb(31,120,180)} .Paired .q2-3{fill:rgb(178,223,138)}*/

			.overlay {
				fill: none;
				pointer-events: all;

		.label {
		  font-weight: bold;
		  text-anchor: middle;
		  cursor: default;
			font-size: 0.3em;
			font-family: sans-serif;

		div.tooltip {
		  position: absolute;
		  text-align: left;
			/* font-family: sans-serif; */
		  padding: 4px;
		  background: #fff;
		  border: 0px;
		  pointer-events: none;

.loader {
		    border: 16px solid #f3f3f3; /* Light grey */
		    border-top: 16px solid #74b2b2; /* Blue */
		    border-radius: 50%;
		    width: 60px;
		    height: 60px;
		    animation: spin 2s linear infinite;

#loadercontainer {
  position: relative;
  top: 100px;
  width: 60px;
  left: 80px;

	@-webkit-keyframes spin {
		  0% { -webkit-transform: rotate(0deg); }
		  100% { -webkit-transform: rotate(360deg); }

		@keyframes spin {
		    0% { transform: rotate(0deg); }
		    100% { transform: rotate(360deg); }



			d3.json("", draw);
			function draw(geo_data) {
			  "use strict";
			  var width = 440,
			      height = 630,
			      scale = 2365.51882004263,
						translateX = 432.31469742010825,
						translateY = 300.8639471506867,
						legendRectSize = 18,
          	legendSpacing = 4,

				var zoom = d3.behavior.zoom()
					.scaleExtent([1, 12])
					.on("zoom", zoomhandler);

				function zoomhandler() {
					svg.attr("transform", "translate(" + d3.event.translate + ")scale(" + d3.event.scale + ")")

			  var projection = d3.geo.conicEqualArea()
						.center([16.382656313727672,62.34103687152436]) //projection center
						.parallels([55.327583999999995,69.059967]) //parallels for conic projection
						.rotate([343.6173436862723]) //rotation for conic projection
			      .translate( [translateX, translateY]);

			  var path = d3.geo.path().projection(projection);

			  var svg ="#chart")
			        .attr("width", width)
			        .attr("height", height)
			        .attr("class", "map")

			  var map = svg.selectAll("path")
			        .attr("d", path)
			        // .style("fill", "lightBlue")
			        .style("stroke", "black")
			        .style("stroke-width", 0.5)
								.on("mouseover", mouseover)
								.on("mousemove", mousemove)
								.on("mouseout", mouseout);

				var color = d3.scale.ordinal()
						.domain(["Sjuksköterskor får mer", "Sjuksköterskor och undersköterskor får lika", "Ingen får utöver avtal"])
						.range(["#730700", "#74b2b2", "#f5cc00",]);

				var legend ="svg")
							.attr("class", "legend")
							.attr("transform", function(d,i) {
								var height = legendRectSize;
								var horz = 0;
								var vert = i * height;
								return "translate(" + horz + "," + vert + ")";

						.attr("width", legendRectSize)
						.attr("height", legendRectSize)
						.style("fill", color)
						.style("stroke", color);

					.attr("x", legendRectSize + legendSpacing)
					.attr("y", legendRectSize - legendSpacing)
					.attr("class", "u-textMeta")
					.text(function(d) {return d; });

				var tooltip ="section")
							.attr("class", "tooltip u-textMeta")
							.style("opacity", 0)

        //loading my own data file
				d3.json("", function(json){
				  data = json;
				    .attr("class", quantify)
        //color by number
				function quantify(d,i) {
					var f = data[i].sifferniva;
					// return "q" + Math.min(8, ~~((f-250) / 150)) + "-9";
					return "q" + f;

				function mouseover() {
						.style("opacity", .9);

        //adding the text for the tooltip
				function mousemove(d, i) {

						tooltip.html("<b>" + + "</b>"+ "<br/>" + data[i].fritext)
							.style("left", (d3.event.pageX) + "px")
							.style("top", (d3.event.pageY - 50) + "px");


				function mouseout() {
							.style("opacity", 0);
        //hide the loader when the map is drawn
        document.getElementById('loader').style.display = "none";