Skip to content

Instantly share code, notes, and snippets.

@thepuzzlemaster
Last active August 29, 2015 14:12
Show Gist options
  • Save thepuzzlemaster/27009fec394ff00f035c to your computer and use it in GitHub Desktop.
Save thepuzzlemaster/27009fec394ff00f035c to your computer and use it in GitHub Desktop.
Tier 6
{"description":"Tier 6","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"data.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"style.css":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"pingpong","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"ajax-caching":true,"thumbnail":"http://i.imgur.com/S8s8dCn.png","inline-console":false}
[
{"mood":"happy","color":"red","shade":"a"},
{"mood":"happy","color":"red","shade":"b"},
{"mood":"happy","color":"red","shade":"c"},
{"mood":"happy","color":"red","shade":"d"},
{"mood":"happy","color":"red","shade":"e"},
{"mood":"happy","color":"red","shade":"f"},
{"mood":"happy","color":"red","shade":"g"},
{"mood":"happy","color":"red","shade":"h"},
{"mood":"happy","color":"red","shade":"i"},
{"mood":"happy","color":"red","shade":"j"},
{"mood":"happy","color":"red","shade":"k"},
{"mood":"happy","color":"red","shade":"l"},
{"mood":"happy","color":"red","shade":"m"},
{"mood":"happy","color":"red","shade":"n"},
{"mood":"happy","color":"red","shade":"o"},
{"mood":"happy","color":"red","shade":"p"},
{"mood":"happy","color":"red","shade":"q"},
{"mood":"happy","color":"red","shade":"r"},
{"mood":"happy","color":"red","shade":"s"},
{"mood":"happy","color":"red","shade":"t"},
{"mood":"happy","color":"red","shade":"u"},
{"mood":"happy","color":"red","shade":"v"},
{"mood":"happy","color":"red","shade":"w"},
{"mood":"happy","color":"red","shade":"x"},
{"mood":"happy","color":"red","shade":"y"},
{"mood":"happy","color":"red","shade":"z"},
{"mood":"happy","color":"yellow","shade":"a"},
{"mood":"happy","color":"yellow","shade":"b"},
{"mood":"happy","color":"yellow","shade":"c"},
{"mood":"happy","color":"yellow","shade":"d"},
{"mood":"happy","color":"yellow","shade":"e"},
{"mood":"happy","color":"yellow","shade":"f"},
{"mood":"happy","color":"yellow","shade":"g"},
{"mood":"sad","color":"yellow","shade":"h"},
{"mood":"happy","color":"yellow","shade":"i"},
{"mood":"happy","color":"yellow","shade":"j"},
{"mood":"happy","color":"yellow","shade":"k"},
{"mood":"happy","color":"yellow","shade":"l"},
{"mood":"happy","color":"yellow","shade":"m"},
{"mood":"happy","color":"yellow","shade":"n"},
{"mood":"happy","color":"yellow","shade":"o"},
{"mood":"happy","color":"yellow","shade":"p"},
{"mood":"happy","color":"yellow","shade":"q"},
{"mood":"happy","color":"yellow","shade":"r"},
{"mood":"happy","color":"yellow","shade":"s"},
{"mood":"happy","color":"yellow","shade":"t"},
{"mood":"happy","color":"yellow","shade":"u"},
{"mood":"happy","color":"yellow","shade":"v"},
{"mood":"happy","color":"yellow","shade":"w"},
{"mood":"happy","color":"yellow","shade":"x"},
{"mood":"happy","color":"yellow","shade":"y"},
{"mood":"happy","color":"yellow","shade":"z"},
{"mood":"happy","color":"orange","shade":"a"},
{"mood":"happy","color":"orange","shade":"b"},
{"mood":"happy","color":"orange","shade":"c"},
{"mood":"happy","color":"orange","shade":"d"},
{"mood":"happy","color":"orange","shade":"e"},
{"mood":"happy","color":"orange","shade":"f"},
{"mood":"happy","color":"orange","shade":"g"},
{"mood":"happy","color":"orange","shade":"h"},
{"mood":"happy","color":"orange","shade":"i"},
{"mood":"happy","color":"orange","shade":"j"},
{"mood":"happy","color":"orange","shade":"k"},
{"mood":"happy","color":"orange","shade":"l"},
{"mood":"happy","color":"orange","shade":"m"},
{"mood":"happy","color":"orange","shade":"n"},
{"mood":"happy","color":"orange","shade":"o"},
{"mood":"happy","color":"orange","shade":"p"},
{"mood":"happy","color":"orange","shade":"q"},
{"mood":"happy","color":"orange","shade":"r"},
{"mood":"happy","color":"orange","shade":"s"},
{"mood":"happy","color":"orange","shade":"t"},
{"mood":"happy","color":"orange","shade":"u"},
{"mood":"happy","color":"orange","shade":"v"},
{"mood":"happy","color":"orange","shade":"w"},
{"mood":"happy","color":"orange","shade":"x"},
{"mood":"happy","color":"orange","shade":"y"},
{"mood":"happy","color":"orange","shade":"z"},
{"mood":"sad","color":"blue","shade":"a"},
{"mood":"sad","color":"blue","shade":"b"},
{"mood":"sad","color":"blue","shade":"c"},
{"mood":"sad","color":"blue","shade":"d"},
{"mood":"sad","color":"blue","shade":"e"},
{"mood":"sad","color":"blue","shade":"f"},
{"mood":"sad","color":"blue","shade":"g"},
{"mood":"sad","color":"blue","shade":"h"},
{"mood":"sad","color":"blue","shade":"i"},
{"mood":"sad","color":"blue","shade":"j"},
{"mood":"sad","color":"blue","shade":"k"},
{"mood":"sad","color":"blue","shade":"l"},
{"mood":"sad","color":"blue","shade":"m"},
{"mood":"sad","color":"blue","shade":"n"},
{"mood":"sad","color":"blue","shade":"o"},
{"mood":"serene","color":"blue","shade":"p"},
{"mood":"sad","color":"blue","shade":"q"},
{"mood":"sad","color":"blue","shade":"r"},
{"mood":"sad","color":"blue","shade":"s"},
{"mood":"sad","color":"blue","shade":"t"},
{"mood":"sad","color":"blue","shade":"u"},
{"mood":"sad","color":"blue","shade":"v"},
{"mood":"sad","color":"blue","shade":"w"},
{"mood":"sad","color":"blue","shade":"x"},
{"mood":"sad","color":"blue","shade":"y"},
{"mood":"sad","color":"blue","shade":"z"},
{"mood":"sad","color":"green","shade":"a"},
{"mood":"sad","color":"green","shade":"b"},
{"mood":"sad","color":"green","shade":"c"},
{"mood":"sad","color":"green","shade":"d"},
{"mood":"sad","color":"green","shade":"e"},
{"mood":"sad","color":"green","shade":"f"},
{"mood":"sad","color":"green","shade":"g"},
{"mood":"sad","color":"green","shade":"h"},
{"mood":"sad","color":"green","shade":"i"},
{"mood":"sad","color":"green","shade":"j"},
{"mood":"sad","color":"green","shade":"k"},
{"mood":"sad","color":"green","shade":"l"},
{"mood":"sad","color":"green","shade":"m"},
{"mood":"sad","color":"green","shade":"n"},
{"mood":"sad","color":"green","shade":"o"},
{"mood":"sad","color":"green","shade":"p"},
{"mood":"sad","color":"green","shade":"q"},
{"mood":"sad","color":"green","shade":"r"},
{"mood":"sad","color":"green","shade":"s"},
{"mood":"sad","color":"green","shade":"t"},
{"mood":"sad","color":"green","shade":"u"},
{"mood":"sad","color":"green","shade":"v"},
{"mood":"sad","color":"green","shade":"w"},
{"mood":"sad","color":"green","shade":"x"},
{"mood":"sad","color":"green","shade":"y"},
{"mood":"sad","color":"green","shade":"z"},
{"mood":"sad","color":"purple","shade":"a"},
{"mood":"sad","color":"purple","shade":"b"},
{"mood":"sad","color":"purple","shade":"c"},
{"mood":"sad","color":"purple","shade":"d"},
{"mood":"sad","color":"purple","shade":"e"},
{"mood":"sad","color":"purple","shade":"f"},
{"mood":"sad","color":"purple","shade":"g"},
{"mood":"sad","color":"purple","shade":"h"},
{"mood":"sad","color":"purple","shade":"i"},
{"mood":"sad","color":"purple","shade":"j"},
{"mood":"sad","color":"purple","shade":"k"},
{"mood":"sad","color":"purple","shade":"l"},
{"mood":"sad","color":"purple","shade":"m"},
{"mood":"sad","color":"purple","shade":"n"},
{"mood":"sad","color":"purple","shade":"o"},
{"mood":"sad","color":"purple","shade":"p"},
{"mood":"sad","color":"purple","shade":"q"},
{"mood":"sad","color":"purple","shade":"r"},
{"mood":"sad","color":"purple","shade":"s"},
{"mood":"sad","color":"purple","shade":"t"},
{"mood":"sad","color":"purple","shade":"u"},
{"mood":"sad","color":"purple","shade":"v"},
{"mood":"sad","color":"purple","shade":"w"},
{"mood":"sad","color":"purple","shade":"x"},
{"mood":"sad","color":"purple","shade":"y"},
{"mood":"sad","color":"purple","shade":"z"},
{"mood":"sad","color":"black","shade":"a"},
{"mood":"sad","color":"black","shade":"b"},
{"mood":"sad","color":"black","shade":"c"},
{"mood":"sad","color":"black","shade":"d"},
{"mood":"sad","color":"black","shade":"e"},
{"mood":"sad","color":"black","shade":"f"},
{"mood":"sad","color":"black","shade":"g"},
{"mood":"sad","color":"black","shade":"h"},
{"mood":"sad","color":"black","shade":"i"},
{"mood":"sad","color":"black","shade":"j"},
{"mood":"sad","color":"black","shade":"k"},
{"mood":"sad","color":"black","shade":"l"},
{"mood":"sad","color":"black","shade":"m"},
{"mood":"sad","color":"black","shade":"n"},
{"mood":"sad","color":"black","shade":"o"},
{"mood":"sad","color":"black","shade":"p"},
{"mood":"sad","color":"black","shade":"q"},
{"mood":"sad","color":"black","shade":"r"},
{"mood":"sad","color":"black","shade":"s"},
{"mood":"sad","color":"black","shade":"t"},
{"mood":"sad","color":"black","shade":"u"},
{"mood":"sad","color":"black","shade":"v"},
{"mood":"sad","color":"black","shade":"w"},
{"mood":"sad","color":"black","shade":"x"},
{"mood":"sad","color":"black","shade":"y"},
{"mood":"sad","color":"black","shade":"z"},
{"mood":"sad","color":"brown","shade":"a"},
{"mood":"sad","color":"brown","shade":"b"},
{"mood":"sad","color":"brown","shade":"c"},
{"mood":"sad","color":"brown","shade":"d"},
{"mood":"sad","color":"brown","shade":"e"},
{"mood":"sad","color":"brown","shade":"f"},
{"mood":"sad","color":"brown","shade":"g"},
{"mood":"sad","color":"brown","shade":"h"},
{"mood":"sad","color":"brown","shade":"i"},
{"mood":"sad","color":"brown","shade":"j"},
{"mood":"sad","color":"brown","shade":"k"},
{"mood":"sad","color":"brown","shade":"l"},
{"mood":"sad","color":"brown","shade":"m"},
{"mood":"sad","color":"brown","shade":"n"},
{"mood":"sad","color":"brown","shade":"o"},
{"mood":"sad","color":"brown","shade":"p"},
{"mood":"sad","color":"brown","shade":"q"},
{"mood":"sad","color":"brown","shade":"r"},
{"mood":"sad","color":"brown","shade":"s"},
{"mood":"sad","color":"brown","shade":"t"},
{"mood":"sad","color":"brown","shade":"u"},
{"mood":"sad","color":"brown","shade":"v"},
{"mood":"sad","color":"brown","shade":"w"},
{"mood":"sad","color":"brown","shade":"x"},
{"mood":"sad","color":"brown","shade":"y"},
{"mood":"sad","color":"brown","shade":"z"},
{"mood":"serene","color":"mauve","shade":"a"},
{"mood":"serene","color":"mauve","shade":"b"},
{"mood":"serene","color":"mauve","shade":"c"},
{"mood":"serene","color":"mauve","shade":"d"},
{"mood":"serene","color":"mauve","shade":"e"},
{"mood":"serene","color":"mauve","shade":"f"},
{"mood":"serene","color":"mauve","shade":"g"},
{"mood":"serene","color":"mauve","shade":"h"},
{"mood":"serene","color":"mauve","shade":"i"},
{"mood":"serene","color":"mauve","shade":"j"},
{"mood":"serene","color":"mauve","shade":"k"},
{"mood":"serene","color":"mauve","shade":"l"},
{"mood":"serene","color":"mauve","shade":"m"},
{"mood":"serene","color":"mauve","shade":"n"},
{"mood":"serene","color":"mauve","shade":"o"},
{"mood":"serene","color":"mauve","shade":"p"},
{"mood":"serene","color":"mauve","shade":"q"},
{"mood":"serene","color":"mauve","shade":"r"},
{"mood":"serene","color":"mauve","shade":"s"},
{"mood":"serene","color":"mauve","shade":"t"},
{"mood":"serene","color":"mauve","shade":"u"},
{"mood":"serene","color":"mauve","shade":"v"},
{"mood":"serene","color":"mauve","shade":"w"},
{"mood":"serene","color":"mauve","shade":"x"},
{"mood":"serene","color":"mauve","shade":"y"},
{"mood":"serene","color":"mauve","shade":"z"},
{"mood":"serene","color":"teal","shade":"a"},
{"mood":"serene","color":"teal","shade":"b"},
{"mood":"serene","color":"teal","shade":"c"},
{"mood":"serene","color":"teal","shade":"d"},
{"mood":"serene","color":"teal","shade":"e"},
{"mood":"serene","color":"teal","shade":"f"},
{"mood":"serene","color":"teal","shade":"g"},
{"mood":"serene","color":"teal","shade":"h"},
{"mood":"serene","color":"teal","shade":"i"},
{"mood":"serene","color":"teal","shade":"j"},
{"mood":"serene","color":"teal","shade":"k"},
{"mood":"serene","color":"teal","shade":"l"},
{"mood":"serene","color":"teal","shade":"m"},
{"mood":"serene","color":"teal","shade":"n"},
{"mood":"serene","color":"teal","shade":"o"},
{"mood":"serene","color":"teal","shade":"p"},
{"mood":"serene","color":"teal","shade":"q"},
{"mood":"serene","color":"teal","shade":"r"},
{"mood":"serene","color":"teal","shade":"s"},
{"mood":"serene","color":"teal","shade":"t"},
{"mood":"serene","color":"teal","shade":"u"},
{"mood":"serene","color":"teal","shade":"v"},
{"mood":"serene","color":"teal","shade":"w"},
{"mood":"serene","color":"teal","shade":"x"},
{"mood":"serene","color":"teal","shade":"y"},
{"mood":"serene","color":"teal","shade":"z"},
{"mood":"serene","color":"maroon","shade":"a"},
{"mood":"serene","color":"maroon","shade":"b"},
{"mood":"happy","color":"maroon","shade":"c"},
{"mood":"serene","color":"maroon","shade":"d"},
{"mood":"serene","color":"maroon","shade":"e"},
{"mood":"serene","color":"maroon","shade":"f"},
{"mood":"serene","color":"maroon","shade":"g"},
{"mood":"serene","color":"maroon","shade":"h"},
{"mood":"serene","color":"maroon","shade":"i"},
{"mood":"serene","color":"maroon","shade":"j"},
{"mood":"serene","color":"maroon","shade":"k"},
{"mood":"serene","color":"maroon","shade":"l"},
{"mood":"serene","color":"maroon","shade":"m"},
{"mood":"serene","color":"maroon","shade":"n"},
{"mood":"serene","color":"maroon","shade":"o"},
{"mood":"serene","color":"maroon","shade":"p"},
{"mood":"serene","color":"maroon","shade":"q"},
{"mood":"serene","color":"maroon","shade":"r"},
{"mood":"serene","color":"maroon","shade":"s"},
{"mood":"serene","color":"maroon","shade":"t"},
{"mood":"serene","color":"maroon","shade":"u"},
{"mood":"serene","color":"maroon","shade":"v"},
{"mood":"serene","color":"maroon","shade":"w"},
{"mood":"serene","color":"maroon","shade":"x"},
{"mood":"serene","color":"maroon","shade":"y"},
{"mood":"serene","color":"maroon","shade":"z"},
{"mood":"serene","color":"white","shade":"a"},
{"mood":"serene","color":"white","shade":"b"},
{"mood":"serene","color":"white","shade":"c"},
{"mood":"serene","color":"white","shade":"d"},
{"mood":"serene","color":"white","shade":"e"},
{"mood":"serene","color":"white","shade":"f"},
{"mood":"serene","color":"white","shade":"g"},
{"mood":"serene","color":"white","shade":"h"},
{"mood":"serene","color":"white","shade":"i"},
{"mood":"serene","color":"white","shade":"j"},
{"mood":"serene","color":"white","shade":"k"},
{"mood":"serene","color":"white","shade":"l"},
{"mood":"serene","color":"white","shade":"m"},
{"mood":"serene","color":"white","shade":"n"},
{"mood":"serene","color":"white","shade":"o"},
{"mood":"serene","color":"white","shade":"p"},
{"mood":"serene","color":"white","shade":"q"},
{"mood":"serene","color":"white","shade":"r"},
{"mood":"serene","color":"white","shade":"s"},
{"mood":"serene","color":"white","shade":"t"},
{"mood":"serene","color":"white","shade":"u"},
{"mood":"serene","color":"white","shade":"v"},
{"mood":"serene","color":"white","shade":"w"},
{"mood":"serene","color":"white","shade":"x"},
{"mood":"serene","color":"white","shade":"y"},
{"mood":"serene","color":"white","shade":"z"}
]
// Solution: [{"mood":"serene","color":"maroon","shade":"c"},{"mood":"sad","color":"blue","shade":"p"},{"mood":"happy","color":"yellow","shade":"h"}]
var data = tributary.data;
var xSpacing = 12;
var ySpacing = 2;
var width = 8;
var abc = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
var colors = ['red', 'yellow', 'orange', 'blue', 'green', 'purple', 'black', 'brown', 'mauve', 'teal', 'maroon', 'white'];
var colorMin = d3.min(data, function(item) {
return item.z;
});
var colorMax = d3.max(data, function(item) {
return item.z;
});
var colorScale = d3.scale.linear()
.domain([0, colors.length])
.interpolate(d3.interpolateHcl)
.range(['#0008ff', '#ff0010'])
.clamp(true);
var shadeScale = d3.scale.linear()
.domain([0, 24])
.range([0, 1])
.clamp(true);
var svg = d3.select('svg')
.attr({
width: '100%',
height: '100%',
style: 'padding: 10px'
});
// mood
svg.append('g')
.selectAll('rect')
.data(data)
.enter()
.append('rect')
.attr({
x: function(d, i) {
return 90;
},
y: function(d, i) {
return ySpacing * i;
},
height: 1,
width: function(d) {
if (d.mood === 'happy') {
return 10;
} else if (d.mood === 'serene') {
return 20;
} else if (d.mood === 'sad') {
return 30;
}
},
style: function(d) {
return;
return 'opacity: ' + shadeScale(abc.indexOf(d.shade));
},
fill: function(d, i) {
return colorScale(colors.indexOf(d.color));
}
})
text {
font-size: 12px;
}
svg {
padding: 20px
}
.node {
font: 11px "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.link {
stroke: steelblue;
stroke-opacity: .4;
fill: none;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment