Skip to content

Instantly share code, notes, and snippets.

View cjhin's full-sized avatar

Chas Jhin cjhin

View GitHub Profile
@cjhin
cjhin / README.md
Last active September 29, 2021 02:13
D3 Day/Week/Month Line Chart

D3 Time Series Day/Week/Month

Wanted to create a (daily) time series chart with automatic rollups to weekly/monthly lines AND nice transitions

Solution

The solution I ended up going with is a bit of an optical illusion.

All three views are technically backed by "daily" data.

@cjhin
cjhin / .block
Last active June 13, 2021 21:33 — forked from mbostock/.block
Org Chart (Radial -> Dendrogram Transition)
license: gpl-3.0
height: 950
border: no
const data = {
cameos: [
{
duration: 10,
reviewStars: 4,
likes: 102,
imgUrl:
"https://starboard-media.s3.amazonaws.com/v/thumb-5af35885716c190014ebfdb6-00001.jpg",
talentUserId: "1",
consumerUserId: "3",
@cjhin
cjhin / README.md
Last active May 26, 2018 05:45
happy-sears-tower
@cjhin
cjhin / README.md
Last active May 24, 2018 01:02
Happy Town
@cjhin
cjhin / README.md
Last active November 24, 2017 17:34
Bump Chart (Major League Soccer v3)
@cjhin
cjhin / README.md
Last active June 26, 2017 18:29
American Pie
@cjhin
cjhin / README.md
Last active April 23, 2017 00:31
Major League Soccer v2

Major League Soccer season data (2006 - 2016)

Slight riff on http://bl.ocks.org/cjhin/11ffe8165207693d513ad67f85d43251

This version uses d3 force layouts (and d3v4) to make it easier to read the nodes/circles. The catch is that b/c the force layout pushes the nodes horizontally, it's no longer possible to show as many years.

For now, this just shows a condensed chart of the past 10 years, theoretically at least one solution would be to make the chart "horizontally" scrollable"

@cjhin
cjhin / billionaire.csv
Last active April 21, 2017 22:55
Table CSS Black Magic
name age children marital-status country gender industry source net-worth
charlene-de-carvalho-heineken 60 5 Married Netherlands Female Food & Beverage Inherited 9.8
beny-steinmetz 58 4 Married Israel Male Metals & Mining Self-made 2.7
lee-shau-kee 86 5 Divorced Hong Kong Male Real Estate Self-made 22.1
david-thomson 57 4 Divorced Canada Male Media Inherited 24.3
bidzina-ivanishvili 58 4 Married Georgia Male Diversified Self-made 5.2
budi-hartono 3 Married Indonesia Male Manufacturing Inherited 8.6
silvio-berlusconi 78 5 Married Italy Male Media Self-made 6.8
robert-kuok 91 8 Married Malaysia Male Diversified Self-made 16.1
andrey-melnichenko 42 0 Married Russia Male Diversified Self-made 10.1
@cjhin
cjhin / data.csv
Last active March 6, 2017 22:16
D3-Force: Split Continuous
country continent gdp
Egypt Africa 330765
South Africa Africa 312957
Malaysia Asia 296219
Israel Asia 296073
Denmark Europe 294951
Colombia South America 293243
Singapore Asia 292734
Philippines Asia 291965
Pakistan Asia 269971