Skip to content

Instantly share code, notes, and snippets.

View kanitw's full-sized avatar

Kanit Wongsuphasawat kanitw

View GitHub Profile
@kanitw
kanitw / .block
Last active February 23, 2018 05:22 — forked from domoritz/.block
Vega-Lite Bl.ocks example
license: bsd-3-clause
@kanitw
kanitw / filtered_line.json
Created April 15, 2016 22:17 — forked from willium/filtered_line.json
vega label specs
{
"width": 1,
"height": 1,
"padding": "auto",
"data": [
{
"name": "source",
"url": "data/stocks.csv",
"format": {
"type": "csv",
@kanitw
kanitw / README.md
Last active August 29, 2015 14:26 — forked from mbostock/.block
Lab and HCL Color Spaces

D3 supports CIELAB (Lab) and CIELCH (HCL) color spaces, which are designed for humans rather than computers.

Lab and HCL color spaces are special in that the perceived difference between two colors is proportional to their Euclidean distance in color space. This special property, called perceptual uniformity, makes them ideal for accurate visual encoding of data. In contrast, the more familiar RGB and HSL color spaces distort data when used for visualization.

You can create Lab or HCL colors in D3 directly using d3.lab or d3.hcl. For example:

var steelblue = d3.lab(52, -4, -32);
var steelblue = d3.hcl(-97, 32, 52);
@kanitw
kanitw / README.md
Last active January 4, 2016 08:09 — forked from mbostock/.block

This simple force-directed graph shows character co-occurence in Les Misérables. A physical simulation of charged particles and springs places related characters in closer proximity, while unrelated characters are farther apart. Layout algorithm inspired by Tim Dwyer and Thomas Jakobsen. Data based on character coappearence in Victor Hugo's Les Misérables, compiled by Donald Knuth.

Compare this display to a force layout with curved links, a force layout with fisheye distortion and a matrix diagram.

Forked from Mike Bostock http://bl.ocks.org/mbostock/4062045 and resized!

@kanitw
kanitw / 0_reuse_code.js
Created November 7, 2013 17:48
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console