Skip to content

Instantly share code, notes, and snippets.

@johnkiernander
johnkiernander / horizontal_waterfall
Last active April 11, 2018 00:06
Horizontal Waterfall
<div id="chartContainer">
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://dimplejs.org/dist/dimple.v1.js"></script>
<script type="text/javascript">
// This code should support any data in this structure changing the data here
// should be dealt with by the the code below. The y axis min and max must
// be able to contain the data required or the results will be incorrect.
// Also the "bar" elements must have the correct value (sum of previous "bar"
// + intervening "var" elements)
@johnkiernander
johnkiernander / Click Sort
Last active December 21, 2015 01:48
How to sort a bar chart by clicking
<div id="chartContainer">
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="/dist/dimple.v1.js"></script>
<script type="text/javascript">
var svg = dimple.newSvg("#chartContainer", 590, 400);
d3.tsv("/data/example_data.tsv", function (data) {
var myChart = new dimple.chart(svg, data);
myChart.setBounds(60, 30, 510, 310)