top of page
Search

JSON Project

  • Writer: Kimberly Agosto
    Kimberly Agosto
  • Dec 5, 2018
  • 1 min read

December 5, 2018

I decided to use my own JSON file as a data archive that I could access by interacting with my sketch. My project is a sample of 10 arrests in NYC in 2017, which I got from here: https://data.cityofnewyork.us/Public-Safety/NYPD-Arrests-Data-Historic-/8h9b-rp9u.

When you click on one of the profiles, a set of data pops up in the upper left corner, which tells the crime, the borough it was committed in, and the age, race, and sex of the perp.

I had a lot of challenges with this particular sketch. It's hard to get a mouse function that identifies the location of the mouse and where it was pressed, and then make an action. So instead, I had to define the parameters for each ellipse in my code in the following fashion;

"if(mouseX>475&&mouseX<545&&mouseY>215&&mouseY<282&&mouseIsPressed)"

Which quickly becomes repetitive and tedious. When I finished my code, I found that I could have defined variables rather than copy and paste long strings of code. However, I was discovering new elements that I could perform during trial and error, which is why I didn't think ahead and simplify the amount of code on the screen using variables. If I were to revise the code I would make variables for x, y, w, and h, and variables for the ellipses.

Link to code: https://editor.p5js.org/kimagosto/sketches/ryr40qHJ4

 
 
 

Recent Posts

See All
My game!

Link to my game: https://editor.p5js.org/kimagosto/sketches/f2JnXUJU8 In my game I created a spaceship that has to avoid the incoming...

 
 
 
Creating Data Summary Tables

January 27, 2019 Data summary tables are a good idea because they concisely present data in an aesthetic manner that is easy to read....

 
 
 

留言


bottom of page