-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #485 from Kitware/sententree
Add SentenTree component
- Loading branch information
Showing
11 changed files
with
364 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,5 +119,9 @@ | |
{ | ||
"title": "TreeHeatmap", | ||
"link": "tree-heatmap" | ||
}, | ||
{ | ||
"title": "SentenTree", | ||
"link": "sententree" | ||
} | ||
] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { goal } from '../util/datasets'; | ||
import showComponent from '../util/showComponent'; | ||
import SentenTree from '../../../components/SentenTree'; | ||
|
||
window.onload = () => { | ||
showComponent(SentenTree, { | ||
data: goal, | ||
id: 'id', | ||
text: 'text', | ||
count: 'count', | ||
graphs: 3 | ||
}); | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
id text count | ||
477182317966798848 brazil's marcelo scores the first goal of the world cup ... against brazil. http://t.co/d3e1ac9e4f 3787 | ||
477181994972246016 at least brazil have scored the first goal of the world cup #brazil2014 2878 | ||
477134696137359360 rt @niallofficial: first game of the world cup tonight ! can't wait ! pra cima majooooorr ! cmon braziiiilllll ! 1702 | ||
477182269107355649 the first goal of the world cup is an own goal! marcelo accidentally knocks it into his own net past julio cesar! croatia leads 1-0. 1689 | ||
477181957348937730 goal: brazil 0-1 croatia marcelo scores an own goal in the 11th minute #joinin #worldcup #bracro – http://t.co/xxtmlp3e67 1582 | ||
477181938726211584 just like we predicted, a brazilian scored the first goal in the world cup 1525 | ||
477181975774519296 whoever bet that the first goal of the world cup was going to be an own goal just made a lot of money. 1405 | ||
477180509240700928 rt @world: 736 players 64 matches 32 teams 12 stadiums 4 years of waiting 1 winning country the 2014 world cup has started . http://t.co/q... 1016 | ||
477176771708981248 rt @5sos: watching the world cup tonight! with the tour fam :) - ash x 996 | ||
477182399303135232 the first goal of the world cup was almost as bad as the opening ceremony. 960 | ||
477159175081164801 rt @cocacola: live from the 2014 fifa world cup in brazil, the unveiling of the happiness flag. http://t.co/obzubmsm5g #worldscup http://t.... 935 | ||
477052723050061824 rt @louis_tomlinson: world cup starts today !!!!!! amazing !!! 915 | ||
477182228561022976 the first goal scored of the world cup 2014... was an own goal! 818 | ||
477179277712977920 rt @espn: after 4 years, the wait is finally over. #bravscro http://t.co/bnzyexlleb 805 | ||
477181874414948352 that's not in the script! own goal from marcelo puts croatia up 0-1. #brazilvscroatia 803 | ||
477182570829213699 that moment when you score an own goal in the opening game of the world cup. http://t.co/zgfubk7wor 746 | ||
477182066744754176 scoring on themselves in the world cup 745 | ||
477181873274122240 world cup 2014 first goal is own-goal by marcelo ! 719 | ||
477182690840416256 atleast brazil scored the first goal of the world cup 😂 665 | ||
477180916545363968 rt @ilgdaily: bae: come over me: i'm watching the world cup ⚽️ bae: but i'm home alone me: ..uh, i'm watching the world cup ⚽️ 569 | ||
477178606485905408 rt @worldstarfunny: bae: come over me: i'm watching the world cup bae: but i'm home alone me: .....i'm watching the world cup 523 | ||
477182244076150786 hang on, this world cup thing's just a live-action rip-off of that playstation game isn't it? 522 | ||
477182395452370945 marcelo scored the first goal of the 2014 world cup. on his own team. 483 | ||
477183469790179328 the lights are out at arena de sao paulo. plenty of sunlight still, but half-lighting in some spots on the pitch. #bravscro 422 | ||
477182060126162944 i would trade the us open, the world cup, & the nba finals for just one football game right now... 420 | ||
477182740182630400 this is the best goal so far in the world cup 2014: marcelo's own goal: http://t.co/gw9xoamfyo 419 | ||
477182045656203266 bet we're doing the same as you at home right about now yea...?!! #brazilvscroatia http://t.co/tm1lu2hmy0 398 | ||
477176976067657728 rt @wesleystromberg: ahh i'm so amped to watch the start of the world cup today! wish i was in my homeland #brasil to fully experience http... 395 | ||
477181737517076481 brazil own-goal: marcelo puts it in his own net. horrific start for the home team #bravscro 395 | ||
477182624189132800 this was brazil's first ever own goal in world cup history #bravscro http://t.co/y32udows56 387 | ||
477182378830336000 marcelo is leading the world cup in goals scored 😂🏆⚽️ 358 | ||
477173496809029633 rt @espn: when the us open, world cup, and nba finals all fall on the same day, it's officially a sports holiday. http://t.co/dnlootpzit 324 | ||
477182517628260353 #teambrazil wrong kind of selfie - marcelo scoring an own-goal in the world cup opener. 322 | ||
477182764215975936 the moment marcelo scored. good finish from there, to be fair. #bra #cro #worldcup http://t.co/05tfdyei3k 322 | ||
477181894564806656 goal! marcelo in his own net! #cro 1 - 0 #bra #worldcup 313 | ||
477182500158988288 that was the first own goal for brazil in world cup history. #brazilvscroatia 310 | ||
477182073917014017 even the dog is watching world cup http://t.co/drhxcjhw3j 300 | ||
477182001812742145 first goal of world cup 2014 is an own goal. 🙈 296 | ||
477179310206226433 rt @fifaworldcup: kick-off: brazil & croatia are underway! the wait is over. #joinin #worldcup #bracro – http://t.co/xxtmlp3e67 http://t.co... 295 | ||
477179038528991232 rt @footballfunnys: 736 players 64 matches 32 teams 12 stadiums 4 years of waiting 1 winning country the 2014 world cup has started h... 291 | ||
477177156334665728 rt @danielsahyounie: the world cup is back yay :) go brazil 276 | ||
477178111381893123 rt @footy_jokes: rt if you are watching world cup 2014. 271 | ||
477177715410223106 rt @geniusfootball: the world cup has started. http://t.co/jepb0zfw0r 266 | ||
477179312454795266 rt @21lva: and the world cup begins 🏆🏆🏆!!! 262 | ||
477181890516905986 1 - the first goal of world cup 2014 is an own goal by brazil's marcelo. 259 | ||
477183281083858944 the \"did i do that?\" face!! #bra #cro http://t.co/pdmpzfstrb 259 | ||
477183014657462274 marcelo's own goal, was brazil's first ever own goal in world cup history. #bracro 242 | ||
477182262916939777 wow. hull city's striker misses, but ball still beats qpr reserve goalie. amazing scenes at the world cup 241 | ||
477182127595720704 marcelo scores the first goal of the 2014 world cup............ against his own team 😂😂😂😂 239 | ||
477171634269204480 rt @keatonstromberg: - game day! #worldcup2014 #brazil http://t.co/uycxnj7bxy 224 | ||
477181853615816704 huge congrats to world cup leading goalscorer marcelo! 223 | ||
477179119172866049 rt @fifaworldcuptm: 4 years are finally over! it's here. the world cup 2014 starts now! http://t.co/dfhavetxul 216 | ||
477181708547424256 first world cup goal...own goal 😂😂😂 213 | ||
477174346792706048 rt @ashofpallettown: it's impossible to not love japan when their world cup mascot is pikachu! http://t.co/m4mlwmfwiw 211 | ||
477182257367900160 marcelo scores the first goal of the 2014 world cup! croatia 1-0 brazil. 210 | ||
477171248670052352 rt @jasminevillegas: #bra #bra #bra #bra #bra #bra #bra #bra #bra #bra #bra #bra #bra #bra #bra #bra #bra #bra #bra #worldcup :) vamos bras... 201 | ||
477181944292061186 marcelo scores the first goal of the 2014 world cup! croatia 1-0 brazil. 193 | ||
477181478154293248 vaaaaaaaaaaaaaai brasil #bra #bra #bra #bra #bra #bra #bra #bra #bra #bra #bra #bra #bra #bra #bra 190 | ||
477182787414282240 1 - marcelo's own goal was brazil's first ever own goal in a world cup match. 186 | ||
477181060816441344 rt @geniusfootball: even the dog is watching world cup http://t.co/bf8gnjd2vj 185 | ||
477173056297644033 rt @theellenshow: the l.a. galaxy wasn't allowed to participate in the world cup since galaxies aren't in the world. they're in outer space... 183 | ||
477181947966672896 goal croatia! marcelo inadvertently flicks the ball into his own net after 10 minutes - disaster for the hosts. #bra 0-1 #cro. #worldcup 180 | ||
477182597458853888 picture: neymar before the game http://t.co/6htqet1u9h [via @squawka] #bra 177 | ||
477179089594228736 rt @soccerrproblems: ladies and gentlemen the world cup has began 🏆🙌⚽️ 168 | ||
477182345884090369 scoring on your own net during the world cup #defenseprobs 168 | ||
477181956028112896 hull city striker wrong foots qpr reserve keeper for opening goal in world cup. 168 | ||
477181804043325442 you mad #bra 160 | ||
477182359050399745 croatia score the first goal in the world cup 2014 https://t.co/hi0dpadqtg 160 | ||
477181922008109058 twitter is the vuvuzela of the 2014 world cup. 158 | ||
477182463022612481 first point of the world cup an own goal by brazil? ouch. 157 | ||
477183065349844992 #worldcup #brazil 157 | ||
477179301537005569 rt @bbcsport: the wait is over! it's kick-off in the @fifaworldcup in brazil. http://t.co/r8wj0xgkdd #bbcworldcup #bravscro http://t.co/dj6... 154 | ||
477181945374203904 own goal from #marcelo. #bra 0-1 #cro 152 | ||
477182452746563585 first ever own goal by a brazilian player in the world cup. 150 | ||
477180881246105601 rt @motogp: #motogp the world cup is underway, who are you supporting? http://t.co/we1kqt9h5l #letsgobrazil http://t.co/xrwvg7l8a2 147 | ||
477182633143582720 twitter error. spoil #worldcup2014 #brazilvscroatia http://t.co/x5h58cpmxr 143 | ||
477182127667036162 the first goal of the #worldcup is an own goal by #bra. did not see that coming! https://t.co/kee9h08ydt 140 | ||
477178542305054720 rt @sportscenter: the world cup kicks off now! neymar leads the favored brazilian selecao on home soil. http://t.co/9icwbqopgz 138 | ||
477181272641785857 rt @squawka: photo of the world cup so far. #worldcup #bra http://t.co/4lnenfk1v8 138 | ||
477182517091774464 croatia score the first goal in the world cup 2014 https://t.co/dk9ohl5ley 137 | ||
477182445948002304 real madrid player scores the first 2014 world cup goal. marcelo in his debut. feel sorry for him. 135 | ||
477183875089965057 it's arrived - players and staff gather to watch the opening game of the #worldcup #bravscro #3lions http://t.co/agaevd5ra0 135 | ||
477183486768345091 world cup 2014 is the first edition in world cup history to open the scoring with an own goal. 133 | ||
477183103103143937 away from the #bra game #por c. ronaldo has limped out of training after 15 mins with a knee injury and is a doubt for the world cup. 133 | ||
477180760806658048 rt @realbobmortimer: #brazilvscroatia for the opening ceremony they should have just laid hulk down on the centre circle and slowly reveale... 126 | ||
477182701158412289 dude on brazil scored on his own goal? so that means he dies if they lose right? isn't that how the world cup works? 123 | ||
477182045920456704 world cup 2014 min 10 : brazil 0 - 1 croatia (marcelo own goal) #firstgoal #worldcup2014 123 | ||
477182095815479296 defenders worst nightmare! welcome to the world cup. lots of time. 121 | ||
477140213467447296 rt @pele: for this world cup, i wish good health to all the players, safety and enjoyment to all the fans, 120 | ||
477182812324245504 an own goal to open the world cup. the only thing more catastrophic than that would be like... a safety to open the super bowl. 116 | ||
477182397541535745 first goal of the 2014 world cup was an own goal, nobody saw that coming 115 | ||
477181966228262914 and everyone thought brazil would destroy croatia. #cro 1-0 #bra 114 | ||
477182142628130816 not a good look. http://t.co/pajmvtcng6 #bra #cro 114 | ||
477183241003085824 croatia is on the board, up 1-0 vs brazil... first own goal for brazil in world cup history. #bravscro 114 | ||
477181405391122432 rt if you're watching the world cup today! ⚽ 108 | ||
477183080885923841 my whole timeline is watching the first match of the world cup and http://t.co/cveq7pheru 104 | ||
477178510646464513 rt @samclaflin: just because i'm a norwich supporter. for this particular game i have to say it: #comeonyouyellows #brasil #brazil2014 #wor... 104 | ||
477107247546638336 rt @_snape_: happy world cup day http://t.co/oufegyzuwk 102 | ||
477183369512361984 louis' tweet to niall today about the world cup! http://t.co/f2gnnso4lw 101 | ||
477169450437734400 rt @pattiemallettle: eu te amo #bra #worldcup 101 | ||
569140211445334016 \"@bbcnewsus: kristen stewart is first us actress to win french \"#oscars\" equivalent...\" did she play an adulterous statue??? 1 | ||
569140294748381184 b\\c the french hate everyone \"bbc: kristen stewart is first us actress to win french \"oscars\" equivalent http://t.co/t8qptvo89o\" 1 |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import { select } from 'd3-selection'; | ||
|
||
import VisComponent from '../../VisComponent'; | ||
import { SentenTreeBuilder, | ||
SentenTreeVis } from 'sententree/dist/SentenTree'; | ||
|
||
export default class SentenTree extends VisComponent { | ||
static get options () { | ||
return [ | ||
{ | ||
name: 'data', | ||
description: 'The data table.', | ||
type: 'table', | ||
format: 'objectlist' | ||
}, | ||
{ | ||
name: 'id', | ||
description: 'The field containing the identifier of each row.', | ||
type: 'string', | ||
domain: { | ||
mode: 'field', | ||
from: 'data', | ||
fieldTypes: ['string', 'integer', 'number'] | ||
} | ||
}, | ||
{ | ||
name: 'text', | ||
description: 'The field containing the text sample.', | ||
type: 'string', | ||
domain: { | ||
mode: 'field', | ||
from: 'data', | ||
fieldTypes: ['string'] | ||
} | ||
}, | ||
{ | ||
name: 'count', | ||
description: 'The field containing the count for each text sample.', | ||
type: 'string', | ||
domain: { | ||
mode: 'field', | ||
from: 'data', | ||
fieldTypes: ['integer'] | ||
} | ||
}, | ||
{ | ||
name: 'graphs', | ||
description: 'The number of graphs to compute and render.', | ||
type: 'integer', | ||
format: 'integer', | ||
default: 3 | ||
} | ||
]; | ||
} | ||
|
||
constructor (el, {data, id = null, text = 'text', count = 'count', graphs = 3}) { | ||
super(el); | ||
|
||
// Empty element. | ||
select(el) | ||
.selectAll('*') | ||
.remove(); | ||
|
||
// Transform input data into correct form. | ||
this.data = data.map((d, i) => ({ | ||
id: id ? d[id] : i, | ||
text: d[text], | ||
count: d[count] !== undefined ? d[count] : 1 | ||
})); | ||
|
||
const model = new SentenTreeBuilder() | ||
.buildModel(this.data); | ||
|
||
this.vis = new SentenTreeVis(el) | ||
.data(model.getRenderedGraphs(graphs)); | ||
} | ||
|
||
render () {} | ||
} |
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
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
Oops, something went wrong.