Permalink
Jump to Line
Fetching contributors…
![]()
Cannot retrieve contributors at this time
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
| <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
| <title>MinnPost</title> | |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
| <script type="text/javascript">var _sf_startpt=(new Date()).getTime()</script> | |
| <link rel="shortcut icon" href="http://www.minnpost.com//sites/default/themes/siteskin/favicon.ico" type="image/x-icon" /> | |
| <meta name="keywords" content="Mark Dayton,Minnesota DFL,Minnesota GOP,Minnesota Legislature,Vikings Stadium,Voter ID Amendment" /> | |
| <meta name="description" content=" " /> | |
| <meta property="og:title" content="The 2012 Legislative session: What did they pass?"/> | |
| <meta property="og:site_name" content="MinnPost"/> | |
| <meta property="og:description" content="Explore bills by category, investigate which bills Gov. Dayton vetoed, and search by your legislators. | |
| "/> | |
| <meta property="og:image" content="http://www.minnpost.com/sites/default/files/images/thumbnails/fullpagearticles/BillExplorerGraphic3.png"/> | |
| <link rel="apple-touch-icon" href="http://www.minnpost.com//sites/default/themes/siteskin/inc/images/apple-touch-icon.png" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"></meta> | |
| <link type="text/css" rel="stylesheet" media="all" href="http://www.minnpost.com/sites/default/files/css/css_cc2732a55db9703697ac738883d915c9.css" /> | |
| <link type="text/css" rel="stylesheet" media="screen" href="http://www.minnpost.com/sites/default/files/css/css_b26ad2d81bc74f1246e9c9a4c45ecdea.css" /> | |
| <link type="text/css" rel="stylesheet" media="print" href="http://www.minnpost.com/sites/default/files/css/css_cd72d16d00ebb27825710d934e28fbe8.css" /> | |
| <!--[if IE]> | |
| <link rel="stylesheet" href="http://www.minnpost.com/sites/default/themes/derma/inc/css/ie.css?n" type="text/css"> | |
| <![endif]--> | |
| </head> | |
| <body class="not-front logged-in page-node node-type-article one-sidebar sidebar-right admin-nw admin-vertical admin-df section-data section-data-id-2012 section-data-id-2012-id-05 section-data-id-2012-id-05-how-we-built-legislative-bill-explorer one-sidebar sidebar-right"> | |
| <div class="outside-embeddable-container"> | |
| <!-- START: Embeddable --> | |
| <div class="node-body fieldlayout node-field-body"> | |
| <style type="text/css"> | |
| /* @import url(''); */ | |
| </style> | |
| <style type="text/css"> | |
| #minnpost-firearm-analysis { | |
| max-width: 960px; | |
| margin: 0 auto; | |
| } | |
| .clear { | |
| clear: both; | |
| } | |
| .js-dependent, | |
| .hidden { | |
| display: none; | |
| } | |
| .footnote { | |
| font-size: .75em; | |
| font-style: italic; | |
| color: #414141; | |
| margin-top: 3em; | |
| border-top: 1px solid #BCBCBC; | |
| padding-top: 1em; | |
| } | |
| .loading-general { | |
| width: 100%; | |
| text-align: center; | |
| padding: 2em 2em; | |
| color: #ABABAB; | |
| vertical-align: middle; | |
| height: 100%; | |
| line-height: 100%; | |
| } | |
| .loading-general span { | |
| padding: 10px 5px 10px 40px; | |
| background: transparent url('https://s3.amazonaws.com/data.minnpost/projects/2012-mn-election-results/images/ajax-loader.gif') center left no-repeat; | |
| vertical-align: middle; | |
| height: 100%; | |
| line-height: 100%; | |
| } | |
| .tooltip-body-container { | |
| position: absolute; | |
| z-index: 99; | |
| top: 0; | |
| right: 0; | |
| } | |
| .tooltip-container { | |
| background-color: #EBEBEB; | |
| background-color: rgba(230, 230, 230, 0.5); | |
| border: 1px solid #777777; | |
| padding: .5em 1em; | |
| -webkit-border-radius: 5px; | |
| -moz-border-radius: 5px; | |
| border-radius: 5px; | |
| text-align: left; | |
| font-size: .75em; | |
| } | |
| #application-container { | |
| min-height: 450px; | |
| padding-top: 1em; | |
| } | |
| #county-chart-container { | |
| width: 100%; | |
| height: 400px; | |
| background-color: #FFFFFF; | |
| } | |
| .by-the-numbers { | |
| list-style: none; | |
| padding: 0; | |
| margin: 0; | |
| font-family: Helvetica,Arial,Geneva,sans-serif; | |
| } | |
| .by-the-numbers .number-block { | |
| list-style: none; | |
| width: 33.333333%; | |
| float: left; | |
| text-align: center; | |
| padding: 0; | |
| margin: 1em 0 0 0; | |
| position: relative; | |
| } | |
| .by-the-numbers .number-block .number { | |
| font-size: 4em; | |
| line-height: 1.25em; | |
| padding: 0 .5em; | |
| } | |
| .by-the-numbers .number-block .number-description { | |
| font-size: 1.15em; | |
| line-height: 1.25em; | |
| padding: 0 .5em; | |
| } | |
| .by-the-numbers .number-block .number-source { | |
| font-size: .65em; | |
| padding: 0 .5em; | |
| } | |
| .by-the-numbers .number-block-map { | |
| width: 66.6666666%; | |
| float: right; | |
| padding: 0; | |
| } | |
| .by-the-numbers sub { | |
| color: #676767; | |
| font-style: italic; | |
| font-size: .65em; | |
| } | |
| .number-block-map h5 { | |
| margin-top: 1em; | |
| } | |
| .map-key-container { | |
| width: 60%; | |
| margin: 5px auto; | |
| } | |
| .map-key { | |
| height: 20px; | |
| } | |
| .map-key div { | |
| height: 20px; | |
| float: left; | |
| } | |
| .map-key-container .key-start { | |
| display: block; | |
| float: left; | |
| font-size: .65em; | |
| font-family: Helvetica,Arial,Geneva,sans-serif; | |
| } | |
| .map-key-container .key-end { | |
| display: block; | |
| float: right; | |
| font-size: .65em; | |
| font-family: Helvetica,Arial,Geneva,sans-serif; | |
| } | |
| .things-dont { | |
| width: 50%; | |
| margin: 4em auto 1em auto; | |
| padding: 2em; | |
| background-color: #DCDCDC; | |
| } | |
| .things-dont ol { | |
| font-size: 1.1em; | |
| } | |
| .things-dont h3 { | |
| text-align: center; | |
| } | |
| /** | |
| * Responsive creen size styles | |
| */ | |
| @media screen and (max-width: 960px) { | |
| .by-the-numbers .number-block { | |
| width: 50%; | |
| } | |
| } | |
| @media screen and (max-width: 650px) { | |
| .by-the-numbers .number-block { | |
| width: 100%; | |
| } | |
| .things-dont { | |
| width: 80%; | |
| } | |
| } | |
| </style> | |
| <!--[if lte IE 7]> | |
| <style type="text/css"> | |
| .ie-upgrade-note { | |
| font-size: 90%; | |
| background-color: #DCDCDC; | |
| border: 1px solid #A2A2A2; | |
| padding: 1em; | |
| margin: 1em 0 2em 0; | |
| } | |
| </style> | |
| <![endif]--> | |
| <!--[if lte IE 8]> | |
| <style type="text/css"> | |
| </style> | |
| <![endif]--> | |
| <!-- Initial HTML for application --> | |
| <div id="minnpost-firearm-analysis"> | |
| <noscript> | |
| <p>This application requires Javascript which is used to make your web browser more interactive. If this message does not go away, please consider enabling Javascript. Here are <a href="http://www.enable-javascript.com/" target="_blank">instructions on how to enable JavaScript in your web browser</a>.</p> | |
| </noscript> | |
| <!--[if lte IE 7]> | |
| <div class="ie-upgrade-note"> | |
| <h4>Consider upgrading your browser</h4> | |
| <p>Your <strong>Internet Browser</strong> is the application you use to navigate webpages on the internet. You are currently using an older version of Internet Explorer. This application may not be full-featured because you are using such an old browser.</p> | |
| <p><a href="http://browsehappy.com/" target="_blank">Click here to find out about upgrading to a newer browsers</a>.</p> | |
| <p>If you cannot install new applications on your computer (because it is not allowed at work, for example), consider using <a href="http://www.google.com/chromeframe" target="_blank">Google's Chrome Frame</a> for Internet Explorer.</p> | |
| </div> | |
| <![endif]--> | |
| <div class="by-the-numbers clear-block"> | |
| <div class="number-block"> | |
| <div class="number"> | |
| <img src="https://s3.amazonaws.com/data.minnpost/projects/minnpost-firearm-analysis/img/star-filled.png" /> | |
| <img src="https://s3.amazonaws.com/data.minnpost/projects/minnpost-firearm-analysis/img/star-empty.png" /> | |
| <img src="https://s3.amazonaws.com/data.minnpost/projects/minnpost-firearm-analysis/img/star-empty.png" /> | |
| <img src="https://s3.amazonaws.com/data.minnpost/projects/minnpost-firearm-analysis/img/star-empty.png" /> | |
| </div> | |
| <div class="number-description">Minnesota's gun law ranking, according to the Brady Scorecard, which concludes the state has "weak gun laws that help feed the illegal gun market and allows the sale of guns without background checks and put children at risk."</div> | |
| <div class="number-source">Source <a href="http://www.bradycampaign.org/stategunlaws/scorecard/MN/" target="_blank">Brady Scorecard</a></div> | |
| </div> | |
| <div class="number-block"> | |
| <div class="number">91,221</div> | |
| <div class="number-description">Active permits to carry as of Dec. 31, 2011 <sub>1</sub></div> | |
| <div class="number-source">Source <a href="https://dps.mn.gov/divisions/bca/Documents/2011%20Permit%20to%20Carry%20Year%20End%20Report%20Final.pdf" target="_blank">MN Dept of Public Safety</a></div> | |
| </div> | |
| <div class="number-block"> | |
| <div class="number">337,534</div> | |
| <div class="number-description">Background checks in 2011 </div> | |
| <div class="number-source">Source <a href="http://www.fbi.gov/about-us/cjis/nics/reports/20121203_1998_2012_state_monthly_totals.pdf" target="_blank">National Instant Criminal Background Checks System</a>.</div> | |
| </div> | |
| <div class="number-block number-block-map"> | |
| <div id="application-container" class="clear-block"> | |
| </div> | |
| </div> | |
| <div class="number-block"> | |
| <div class="number">7 days</div> | |
| <div class="number-description">Maximum waiting period before issuance of a permit to purchase handguns or assault weapons <sub>3</sub></div> | |
| <div class="number-source">Source <a href="https://www.revisor.mn.gov/statutes/?id=624.7132&year=2012" target="_blank">MN Revisor of Statutes</a></div> | |
| </div> | |
| <div class="number-block"> | |
| <div class="number">$76,795</div> | |
| <div class="number-description">NRA campaign contributions to and outside spending on behalf of Minnesota congressional candidates in 2012 <sub>2</sub></div> | |
| <div class="number-source">Source <a href="http://www.opensecrets.org/outsidespending/recips.php?cmte=C90013301&cycle=2012" target="_blank">Open Secrets [1]</a> and <a href="http://www.opensecrets.org/orgs/recips.php?id=D000000082&type=P&cycle=2012&sort=A&state=MN" target="_blank">[2]</a></div> | |
| </div> | |
| <div class="number-block"> | |
| <div class="number">495</div> | |
| <div class="number-description">Criminal forfeitures of firearms in 2011</div> | |
| <div class="number-source">Source <a href="http://www.auditor.state.mn.us/reports/gid/2011/forfeiture/forfeiture_11_report.pdf" target="_blank">MN State Auditor</a></div> | |
| </div> | |
| <!-- | |
| <div class="number-block"> | |
| <div class="number">C?</div> | |
| <div class="number-description">NRA grade for Minnesota (see <a href="http://www.fbi.gov/about-us/cjis/nics/reports/20121203_1998_2012_state_monthly_totals.pdf" target="_blank">report</a>)</div> | |
| </div> | |
| <div class="number-block"> | |
| <div class="number">100,000?</div> | |
| <div class="number-description">Guns seized from crimes in Minnesota (see <a href="http://www.fbi.gov/about-us/cjis/nics/reports/20121203_1998_2012_state_monthly_totals.pdf" target="_blank">report</a>)</div> | |
| </div> | |
| <div class="number-block"> | |
| <div class="number">50?</div> | |
| <div class="number-description">Gun deaths in Minnesota (see <a href="http://www.fbi.gov/about-us/cjis/nics/reports/20121203_1998_2012_state_monthly_totals.pdf" target="_blank">report</a>)</div> | |
| </div> | |
| <div class="number-block"> | |
| <div class="number">17th</div> | |
| <div class="number-description">On guns laws</div> | |
| <div class="number-source">Minnesota's ranking on guns laws according to the <a href="http://www.bradycampaign.org/stategunlaws/scorecard/MN/" target="_blank">Brady Scorecard</a> (2011)</div> | |
| </div> | |
| --> | |
| </div> | |
| <div class="things-dont clear-block"> | |
| <h3>What we don't know about guns in Minnesota:</h3> | |
| <ol> | |
| <li>The total number of guns in the state.</li> | |
| <li>The amount of ammunition sold or owned.</li> | |
| <li>The number of gun owners.</li> | |
| <li>A breakdown of the types of guns sold in Minnesota.</li> | |
| <li>The number of guns sold at gunshows.</li> | |
| <li>The number of guns trafficked and sold illegally.</li> | |
| </ol> | |
| </div> | |
| <p class="footnote">Population data from <a href="http://www.gis.leg.mn/metadata/county2010.htm" target="_blank">2010 MN State Legislature GIS county files</a>. Permit to Carry numbers from <a href="https://dps.mn.gov/divisions/bca/Documents/2011%20Permit%20to%20Carry%20Year%20End%20Report%20Final.pdf" target="_blank">2011 MN Department of Public Safety report</a>. <a href="http://thenounproject.com/noun/star/#icon-No431" target="_blank">Star</a> icon from The Noun Project. | |
| <br /><br /> | |
| <sub>1</sub> Report of valid permits for applications received from 05/01/2003 to 12/31/2011 and valid on or before 12/31/2011 for all the counties.<br /> | |
| <sub>2</sub> The total NRA contributions number is both contributions to campaigns and money spent on behalf of candidates, but independent of their campaigns.<br /> | |
| <sub>3</sub> The <a href="https://www.revisor.mn.gov/statutes/?id=624.7132&year=2012" target="_blank">law defining the waiting period</a> is not precise and refers to both a 5 business day and 7 day waiting period. | |
| </p> | |
| </div> | |
| <!-- Templates to be used in client side processing. --> | |
| <script id="template-loading" type="text/template"> | |
| <div class="loading-general-container"> | |
| <div class="loading-general"><span>Loading...</span></div> | |
| </div> | |
| </script> | |
| <script id="template-chart-container" type="text/template"> | |
| <div id="county-chart-container"></div> | |
| <h5>Permits to Carry per capita</h5> | |
| <div class="map-key-container clear-block"> | |
| <div class="map-key"></div> | |
| <span class="key-start">Fewer permits</span><span class="key-end">More permits</span> | |
| </div> | |
| </script> | |
| <script id="template-tooltip" type="text/template"> | |
| <div class="tooltip-container"> | |
| <h4><%= d.properties.NAME %> County</h4> | |
| Population: <strong><%= d3.format(',d')(d.properties.POPULATION) %></strong><br /> | |
| Permits: <strong><%= d3.format(',d')(d.properties.permits) %></strong><br /> | |
| Permits per population: <strong><%= d3.format('.2%')(d.properties.permitsPopulation) %></strong><br /> | |
| </div> | |
| </script> | |
| <!-- jQuery that is used on MinnPost site (ensures test environment) --> | |
| <script type="text/javascript"> | |
| window.jQuery || document.write('<script type="text/javascript" src="https://s3.amazonaws.com/data.minnpost/js/jquery-1.3.2/jquery-1.3.2.min.js"><\/script>') | |
| </script> | |
| <!--[if lte IE 8]> | |
| <script type="text/javascript" src="https://s3.amazonaws.com/data.minnpost/js/es5-shim-master-20120801/es5-shim.min.js"></script> | |
| <![endif]--> | |
| <script type="text/javascript" src="https://s3.amazonaws.com/data.minnpost/js/underscore-1.3.3/underscore-min.js"></script> | |
| <script type="text/javascript" src="https://s3.amazonaws.com/data.minnpost/js/jquery-custom-master-20120606/jquery-1.7.2.custom.min.js"></script> | |
| <script type="text/javascript" src="https://s3.amazonaws.com/data.minnpost/js/r2d3-master-20121114/r2d3.v2.min.js"></script> | |
| <script type="text/javascript"> | |
| // Handle custom jQuery | |
| jQueryCustom = jQueryCustom.noConflict(); | |
| (function($, w, undefined) { | |
| var dataDir = 'https://s3.amazonaws.com/data.minnpost/projects/minnpost-boundary-conversions/data/mn-county-2010/geojson-dp-60/'; | |
| var countyFirearmData = [ | |
| { county: 'Aitkin', permits: 496 }, | |
| { county: 'Anoka', permits: 7168 }, | |
| { county: 'Becker', permits: 625 }, | |
| { county: 'Beltrami', permits: 669 }, | |
| { county: 'Benton', permits: 797 }, | |
| { county: 'Big Stone', permits: 65 }, | |
| { county: 'Blue Earth', permits: 755 }, | |
| { county: 'Brown', permits: 285 }, | |
| { county: 'Carlton', permits: 912 }, | |
| { county: 'Carver', permits: 1638 }, | |
| { county: 'Cass', permits: 865 }, | |
| { county: 'Chippewa', permits: 220 }, | |
| { county: 'Chisago', permits: 1566 }, | |
| { county: 'Clay', permits: 437 }, | |
| { county: 'Clearwater', permits: 176 }, | |
| { county: 'Cook', permits: 256 }, | |
| { county: 'Cottonwood', permits: 145 }, | |
| { county: 'Crow Wing', permits: 1707 }, | |
| { county: 'Dakota', permits: 6587 }, | |
| { county: 'Dodge', permits: 308 }, | |
| { county: 'Douglas', permits: 980 }, | |
| { county: 'Faribault', permits: 251 }, | |
| { county: 'Fillmore', permits: 351 }, | |
| { county: 'Freeborn', permits: 381 }, | |
| { county: 'Goodhue', permits: 885 }, | |
| { county: 'Grant', permits: 129 }, | |
| { county: 'Hennepin', permits: 13793 }, | |
| { county: 'Houston', permits: 359 }, | |
| { county: 'Hubbard', permits: 442 }, | |
| { county: 'Isanti', permits: 1019 }, | |
| { county: 'Itasca', permits: 1483 }, | |
| { county: 'Jackson', permits: 136 }, | |
| { county: 'Kanabec', permits: 409 }, | |
| { county: 'Kandiyohi', permits: 800 }, | |
| { county: 'Kittson', permits: 70 }, | |
| { county: 'Koochiching', permits: 349 }, | |
| { county: 'Lac qui Parle', permits: 86 }, | |
| { county: 'Lake', permits: 329 }, | |
| { county: 'Lake of the Woods', permits: 106 }, | |
| { county: 'Le Sueur', permits: 439 }, | |
| { county: 'Lincoln', permits: 37 }, | |
| { county: 'Lyon', permits: 279 }, | |
| { county: 'Mahnomen', permits: 61 }, | |
| { county: 'Marshall', permits: 139 }, | |
| { county: 'Martin', permits: 254 }, | |
| { county: 'McLeod', permits: 615 }, | |
| { county: 'Meeker', permits: 390 }, | |
| { county: 'Mille Lacs', permits: 693 }, | |
| { county: 'Morrison', permits: 764 }, | |
| { county: 'Mower', permits: 476 }, | |
| { county: 'Murray', permits: 107 }, | |
| { county: 'Nicollet', permits: 358 }, | |
| { county: 'Nobles', permits: 240 }, | |
| { county: 'Norman', permits: 79 }, | |
| { county: 'Olmsted', permits: 2131 }, | |
| { county: 'Otter Tail', permits: 1650 }, | |
| { county: 'Pennington', permits: 182 }, | |
| { county: 'Pine', permits: 754 }, | |
| { county: 'Pipestone', permits: 101 }, | |
| { county: 'Polk', permits: 434 }, | |
| { county: 'Pope', permits: 191 }, | |
| { county: 'Ramsey', permits: 5498 }, | |
| { county: 'Red Lake', permits: 78 }, | |
| { county: 'Redwood', permits: 235 }, | |
| { county: 'Renville', permits: 269 }, | |
| { county: 'Rice', permits: 954 }, | |
| { county: 'Rock', permits: 44 }, | |
| { county: 'Roseau', permits: 262 }, | |
| { county: 'Scott', permits: 2566 }, | |
| { county: 'Sherburne', permits: 2434 }, | |
| { county: 'Sibley', permits: 265 }, | |
| { county: 'St. Louis', permits: 6330 }, | |
| { county: 'Stearns', permits: 2280 }, | |
| { county: 'Steele', permits: 512 }, | |
| { county: 'Stevens', permits: 134 }, | |
| { county: 'Swift', permits: 130 }, | |
| { county: 'Todd', permits: 593 }, | |
| { county: 'Traverse', permits: 74 }, | |
| { county: 'Wabasha', permits: 476 }, | |
| { county: 'Wadena', permits: 250 }, | |
| { county: 'Waseca', permits: 250 }, | |
| { county: 'Washington', permits: 5310 }, | |
| { county: 'Watonwan', permits: 176 }, | |
| { county: 'Wilkin', permits: 66 }, | |
| { county: 'Winona', permits: 693 }, | |
| { county: 'Wright', permits: 2768 }, | |
| { county: 'Yellow Medicine', permits: 165 } | |
| ]; | |
| // Tooltip placeholder | |
| var templateTooltip = $('#template-tooltip').html(); | |
| var $tooltip = $('<div>').addClass('tooltip-body-container').hide() | |
| .appendTo('.number-block-map'); | |
| // Function to create visualization | |
| var updateChart = function(data, containerSelector) { | |
| var $container = $(containerSelector); | |
| // Handle inputs and updates | |
| var width = parseInt($container.width()); | |
| var height = parseInt($container.height()); | |
| // Bounding code borrowed from: http://www.larsko.org/v/igdp/ | |
| var margin = width * 0.02; | |
| var proj = d3.geo.mercator().scale(1).translate([0,0]); | |
| var bounds0 = d3.geo.bounds(data); | |
| var bounds = bounds0.map(proj); | |
| var xscale = (width - 2 * margin) / Math.abs(bounds[1][0] - bounds[0][0]); | |
| var yscale = (height - 2 * margin) / Math.abs(bounds[1][1] - bounds[0][1]); | |
| var pscale = Math.min(xscale, yscale); | |
| // Create svg canvas | |
| var svg = d3.select(containerSelector).append('svg') | |
| .attr('width', width) | |
| .attr('height', height); | |
| // Handle projection | |
| var wscale = pscale; | |
| proj.scale(pscale); | |
| proj.translate(proj([-bounds0[0][0], -bounds0[1][1]])); | |
| var path = d3.geo.path().projection(proj); | |
| // Handle svg canvas, dpeneding on orientation | |
| if (xscale > yscale) { | |
| var d = xscale * Math.abs(bounds[1][0] - bounds[0][0]) - yscale * Math.abs(bounds[1][0] - bounds[0][0]); | |
| svg.attr('transform', 'translate(' + d / 2 + ', 0)'); | |
| } | |
| else { | |
| var d = yscale * Math.abs(bounds[1][1] - bounds[0][1]) - xscale * Math.abs(bounds[1][1] - bounds[0][1]); | |
| svg.attr('transform', 'translate(0, ' + d / 5 + ')'); | |
| } | |
| // Handle offset, dpeneding on orientation | |
| var widthd = proj(bounds0[0])[1]; | |
| var heightd = proj(bounds0[1])[0]; | |
| if (xscale > yscale) { | |
| var offsetxd = (width / 2 - widthd / 2); | |
| var offsetyd = margin; | |
| } | |
| else { | |
| var offsetxd = margin; | |
| var offsetyd = (height / 2 - heightd / 2); | |
| } | |
| // Colors | |
| //.range(['#FCFBFD', '#EFEDF5', '#DADAEB', '#BCBDDC', '#9E9AC8', '#807DBA', '#6A51A3', '#4A1486']) | |
| //.range(['#FFFFD9', '#EDF8B1', '#C7E9B4', '#7FCDBB', '#41B6C4', '#1D91C0', '#225EA8', '#253494', '#081D58']) | |
| var colors = ['#2D3C52', '#3B4A5F', '#49586D', '#58667B', '#667488', '#758296', '#8390A4', '#919EB1', '#A0ACBF', '#AEBACD', '#BDC9DB'].reverse(); | |
| var min = _.min(data.features, function(d) { return d.properties.permitsPopulation; }); | |
| var max = _.max(data.features, function(d) { return d.properties.permitsPopulation; }); | |
| var colorRange = d3.scale.linear() | |
| .domain(d3.range(min.properties.permitsPopulation, max.properties.permitsPopulation, 0.003)) | |
| .range(colors) | |
| .clamp(true); | |
| // Make key | |
| _.each(colors, function(c) { | |
| $('<div>').css('width', ((1 / colors.length * 100) - .01) + '%') | |
| .css('background-color', c) | |
| .appendTo('.map-key'); | |
| }); | |
| // Render paths | |
| svg.selectAll('path') | |
| .data(data.features) | |
| .enter().append('path') | |
| .attr('d', path) | |
| .attr('stroke', '#EDEDED') | |
| .attr('transform', 'translate(' + offsetxd + ', ' + offsetyd + ')') | |
| .attr('stroke', '#DEDEDE') | |
| .attr('fill', function(d) { return colorRange(d.properties.permitsPopulation); }) | |
| .on('mouseover', function(d) { | |
| this.attr('stroke', '#898989') | |
| .attr('stroke-width', 3); | |
| //this.toFront(); // This screws up hover in IE7/8 | |
| $tooltip | |
| .html(_.template(templateTooltip, { d: d })) | |
| .show(); | |
| }) | |
| .on('mouseout', function(d) { | |
| this.attr('stroke', '#DEDEDE') | |
| .attr('stroke-width', 1); | |
| $tooltip.hide(); | |
| }) | |
| .on('click', function(d) { | |
| this.attr('stroke', '#020202'); | |
| }); | |
| // Remove loading | |
| $('.loading').html(''); | |
| } | |
| // When ready, make the magic happen | |
| $(document).ready(function() { | |
| $('#application-container').html($('#template-loading').html()); | |
| window.mn_county_2010 = function(data) { | |
| // Add in permit data | |
| data.features = _.map(data.features, function(d) { | |
| var found = false; | |
| _.each(countyFirearmData, function(c) { | |
| if (c.county == d.properties.NAME) { | |
| d.properties.permits = c.permits; | |
| d.properties.permitsPopulation = c.permits / d.properties.POPULATION; | |
| found = true; | |
| } | |
| }); | |
| return d; | |
| }); | |
| // Start application | |
| $('#application-container').html($('#template-chart-container').html()); | |
| updateChart(data, '#county-chart-container'); | |
| }; | |
| $.ajax({ | |
| type: 'GET', | |
| dataType: 'jsonp', | |
| url: dataDir + 'mn-county-2010.jsonp?callback=mn_county_2010', | |
| jsonp: 'callback' | |
| }); | |
| }); | |
| })(jQueryCustom, window); | |
| </script> | |
| </div> | |
| <!-- END: Embeddable --> | |
| </div> | |
| </body> | |
| </html> |