Notes
![]() ![]() Notes - notes.io |
* Creates legend shape based on category and song attribute passed
*
* @param category
* Category attributes to display
* @param song
* Song attribute glyphs are sorted by
*
*/
public void updateLegend(String category, String song) {
String sub1 = "";
String sub2 = "";
String sub3 = "";
String sub4 = "";
if (category == "Hobby") {
sub1 = "Reading";
sub2 = "Art";
sub3 = "Sports";
sub4 = "Music";
}
else if (category == "Major") {
sub1 = "Comp Sci";
sub2 = "Other Eng";
sub3 = "Math/CMDA";
sub4 = "Other";
}
else if (category == "Region") {
sub1 = "Northeast";
sub2 = "Southeast";
sub3 = "Other US";
sub4 = "Outside US";
}
// Legend descriptions
int legendW = 120;
int legendH = 200;
int betweenY = 20;
int betweenX = 5;
int startX = 850;
int startY = 280;
legend = new Shape[13];
legend[0] = new TextShape(startX, startY, category + " Legend",
Color.BLACK);
legend[1] = new TextShape(startX, legend[0].getY() + betweenY, sub1,
Color.MAGENTA);
legend[2] = new TextShape(startX, legend[1].getY() + betweenY, sub2,
Color.BLUE);
legend[3] = new TextShape(startX, legend[2].getY() + betweenY, sub3,
Color.YELLOW);
legend[4] = new TextShape(startX, legend[3].getY() + betweenY, sub4,
Color.GREEN);
int centerW = startX - betweenX + legendW / 2;
legend[5] = new TextShape(0, legend[4].getY() + betweenY, "Song "
+ song, Color.BLACK);
legend[5].moveTo(centerW - legend[5].getWidth() / 2, legend[5].getY());
legend[8] = new Shape(centerW - AXIS_W / 2, legend[5].getY() + betweenY,
AXIS_W, AXIS_H, Color.BLACK);
int axisCenterY = legend[8].getY() + AXIS_H / 2;
legend[6] = new TextShape(0, 0, "Heard", Color.BLACK);
legend[7] = new TextShape(0, 0, "Likes", Color.BLACK);
legend[6].move(centerW - AXIS_W / 2 - betweenX - legend[6].getWidth(),
axisCenterY - legend[6].getHeight() / 2);
legend[7].move(centerW + AXIS_W / 2 + betweenX / 2, axisCenterY
- legend[7].getHeight() / 2);
// legend outline
startX = startX - betweenX;
startY = startY - betweenX;
int thickness = 3;
legend[9] = new Shape(startX, startY, legendW, thickness, Color.BLACK);
legend[10] = new Shape(startX, startY + legendH - thickness, legendW,
thickness, Color.BLACK);
legend[11] = new Shape(startX, startY, thickness, legendH, Color.BLACK);
legend[12] = new Shape(startX + legendW - thickness, startY, thickness,
legendH, Color.BLACK);
for (int k = 0; k < legend.length; k++) {
if (k < 8) {
legend[k].setBackgroundColor(Color.WHITE);
}
window.addShape(legend[k]);
}
}
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team