Skip to content

Instantly share code, notes, and snippets.

@dukevis
dukevis / code.js
Last active May 17, 2017 19:22
Autism bigram network with Cytoscape.js
$(function(){ // on dom ready
//console.log(network_data_file)
var colors2 = ["#8dd3c7","#bc80bd","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#ffed6f"]
var node_group = network_data_file.elements.nodes;
for (var i = 0; i < node_group.length; i++)
{
@dukevis
dukevis / index.html
Last active September 21, 2015 01:35 — forked from mbostock/.block
Hierarchical Edge Bundling
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.node {
font: 11px "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.link {
stroke: steelblue;
@dukevis
dukevis / README.md
Last active December 13, 2017 21:43 — forked from mbostock/.block
Chord Diagram

Chord diagrams show directed relationships among a group of entities. This example also demonstrates simple interactivity by using mouseover filtering. Layout inspired by Martin Krzywinski's beautiful work on Circos.

@dukevis
dukevis / d3.min.js
Last active September 19, 2015 01:31 — forked from asifr/data.json
Punchcard visualization using D3.js
!function(){function n(n){return n&&(n.ownerDocument||n.document||n).documentElement}function t(n){return n&&(n.ownerDocument&&n.ownerDocument.defaultView||n.document&&n||n.defaultView)}function e(n,t){return t>n?-1:n>t?1:n>=t?0:0/0}function r(n){return null===n?0/0:+n}function u(n){return!isNaN(n)}function i(n){return{left:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)<0?r=i+1:u=i}return r},right:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)>0?u=i:r=i+1}return r}}}function o(n){return n.length}function a(n){for(var t=1;n*t%1;)t*=10;return t}function c(n,t){for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}function l(){this._=Object.create(null)}function s(n){return(n+="")===pa||n[0]===va?va+n:n}function f(n){return(n+="")[0]===va?n.slice(1):n}function h(n){return s(n)in this._}function g(n){return(n=s(n))in this._&&delete this._[n]}function p(){var n=[]
@dukevis
dukevis / colorbrewer.js
Created September 14, 2015 02:36
sexual disorder streamgraph
// This product includes color specifications and designs developed by Cynthia Brewer (http://colorbrewer.org/).
var colorbrewer = {YlGn: {
3: ["#f7fcb9","#addd8e","#31a354"],
4: ["#ffffcc","#c2e699","#78c679","#238443"],
5: ["#ffffcc","#c2e699","#78c679","#31a354","#006837"],
6: ["#ffffcc","#d9f0a3","#addd8e","#78c679","#31a354","#006837"],
7: ["#ffffcc","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],
8: ["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],
9: ["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"]
},YlGnBu: {
@dukevis
dukevis / colorbrewer.js
Created September 14, 2015 02:33
autism streamgraph
// This product includes color specifications and designs developed by Cynthia Brewer (http://colorbrewer.org/).
var colorbrewer = {YlGn: {
3: ["#f7fcb9","#addd8e","#31a354"],
4: ["#ffffcc","#c2e699","#78c679","#238443"],
5: ["#ffffcc","#c2e699","#78c679","#31a354","#006837"],
6: ["#ffffcc","#d9f0a3","#addd8e","#78c679","#31a354","#006837"],
7: ["#ffffcc","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],
8: ["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],
9: ["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"]
},YlGnBu: {
@dukevis
dukevis / index.html
Created September 14, 2015 02:30
mental disabilities streamgraph
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link href="nv.d3.css" rel="stylesheet" type="text/css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.2/d3.min.js" charset="utf-8"></script>
<script src="nv.d3.js"></script>
<style>
text {
@dukevis
dukevis / mental_flot_data.csv
Created September 13, 2015 15:37
recline_test
year intellectual disability learning disability mental deficiency mental handicap mental retardation other mental term
1945 0.017857143 0.089285714 0.017857143
1946 0.085561497 0.010695187 0.021390374
1947 0.004975124 0.064676617 0.004975124 0.009950249
1948 0.071770335 0.014354067 0.004784689
1949 0.058365759 0.003891051 0.019455253 0.011673152
1950 0.033846154 0.006153846 0.012307692 0.006153846
1951 0.001179245 0.047169811 0.001179245 0.018867925 0.004716981
1952 0.025879917 0.004140787 0.025879917 0.007246377
1953 0.001046025 0.001046025 0.040794979 0.005230126 0.018828452 0.003138075
@dukevis
dukevis / Readme.md
Last active September 11, 2015 18:43 — forked from WillTurman/Readme.md
D3 Interactive Streamgraph

D3 Streamgraph Example

Series Hover

The series hover interactivity uses the technique from lgrammel seen here: http://bl.ocks.org/1963983

Data Tooltip

It isn't necessarily a tooltip, but data is displayed by inverting the x-axis value into a date, and mapping the date to the corresponding data value for the series.

@dukevis
dukevis / basketball_data.csv
Last active August 29, 2015 14:00
chord diagram + multiline chart
Year UNC Duke NCS WF MD UVA Clem
1954 0 1 3 2 1 0 0
1955 0 3 6 3 1 1 0
1956 1 4 9 5 1 1 0
1957 3 4 9 6 2 1 0
1958 5 5 10 6 5 1 0
1959 7 6 13 6 5 2 0
1960 8 9 14 8 5 2 0
1961 8 11 14 10 6 2 0
1962 8 12 14 13 6 2 2