- Created date: 2013-01-29
- Author: @echojuliett
Last active
December 11, 2015 21:39
-
-
Save e9t/4664433 to your computer and use it in GitHub Desktop.
SNU DMLab logo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var width = 170; | |
var height = 170; | |
var root = d3.select('#chart').append('svg') | |
.attr('width', width) | |
.attr('height', height) | |
var rects = [ | |
{ x: 10, y: 40, w: 50, h: 50, fill: '#bd7' }, | |
{ x: 10, y: 90, w: 50, h: 50, fill: '#bd7' }, | |
{ x: 60, y: 40, w: 50, h: 50, fill: '#8B3' }, | |
{ x: 60, y: 90, w: 50, h: 50, fill: '#8B3' }, | |
{ x: 110, y: 40, w: 50, h: 50, fill: '#184' }, | |
{ x: 110, y: 90, w: 50, h: 50, fill: '#184' }, | |
]; | |
root.selectAll('rect') | |
.data(rects).enter() | |
.append('rect') | |
.attr('x', function(d) { return d.x; }) | |
.attr('y', function(d) { return d.y; }) | |
.attr('width', function(d) { return d.w; }) | |
.attr('height', function(d) { return d.h; }) | |
.attr('fill', function(d) { return d.fill }) | |
.attr('stroke-width', 10) | |
.attr('stroke', 'whitesmoke'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<body> | |
<div id="chart"></div> | |
<script type="text/javascript" src="dmlab.js"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment