diff --git a/README.markdown b/README.markdown index 7a30ca13..38f6a1e6 100644 --- a/README.markdown +++ b/README.markdown @@ -2,13 +2,24 @@ Assignment 4 - Creative Coding === http://a4-owen-blaufuss.glitch.me +An interactive bar graph to explore the lyrical volume of the band They Might Be Giants over time. +NOTE: The lyrics are stored as a large number of small files. They are only requested once, on page load, but Glitch doesn't seem to like this volume of requests; refreshing the page many times back to back may result in being rate-limited. Requirements ------------ - Server, created using Express - [D3.js](https://d3js.org) -- User interface +- User interface wtih following parameters: + - X axis display radio button choices + - X axis display album name dropdown list + - Y axis display radio button choices + - Y axis display custom search box + +Challenges +---------- +- Due to the format in which the lyrics were downloaded, a large volume of network requests is made on page load. Making this happen efficiently and ensuring that all these requests had finished before display was a bit of a challenge. +- The lengths and formatting of different songs and albums was difficult to predict and work around. To avoid having to make major changes for edge cases, an alternate solution, hovertext on each bar, was used as a label. Special thanks: ----------- diff --git a/data/1995_John-Flansburgh's-Mono-Puff_Dr.-Kildare-Demo.lyric b/data/1995_John-Flansburgh's-Mono-Puff_Dr.-Kildare-Demo.lyric deleted file mode 100644 index b01c8be4..00000000 --- a/data/1995_John-Flansburgh's-Mono-Puff_Dr.-Kildare-Demo.lyric +++ /dev/null @@ -1,4 +0,0 @@ -Who'll teach me drama? -Who'll be my acting coach? -I love the theater -I'm Dr. Kildare! diff --git a/data/1995_John-Flansburgh's-Mono-Puff_Nixon's-The-One-Demo.lyric b/data/1995_John-Flansburgh's-Mono-Puff_Nixon's-The-One-Demo.lyric deleted file mode 100644 index f2d468b9..00000000 --- a/data/1995_John-Flansburgh's-Mono-Puff_Nixon's-The-One-Demo.lyric +++ /dev/null @@ -1,5 +0,0 @@ -When they look back and weigh everything he's done -They will realize: -Nixon's the one -Nixon's the one -Nixon's the one diff --git a/data/1995_John-Flansburgh's-Mono-Puff_So-Long-Mockingbird-Demo.lyric b/data/1995_John-Flansburgh's-Mono-Puff_So-Long-Mockingbird-Demo.lyric deleted file mode 100644 index afe43974..00000000 --- a/data/1995_John-Flansburgh's-Mono-Puff_So-Long-Mockingbird-Demo.lyric +++ /dev/null @@ -1,25 +0,0 @@ -So long, mockingbird -Laughing on the telephone line -So long, mockingbird -Laughing on the telephone line -I can read your mind -From half a mile -Peek into your mind -But I won't say - -Hello, open field -I'm happy as a scarecrow now -Hello, open field -I'm happy as a scarecrow now - -The cars can pass me by -But I don't mind -They can pass me by -I don't mind - -So long, mockingbird -I won't miss your mockingbird face -So long, mockingbird -I won't miss your mockingbird face - -I hate you so diff --git a/data/1995_John-Flansburgh's-Mono-Puff_Tryptophan.lyric b/data/1995_John-Flansburgh's-Mono-Puff_Tryptophan.lyric deleted file mode 100644 index fbbbc1e5..00000000 --- a/data/1995_John-Flansburgh's-Mono-Puff_Tryptophan.lyric +++ /dev/null @@ -1,20 +0,0 @@ -Tryptophane -I was wrong, it's an ordinary day -Tryptophane -It began, I was feeling like I am -By the leg of the bird -And the special day observed -I was mad 'til I found -There was more to go around -Tryptophane - -All alone, I was wrong -And there's much more going on -In my vein, in my mind -In my chemistry I'd find - -Tryptophane, I'm aware -Like the calm breeze in the air -Like a swan on the lake -I'm not calm, that's my mistake -Tryptophane diff --git a/data/1995_John-Flansburgh's-Mono-Puff_Unsupervised-I-Hit-My-Head-Demo.lyric b/data/1995_John-Flansburgh's-Mono-Puff_Unsupervised-I-Hit-My-Head-Demo.lyric deleted file mode 100644 index f947556e..00000000 --- a/data/1995_John-Flansburgh's-Mono-Puff_Unsupervised-I-Hit-My-Head-Demo.lyric +++ /dev/null @@ -1,29 +0,0 @@ -I hit my head -I hear the phone ring -I was distracted by my friend Joe -I hit my head -Now I'm left-handed -I lost my sublet to my friend Joe - -I've lost my superpowers -I was invisible -I could just cut myself -Right out my will -I was unsupervised -I had a real good time -Until I . . . I hit my head - -Back in the day -With my friends 'round me -You could count on me with just one hand -When I digress -You'd find me smiling -Could be living underneath the ground - -I've lost my superpowers -I was invisible -I could just cut myself -Right out my will -I was unsupervised -I had a real good time -Until I . . . I hit my head diff --git a/data/1995_John-Flansburgh's-Mono-Puff_What-Bothers-The-Spaceman-Demo.lyric b/data/1995_John-Flansburgh's-Mono-Puff_What-Bothers-The-Spaceman-Demo.lyric deleted file mode 100644 index 05e3b53f..00000000 --- a/data/1995_John-Flansburgh's-Mono-Puff_What-Bothers-The-Spaceman-Demo.lyric +++ /dev/null @@ -1,20 +0,0 @@ -Far from the crowd -He's the day watchman -Walk past the trees -He used to swing from -What bothers the spaceman? -The teeth in his head -I'm sure he could smile for us - -Wave to the people -Out on the lawn -Mr. Ellis and Mr. Lee -Mr. Lee and me - -What bothers the spaceman? -What's left for him now? -I'm sure he could smile for us - -Lee Lee Lee Lee Lee Lee Lee (ley ley) -Lee Lee Lee Lee Lee Lee Lee Lee (ley ley) -Lee Lee Lee Lee Lee Lee Lee Lee (ley ley ley) diff --git a/data/1996_House-Of-Mayors_Will-You-Love-Me-In-December-As-You-Do-In-May.lyric b/data/1996_House-Of-Mayors_Will-You-Love-Me-In-December-As-You-Do-In-May.lyric deleted file mode 100644 index 90491e79..00000000 --- a/data/1996_House-Of-Mayors_Will-You-Love-Me-In-December-As-You-Do-In-May.lyric +++ /dev/null @@ -1,29 +0,0 @@ -Now, in the summer of life, sweetheart -You say you love but me -Gladly I give all my heart to you -Throbbing with ecstasy -But last night I saw, while a-dreaming -The future old and gray, -And I wondered if you'll love me then, dear -Just as you do today? - -Will you love me in December as you do in May? -Will you love me in the good old-fashioned way? -When my hair has all turned gray, -Will you kiss me then and say, -That you love me in December as you do in May? - -You say the glow on my cheek, sweetheart -Is like the rose so sweet -But when the bloom of fair youth has flown -Then will our lips still meet? -When life's setting sun fades away, dear, -And all is said and done, -Will your arms still entwine and caress me? -Will our hearts beat as one? - -Will you love me in December as you do in May? -Will you love me in the good old-fashioned way? -When my hair has all turned gray, -Will you kiss me then and say, -That you love me in December as you do in May? diff --git a/data/1996_The-Devil-Went-Down-To-Newport-EP_Oddball.lyric b/data/1996_The-Devil-Went-Down-To-Newport-EP_Oddball.lyric deleted file mode 100644 index 8bf0a312..00000000 --- a/data/1996_The-Devil-Went-Down-To-Newport-EP_Oddball.lyric +++ /dev/null @@ -1,35 +0,0 @@ -In between the matter I would fall -Like the notes between the chords in this song -Possibilities would be great -I could attend, I would not be late -For the gathering of the society of the -Oddballs! -Though every ball is different -Oddball! -I might as well be all alone if I'm not -Oddball! -Because time between the oddballs is so very long - -Now I wanna talk to everyone about mathematics. - -Mathematics moves at such a crawl -And gravity is a-mighty strong -It's so strong that every place an orb -So many places to count, I can't absorb -Yeah, but every now and then there comes along - -Oddball! -Though every ball is different -Oddball! -I might as well be all alone in my mind -Oddball! -'Cause space between the oddballs is so very long - -Oddball! -Though every ball is different -Oddball! -I might as well be all alone if I'm not -Oddball! -Because space between the oddballs is so very long - -Mr. Frank Black diff --git a/data/1996_The-Devil-Went-Down-To-Newport-EP_Pretty-Fly.lyric b/data/1996_The-Devil-Went-Down-To-Newport-EP_Pretty-Fly.lyric deleted file mode 100644 index 41f84144..00000000 --- a/data/1996_The-Devil-Went-Down-To-Newport-EP_Pretty-Fly.lyric +++ /dev/null @@ -1,23 +0,0 @@ -Once upon a time -There was a pretty fly -He had a pretty wife -This pretty fly -But one night -She flew away -Flew away - -She had (two pretty children) -But one night -These two pretty children -Flew away -Flew away -Into the sky -Into the moon - -Once upon a time -There was a pretty fly -He had a pretty wife -This pretty fly -But one night -She flew away -Flew away diff --git a/data/1996_The-Devil-Went-Down-To-Newport-EP_The-Devil-Went-Down-To-Newport-Totally-Remade.lyric b/data/1996_The-Devil-Went-Down-To-Newport-EP_The-Devil-Went-Down-To-Newport-Totally-Remade.lyric deleted file mode 100644 index 2ae53690..00000000 --- a/data/1996_The-Devil-Went-Down-To-Newport-EP_The-Devil-Went-Down-To-Newport-Totally-Remade.lyric +++ /dev/null @@ -1,59 +0,0 @@ -The Devil went down -To Newport town -He brought his red surfboard -To race against the Lord -And it was totally rocking -It was totally rocking - -Satan told his girl, -"I'm gonna catch a curl" -He caught a heinous wave -And he gave the crowd a wave - -It was totally rocking -It was totally rocking - -They were surfin' for souls (they were surfin' for souls) -To the beat of rock and roll (to the beat of rock) - -Next came God's turn -Got a wicked sunburn -He didn't use lotion -Parting the ocean - -Totally rocking -It was totally rocking - -God said to Satan, -"Dude, I'm sick of waitin' -In order to win -Chuck, you gotta hang ten" - -It was totally rocking -It was totally rocking - -Things were lookin' rad -For the forces of bad -All right - -Satan went surfin' -He didn't have a board -He could not hang ten -He could only hang four - -Satan had a problem -He could not compete -Satan was hindered -By his cloven feet - -It was totally rocking -It was totally rocking -It was totally rocking -It was totally rocking - -Go, go, Satan, go -Go, go, Satan, go -Go, go, Satan, go -Go, go, Satan, go -Go, go, Satan, go -Go, go, Satan, go diff --git a/data/1996_The-Devil-Went-Down-To-Newport-EP_The-Devil-Went-Down-To-Newport-Totally-Rocking.lyric b/data/1996_The-Devil-Went-Down-To-Newport-EP_The-Devil-Went-Down-To-Newport-Totally-Rocking.lyric deleted file mode 100644 index 93d8e5df..00000000 --- a/data/1996_The-Devil-Went-Down-To-Newport-EP_The-Devil-Went-Down-To-Newport-Totally-Rocking.lyric +++ /dev/null @@ -1,66 +0,0 @@ -The Devil went down -To Newport town -He brought his red surfboard -To race against the Lord -It was totally rocking -It was totally rocking -It was totally rocking -It was totally rocking - -Satan told his girl, -"I'm gonna ride a curl" -He caught a heinous wave -And he gave the crowd a wave - -It was totally rocking -It was totally rocking - -They were surfin' for souls -To the beat of rock and roll -Alright - -Next came God's turn -Got a wicked sunburn -He didn't use lotion -While he was parting the ocean - -It was totally rocking -It was totally rocking -It was totally rocking -It was totally rocking - -God said to Satan, -"Dude, I'm sick of waitin' -In order to win -Chuck, you gotta hang ten" - -It was totally rocking -It was totally rocking - -Things were lookin' rad -Oh yeah -For the forces of bad -Alright - -Satan went surfin' -Didn't need a board -Could not hang ten -He could only hang four - -Satan had a problem -He could not compete -Satan was hindered -By his cloven feet - -It was totally rocking -It was totally rocking -It was totally rocking -It was totally rocking - -Go, go, Satan, go -Go, go, Satan, go -Go, go, Satan, go -Go, go, Satan, go -Go, go, go - -Alright! diff --git a/data/1996_The-Devil-Went-Down-To-Newport-EP_Tryptophane.lyric b/data/1996_The-Devil-Went-Down-To-Newport-EP_Tryptophane.lyric deleted file mode 100644 index fbbbc1e5..00000000 --- a/data/1996_The-Devil-Went-Down-To-Newport-EP_Tryptophane.lyric +++ /dev/null @@ -1,20 +0,0 @@ -Tryptophane -I was wrong, it's an ordinary day -Tryptophane -It began, I was feeling like I am -By the leg of the bird -And the special day observed -I was mad 'til I found -There was more to go around -Tryptophane - -All alone, I was wrong -And there's much more going on -In my vein, in my mind -In my chemistry I'd find - -Tryptophane, I'm aware -Like the calm breeze in the air -Like a swan on the lake -I'm not calm, that's my mistake -Tryptophane diff --git a/data/1996_The-Hal-Cragin-Years_Dedicated.lyric b/data/1996_The-Hal-Cragin-Years_Dedicated.lyric deleted file mode 100644 index 43a1943b..00000000 --- a/data/1996_The-Hal-Cragin-Years_Dedicated.lyric +++ /dev/null @@ -1,34 +0,0 @@ -Puff! [repeated throughout song] -Stop playing games of the mind -Hey diddo ging gindedo d-ding gingedo go -Oh, o-o-o-oh it's you, ee oh oh oh oh oh why what the - -Not only, but especially for, the ladies -Mono Puff -Not only, but especially for, the ladies -Mono Puff - -Mono Puff - -Mono (Puff) -Mono (Puff) -Mono (Puff) -Mono (Puff) - -Not only, but especially for, the ladies -Mono Puff -Not only, but especially for, the ladies -Mono Puff - -Mono (Puff) -Mono Puff -Mono (Puff) -Mono (Puff) - -Comes the sound comin' at ya -Hummin' at ya -Strummin' and drummin' at ya - -October 17th: Stayed inside. At 11 o'clock I see my dedicated friend through my window. He's across the street, turning the key in his front door. I sit in my chair just beyond the sunlight of the window and speak out: "There he is." He looks around, thinking, incorrectly, that he will someday discover my secret identity. - -Puff! diff --git a/data/1996_The-Hal-Cragin-Years_Imaginary-Friend.lyric b/data/1996_The-Hal-Cragin-Years_Imaginary-Friend.lyric deleted file mode 100644 index 3c955835..00000000 --- a/data/1996_The-Hal-Cragin-Years_Imaginary-Friend.lyric +++ /dev/null @@ -1,34 +0,0 @@ -The beauty of -A felt-tip pen -The comfort found -In imaginary friends - -I've been all around this crummy world -And no one will defend -The comfort found -In imaginary friends - -I booked my trip -On a time machine -Going back one hour -To the previous scene - -Right before you called my name -I was talking to a friend -They could not understand -So I'm explaining it all again -The beauty of -Imaginary friends - -"Eric...." - -I can disappear -In a Store 24 -And re-emerge -Distorted and small - -Back in deepest, -Darkest Massachusetts -Isolated from -The comfort found -In imaginary friends diff --git a/data/1996_The-Hal-Cragin-Years_Mr.-Hughes-Says.lyric b/data/1996_The-Hal-Cragin-Years_Mr.-Hughes-Says.lyric deleted file mode 100644 index 859b5f4c..00000000 --- a/data/1996_The-Hal-Cragin-Years_Mr.-Hughes-Says.lyric +++ /dev/null @@ -1,25 +0,0 @@ -Tell your sister and your brother -Tell the alien and the chimp -Tell the corpse and tell the killer -Tell the pilot and the blimp - -Tell the wind and tell the phone -Tell the birds and tell the fly -Tell the streetlights and the car -Tell the stars and tell the sky - -Mr. Hughes says, "Live and learn. -Dig and be dug in return." - -Tell the boxer and the fist -Tell the logo and the lid -Tell the ladies and the lords -Tell the goats and tell the kid - -Tell the stylus and the disc -Tell the dust and tell the breeze -Tell the needles and the wool -Tell the locks and tell the keys - -Mr. Hughes says, "Live and learn. -Dig and be dug in return." diff --git a/data/1996_The-Hal-Cragin-Years_What-Everybody-Knows.lyric b/data/1996_The-Hal-Cragin-Years_What-Everybody-Knows.lyric deleted file mode 100644 index 4fe57414..00000000 --- a/data/1996_The-Hal-Cragin-Years_What-Everybody-Knows.lyric +++ /dev/null @@ -1,34 +0,0 @@ -She left me behind -With my tearstained mind -And this monkey fur coat -That nobody wants - -When she tore me in half -My neighbors would smile -'Cause that's all the fun -They'd had in awhile - -And I just found out -What everybody knows -And I can't go back -To where I wanna go - -I met my girlfriend's friend -Walking right down my block -She had a prosaic stare -And a prosaic cough - -She would poke at my coat -And I would reply -And kick at the ground -And not look in her eyes - -And I just found out -What everybody knows -And I can't go back -To where I wanna go - -And I just found out -What everybody knows -And I can't go back -To where I wanna go diff --git a/data/1997_Olive-The-Other-Reindeer_Olive-The-Other-Reindeer.lyric b/data/1997_Olive-The-Other-Reindeer_Olive-The-Other-Reindeer.lyric deleted file mode 100644 index 08faa545..00000000 --- a/data/1997_Olive-The-Other-Reindeer_Olive-The-Other-Reindeer.lyric +++ /dev/null @@ -1,12 +0,0 @@ -Olive, the other reindeer, -was a little tiny dog. -She helped Mr. Santa make it through -the North Pole fog. -She flew down on a piece of string, -Comet put her there. -And when the gumdrops began to fall... -She helped Santa get them all. -Now all the other, reindeer -have a new doggie friend, -Her name is Olive. -And now the song must end. diff --git a/data/1998_The-Steve-Calhoon-Years_Backstabbing-Liar.lyric b/data/1998_The-Steve-Calhoon-Years_Backstabbing-Liar.lyric deleted file mode 100644 index 1d185c55..00000000 --- a/data/1998_The-Steve-Calhoon-Years_Backstabbing-Liar.lyric +++ /dev/null @@ -1,29 +0,0 @@ -Hear the scream that the turning subway made -Hear the screams of the people in your way -They love you very much but they -Don't know that you're the one - -Backstabbing liar -And have been all along -Backstabbing liar -Has learned to write songs - -See the mirror and reflections in the light -See the fanzine and your paragraphs of lies -We got along so well that I -Could hardly tell you're the - -Backstabbing liar -And everyone's wrong -Backstabbing liar -Has learned to write songs - -Backstabbing liar -And everyone's wrong -Backstabbing liar -Has learned to write songs - -Backstabbing liar -Says he's resigned -Backstabbing liar -Will change your mind diff --git a/data/1998_The-Steve-Calhoon-Years_Hillbilly-Drummer-Girl.lyric b/data/1998_The-Steve-Calhoon-Years_Hillbilly-Drummer-Girl.lyric deleted file mode 100644 index 4bd7c27f..00000000 --- a/data/1998_The-Steve-Calhoon-Years_Hillbilly-Drummer-Girl.lyric +++ /dev/null @@ -1,48 +0,0 @@ -She came down from the Ozarks -To the big city Memphis world -She's a legend and a landmark -Hillbilly drummer girl - -A stomach full of whiskey -More than any man -A bar of broken tables -An empty gasoline can - -A black behemoth Caddy -Sleeping bag in back -Holes right through the floorboard -A rolling chicken shack - -She came down from the Ozarks -To the big city Memphis world -She's a legend and a landmark -Hillbilly drummer girl -Hillbilly drummer girl - -At ten o'clock tomorrow -Playing for a crowd of six -Free beer and eight dollars -That's money for new sticks - -Party 'cross the river -Ends up in the mud -Morning in the drunk tank -Coffee and dried blood - -She came down from the Ozarks -To the big city Memphis world -She's a legend and a landmark -Hillbilly drummer girl -Hillbilly drummer girl - -The ducks are in the lobby -And Graceland's down the road -A vacant lot, a pile of bricks -Now she's the living soul - -She came down from the Ozarks -To the big city Memphis world -She's a legend and a landmark -Hillbilly drummer girl -Hillbilly drummer girl -Hillbilly drummer girl diff --git a/data/1998_The-Steve-Calhoon-Years_Night-Security.lyric b/data/1998_The-Steve-Calhoon-Years_Night-Security.lyric deleted file mode 100644 index c9f29b9b..00000000 --- a/data/1998_The-Steve-Calhoon-Years_Night-Security.lyric +++ /dev/null @@ -1,28 +0,0 @@ -I want to know the day custodian -I want to hear his harsh refrain -But most of all -I hear the calling -Of the watchman afterhours - -I want to be the night security -I want to own a tiny TV -With the sound turned down -And no one around -I'll sing so very loud - -I want to be the night security -I want to sleep right in my clothes -I want to open my eyes -As people walk by -And whisper, "Who's that guy?" - -My keychain is on the table -Its massive size implies -The scope of what I'm able -To unlock any time - -I want to be the night security -I want to sleep right in my clothes -I want to open my eyes -As people walk by -And whisper, "Who's that guy?" diff --git a/data/1998_The-Steve-Calhoon-Years_Poison-Flowers.lyric b/data/1998_The-Steve-Calhoon-Years_Poison-Flowers.lyric deleted file mode 100644 index d095cd64..00000000 --- a/data/1998_The-Steve-Calhoon-Years_Poison-Flowers.lyric +++ /dev/null @@ -1,21 +0,0 @@ -Who's going to wear my sandals stained with cherry soda? -(We will we will we will) -Who's going to ride my bike when I'm back in school? - -Who's going to build my death ray? -Who's going to build my death ray? -And grow poison flowers -Poison flowers with me? - -Who's going to steal the rowboats from the lifeguard station? -(We will we will we will) -Who'll type manifestos at my summer job? - -Who's going to build my bomb? -Who's going to build my bomb? -And grow poison flowers -Poison flowers -Poison flowers -Poison flowers with me? - -(Please don't leave!) diff --git a/data/1999_Montana_Louisiana.lyric b/data/1999_Montana_Louisiana.lyric deleted file mode 100644 index 104a65d7..00000000 --- a/data/1999_Montana_Louisiana.lyric +++ /dev/null @@ -1,48 +0,0 @@ -I'm trying to figure out where everybody's gone -I wonder when they're gonna turn the lights back on -I will be nice about it, I will be forgiving -And I will act as if I wasn't ever put upon - -But someone has put something over on me -They've pulled the wool down over me and I can't see -I can't identify exactly who's responsible -But I know where I am and so I know who it could be - -Louisiana, take this blanket off of me -I know you're out there with your hands around my neck -And I can feel your breath -Now Louisiana, take this thing away -Louisiana -Louisiana - -You were not so bad, and I won't be mad -If you'll only take this blanket off of me - -Ahhhhhhhhhh - -Although I'm glad that Louisiana is a place -So I don't have to spin in dark and empty space -I wish that everything went just as I wish everything would go -I wish I didn't have the blanket on my face - -Louisiana, take this blanket off of me -I know you're out there with your hands around my neck -And I can feel your breath -Now Louisiana, take this thing away -Louisiana -Louisiana - -You were not so bad, and I won't be mad -If you'll only take this blanket off of me - -Louisiana, take this blanket off of me -I know you're out there with your hands around my neck -And I can feel your breath -Now Louisiana, take this thing away -Louisiana -Louisiana - -You were not so bad, and I won't be mad -If you'll only take this blanket off of me - -Louisiana, take this blanket off of me diff --git a/data/1999_Montana_Montana.lyric b/data/1999_Montana_Montana.lyric deleted file mode 100644 index f88bd4d1..00000000 --- a/data/1999_Montana_Montana.lyric +++ /dev/null @@ -1,48 +0,0 @@ -What are you staring at -In that hospital bed? -Let me explain -I wasn't thinking about anything -Then it hit me that Montana was really just a leg -With the round part just the way you would expect -And it started with a feeling that ended in a leg -And it seemed to me Montana was a leg - -A leg -Now I get it -I'll tell the person next to me -And then haul off and die - -I won't need this -Electric folding bed -I can lose these -Tiny pillcups now - -'Cause it hit me that Montana was really just a leg -And then just like that it all fell into place -And I don't think I can stand any longer in this bed -Since I figured out Montana was a leg - -A leg -Now I get it -I wasn't sure but now I know -And I can finally go -Give out my lungs, give up and tell -The information to the man in the next bed down -In the morning he'll tell someone the last thing that I said -When I told him that Montana was a leg - -From the beginning there was something about it staring me -In the face I should have guessed it right away -When it started with a feeling that ended in a leg -And it seemed to me Montana was a leg - -A leg -Now I get it -I'll tell the person next to me -(I'll tell them that Montana was) -I'll say Montana was -A leg -Now I get it -I wasn't sure -But now I know -And I can finally go diff --git a/data/2021_Roman-Songs_CATENAS-MEAS-AMISI.lyric b/data/2021_Roman-Songs_CATENAS-MEAS-AMISI.lyric deleted file mode 100644 index e69de29b..00000000 diff --git a/data/2021_Roman-Songs_HAEC-QVOQVE-EST-RES.lyric b/data/2021_Roman-Songs_HAEC-QVOQVE-EST-RES.lyric deleted file mode 100644 index e69de29b..00000000 diff --git a/data/2021_Roman-Songs_NVNC-AVT-NVMQVAM.lyric b/data/2021_Roman-Songs_NVNC-AVT-NVMQVAM.lyric deleted file mode 100644 index e69de29b..00000000 diff --git a/data/2021_Roman-Songs_TECVM-CIRCVMAMBVLARE-NOLO.lyric b/data/2021_Roman-Songs_TECVM-CIRCVMAMBVLARE-NOLO.lyric deleted file mode 100644 index e69de29b..00000000 diff --git a/public/script.js b/public/script.js index 562b988f..7fb3b1b4 100644 --- a/public/script.js +++ b/public/script.js @@ -9,7 +9,7 @@ var xYearEnd = 2022; var xAlbumsList = []; const chartHeight = 400 const chartWidth = 600 -const chartMargin = { left: 60, top: 10, right: 50, bottom: 25 } +const chartMargin = { left: 75, top: 10, right: 50, bottom: 25 } //chart data var xArray = []; @@ -20,8 +20,8 @@ let maxVal = 0; const submit = function (e) { // prevent default form action from being carried out e.preventDefault(); - console.log("Submit"); - return false; + document.getElementById("searchCount").checked = true; + chartDisplay(); }; const showStatus = function (msg) { @@ -52,7 +52,8 @@ window.onload = function () { lyricData = lyricData.sort((a, b) => (a.year > b.year ? 1 : -1)); //showStatus("fetching lyrics..."); - for (let song of lyricData) { + for (let i = 0; i < lyricData.length; i++) { + let song = lyricData[i] fetch(song.filename) .then(response => response.text()) .then(textString => { @@ -63,10 +64,13 @@ window.onload = function () { xAlbumsList.push(song.album); } - showStatus("Search!"); - //data is all set up, enable form controls - enableForm(); - chartDisplay(); + //if on last iteration + if (i === lyricData.length - 1) { + showStatus("Search!"); + //data is all set up, enable form controls + enableForm(); + chartDisplay(); + } }); } }); @@ -83,6 +87,7 @@ const enableForm = function () { } document.getElementById("xYears").checked = true; document.getElementById("wordCount").checked = true; + document.getElementById('searchCount').onclick = ""; const setX3selector = document.getElementById('albumSelect'); setX3selector.onchange = chartDisplay; @@ -91,6 +96,8 @@ const enableForm = function () { for (var i = 0; i < inputs.length; i++) { inputs[i].disabled = false; } + + document.getElementById("status").style.display = "none" }; @@ -110,11 +117,14 @@ const chartDisplay = function () { } //find maximum value for the y axis maxVal = Math.max(...data.map(d => d.value)); - drawY(maxVal); - drawBars(data); - console.log("Displaying:") - console.log(lyricData); + clearBars(); + if (maxVal > 0){ + drawY(maxVal); + + drawBars(data); + } + } /* @@ -155,6 +165,8 @@ const evalMetric = function (text) { return evalWords(text).length; case "wordCountUnique": return evalUniqueWords(text).length; + case "searchCount": + return evalSearch(text).length; default: return evalChars(text).length; } @@ -178,10 +190,10 @@ const setXYears = function () { const setXAlbums = function () { allowXSongs(false)//disable album selection - chartMargin.bottom = 90; + chartMargin.bottom = 120; //console.log(xAlbumsList); xArray = xAlbumsList;//all albums - let albumScale = d3.scaleBand().domain(xArray).range([chartMargin.left, chartWidth - chartMargin.right]).padding(0.5); + let albumScale = d3.scaleBand().domain(xArray).range([chartMargin.left, chartWidth - chartMargin.right]); let axisBottom = d3.axisBottom(albumScale); d3.select('#bottom').call(axisBottom).attr('transform', 'translate(0,' + (chartHeight - chartMargin.bottom) + ')') .selectAll("text") @@ -191,7 +203,7 @@ const setXAlbums = function () { const setXSongs = function () { populateXSongs(); - chartMargin.bottom = 90; + chartMargin.bottom = 120; allowXSongs(true)//enable album selection let albumNames = document.querySelector("#albumSelect").value; xArray = lyricData.filter(song => song.album === albumNames).map(song => song.name);//all song names in this album @@ -249,25 +261,39 @@ const evalUniqueWords = function (text) { return [...new Set(words)]; } -const drawBars = function (data) { +const evalSearch = function (text) { + let reg = new RegExp(document.querySelector("#search").value.toLowerCase(), "g") + return (text.toLowerCase().match(reg) || []); +} + +const clearBars = function(){ //clear all bars d3.selectAll('g.bar').remove(); +} + +const drawBars = function (data) { //start over again let barWidth = (chartWidth - chartMargin.left - chartMargin.right) / data.length; + let color = d3.scaleSequentialSqrt() + .domain([0, maxVal]) + .interpolator(d3.interpolateBlues); let y = d3.scaleLinear() .domain([maxVal * 1.1, 0]) .range([0, chartHeight]) let svg = d3.select('#chart'); let bar = svg .selectAll('g.bar') - .data(data.map(d => d.value)) + .data(data) .enter() .append('svg:g') .attr('class', 'bar') .attr('transform', (_, i) => 'translate(' + (1 + chartMargin.left + i * barWidth) + ', 0)'); bar .append('rect') + .attr('fill', d => color(d.value)) .attr('width', barWidth - 1) - .attr('y', d => y(d) - chartMargin.bottom) - .attr('height', d => chartHeight - y(d)) + .attr('y', d => y(d.value) - chartMargin.bottom) + .attr('height', d => chartHeight - y(d.value)) + .append("svg:title") + .text(d => d.name) } \ No newline at end of file diff --git a/public/style.css b/public/style.css index d0ed1faf..a52cbc87 100644 --- a/public/style.css +++ b/public/style.css @@ -7,4 +7,14 @@ form { form div { padding:16px; flex-grow:0.5; +} + +#status{ + position: absolute; + margin-left: auto; + margin-right: auto; + left: 0; + right: 0; + top: 200px; + text-align: center; } \ No newline at end of file diff --git a/views/index.html b/views/index.html index 91863c77..9c3fc750 100644 --- a/views/index.html +++ b/views/index.html @@ -12,7 +12,10 @@
Hover mouse over each bar for song/album name labels.
+