Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
simple blur
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<style>
html, body {
background: #ffffff;
font-family: Helvetica, Arial, Tahoma, sans-serif;
margin: 0;
padding: 0;
}
path {
fill: none;
stroke: #343434;
}
.result {
fill: none;
stroke: #343434;
stroke-width: 4px;
}
h1,h2,h3 {
padding-left: 140px;
padding-top: 10px;
}
</style>
</head>
<body>
<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink= 'http://www.w3.org/1999/xlink' height=300 width=450>
<defs>
<filter id="filter-blur" x="0" y="0">
<feGaussianBlur in="SourceGraphic" stdDeviation="10" />
</filter>
</defs>
</svg>
<script src='//cdnjs.cloudflare.com/ajax/libs/d3/3.4.11/d3.min.js'></script>
<script>
var data = [4, 8, 40, 15, 16, 23, 42, 18];
var x = d3.scale.linear()
.domain([0, d3.max(data)])
.range([0, 420]);
d3.select('svg')
.selectAll('rect')
.data(data)
.enter().append('rect')
.attr({
filter: 'url(#filter-blur)',
height: 20,
width: function(d) { return x(d) + 'px'; },
x: 0,
y: function(d,i){ return i * 30; }
})
.text(function(d) { return d; });
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.