The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

SSteve (24) [Avatar] Offline
#1
The file in section 3.1.1 is called "worldcup.csv" but the code in listing 3.3 is looking for a file called "teams.csv".
SSteve (24) [Avatar] Offline
#2
Re: Chapter 3 code - Listing 3.2
Safari 6.1.2 and Chrome 34.0.1847.116 running under OS X 10.8.5 both seemed to have trouble with these lines in Listing 3.2:

<script src="d3.v3.min.js" type="text/javascript" />
<script src="colorbrewer.js" type="text/javascript" />
<script src="soccerviz.js" type="text/javascript" />


They built a DOM that looked like this:

<html><head>
    <title>D3 in Action Examples</title>
    <meta charset="utf-8">
    <script src="d3.v3.min.js" type="text/javascript">
        <script src="colorbrewer.js" type="text/javascript" />
        <script src="soccerviz.js" type="text/javascript" />
        <body onload="createSoccerViz()">
        <div id="viz">
            <svg style="width:500px;height:500px;border:1px lightgray solid;" />
        </div>
        <div id="controls" />
        </body>
        </html>
    </script>
    </head>
    <body></body>
</html>


But when I changed those lines to this:

    <script src="d3.v3.min.js" type="text/javascript"></script>
    <script src="colorbrewer.js" type="text/javascript"></script>
    <script src="soccerviz.js" type="text/javascript"></script>


they both worked fine.


Message was edited by: SSteve - Added code tags on a whim and they worked
SSteve (24) [Avatar] Offline
#3
Re: Chapter 3 code - Listing 3.2
d3ia_2.html doesn't include a link to the d3ia.css stylesheet.
SSteve (24) [Avatar] Offline
#4
Re: Chapter 3 code - Listing 3.1
The css selector "g.active > text" didn't increase the font size when running the code in section 3.2.3. I changed the selector to "g > text.active" and it did work.

Also, the code in section 3.2.3 manipulates the text class "highlight" but the class name in d3ia.css is "active".
SSteve (24) [Avatar] Offline
#5
Re: Chapter 3 code - Section 3.2.4
The definitions for function buttonClick under Color Ramps for Numerical Data both start with "var maxValue = d3.max(worldCup". I think that's supposed to be "var maxValue = d3.max(incomingData"

Also I had to change ".range(Reds[3])" to ".range(colorbrewer.Reds[3])" to get the examples to work.
brandtryan (11) [Avatar] Offline
#6
Re: Chapter 3 code
In the beginning of Chapter 3, the author explains that for non one-off visualizations, that there should be some project organization, and goes on to detail the various folders to create (Resources, Stylesheets, etc.) -- and despite having read this, I created all of the directories, as I didn't know what we were going to create in the following pages. Of course, this resulted in all of the links to css/js, etc. files not working, as the soccer visualization keeps all of the relevant files in the root directory.

I guess my point is -- a note might be helpful preceding the descriptions of the various project organization folders, that the next visualization we will be working on will not require this organization.
250226 (6) [Avatar] Offline
#7
That happened because script tags must include a separate opening and closing, not one self-closing tag.