Created
July 6, 2013 04:54
-
-
Save ASRagab/5938686 to your computer and use it in GitHub Desktop.
Processing Gist which draws a Bubble Chart..manually or as manually as one gets in Processing
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
Company[] companies; | |
PFont font; | |
void setup() | |
{ | |
String[] company = loadStrings("Testdata.csv"); | |
size(800,800); | |
background(255); | |
noStroke(); | |
smooth(); | |
font = loadFont("BrowalliaNew-18.vlw"); | |
textFont(font); | |
println(company.length); | |
for(int i=0; i<company.length; i++) | |
{ | |
String[] temp = split(company[i], ','); | |
for(int j=0; j<temp.length; j++) | |
{ | |
companies[j] = new Company(temp[j], Integer.parseInt(temp[j+1]), Integer.parseInt(temp[j+2]), Integer.parseInt(temp[j+3]), Integer.parseInt(temp[j+4])); | |
} | |
} | |
} | |
void draw(){ | |
stroke(255); | |
fill(0,0,255); | |
textAlign(CENTER); | |
text("4 Category Visualization of Test Company Data", width/2, 10); | |
line(25,25,25,725); | |
text("Data Security", 5, height/2); | |
line(25,725, 725,725); | |
text("Project Complexity", width/2, 740); | |
for(int i=0; i<companies.length; i++){ | |
companies[i].drawCompany(); | |
} | |
} | |
class Company{ | |
String name; | |
int resources; | |
int security; | |
int complexity; | |
int flexibility; | |
Company(String _name, int _resources, int _security, int _complexity, int _flexibility) | |
{ | |
name = _name; | |
resources = _resources; | |
security = _security; | |
complexity = _complexity; | |
flexibility = _flexibility; | |
} | |
public void drawCompany() | |
{ | |
ellipseMode(CENTER); | |
fill(0,flexibility*50,0); | |
ellipse(150+(125*complexity), 800-(150+125*security), 25*resources, 25*resources); | |
fill(0); | |
text(name, 150+(125*complexity), 800-(150+125*security)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Could you provide the csv file please?
Thanks