Skip to content

Instantly share code, notes, and snippets.

@SpaceActuary
SpaceActuary / index.html
Last active August 29, 2015 14:10
Bar Chart Transitions - Positive to Negative
<!DOCTYPE html>
<meta charset="utf-8">
<style>
</style>
<body>
<button onClick="flip1();">Flip - Single Transition, Cubic-In-Out</button>
<button onClick="flip2();">Flip - Double Transition, Cubic-Out, Cubic-In</button>
@SpaceActuary
SpaceActuary / README.md
Last active August 29, 2015 14:11
Pension Waterfalls
<html>
<head>
<script src="http://d3js.org/d3.v3.min.js"></script>
<!-- <script src="http://www.jstat.org/jstat-1.0.0.min.js"></script> -->
<!-- above source is down, need to build our own jstat (https://github.com/jstat/jstat), meanwhile, use unreliable mirror: -->
<script src="jstat.min.js"></script>
</head>
<body>
<div id="d3"></div>
<script type="text/javascript">
@SpaceActuary
SpaceActuary / README.md
Last active September 10, 2015 22:15
Challenger

hello markdown

@SpaceActuary
SpaceActuary / README.md
Created November 2, 2015 16:01
Drag + Zoom

An example of how to combine d3.behavior.drag and d3.behavior.zoom, using stopPropagation to allow the drag behavior to take precedence over panning. Use the mouse to pan by clicking on the background, or drag by clicking on individual dots; you may also use the mousewheel to zoom.

Note: combining these two behaviors means that gesture interpretation is ambiguous and highly sensitive to position. A click on a circle is interpreted as dragging that circle, whereas a click one pixel away could be interpreted as panning the background. A more robust method of combining these behaviors is to employ modality. For example, if the user holds down the SPACE key, clicking and dragging is interpreted as panning, rather than dragging, regardless of the click location. This approach is commonly employed in commercial software such as Adobe Photoshop.

This example was created in response to a [Stack Overflow quest

@SpaceActuary
SpaceActuary / README.md
Last active November 28, 2015 20:03
Loss Limiting
@SpaceActuary
SpaceActuary / README.md
Last active November 28, 2015 22:14
Distributions
@SpaceActuary
SpaceActuary / README.md
Last active December 1, 2015 17:47
Distributions 3
@SpaceActuary
SpaceActuary / README.md
Created December 4, 2015 21:46
un-nest
@SpaceActuary
SpaceActuary / README.md
Last active December 14, 2015 15:25
Non-negative Distributions