Errata

Visualizing Data

Errata for Visualizing Data

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
ch6
section 6.2



Here is the code snippet from section 6.2 I'm working on:


void readData( ) {
String[] lines = loadStrings("zips.tsv");
parseInfo(lines[0]); // read the header line

places = new Place[totalCount];
for (int i = 1; i < lines.length; i++) {
places[placeCount] = parsePlace(lines[i]);
placeCount++;
}
}


I keep getting an array out of bounds error for this line:

places[placeCount] = parsePlace(lines[i]);


Here is the error information I get:
ArrayIndexOutOfBoundsException: 5712

and the stacktrace:

Exception in thread "Animation Thread" java.lang.ArrayIndexOutOfBoundsException: 5712
at ch06_scatterplot.readData(ch06_scatterplot.java:45)
at ch06_scatterplot.setup(ch06_scatterplot.java:34)
at processing.core.PApplet.handleDraw(PApplet.java:1372)
at processing.core.PApplet.run(PApplet.java:1300)
at java.lang.Thread.run(Unknown Source)



Thanks,
Marlena Compton


marlena compton  Jan 30, 2009 
sec 6.6
This is in the digital version.

I've implemented the code for this section and I'm noticing two problems.

1. The first digit I type does not show up on the screen or the map.

2. There is some problem with the colors. Instead of the map gradually fading to the colors I specified for dormant, highlight, unhighlight, the map is having itself a rave. It flashes several bright colors before turning the "highlight" area purple, and the "unhighlight" area yellow.

I'm taking another look at the code I've written, but wanted to see if there is any particular area where I should be focusing my attention.

This chapter has been particularly challenging.

Thanks,
Marlena

Marlena Compton  Mar 18, 2009 
5.3.1
After description of regular expressions

in the for loop of parseWinLoss:

lines.length() is generating a null pointer error. I downloaded the example project from Ben Fry's web-site, step_08b_web and got the same null pointer exception in the setupStandings method. The second line of this method also accesses lines.length.

Anonymous  Dec 04, 2008 
6.8


Zooming isn't working as advertised.

After typing in the code from the book and debugging for syntax errors, the only functionality I get is opposite from zooming. I start typing in numbers and all of the data points shrink to the bottom left corner of the screen.

Since the code from your web-site zooms correctly, I started reading through your code and can see that it is substantially different from code that is in the book.

Would you mind providing some comments about the changes? Since I want to finish this chapter, I'm going to keep going with just changing my code from the books not-working code to your is-working code, but I'd like to see some comments on what's changed and why.

Zooming is the reason why I've stuck with this chapter, as long as it's taken me, and I'd really like to know.

Cheers,
Marlena

Marlena Compton  Apr 01, 2009 
Printed Page 42, 43
code examples, general note inset

Page 42 code for setup() declares the font.

Page 42 note (paw prints) reinforces the "setup() runs once" concept.

Page 43 code stub includes the needed-once (right??) declaration for "textAlign(CENTER);"

Granted, the major point of that particular note is to load your font once 'cause it is time consuming. But the "valuable principle" is to do one-time things one times.

Anonymous   
Printed Page 55
last paragraph and code

- end of paragraph tells me about the importance of comments
- the first comment tells me m is set "arbitrarily high"; followed by a contradictory phrase
- the first line of code appears to set m very low (MIN_FLOAT)

Anonymous   
Printed Page 59
9th line of code in the example

PFont plotFont; --> should be bold.

(Comment refers to print version -- is correct in the online version.)

(65/66) code block;
Need instruction to add line of code:

drawVolumeLabels();

to the draw() method.

Anonymous   
Printed, PDF, Page 63

The book explains how to build the drawYearLabels function, shows what the output of the code should look like, but doesn't add the code until p69 that tells you where to call the function from.

Scott Thompson  Feb 07, 2016 
159
draw method

Hi Ben:

I had to add code from the example I downloaded on your web-site to get the zip code I was typing to show up. The draw method listed in the printed text and in the on-line safari text left out the lines that draw the zip code being typed on the screen. So I kept typing digits but couldn't see my zip code anywhere.

I looked but couldn't find this info listed in the errata.

In addition, the code from your web-site had these messages "zipdecode by Ben Fry" and "type the digits of a zip code." When I ran it the way it was typed in the example, the label was positioned over the area where the numbers where added so I made a separate text label with a Y coordinate higher than the Y of the zip code text.

Here's what I ended up with:


void setup(){

message = "";
zipCodeLabel = "Type the digits of a zip code";


size(720, 453, P3D);

mapX1 = 30;
mapX2 = width - mapX1;
mapY1 = 20;
mapY2 = height - mapY1;


font = loadFont("Arial-BoldMT-15.vlw");
textFont(font);
textMode(SCREEN);


messageX = 40;
messageY = height - 30;
message2Y = height - 45;


text(message,messageX, messageY);


readData();
}//end setup

void draw(){

background(backgroundcolor);

text(zipCodeLabel, messageX, message2Y);
text(message, messageX, messageY);
for (int i = 0; i < placeCount; i++){
places[i].draw( );
}

if (typedCount == 0){
fill(waitingcolor);
textAlign(LEFT);

//if all places are loaded
if (placeCount == totalCount){

}//end if placecount

text(message, messageX, messageY);
} else {
if (foundCount > 0){
if (typedCount == 4){
//will have zoom later so that points can be de-clustered
for (int i=0; i < placeCount; i++){
if (places[i].matchDepth == typedCount){
places[i].draw();
}
}
}



fill(highlightcolor);
textAlign(LEFT);
text(typedString, messageX, messageY);
} else {
fill(badcolor);
text(typedString, messageX, messageY);
}
}



}//end draw

Marlena Compton  Feb 27, 2009 
Printed Page 167
1st paragraph

The text indicates that the command:

set(xx, yy, faders[matchDepth].colorValue);

should be placed in the draw() method of the Place class.

There is no colorValue variable in the ColorIntegrator class. Either of the following commands:

set(xx, yy, faders[matchDepth].get());

or

set(xx, yy, faders[matchDepth].value);

work properly.

Alternatively the "value" variable of the ColorIntegrator class could be changed to "colorValue."

David Gange  Sep 26, 2010 
Printed, PDF Page 176 177
Sample Code

In the class ColorIntegrator, there is no property named "colorValue". The property in the downloadable example is named "value". There are four references to "colorValue" on pages 176-177. Either change all four references to "value", or change the property in the ColorIntegrator class to "colorValue".

Sample code on page 176 in the draw() method:

set(xx, yy, faders[matchDepth].colorValue);

and at the top of the drawChosen() method:

fill(faders[matchDepth].colorValue);

Sample code on page 177 in the draw() method:

set((int)xx, (int)yy, faders[matchDepth].colorValue);

and

fill(faders[matchDepth].colorValue);



Anonymous  Jan 22, 2014 
Printed Page 192
code for "main tab"

The code fails with the message "use textFont() before textWidth()". textFont() is called as part of the function setup(). textWidth() is called in the code on the following page. The version of Processing I am using is 0142. I got the same message with version 0135. I notice that the Processing documentation seems to suggest that the setup() function operates differently in versions prior to 0135 (the last stable release). If I move the font code into the draw() function, before map.draw() - then the code executes with results as illustrated in the book. A casual search of the book gave no indication of the version of Processing used while developing the examples.

Anonymous