Tuesday, May 1, 2012

PANNING!!

Solved the next problem in a single day! Had one of those moments when a logic error causes visibly amusing results on screen. On first attempt, I clicked, dragged, and the circle went ZOOMING out of the screen. I was able to retrieve it and could pan it around, as long as I was EXTREMELY cautious with my movements. It was pretty immediately obvious that each movement was being compared not to the previous mouse location, but to the original mouse location, so the farther away the mouse got from its mousedown location, the more extreme the movements of the circle.

Changed my logic entirely for the next go-round and set up the circles so that they all maintained the same "offset" that they had with the mouseLoc when mouseDown occurred. Worked fine and I was able to move on and implement with an array of circle objects shortly after.

Next step will be to try to bring all of the functionalities together. MIGHT try combining just zooming and panning before trying to put it together with everything else. In the meantime, I need to work on organizing my full data set for the final deployment.

Sunday, April 29, 2012

ZOOMING!!

YES! While just a few lines of code, this was one of the more challenging problem-solving tasks that I've had to overcome in this project. Of course, as I mentioned in the previous post, there's always a tendency to push the hard tasks off until end, (and I suspect that the single remaining big task - panning - will prove to be even tougher). Jim called it the "smart friend" approach to programming - do the easier stuff and tell yourself, "I'll just have my smart friend do that other part." Of course, eventually you end up stepping up as the smart friend, but it keeps you from freaking out in the meantime.

Actually, all this one really took was taking pencil to paper to draw out what's actually happening when you PERCEIVE the field as zooming in or out, which is, of course, simply a repositioning of the elements in the field. Once the pictures were drawn, it all came together (still took four days of thinking). It also involves that percent increase, percent decrease logic - for example, if the market drops 33.3%, it has to rise 50% to get you back where you started.

Also implemented two buttons for zoom in and zoom out, but in a most rudimentary fashion. I'll really need to create a button class to handle these at some point.

Actually, there's one more trick to be pulled off here - the implementation of a svg (scalable vector graphic) version of the Texas map and making the map grow and shrink with zoom in and zoom out functions.

Tuesday, April 24, 2012

April 24 - v07

  • Expanded search for maxPop and minPop functions to search across a series of columns that represent populations over a series of years by nesting two "for" statements. 
  • Got it to read a progressive series of population values in successive columns. 
  • Updates year and circle size on mouseup. There's a problem with text alignment in the year. It jumps left - MAYBE when you roll over a circle. 
This is getting to be a serious mental exercise at this point! I guess that's typically the case, as there's a tendency to solve the easy problems and leave the tough ones for later. As a result, each problem gets progressively more challenging!

Monday, April 23, 2012

April 23 - v06

GOOD bit of progress today!
  • Went about correcting the representation of population using area by rewriting map function. DID include a minimum radius that would accommodate VERY small districts (working with down to 255 in my test data). 
  • Enabled reading of dropout rate data from spreadsheet and representation as a pie slice. 
  • Centered (and reduced size of) rollover text (in Circle object class - copied changes to my class library).
  • Added calculation of minimum district size (employed MAX_INT).

Sunday, April 22, 2012

April 22 catch up

A number of new breakthroughs since the last post. Have deployed my Circle class as an array of circles, which is perhaps the biggest hurdle to overcome to realize the complete visualization. I also diverted my attention briefly to create another object class (which, incidentally, went VERY smoothly) to create bullet graph as per Stephen Few. An exciting extension of this idea came at Stephen's workshop, when he mentioned that (1) no one commercial vendor had yet implemented a bullet graph and (2) he had posted a complete bullet graph specification on his website. I see this as an opportunity to extend my bullet graph object class to fully realize Stephen's specification and to share it with the Processing community.

But back to the Texas vis project...
I've learned some important lessons about the XlsReader library and the nature of xls spreadsheets. It took my QUITE some time to determine that CALCULATED VALUES in an excel spreadsheet are not recognized as ANY of the data primitive types (at least int, float, or string). While my code was running, I was getting a continuous stream of error messages indicating a type mismatch. I ultimately determined that it was the result of calculated results in the spreadsheet. When I replaced them with "hard-coded" values, the problem was resolved.

Next steps will be to read the dropout rate from the xls and represent it correctly. THEN, read a series of values over the course of years and move through them on mouseclicks.

Tuesday, April 10, 2012

Expanding the Circle object class

I've added some new methods to my Circle class - preparing it to serve as the "district" circles that will populate my Texas dropout vis. I've now implemented the arc and resizing of the arc. I've also implemented the rollover text that will give the name of the district, along with any other data that I wish to display. At the moment I seem to be having difficulty with anti-aliasing the text - look pretty pixelated, though I'm obviously controlling the font, because I CAN resize it.

Onward and upward!

Sunday, April 8, 2012

Resurfacing

While there have been no posts for a number of weeks here, that doesn't translate to no activity - just a lack of diligence on the blogging front. This morning marked another good breakthrough, though, so I thought I'd try to catch up with a list of things that I've been working on.

1) in a big move toward my primary goal, I've drawn circles on a Texas map, locating them so that they are centered upon their district headquarters and sized according to the district's student population.

2) another BIG breakthrough was figuring out how to implement a library and getting the XLSReader library implemented and working. Now I can suck in all of my data from excel spreadsheets rather than formatting at CSV or TSV documents.

3) I also learned how to receive mouse input and created a little demo of this that causes an arc to resize within a circle. ArcGrowth02 is the demo.

4) Also created a bit of a button functionality - changes colors on rollover and then responds to a mouseup within. MouseInRect demonstrates this functionality.

5) But the BIGGEST breakthrough was creating and successfully implementing an object class. The class is pretty simple at the moment - just draws and resizes a circle - but it will be the basis of all of the circles that are drawn as part of the project. I'll probably also create a button class, since everybody seems to need one of those.