Skip to content

Instantly share code, notes, and snippets.

View ndarville's full-sized avatar

N. Darville ndarville

  • Europe
View GitHub Profile
@ndarville
ndarville / README.md
Last active December 23, 2015 03:39
Party Trend (Single-Party Display)

(This chart is a part of the d3-charts collection available [here][collection].)


The subject of this project is nowhere near as exciting as its title would suggest. It aims to present a trend for a political party, or candidate, by combining the polling from multiple institutes as well as their confidence interval.

This chart has two basic views:

  • Single-party display
  • All-party display
@ndarville
ndarville / README.md
Last active December 23, 2015 05:29
Combi Chart

(This chart is a part of the d3-charts collection available [here][collection].)


Combines the [Party Votes][pv] and [Coalition Majority][cm] charts.

Inspirations

  1. [Eric Waller's IE usage chart][erwaller].
  2. [Mike Bostock's brushing dmeo][mbostock].
@ndarville
ndarville / README.md
Last active December 23, 2015 06:49
Blame Chart

(This chart is a part of the d3-charts collection available here.)


Combines a line chart with an index of the administration was in charge at different points in time, allowing all sides to point fingers and take credit for up- and downswings that may or may not have happened.

@ndarville
ndarville / style.css
Last active December 24, 2015 02:29
Subreddit stylesheet
.down { display: none; } /** Hide downvote arrows */
textarea, input[type="text"] { font-family: Verdana, sans-serif !important; }
#header { background-color: #9ECAE1; }
/** Flair */
.flair {
color: #FFF;
font-weight: bold;
padding: 1px 3px;
border: 2px solid #FFF;
@ndarville
ndarville / README.md
Last active December 24, 2015 16:19
Relative Budgets

(This chart is a part of the d3-charts collection available [here][collection].)


Shows how different parties fall on the spectrum of budget proposals relative to each other and a fabled centre in the middle.

Usage

There are three types of values types to display:

@ndarville
ndarville / README.md
Last active May 23, 2024 09:02
From CSV to HTML table (Simple)

This code generates an HTML table based from a CSV file. This is from the tutorial by Christophe Viau.

In trying his code example, I discovered that the code doesn't work as-is, so I figured others might like to see a working d3.js example that did not rely on a pre-existing container HTML element.

The code remains the same except for some cosmetic tweaks.

The task of writing the CSS is left as an exercise for the reader.

@ndarville
ndarville / README.md
Last active December 27, 2015 00:59
From CSV to HTML table (Advanced)

This code generates an HTML table based from a CSV file.

Original code by Shawn Allen via the D3 Noob.

The task of writing the CSS is left as an exercise for the reader.

@ndarville
ndarville / _.md
Created November 11, 2013 01:15
Tributary inlet
@ndarville
ndarville / README.md
Created November 22, 2013 14:14
Neoliberalism and Metrics
Field Quality Metric
Financial Sector Dow Jones
Journalism Pulitzers
Schools Standardized test scores
Police Clear rate
Academia Citations, etc.
Corporations Stack ranking
Politics Polls, Party membership
@ndarville
ndarville / README.md
Last active December 29, 2015 09:09
Symmetric Stack Chart

(This chart is a part of the d3-charts collection available [here][collection].)


This is an symmetric stack chart with each bar anchored around a common origin. The code was based on Mike Bostock's ["Bar Chart with Negative Values" chart][original] and inspired by a [post][junk-charts] on Junk Charts.

Unlike the examples in the two links, the x axis of this implementation has a symmetric x-axis to ensure readers aren't [perceptually manipulated][perception] by one side taking up a larger, more imposing, share of the space than the other.

The main thing to have in mind when using this particular chart is that the order of your data rows matter; a part of the story this chart tells uses the vertical dimension, so embrace it. Usually, you'll see people use the chart for demographics with people divided by age or income, but there are plenty of other uses you'll realize soon enough.