This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var root = d3z.toFlareRecursive({ | |
data: json, | |
parentKey: 'superClass', | |
childKey: 'thisClass', | |
nameKey: function(obj){ | |
var prefix = obj['thisClass'].match(/\/([a-zA-Z_]*)\#/)[1], | |
name = obj['thisClass'].match(/\#(.*)>/)[1]; | |
return prefix + ":" + name; | |
}, | |
sizeKey: function(obj){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"keys": ["thisClass", "superClass", "instances"], | |
"0": { "instances": 0, | |
"thisClass": "<http://ontologies.semanticarts.com/gist#Equipment>", | |
"superClass": "<http://ontologies.semanticarts.com/gist#PhysicalIdentifiableItem>" }, | |
"1": { "instances": 0, | |
"thisClass": "<http://ontologies.semanticarts.com/gist#SomeParentClass>", | |
"superClass": "None" }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "flare", | |
"children": [ | |
{ | |
"name": "analytics", | |
"children": [ | |
{ | |
"name": "cluster", | |
"children": [ | |
{ "name": "AgglomerativeCluster", "size": 3938 }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function toFlareRecursive(options) { | |
// data: object, | |
// parentKey: string, | |
// childKey: string, | |
// sizeKey: (optional) string or function, | |
// nameKey: string or function, | |
// rootName: (optional) string (only used if there's more than one top-level object) | |
// Return either the value of the name key or the result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function toFlareRecursive(data, parentKey, childKey) { | |
var root = { 'name': 'Classes', 'children': [] }; | |
function findChildren(d){ | |
var subclasses = _.filter(data, function(obj){ | |
return obj[parentKey] === d[childKey]; | |
}); | |
if ( subclasses.length > 0 ) { | |
d.children = []; | |
_.each(subclasses, function(obj){ | |
obj.name = obj.thisClass; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"key": "September", | |
"values": [ | |
{ | |
"key": "30", | |
"values": [ | |
{ | |
"key": "Semantic Arts", | |
"values": [ | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Insert this at the top of the process() function | |
// This part just converts the flat objec to a flat array, nothing fancy | |
var flatty = []; | |
_.each(data, function(obj, key) { | |
if ( key !== 'keys' ) { flatty.push(obj); } | |
}); | |
console.log(flatty); | |
var nested_data = d3.nest() // create the nest object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
After reading “Trust Me, I’m Lying,” I’m inclined to take Holiday’s argument with a grain of salt. | |
I can’t escape the impression of an ex-con saying “I know scams but this is legit!” | |
He makes it crystal clear in the central thesis of the book--the media is rife for manipulation and | |
has even set itself up that way. The problem is that this throws into question Holiday’s | |
own credibility in writing this book. Why should I trust you if you’ve made it so clear | |
that your marketable skill is lying? | |
This is underscored perhaps by the oh-so-frequent mentions of one of Holiday’s flagship clients at the time, | |
the culturally questionable Tucker Max. I’m not taking issue with the citation of real world cases of | |
media manipulation; on the contrary I think it’s what lends the book what credibility it does have. But the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Cowork</title> | |
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.js"></script> | |
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.1.min.js"></script> | |
<script type="text/javascript" src="jquery-ui.min.js"></script> | |
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/d3/3.4.11/d3.min.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Sorry, the demo is over</title> | |
<style type="text/css"> | |
html { background: #efefef; } | |
body { | |
width: 100%; | |
max-width: 500px; |