Skip to content

Instantly share code, notes, and snippets.

@biovisualize
biovisualize / index.html
Created October 3, 2011 03:17
Append node already in the DOM
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
<title></title>
</head>
<style type="text/css">
</style>
<body>
@biovisualize
biovisualize / index.html
Created October 5, 2011 04:06
Download link for generated SVG (from mbostock)
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
<title>Download SVG</title>
<style type="text/css">
#download{
cursor: pointer;
text-decoration: none;
color: black;
@biovisualize
biovisualize / index.html
Created October 6, 2011 01:35
Inkscape d3 tutorial
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
<title>D3-Inkscscape tutorial</title>
</head>
<body>
<div id="viz"></div>
<a href="#" id="download">Download</a>
<script type="text/javascript">
@biovisualize
biovisualize / index.html
Created October 11, 2011 05:21
Parallel Coordinates Plot (first draft)
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
</head>
<body>
<div id="viz"></div>
<script type="text/javascript">
(function(){bio = {};
@biovisualize
biovisualize / index.html
Created October 13, 2011 21:35
Sortable bar chart
<!DOCTYPE html>
<html>
<head>
<title>Bar Chart</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.0.0"></script>
<style type="text/css">
body {
font: 10px sans-serif;
}
svg {
@biovisualize
biovisualize / index.html
Created October 14, 2011 07:32
Line chart with icicle diagram range selector
<html>
<head>
<title></title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
<style type="text/css">
.domain{
display: none;
}
</style>
</head>
@biovisualize
biovisualize / README.md
Last active March 4, 2016 22:43
D3 chart plugin template

A template example to write simple chart plugins on top of D3. It is a base for discussion, so your are much welcome to modify it and comment it. The requirements are discussed on the wiki.

This implementation provides: div or svg parent, variants (bars or stacked bars), position, relative position (after or under another chart of the same svg parent), margins, gap between bars (in %), transition duration, separated data and labels (to discuss), uses axis component (to complete), chart size taken from the parent and will resize with it, all items accessible from CSS for styling, most options optional, automatic redraw on setting change and zero argument returns the value.

In this example, the first bar chart data updates periodically and a mouse click changes chart type.

@biovisualize
biovisualize / index.html
Created April 4, 2012 04:08
Bar chart to polar area chart
<!DOCTYPE html>
<html >
<head>
<script type="text/javascript" src="http://github.com/mbostock/d3/raw/v1.8.2/d3.js"></script>
</head>
<body>
<div id="vis_div_id1" style="position:absolute;"></div>
<div id="vis_div_id2" style="position:absolute;left:500px"></div>
<script type="text/javascript">
@biovisualize
biovisualize / index.html
Created April 6, 2012 21:06
Zoom/pan map
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<!--
Zoom/pan map example: integrates d3.geo and d3.behavior
Iain Dillingham, http://dillingham.me.uk/
With help from Jason Davies, http://www.jasondavies.com/
-->
<title>Zoom/pan map example</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.v2.js"></script>
@biovisualize
biovisualize / index.html
Last active July 13, 2021 22:53
Tooltip as a d3 helper
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script type="text/javascript" src="https://d3js.org/d3.v3.min.js"></script>
<script type="text/javascript" src="./tooltip.js"></script>
</head>
<body>
<div class="viz"></div>
<script type="text/javascript">