Skip to content

Instantly share code, notes, and snippets.

@milroc
milroc / index.html
Created June 22, 2012 21:17 — forked from biovisualize/index.html
Tooltip as a d3 helper
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
<script type="text/javascript" src="./tooltip.js"></script>
</head>
<body>
<div class="viz"></div>
<script type="text/javascript">
@milroc
milroc / README.md
Last active October 6, 2015 12:08 — forked from ZJONSSON/index.html
axes as whitespace

This is a fork of Ziggy Jonsson's Bar Stack (flex lao) to add to this conversation.

The purpose of this gist was to recommend using whitespace to represent the axes of visualizations, as they signify the zero point in the opposite dimensions encoding. Additionally, this enhances the users comprehension because positive and negative areas are able to be assessed independently.

When doing visual encoding, we tend to ignore whitespace and let 0's handle themselves. To learn about other techniques around this concept, refer to: The Design of Nothing: Null, Zero, Blank by Andy Kirk (@visualisingdata).

Proposed Improvements:

  • aesthetics (very little changes from original example were made).
  • transitions that serve a purpose and flow with the expectation of the reader.
@milroc
milroc / README.md
Last active October 23, 2019 20:09 — forked from mbostock/.block
Minimum Viable Chart Junk (Updating Line Chart)

This is a fork of Mike Bostock's Line Transition.

This fork was originally intended to showcase a principle of using padding between the x and y axis. This is a concept I've seen covered over and over again when dealing with non-zero minimum value charts (see example).

I also found it interesting to update both the line and the x axis. It should be noted that this was not the intent of the line transition example, seeing that the line was treated as a queue, pushing and popping from the front and back of the data. It talked on how to prevent odd visual behavior of the path when those changes occur, nothing more or less.

That being said, the visual change to the axis was a hack (see x_axis_scale) to just better understand how useful a constant, fast linear change effects my comprehension of the data.

So far, my personal opinion is that when dealing with updating data similar to this, it is best to spend most of your no

@milroc
milroc / README.md
Created July 6, 2012 22:18
Area encoding to help a friend

Code to help Walter Gunter Jr. (@wegunterjr) with learning d3.js. based on: http://jsfiddle.net/wegunterjr/r92zG/

This is a variation of a stacked bar chart, where an additional dimension is mapped to width of the section. This additional dimension causes unnecessary complexity for the user.

Normal bar charts use a 1-dimensional area encoding (or redundantly encodes position and area), namely that the bars are all comparable in size, but fixed to one dimension.

By adding a second dimension (regardless of whether it is aesthetically pleasing), the usefulness of the encoding is still mapped to the area. Namely that the reader will interpret the smaller area as meaningful. Therefore it is recommended to map these dimensions with data that have a directly proportional relationship.

@milroc
milroc / README.md
Created July 6, 2012 22:34 — forked from milroc/README.md
bl.ocks template

Template for creating bl.ocks.

@milroc
milroc / README.md
Last active October 13, 2015 20:57 — forked from dchud/README.md
selection.each example
@milroc
milroc / index.html
Last active December 16, 2015 17:18
Bubble Chart
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<link type="text/css" rel="stylesheet" href="style.css"/>
</head>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="src.js"></script>
<div id="chart"></div>
# Editor backup files
*.bak
*~
@milroc
milroc / README.md
Last active December 17, 2015 00:00
bar + sum: vanilla d3.js
@milroc
milroc / README.md
Last active September 15, 2016 08:48
bar + sum: reusable d3.js