From b91da088e67dcf20f31068b981ed3c6befb03372 Mon Sep 17 00:00:00 2001 From: Matthew Gerring Date: Sun, 3 Feb 2013 12:06:22 -0800 Subject: [PATCH] colorz --- public/css/style.less | 38 ++++++++++++++++++++++++++++++++++- public/js/counties-overlay.js | 3 +++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/public/css/style.less b/public/css/style.less index 51c67e4..8876fd9 100644 --- a/public/css/style.less +++ b/public/css/style.less @@ -135,11 +135,47 @@ body.footer-up { left:30%; } + + path { fill: #000; - fill-opacity: .2; + fill-opacity: .8; stroke: #fff; stroke-width: 1.5px; + .apathy( @num ) { + fill: lighten(#b63b3d,percentage(@num)); + } + + &.apathy-1{ + .apathy(0); + } + &.apathy-2{ + .apathy(.05); + } + &.apathy-3{ + .apathy(.10); + } + &.apathy-4{ + .apathy(.15); + } + &.apathy-5{ + .apathy(.20); + } + &.apathy-6{ + .apathy(.25); + } + &.apathy-7{ + .apathy(.30); + } + &.apathy-8{ + .apathy(.35); + } + &.apathy-9{ + .apathy(.40); + } + &.apathy-10{ + .apathy(.45); + } } path:hover { diff --git a/public/js/counties-overlay.js b/public/js/counties-overlay.js index 2e10a8f..e98c175 100644 --- a/public/js/counties-overlay.js +++ b/public/js/counties-overlay.js @@ -1,6 +1,8 @@ var layer; var data; var layer_data; +var scale = d3.scale.linear(); +scale.domain([1,100]).rangeRound([1,10]); function addOverlay(house) { @@ -20,6 +22,7 @@ function addOverlay(house) { .enter() .append("path") .attr('data-name', function(d){ return d.properties.name }) + .attr('class', function(d){var blah = scale( layer_data[d.properties.district]["votesperregisterednorm"] ); return 'apathy-'+blah; }) .on('mouseover',function(d){ $("#mouseinfo").html(d.properties.name + "
" + "# Contributions: " + layer_data[d.properties.district]["nocontributions"]);