100% found this document useful (1 vote)
68 views77 pages

Full Download Data Visualization With JavaScript 1st Edition Stephen A. Thomas PDF

Thomas

Uploaded by

sayethmuaed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
68 views77 pages

Full Download Data Visualization With JavaScript 1st Edition Stephen A. Thomas PDF

Thomas

Uploaded by

sayethmuaed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 77

Visit https://ebookfinal.

com to download the full version and


explore more ebook

Data Visualization with JavaScript 1st Edition


Stephen A. Thomas

_____ Click the link below to download _____


https://ebookfinal.com/download/data-visualization-
with-javascript-1st-edition-stephen-a-thomas/

Explore and download more ebook at ebookfinal.com


Here are some recommended products that might interest you.
You can download now and explore!

Learning IPython for Interactive Computing and Data


Visualization 1st Edition Rossant

https://ebookfinal.com/download/learning-ipython-for-interactive-
computing-and-data-visualization-1st-edition-rossant/

ebookfinal.com

Learning Predictive Analytics with R Get to grips with key


data visualization and predictive analytic skills using R
1st Edition Eric Mayor
https://ebookfinal.com/download/learning-predictive-analytics-with-r-
get-to-grips-with-key-data-visualization-and-predictive-analytic-
skills-using-r-1st-edition-eric-mayor/
ebookfinal.com

Cartography Visualization of Geospatial Data Third Edition


Menno-Jan Kraak

https://ebookfinal.com/download/cartography-visualization-of-
geospatial-data-third-edition-menno-jan-kraak/

ebookfinal.com

The Visual Organization Data Visualization Big Data and


the Quest for Better Decisions 1st Edition Phil Simon

https://ebookfinal.com/download/the-visual-organization-data-
visualization-big-data-and-the-quest-for-better-decisions-1st-edition-
phil-simon/
ebookfinal.com
A Year with Thomas Merton Thomas Merton

https://ebookfinal.com/download/a-year-with-thomas-merton-thomas-
merton/

ebookfinal.com

Data Visualization Part 1 New Directions for Evaluation


Number 139 1st Edition Evergreen

https://ebookfinal.com/download/data-visualization-part-1-new-
directions-for-evaluation-number-139-1st-edition-evergreen/

ebookfinal.com

Minimally Invasive Periodontal Therapy Clinical Techniques


and Visualization Technology 1st Edition Stephen K. Harrel

https://ebookfinal.com/download/minimally-invasive-periodontal-
therapy-clinical-techniques-and-visualization-technology-1st-edition-
stephen-k-harrel/
ebookfinal.com

HTML5 programming with JavaScript for dummies Mueller

https://ebookfinal.com/download/html5-programming-with-javascript-for-
dummies-mueller/

ebookfinal.com

College Algebra with Modeling and Visualization 4th


Edition Gary K. Rockswold

https://ebookfinal.com/download/college-algebra-with-modeling-and-
visualization-4th-edition-gary-k-rockswold/

ebookfinal.com
Data Visualization with JavaScript 1st Edition Stephen A.
Thomas Digital Instant Download
Author(s): Stephen A. Thomas
ISBN(s): 9781593276058, 1593276052
Edition: 1
File Details: PDF, 14.22 MB
Year: 2015
Language: english
DATA
VISUALIZATION
• WITH JAVASCRIPT

STEPHEN A. THOMAS


Data Visualization
with JavaScript
Data Visualization
with JavaScript
Stephen A . thomA S
DATA VISUALIZATION WITH JAVASCRIPT. Copyright © 2015 by Stephen A. Thomas.

All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical,
including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the
copyright owner and the publisher.

Printed in USA
First printing

19 18 17 16 15 123456789

ISBN-10: 1-59327-605-2
ISBN-13: 978-1-59327-605-8

Publisher: William Pollock


Production Editor: Laurel Chun
Cover Illustration: Beth Middleworth
Developmental Editor: Seph Kramer
Technical Reviewer: Christopher Keen
Copyeditor: Rachel Monaghan
Compositor: Lynn L’Heureux
Proofreader: Emelie Burnette
Indexer: BIM Indexing & Proofreading Services

The visualization on the cover is inspired by the work of Mike Bostock.


It is described in “Creating a Unique Visualization” on page 252.

For information on distribution, translations, or bulk sales, please contact No Starch Press, Inc. directly:

No Starch Press, Inc.


245 8th Street, San Francisco, CA 94103
phone: 415.863.9900; [email protected]
www.nostarch.com

The Library of Congress Cataloging-in-Publication Data

Thomas, Stephen A., 1962-


Data visualization with JavaScript / by Stephen A. Thomas.
pages cm
ISBN 978-1-59327-605-8 -- ISBN 1-59327-605-2
1. Information visualization--Data processing. 2. JavaScript (Computer program language) I. Title.
QA76.9.I52T46 2015
005.2'762--dc23
2014039759

No Starch Press and the No Starch Press logo are registered trademarks of No Starch Press, Inc. Other product and company names
mentioned herein may be the trademarks of their respective owners. Rather than use a trademark symbol with every occurrence of a
trademarked name, we are using the names only in an editorial fashion and to the beneit of the trademark owner, with no intention
of infringement of the trademark.

The information in this book is distributed on an “As Is” basis, without warranty. While every precaution has been taken in the
preparation of this work, neither the author nor No Starch Press, Inc. shall have any liability to any person or entity with respect to
any loss or damage caused or alleged to be caused directly or indirectly by the information contained in it.
About the Author
Stephen A. Thomas specializes in frontend development at Georgia Tech’s Depart-
ment of Education Technology and has developed complex JavaScript visualiza-
tions for the health-care and security industries. He writes and speaks about data
visualization in publications and at conferences around the world.

About the Technical Reviewer


Chris Keen resides in Atlanta, Georgia, and has been writing JavaScript since
2004. Chris has had the honor of working on visualizations ranging from an
SVG tweet map at Weather.com to full-blown interactive maps with Leaflet.js at
Endgame Systems. Chris is currently infatuated with making data dashboards
using Backbone, Epoxy, and D3. Chris recently founded Keen Concepts (http://
keenconcepts.io/), and he consults on JavaScript-rich web applications.
Brief Contents
Acknowledgments ..........................................................................................................xvi
Introduction ....................................................................................................................... 1
Chapter 1: Graphing Data ................................................................................................ 5
Chapter 2: Making Charts Interactive ........................................................................... 47
Chapter 3: Integrating Charts on a Page...................................................................... 89
Chapter 4: Creating Specialized Graphs .....................................................................119
Chapter 5: Displaying Timelines ...................................................................................147
Chapter 6: Visualizing Geographic Data .....................................................................179
Chapter 7: Custom Visualizations with D3.js .............................................................. 223
Chapter 8: Managing Data in the Browser ................................................................. 269
Chapter 9: Building Data-Driven Web Applications: Part 1 .................................... 295
Chapter 10: Building Data-Driven Web Applications: Part 2 .................................. 327
Index ............................................................................................................................... 353
Contents in Detail
Acknowledgments ....................................................................................................xvi

Introduction ................................................................................................................... 1
The Book’s Philosophy ..................................................................................................... 2
The Book’s Contents ........................................................................................................ 3
Source Code for Examples .............................................................................................. 4

Chapter 1: Graphing Data ........................................................................................ 5


Creating a Basic Bar Chart ............................................................................................... 6
Step 1: Include the Required JavaScript............................................................... 6
Step 2: Set Aside a <div> Element to Hold the Chart ........................................ 7
Step 3: Deine the Data .......................................................................................... 7
Step 4: Draw the Chart ........................................................................................... 8
Step 5: Fix the Vertical Axis ................................................................................... 9
Step 6: Fix the Horizontal Axis ............................................................................ 10
Step 7: Adjust the Styling ......................................................................................12
Step 8: Vary the Bar Color .....................................................................................13
Step 9: Work Around Flotr2 “Bugs” .................................................................... 14
Plotting Continuous Data with a Line Chart ................................................................ 15
Step 1: Deine the Data ........................................................................................ 15
Step 2: Graph the CO2 Data ................................................................................ 16
Step 3: Add the Temperature Data ......................................................................17
Step 4: Improve the Chart’s Readability ..............................................................17
Step 5: Clarify the Temperature Measurements ............................................... 18
Step 6: Label the Chart ........................................................................................ 20
Step 7: Work Around Flotr2 “Bugs” .................................................................... 21
Emphasizing Fractions Using a Pie Chart ..................................................................... 21
Step 1: Deine the Data ........................................................................................ 23
Step 2: Draw the Chart ......................................................................................... 23
Step 3: Label the Values ....................................................................................... 24
Step 4: Work Around Flotr2 “Bugs” .................................................................... 25
Plotting X/Y Data with a Scatter Chart ......................................................................... 25
Step 1: Deine the Data ........................................................................................ 26
Step 2: Format the Data ....................................................................................... 26
Step 3: Plot the Data ............................................................................................. 26
Step 4: Adjust the Chart’s Axes........................................................................... 27
Step 5: Label the Data .......................................................................................... 28
Step 6: Clarify the X-Axis...................................................................................... 29
Step 7: Answer Users’ Questions ........................................................................ 30
Step 8: Work Around Flotr2 “Bugs” .................................................................... 33
Adding Magnitudes to X/Y Data with a Bubble Chart ............................................... 34
Step 1: Deine the Data ........................................................................................ 34
Step 2: Create a Background for the Chart........................................................ 35
Step 3: Plot the Data ............................................................................................. 36
Step 4: Add the Background ............................................................................... 37
Step 5: Color the Bubbles .................................................................................... 38
Step 6: Adjust the Legend Styles ........................................................................ 40
Step 7: Work Around Flotr2 “Bugs” .................................................................... 41
Displaying Multidimensional Data with a Radar Chart ............................................... 41
Step 1: Deine the Data ........................................................................................ 42
Step 2: Create the Chart ...................................................................................... 44
Step 3: Work Around Flotr2 “Bugs” .................................................................... 45
Summing Up .................................................................................................................... 46

Chapter 2: Making Charts Interactive .............................................................. 47


Selecting Chart Content ................................................................................................ 48
Step 1: Include the Required JavaScript Libraries............................................. 49
Step 2: Set Aside a <div> Element to Hold the Chart ...................................... 50
Step 3: Prepare the Data ...................................................................................... 50
Step 4: Draw the Chart ......................................................................................... 51
Step 5: Add the Controls ..................................................................................... 52
Step 6: Deine the Data Structure for the Interaction ....................................... 54
Step 7: Determine Chart Data Based on the Interaction State........................ 55
Step 8: Add the Controls Using JavaScript ........................................................ 57
Step 9: Respond to the Interaction Controls ..................................................... 58
Zooming In on Charts ..................................................................................................... 59
Step 1: Prepare the Page...................................................................................... 60
Step 2: Draw the Chart ......................................................................................... 60
Step 3: Prepare the Data to Support Interaction ...............................................61
Step 4: Prepare to Accept Interaction Events.................................................... 62
Step 5: Enable the Interaction ............................................................................. 63
Tracking Data Values ...................................................................................................... 65
Step 1: Set Aside a <div> Element to Hold the Charts .................................... 66
Step 2: Prepare the Data ...................................................................................... 67
Step 3: Draw the Charts ....................................................................................... 68
Step 4: Implement the Interaction ...................................................................... 71
Retrieving Data Using AJAX .......................................................................................... 75
Step 1: Understand the Source Data ...................................................................76
Step 2: Get the First Level of Data via AJAX ..................................................... 77
Step 3: Process the First Level of Data ............................................................... 80
Step 4: Get the Real Data ..................................................................................... 81
Step 5: Process the Data ...................................................................................... 84
Step 6: Create the Chart ...................................................................................... 85
Summing Up .................................................................................................................... 88

Chapter 3: Integrating Charts on a Page ........................................................ 89


Creating a Classic Sparkline .......................................................................................... 91
Step 1: Include the Required JavaScript Libraries............................................. 91
Step 2: Create the HTML Markup for the Sparkline .......................................... 91
Step 3: Draw the Sparkline................................................................................... 92
Step 4: Adjust the Chart Style ............................................................................. 93

x | Contents in Detail
Charting Many Variables ................................................................................................ 94
Step 1: Prepare the HTML Markup...................................................................... 94
Step 2: Draw the Charts ....................................................................................... 95
Step 3: Establish a Default Style for the Charts................................................. 96
Step 4: Modify the Default Style for Special Classes ........................................ 97
Step 5: Create a Unique Style for a Speciic Chart ............................................ 99
Annotating Sparklines .................................................................................................. 101
Step 1: Prepare the Data .................................................................................... 102
Step 2: Prepare the HTML Markup ................................................................... 102
Step 3: Add the Chart......................................................................................... 102
Step 4: Add the Primary Annotation ................................................................. 103
Step 5: Provide Additional Information ............................................................ 105
Drawing Composite Charts ......................................................................................... 105
Step 1: Draw the Trading Volume Chart ........................................................... 106
Step 2: Add the Closing Price Chart ................................................................. 106
Step 3: Add the Annotations ............................................................................. 107
Step 4: Show Details as a Chart......................................................................... 108
Responding to Click Events ..........................................................................................110
Step 1: Add the Chart ..........................................................................................110
Step 2: Handle Click Events ................................................................................ 111
Step 3: Improve the Transitions ..........................................................................112
Step 4: Animate ....................................................................................................114
Updating Charts in Real Time.......................................................................................115
Step 1: Retrieve the Data.....................................................................................116
Step 2: Update the Visualization ........................................................................116
Summing Up ...................................................................................................................117

Chapter 4: Creating Specialized Graphs.........................................................119


Visualizing Hierarchies with Tree Maps....................................................................... 120
Step 1: Include the Required Libraries ............................................................. 120
Step 2: Prepare the Data .....................................................................................121
Step 3: Draw the Tree Map .................................................................................121
Step 4: Vary the Shading to Show Additional Data ......................................... 122
Highlighting Regions with a Heat Map ....................................................................... 125
Step 1: Include the Required JavaScript........................................................... 126
Step 2: Deine the Visualization Data................................................................ 127
Step 3: Create the Background Image ............................................................. 127
Step 4: Set Aside an HTML Element to Contain the Visualization ................ 128
Step 5: Format the Data ..................................................................................... 128
Step 6: Draw the Map ......................................................................................... 129
Step 7: Adjust the Heat Map z-index ................................................................ 130
Showing Relationships with Network Graphs ............................................................ 130
Step 1: Include the Required Libraries ............................................................. 130
Step 2: Prepare the Data .....................................................................................131
Step 3: Deine the Graph’s Nodes .................................................................... 132

Contents in Detail | xi
Step 4: Connect the Nodes with Edges ........................................................... 133
Step 5: Automate the Layout ............................................................................. 134
Step 6: Add Interactivity......................................................................................137
Revealing Language Patterns with Word Clouds ...................................................... 138
Step 1: Include the Required Libraries ............................................................. 139
Step 2: Prepare the Data .................................................................................... 140
Step 3: Add the Required Markup .....................................................................141
Step 4: Create a Simple Cloud ...........................................................................142
Step 5: Add Interactivity..................................................................................... 143
Summing Up .................................................................................................................. 146

Chapter 5: Displaying Timelines .........................................................................147


Building Timelines with a Library ................................................................................ 148
Step 1: Include the Required Libraries ............................................................. 148
Step 2: Prepare the Data .....................................................................................149
Step 3: Draw the Timeline .................................................................................. 150
Step 4: Set Chronoline.js Options for the Data ............................................... 150
Building Timelines with JavaScript.............................................................................. 153
Step 1: Prepare the HTML Skeleton .................................................................. 154
Step 2: Start JavaScript Execution .................................................................... 154
Step 3: Create the Timeline in Semantic HTML............................................... 155
Step 4: Include the Supporting Content .......................................................... 157
Step 5: Optionally Take Advantage of jQuery ..................................................159
Step 6: Fix Timeline Problems with CSS ............................................................159
Step 7: Add Styles to Visually Structure the Timeline ......................................161
Step 8: Add Interactivity..................................................................................... 163
Using a Web Component ..............................................................................................167
Step 1: Preview the Standard Component ....................................................... 168
Step 2: Include the Required Components ......................................................170
Step 3: Prepare the Data .....................................................................................170
Step 4: Create a Default Timeline ......................................................................172
Step 5: Adjust the Timeline Styles .....................................................................174
Summing Up ...................................................................................................................177

Chapter 6: Visualizing Geographic Data.........................................................179


Using Map Fonts ........................................................................................................... 180
Step 1: Include the Fonts in the Page ............................................................... 180
Step 2: Display One Country ..............................................................................181
Step 3: Combine Multiple Countries into a Single Map ................................. 182
Step 4: Vary the Countries Based on the Data ................................................ 183
Step 5: Add a Legend ......................................................................................... 185
Working with Scalable Vector Graphics ..................................................................... 186
Step 1: Create the SVG Map .............................................................................. 188
Step 2: Embed the Map in the Page ................................................................. 189
Step 3: Collect the Data ..................................................................................... 190
Step 4: Deine the Color Scheme ...................................................................... 191
Step 5: Color the Map ........................................................................................ 192

xii | Contents in Detail


Step 6: Add a Legend ......................................................................................... 193
Step 7: Add Interactions......................................................................................194
Including Maps for Context ......................................................................................... 197
Step 1: Set Up the Web Page ............................................................................ 198
Step 2: Prepare the Data .................................................................................... 198
Step 3: Choose a Map Style............................................................................... 199
Step 4: Draw the Map ......................................................................................... 199
Step 5: Add the Sightings .................................................................................. 200
Integrating a Full-Featured Mapping Library ............................................................ 201
Step 1: Prepare the Data .................................................................................... 201
Step 2: Set Up the Web Page and Libraries ..................................................... 202
Step 3: Draw the Base Map................................................................................ 203
Step 4: Add the Routes to the Map .................................................................. 205
Step 5: Add an Animation Control .................................................................... 207
Step 6: Prepare the Animation .......................................................................... 210
Step 7: Animate the Routes ................................................................................211
Step 8: Create Labels for the Stops ...................................................................214
Step 9: Build the Label Animation .................................................................... 216
Step 10: Incorporate Label Animation in the Animation Step ....................... 218
Step 11: Add a Title ............................................................................................. 221
Summing Up .................................................................................................................. 222

Chapter 7: Custom Visualizations with D3.js ............................................... 223


Adapting a Traditional Chart Type .............................................................................. 224
Step 1: Prepare the Data .................................................................................... 225
Step 2: Set Up the Web Page ............................................................................ 225
Step 3: Create a Stage for the Visualization ..................................................... 226
Step 4: Control the Chart’s Dimensions ........................................................... 227
Step 5: Draw the Chart Framework ................................................................... 228
Step 6: Add the Data to the Chart .................................................................... 231
Step 7: Answer Users’ Questions ...................................................................... 232
Creating a Force-Directed Network Graph ............................................................... 232
Step 1: Prepare the Data .................................................................................... 233
Step 2: Set Up the Page ..................................................................................... 234
Step 3: Create a Stage for the Visualization ..................................................... 235
Step 4: Draw the Graph’s Nodes....................................................................... 235
Step 5: Draw the Graph’s Edges ....................................................................... 238
Step 6: Position the Elements ............................................................................ 238
Step 7: Add Force Direction to the Graph ....................................................... 240
Step 8: Add Interactivity..................................................................................... 242
Step 9: Experiment with Other Enhancements ............................................... 245
Creating a Scalable Map .............................................................................................. 245
Step 1: Prepare the Data .................................................................................... 245
Step 2: Set Up the Page ..................................................................................... 246
Step 3: Create a Map Projection ....................................................................... 246
Step 4: Initialize the SVG Container .................................................................. 247
Step 5: Retrieve the Map Data........................................................................... 247

Contents in Detail | xiii


Step 6: Draw the Map ......................................................................................... 248
Step 7: Retrieve the Weather Data .................................................................... 249
Step 8: Plot the Data ........................................................................................... 249
Step 9: Add Interactivity .................................................................................... 250
Creating a Unique Visualization................................................................................... 252
Step 1: Prepare the Data .................................................................................... 253
Step 2: Set Up the Page ..................................................................................... 253
Step 3: Create a Stage for the Visualization ..................................................... 254
Step 4: Create Scales .......................................................................................... 254
Step 5: Retrieve the Data ................................................................................... 256
Step 6: Draw the Visualization ........................................................................... 258
Step 7: Color the Areas ...................................................................................... 259
Step 8: Make the Visualization Interactive ....................................................... 262
Summing Up .................................................................................................................. 267

Chapter 8: Managing Data in the Browser ................................................... 269


Using Functional Programming ................................................................................... 270
Step 1: Start with an Imperative Version........................................................... 271
Step 2: Debug the Imperative Code ................................................................ 271
Step 3: Understand the Problems Imperative
Programming May Introduce................................................................ 272
Step 4: Rewrite Using Functional Programming Style .................................... 273
Step 5: Evaluate Performance............................................................................ 273
Step 6: Fix the Performance Problem ................................................................274
Working with Arrays ...................................................................................................... 275
Extracting Elements by Position ....................................................................... 275
Combining Arrays ............................................................................................... 278
Removing Invalid Data Values ........................................................................... 280
Finding Elements in an Array............................................................................. 281
Generating Arrays............................................................................................... 282
Enhancing Objects ....................................................................................................... 283
Working with Keys and Values ........................................................................... 283
Cleaning Up Object Subsets ............................................................................. 285
Updating Attributes............................................................................................ 286
Manipulating Collections ............................................................................................. 288
Working with Iteration Utilities .......................................................................... 289
Finding Elements in a Collection ...................................................................... 290
Testing a Collection ............................................................................................ 292
Rearranging Collections .................................................................................... 292
Summing Up .................................................................................................................. 294

Chapter 9: Building Data-Driven Web Applications: Part 1 ................. 295


Frameworks and Libraries ............................................................................................ 297
Step 1: Select an Application Library ............................................................... 297
Step 2: Install Development Tools .................................................................... 298
Step 3: Deine a New Project ............................................................................. 298
Step 4: Add Our Unique Dependencies .......................................................... 301

xiv | Contents in Detail


Models and Views ......................................................................................................... 302
Step 1: Deine the Application’s Models .......................................................... 303
Step 2: Implement the Model............................................................................ 304
Step 3: Deine the Application’s Collections ................................................... 306
Step 4: Deine the Application’s Main View ..................................................... 307
Step 5: Deine the Main View Templates...........................................................311
Step 6: Reine the Main View ..............................................................................314
Views for Visualizations ..................................................................................................316
Step 1: Deine the Additional Views ..................................................................317
Step 2: Implement the Details View...................................................................317
Step 3: Implement the Properties View.............................................................318
Step 4: Implement the Map View ...................................................................... 322
Step 5: Implement the Charts View .................................................................. 325
Summing Up .................................................................................................................. 326

Chapter 10: Building Data-Driven Web Applications: Part 2 ............... 327


Connecting with the Nike+ Service ............................................................................ 328
Step 1: Authorize Users ...................................................................................... 328
Step 2: Accept the Nike+ Response ................................................................. 330
Step 3: Page the Collection ............................................................................... 330
Step 4: Dynamically Update the View ............................................................... 334
Step 5: Filter the Collection ............................................................................... 335
Step 6: Parse the Response ............................................................................... 336
Step 7: Retrieve Details ...................................................................................... 336
Putting It All Together .................................................................................................. 340
Step 1: Create a Backbone.js Router ................................................................ 340
Step 2: Support Run Models Outside of Any Collection ............................... 342
Step 3: Let Users Change Views ........................................................................ 345
Step 4: Fine-Tune the Application..................................................................... 349
Summing Up .................................................................................................................. 351

Index ............................................................................................................................. 353

Contents in Detail | xv
Acknowledgments
Even though it’s been said many times, there’s no getting around the fact that
a book is the work of many people other than the author. This book certainly
wouldn’t have been possible without the patience of Seph and the other ine folks
at No Starch Press. There simply is no better publisher for technical books. Kudos
also to Chris for the technical review, though, of course, the remaining mistakes
are mine alone. I owe a special thanks to NickC for his generosity; it’s such a plea-
sure to meet folks that appreciate the true community spirit of the Web and web
development. Finally, shout-outs to the team developing the Open Academic
Environment and my colleagues at the Georgia Institute of Technology; working
with them is a true pleasure.
Introduction

It’s getting hard to ignore the importance of


data in our lives. Data is critical to the largest
social organizations in human history (giants
like Facebook and Google), and its collection
has widespread geopolitical implications, as
we all saw with the NSA surveillance scandal.
But it’s also getting easier to ignore the data
itself. One estimate suggests that 99.5% of the
data our systems collect goes to waste.
Data visualization is a tool that addresses this gap. Effective visualizations
clarify; they transform abstract collections of numbers into shapes and forms that
viewers quickly grasp and understand. The best visualizations impart this under-
standing intuitively. Viewers comprehend the data immediately—without thinking.
This frees viewers to more fully consider the implications of the data: the stories it
tells, the insights it reveals, or even the warnings it offers.
If you’re developing websites or web applications today, there’s a good
chance you have data to communicate—data best presented in a good visual-
ization. But how do you know what kind of visualization is appropriate? And even
more importantly, how do you actually create one? In the chapters that follow, we
explore dozens of different visualizations, techniques, and toolkits. Each example
discusses the appropriateness of the visualization (and suggests possible alterna-
tives) and provides step-by-step instructions for adding the visualization to your
web pages.

The Book’s Philosophy


In creating this book, I’ve tried to follow four main principles to make sure it pro-
vides meaningful and practical guidance.

Implementation vs. Design


This book won’t teach you how to design data visualizations. Quite honestly,
there are other authors far better qualified than me for that (Edward Tufte, for
example). Instead, this book will focus on implementing visualizations. When
appropriate, I’ll take a slightly bigger picture view to discuss the strengths and
weaknesses of particular visualization strategies, but the main goal is to show
you how to create a wide range of visualizations. (I recognize that sometimes
the boss absolutely insists on a pie chart.)

Code vs. Styling


As you might guess from the title, this book focuses on how to use Java-
Script code to create visualizations. The examples don’t assume you’re
a JavaScript expert—and I’ll be sure to explain any code more complicated
than a basic jQuery selector—but I won’t spend much time discussing styles
for the visualizations. Fortunately, styling visualizations is pretty much the
same as styling other web content. Basic experience with HTML and CSS
will serve you well when you add visualizations to your pages.

Simple vs. Complex


Most of the book’s examples are simple, straightforward visualizations. Com-
plex visualizations can be engaging and compelling, but studying a lot of
advanced code usually isn’t the best way to learn the craft. In these examples,
I’ll try to stay as simple as possible so you can clearly see how to use the vari-
ous tools and techniques. Simple doesn’t mean boring, however, and even
the simplest visualizations can be enlightening and inspiring.

2 | Introduction
Reality vs. an Ideal World
When you begin building your own visualizations, you’ll discover that the
real world is rarely as kind as you’d wish. Open source libraries have bugs,
third-party servers have security issues, and not every user has updated
to the latest and greatest web browser. I’ve addressed these realities in the
examples in this book. I’ll show you how to accommodate older browsers
when it’s practical, how to comply with security constraints such as Cross-
Origin Resource Sharing (CORS), and how to work around bugs in other
folks’ code.

The Book’s Contents


The chapters that follow cover a variety of visualization techniques and the
JavaScript libraries that we can use to implement them.
> Chapter 1 begins with the most basic visualizations—static charts and
plots—using the Flotr2 library.
> Chapter 2 adds interactivity to the visualizations, giving users the chance
to select content, zoom in, and track values. The chapter also shows how to
retrieve data for visualizations directly from the Web. For variety, its examples
use the Flot library, which is based on jQuery.
> Chapter 3 looks at integrating multiple visualizations and with other content
on a web page; it uses the jQuery sparklines library.
> In Chapter 4, we consider visualizations other than standard charts and
plots, including tree maps, heat maps, network graphs, and word clouds.
Each example focuses on a particular JavaScript library designed specifically
for the visualization type.
> Chapter 5 covers time-based visualizations. It looks at several ways to visual-
ize timelines, including traditional libraries; pure HTML, CSS, and JavaScript;
and full-featured web components.
> In Chapter 6, we consider geographic data as we look at different ways to
incorporate maps into our visualizations.
> Chapter 7 introduces the powerful D3.js library, a flexible and full-featured
toolkit for building custom visualizations of almost any type.
> Beginning in Chapter 8, we consider other aspects of web-based visualiza-
tions. This chapter shows off the Underscore.js library, which makes it easy to
prepare the data that drives our visualizations.
> Finally, Chapters 9 and 10 walk through the development of a complete,
single-page web application that relies on data visualization. Here we’ll see
how to use modern development tools such as Yeoman and the Backbone.js
library.

Introduction | 3
Source Code for Examples
To make the text as clear and readable as possible, examples usually contain iso-
lated snippets of JavaScript, plus occasional fragments of HTML or CSS. Complete
source code for all examples is available on GitHub at http://jsDataV.is/source/.

4 | Introduction
Graphing Data
1

Many people think of data visualization as intri-


cate interactive graphics of dazzling complex-
ity. Creating effective visualizations, however,
doesn’t require Picasso’s artistic skill or Turing’s
programming expertise. In fact, when you con-
sider the ultimate purpose of data visualization—
helping users understand data—simplicity is one
of the most important features of an effective
visualization. Simple, straightforward charts are
often the easiest to understand.
After all, users have seen hundreds or thousands of bar charts, line charts, X/Y
plots, and the like. They know the conventions that underlie these charts, so they
can interpret a well-designed example effortlessly. If a simple, static chart presents
the data best, use it. You’ll spend less effort creating your visualization, and your
users will spend less effort trying to understand it.
There are many high-quality tools and libraries to help you get started with
simple visualizations. With these tools, you can avoid reinventing the wheel, and
you can be assured of a reasonably attractive presentation by sticking with the
library defaults. We’ll look at several of these tools throughout the book, but for
this chapter we’ll use the Flotr2 library (http://www.humblesoftware.com/flotr2/).
Flotr2 makes it easy to add standard bar charts, line charts, and pie charts to any
web page, and it also supports some less common chart types. We’ll take a look
at all of these techniques in the examples that follow. Here’s what you’ll learn:
> How to create a basic bar chart
> How to plot continuous data with a line chart
> How to emphasize fractions with a pie chart
> How to plot X/Y data with a scatter chart
> How to show magnitudes of X/Y data with a bubble chart
> How to display multidimensional data with a radar chart

Creating a Basic Bar Chart


If you’re ever in doubt about what type of chart best explains your data, your first
consideration should probably be the basic bar chart. We see bar charts so often
that it’s easy to overlook how effective they can be. Bar charts can show the evo-
lution of a value over time, or they can provide a straightforward comparison of
multiple values. Let’s walk through the steps to build one.

Step 1: Include the Required JavaScript


Since we’re using the Flotr2 library to create the chart, we need to include that library
in our web pages. The Flotr2 package isn’t currently popular enough for public con-
tent distribution networks, so you’ll need to download a copy and host it on your
own web server. We’ll use the minimized version (flotr2.min.js) since it provides the
best performance.
Flotr2 doesn’t require any other JavaScript libraries (such as jQuery), but it
does rely on the HTML canvas feature. Major modern browsers (Safari, Chrome,
Firefox) support canvas, but until version 9, Internet Explorer (IE) did not. Unfor-
tunately, there are still millions of users with IE8 (or even earlier). To support those
users, we can include an additional library (excanvas.min.js) in our pages. That library
is available from Google (https://code.google.com/p/explorercanvas/ ). Start with
the following skeleton for your HTML document:

<!DOCTYPE html>
<html lang="en">

6 | Chapter 1
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<!-- Page Content Here -->
u <!--[if lt IE 9]><script src="js/excanvas.min.js"></script><![endif]-->
<script src="js/flotr2.min.js"></script>
</body>
</html>

Since other browsers don’t need excanvas.min.js, we use some special


markup at u to make sure that only IE8 and earlier will load it. Also, notice that
we’re including the JavaScript libraries at the end of the document. This approach
lets the browser load the document’s entire HTML markup and begin laying out
the page while it waits for the server to provide the JavaScript libraries.

Step 2: Set Aside a <div> Element to Hold the Chart


Within our document, we need to create a <div> element to contain the chart. This
element must have an explicit height and width, or Flotr2 won’t be able to construct
the chart. We can indicate the element’s size in a CSS style sheet, or we can place
it directly on the element itself. Here’s how the document might look with the latter
approach.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<div id="chart" style="width:600px;height:300px;"></div>
<!--[if lt IE 9]><script src="js/excanvas.min.js"></script><![endif]-->
<script src="js/flotr2.min.js"></script>
</body>
</html>

Note that we’ve given the <div> an explicit id ("chart") so we can reference it
later. You’ll need to use a basic template like this (importing the Flotr2 library and
setting up the <div>) for all the charts in this chapter.

Step 3: Define the Data


Now we can tackle the data that we want to display. For this example, I’ll use the
number of Manchester City wins in the English Premier League for the past seven
years. Of course you’ll want to substitute your actual data values, either with inline
JavaScript (like the following example) or by another means (such as an AJAX call
to the server).

Graphing Data | 7
<script>
var wins = [[[2006,13],[2007,11],[2008,15],[2009,15],[2010,18],[2011,21],
[2012,28]]];
</script>

As you can see, we have three layers of arrays. Let’s start from the inside and
work our way out. For Flotr2 charts, each data point is entered in a two-item array
with an x-value and y-value. In our case we’re using the year as the x-value and the
number of wins as the y-value. We collect all these values in another array called a
series. We place this series inside one more outer array. We could enter multiple
series into this outer array, but for now we’re showing only one series. Here’s a
quick summary of each layer:
> Each data point consists of an x-value and a y-value packaged in an array.
> Each series consists of a set of data points packaged in an array.
> The data to chart consists of one or more series packaged in an array.

Step 4: Draw the Chart


That’s all the setup we need. A simple call to the Flotr2 library, as shown here,
creates our first attempt at a chart.

window.onload = function () {
Flotr.draw(
document.getElementById("chart"),
wins,
{
bars: {
show: true
}
}
);
};

First we make sure the browser has loaded our document; otherwise, the
chart <div> might not be present. That’s the point of window.onload. Once that
event occurs, we call Flotr.draw with three parameters: the HTML element to con-
tain the chart, the data for the chart, and any chart options (in this case, we specify
options only to tell Flotr2 to create a bar chart from the data).
Since Flotr2 doesn’t require jQuery, we haven’t taken advantage of any
of jQuery’s shortcuts in this example. If your page already includes jQuery, you
can use the standard jQuery conventions for the Flotr2 charts in this chapter to
execute the script after the window has loaded, and to find the <div> container
for the chart.
Figure 1-1 shows what you’ll see on the web page.

8 | Chapter 1
25.0

20.0

15.0

2005.0 2006.0 2007.0 2008.0 2009.0 2010.0 2011.0 2012.0 2013.0

FIGURE 1-1: The Flotr2 library turns data into a basic (if unpolished)
bar chart.

Now you have a bar chart, but it’s not showing the information very effec-
tively. Let’s add some options incrementally until we get what we want.

Step 5: Fix the Vertical Axis


The most glaring problem with the vertical axis is its scale. By default, Flotr2 auto-
matically calculates the range of the axis from the minimum and maximum values
in the data. In our case the minimum value is 11 wins (from 2007), so Flotr2 dutifully
uses that as its y-axis minimum. In bar charts, however, it’s almost always best to
make 0 the y-axis minimum. If you don’t use 0, you risk overemphasizing the dif-
ferences between values and confusing your users. Anyone who glances at the
chart in Figure 1-1, for example, might think that Manchester City did not win any
matches in 2007. That certainly wouldn’t do the team any justice.
Another problem with the vertical axis is the formatting. Flotr2 defaults to a
precision of one decimal place, so it adds the superfluous “.0” to all the labels. We
can fix both of these problems by specifying some y-axis options.

Flotr.draw(document.getElementById("chart"), [wins], {
bars: {
show: true
},
yaxis: {
min: 0,
tickDecimals: 0
}
});

Graphing Data | 9
The min property sets the minimum value for the y-axis, and the tickDecimals
property tells Flotr2 how many decimal places to show for the labels. In our case
we don’t want any decimal places.
As you can see in Figure 1-2, adding these options definitely improves the
vertical axis since the values now start at zero and are formatted appropriately for
integers.

30

25

20

15

10

0
2005.0 2006.0 2007.0 2008.0 2009.0 2010.0 2011.0 2012.0 2013.0

FIGURE 1-2: Simple options help Flotr2 construct a better vertical axis.

Step 6: Fix the Horizontal Axis


The horizontal axis needs some work as well. Just as with the y-axis, Flotr2 assumes
that the x-axis values are real numbers and shows one decimal place in the labels.
Since we’re charting years, we could simply set the precision to 0, as we did for the
y-axis. But that’s not a very general solution, since it won’t work when the x-values
are non-numeric categories (like team names). For the more general case, let’s first
change our data to use simple numbers rather than years for the x-values. Then we’ll
create an array that maps those simple numbers to arbitrary strings, which we can
use as labels.

var wins = [[[0,13],[1,11],[2,15],[3,15],[4,18],[5,21],[6,28]]];


var years = [
[0, "2006"],
[1, "2007"],
[2, "2008"],
[3, "2009"],
[4, "2010"],
[5, "2011"],
[6, "2012"]
];

10 | Chapter 1
As you can see, instead of using the actual years for the x-values, we’re simply
using 0, 1, 2, and so on. We then define a second array that maps those integer
values to strings. Although here our strings are years (and thus numbers), they
could be anything.
Another problem is a lack of spacing between the bars. By default, each bar
takes up its full horizontal space, but that makes the chart look very cramped. We
can adjust that with the barWidth property. Let’s set it to 0.5 so that each bar takes
up only half the available space.
Here’s how we pass those options to Flotr2.

Flotr.draw(document.getElementById("chart"), wins, {
bars: {
show: true,
barWidth: 0.5
},
yaxis: {
min: 0,
tickDecimals: 0
},
xaxis: {
u ticks: years
}
});

Note at u that we use the ticks property of the x-axis to tell Flotr2 which
labels match which x-values. Now we’re starting to get somewhere with our chart,
as shown in Figure 1-3. The x-axis labels are appropriate for years, and there is
space between the bars to improve the chart’s legibility.

30

25

20

15

10

0
2006 2007 2008 2009 2010 2011 2012

FIGURE 1-3: We can define our own labels for the horizontal axis.

Graphing Data | 11
Step 7: Adjust the Styling
Now that the chart is functional and readable, we can pay some attention to the
aesthetics. Let’s add a title, get rid of the unnecessary grid lines, and adjust the
coloring of the bars.

Flotr.draw(document.getElementById("chart"), wins, {
title: "Manchester City Wins",
colors: ["#89AFD2"],
bars: {
show: true,
barWidth: 0.5,
shadowSize: 0,
fillOpacity: 1,
lineWidth: 0
},
yaxis: {
min: 0,
tickDecimals: 0
},
xaxis: {
ticks: years
},
grid: {
horizontalLines: false,
verticalLines: false
}
});

As you can see in Figure 1-4, we now have a bar chart that Manchester City
fans can be proud of.

Manchester City Wins


30

25

20

15

10

0
2006 2007 2008 2009 2010 2011 2012

FIGURE 1- 4: Additional options let us adjust the visual styles of the chart.

12 | Chapter 1
For any data set of moderate size, the standard bar chart is often the most
effective visualization. Users are already familiar with its conventions, so they don’t
have to put any extra effort into understanding the format. The bars themselves
offer a clear visual contrast with the background, and they use a single linear
dimension (height) to show differences between values, so users easily grasp the
salient data.

Step 8: Vary the Bar Color


So far our chart has been monochromatic. That makes sense because we’re show-
ing the same value (Manchester City wins) across time. But bar charts are also
good for comparing different values. Suppose, for example, we wanted to show
the total wins for multiple teams in one year. In that case, it makes sense to use a
different color for each team’s bar. Let’s go over how we can do that.
First we need to restructure the data somewhat. Previously we’ve shown only
a single series. Now we want a different series for each team. Creating multiple
series lets Flotr2 color each independently. The following example shows how the
new data series compares with the old. We’ve left the wins array in the code for
comparison, but it’s the wins2 array that we’re going to show now. Notice how the
nesting of the arrays changes. Also, we’re going to label each bar with the team
abbreviation instead of the year.

var wins = [[[0,13],[1,11],[2,15],[3,15],[4,18],[5,21],[6,28]]];


var wins2 = [[[0,28]],[[1,28]],[[2,21]],[[3,20]],[[4,19]]];
var teams = [
[0, "MCI"],
[1, "MUN"],
[2, "ARS"],
[3, "TOT"],
[4, "NEW"]
];

With those changes, our data is structured appropriately, and we can ask
Flotr2 to draw the chart. When we do that, let’s use different colors for each team.
Everything else is the same as before.

Flotr.draw(document.getElementById("chart"), wins2, {
title: "Premier League Wins (2011-2012)",
colors: ["#89AFD2", "#1D1D1D", "#DF021D", "#0E204B", "#E67840"],
bars: {
show: true,
barWidth: 0.5,
shadowSize: 0,
fillOpacity: 1,
lineWidth: 0
},
yaxis: {
min: 0,
tickDecimals: 0
},

Graphing Data | 13
xaxis: {
ticks: teams
},
grid: {
horizontalLines: false,
verticalLines: false
}
});

As you can see in Figure 1-5, with a few minor adjustments we’ve completely
changed the focus of our bar chart. Instead of showing a single team at different
points in time, we’re now comparing different teams at the same point in time.
That’s the versatility of a simple bar chart.

Premier League Wins (2011-2012)


30

25

20

15

10

0
MCI MUN ARS TOT NEW

FIGURE 1-5: Bar charts can compare different quantities at one point
in time as well as the same quantity at different points in time.

We’ve used a lot of different code fragments to put together these examples.
If you want to see a complete example in a single file, check out this book’s
source code at http://jsDataV.is/source/.

Step 9: Work Around Flotr2 “Bugs”


If you’re building large web pages with a lot of content, you may run into a Flotr2
“bug” that can be quite annoying. I’ve put “bug” in quotation marks because the
Flotr2 behavior is deliberate, but I believe it’s not correct. In the process of con-
structing its charts, Flotr2 creates dummy HTML elements so it can calculate their
sizes. Flotr2 doesn’t intend these dummy elements to be visible on the page, so it
“hides” them by positioning them off the screen. Unfortunately, what Flotr2 thinks
is off the screen isn’t always. Specifically, line 2,281 of flotr2.js is:

D.setStyles(div, { "position" : "absolute", "top" : "-10000px" });

14 | Chapter 1
Flotr2 intends to place these dummy elements 10,000 pixels above the top
of the browser window. However, CSS absolute positioning can be relative to the
containing element, which is not always the browser window. So if your document
is more than 10,000 pixels high, you may find Flotr2 scattering text in random-
looking locations throughout the page. There are a couple of ways to work around
this bug, at least until the Flotr2 code is revised.
One option is to modify the code yourself. Flotr2 is open source, so you can
freely download the full source code and modify it appropriately. One simple
modification would position the dummy elements far to the right or left rather
than above. Instead of "top" you could change the code to "right". If you’re not
comfortable making changes to the library’s source code, another option is to find
and hide those dummy elements yourself. You should do this after you’ve called
Flotr.draw() for the last time. The latest version of jQuery can banish these extra-
neous elements with the following statement:

$(".flotr-dummy-div").parent().hide();

Plotting Continuous Data with a Line Chart


Bar charts work great for visualizing a modest amount of data, but for more signifi-
cant amounts of data, a line chart can present the information much more effec-
tively. Line charts are especially good at revealing overall trends in data without
bogging the user down in individual data points.
For our example, we’ll look at two measures that may be related: carbon
dioxide (CO2) concentration in the atmosphere and global temperatures. We want
to show how both measures have changed over time, and we’d like to see how
strongly related the values are. A line chart is a perfect visualization tool for look-
ing at these trends.
Just like for the bar chart, you’ll need to include the Flotr2 library in your web
page and create a <div> element to contain the chart. Let’s start prepping the data.

Step 1: Define the Data


We’ll begin with CO2 concentration measurements. The US National Oceanographic
and Atmospheric Administration (NOAA) publishes measurements (http://www.esrl
.noaa.gov/gmd/ccgg/trends/co2_data_mlo.html) taken at Mauna Loa, Hawaii, from
1959 to the present day. The first few values are shown in the following excerpt.

var co2 = [
[ 1959, 315.97 ],
[ 1960, 316.91 ],
[ 1961, 317.64 ],
[ 1962, 318.45 ],
// Data set continues...

Graphing Data | 15
NOAA also publishes measurements of mean global surface temperature
(http://www.ncdc.noaa.gov/cmb-faq/anomalies.php). These values measure the dif-
ference from the baseline, which is currently taken to be the average temperature
over the entire 20th century. Since the CO2 measurements begin in 1959, we’ll use
that as our starting point for temperature as well.

var temp = [
[ 1959, 0.0776 ],
[ 1960, 0.0280 ],
[ 1961, 0.1028 ],
[ 1962, 0.1289 ],
// Data set continues...

Step 2: Graph the CO2 Data


Graphing one data set is quite easy with Flotr2. We simply call the draw() method
of the Flotr object. The only parameters the method requires are a reference to
the HTML element in which to place the graph, and the data itself. The lines prop-
erty of the data object indicates that we want a line chart.

Flotr.draw(
document.getElementById("chart"),
[{ data: co2, lines: {show:true} }]
);

Since Flotr2 does not require jQuery, we’re not using any jQuery conve-
nience functions in our example. If you do have jQuery on your pages, you can
simplify the preceding code a little. In either case, Figure 1-6 shows the result.

380

360

340

320

1960 1970 1980 1990 2000 2010

FIGURE 1- 6: The first chart shows one data set.

16 | Chapter 1
The chart clearly shows the trend in CO2 concentration for the past 50-plus
years.

Step 3: Add the Temperature Data


With a simple addition to our code, we can include temperature measurements in
our chart.

Flotr.draw(
document.getElementById("chart"),
[
{ data: co2, lines: {show:true} },
{ data: temp, lines: {show:true}, yaxis: 2 }
]
);

Note that we include the yaxis option for the temperature data and give it a
value of 2. That tells Flotr2 to use a different y-scale for the temperature data.
The chart in Figure 1-7 now shows both measurements for the years in ques-
tion, but it’s gotten a little cramped and confusing. The values butt up against the
edges of the chart, and the grid lines are hard for users to interpret when there are
multiple vertical axes.

0.60

380

0.40

360

0.20

340

0.00

320

1960 1970 1980 1990 2000 2010

FIGURE 1-7: A single chart can show multiple data sets.

Step 4: Improve the Chart’s Readability


By using more Flotr2 options, we can make several improvements in our line chart’s
readability. First we can eliminate the grid lines, since they aren’t relevant for the
temperature measurements.

Graphing Data | 17
We can also extend the range of both vertical axes to provide a bit of
breathing room for the chart. Both of these changes are additional options to the
draw() method.

Flotr.draw(
document.getElementById("chart"),
[
{ data: co2, lines: {show:true} },
{ data: temp, lines: {show:true}, yaxis: 2 }
],{
u grid: {horizontalLines: false, verticalLines: false},
v yaxis: {min: 300, max: 400},
w y2axis: {min: -0.15, max: 0.69}
}
);

The grid options at u turn off the grid lines by setting both the
horizontalLines and verticalLines properties to false. The yaxis options at v
specify the minimum and maximum value for the first vertical axis (CO2 concentra-
tion), while the y2axis options at w specify those values for the second vertical axis
(temperature difference).
The resulting graph in Figure 1-8 is cleaner and easier to read.

400

0.60

380

0.40
360

0.20
340

320
0.00

300
1960 1970 1980 1990 2000 2010

FIGURE 1-8: Removing grid lines and expanding the axes makes
the chart easier to read.

Step 5: Clarify the Temperature Measurements


The temperature measurements might still be confusing to users, since they’re
not really temperatures; they’re actually deviations from the 20th-century average.
Let’s convey that distinction by adding a line for that 20th-century average and

18 | Chapter 1
explicitly labeling it. The simplest way to do that is to create a “dummy” data set
and add that to the chart. The extra data set has nothing but zeros.

var zero = [];


for (var yr=1959; yr<2012; yr++) { zero.push([yr, 0]); };

When we add that data set to the chart, we need to indicate that it corre-
sponds to the second y-axis. And since we want this line to appear as part of the
chart framework rather than as another data set, let’s deemphasize it somewhat by
setting its width to one pixel, coloring it dark gray, and disabling shadows.

Flotr.draw(
document.getElementById("chart"),
[
{ data: zero, lines: {show:true, lineWidth: 1}, yaxis: 2,
shadowSize: 0, color: "#545454" },
{ data: co2, lines: {show:true} },
{ data: temp, lines: {show:true}, yaxis: 2 }
],{
grid: {horizontalLines: false, verticalLines: false},
yaxis: {min: 300, max: 400},
y2axis: {min: -0.15, max: 0.69}
}
);

As you can see, we’ve placed the zero line first among the data sets. With
that order, Flotr2 will draw the actual data on top of the zero line, as shown in Fig-
ure 1-9, reinforcing its role as chart framework instead of data.

400

0.60

380

0.40
360

0.20
340

320
0.00

300
1960 1970 1980 1990 2000 2010

FIGURE 1-9: A dummy data set can emphasize a position on a chart axis.

Graphing Data | 19
Step 6: Label the Chart
For the last step in this example, we’ll add appropriate labels to the chart. That
includes an overall title, as well as labels for individual data sets. And to make it
clear which axis refers to temperature, we’ll add a “°C” suffix to the temperature
scale. We identify the label for each data series in the label option for that series.
The overall chart title merits its own option, and we add the “°C” suffix using a
tickFormatter() function.

Flotr.draw(
document.getElementById("chart"),
[ {
data: zero,
label: "20<sup>th</sup>-Century Baseline Temperature",
lines: {show:true, lineWidth: 1},
shadowSize: 0,
color: "#545454"
},
{
data: temp,
label: "Yearly Temperature Difference (°C)",
lines: {show:true}
},
{
data: co2,
yaxis: 2,
label: "CO<sub>2</sub> Concentration (ppm)",
lines: {show:true}
}
],
{
title: "Global Temperature and CO<sub>2</sub> Concentration (NOAA Data)",
grid: {horizontalLines: false, verticalLines: false},
y2axis: {min: -0.15, max: 0.69,
u tickFormatter: function(val) {return val+" °C";}}
yaxis: {min: 300, max: 400},
}
);

For each value on the axis, the formatter function is called with the value,
and Flotr2 expects it to return a string to use for the label. As you can see at u, we
simply append the " °C" string to the value.
Notice that we’ve also swapped the position of the CO2 and temperature
graphs. We’re now passing the temperature data series ahead of the CO2 series.
We did that so that the two temperature quantities (baseline and difference) appear
next to each other in the legend, making their connection a little clearer to the user.

20 | Chapter 1
And because the temperature now appears first in the legend, we’ve also swapped
the axes, so the temperature axis is on the left. Finally, we’ve adjusted the title of the
chart for the same reason. Figure 1-10 shows the result.

Global Temperature and CO2 Concentration (NOAA Data)


400
20th-Century Baseline Temperature
0.60 ºC Yearly Temperature Difference (ºC)
CO2 Concentration (ppm)
380

0.40 ºC
360

0.20 ºC 340

320
0.00 ºC

300
1960 1970 1980 1990 2000 2010

FIGURE 1-10: Labeling the axes and adding a legend completes


the chart.

A line chart like Figure 1-10 excels in visualizing this kind of data. Each data
set contains over 50 points, making it impractical to present each individual point.
And in fact, individual data points are not the focus of the visualization. Rather, we
want to show trends—the trends of each data set as well as that data set’s correla-
tion to the others. Connecting the points with lines leads the user right to those
trends and to the heart of our visualization.

Step 7: Work Around Flotr2 “Bugs”


Be sure to refer to Step 9 of “Creating a Basic Bar Chart” on page 14 to see how
to work around some “bugs” in the Flotr2 library.

Emphasizing Fractions Using a Pie Chart


Pie charts don’t get a lot of love in the visualization community, and for a pretty
good reason: they’re rarely the most effective way to communicate data. We will
walk through the steps to create pie charts in this section, but first let’s take some
time to understand the problems they introduce. Figure 1-11, for example, shows
a simple pie chart. Can you tell from the chart which color is the largest? The
smallest?

Graphing Data | 21
FIGURE 1-11: Pie charts can make
it hard to compare values.

It’s very hard to tell. That’s because humans are not particularly good at
judging the relative size of areas, especially if those areas aren’t rectangles. If we
really wanted to compare these five values, a bar chart works much better. Fig-
ure 1-12 shows the same values in a bar chart.

Bar charts usually make


FIGURE 1-12:
comparisons easier.

Now, of course, it’s easy to rank each color. With a bar chart we only have to
compare one dimension—height. This yields a simple rule of thumb: if you’re com-
paring different values against one another, consider a bar chart first. It will almost
always provide the best visualization.
One case, however, where pie charts can be quite effective is when we want
to compare a single partial value against a whole. Say, for example, we want to
visualize the percentage of the world’s population that lives in poverty. In that
case, a pie chart may work quite well. Here’s how we can construct such a chart
using Flotr2.
Just as in Step 1 of “Creating a Basic Bar Chart” on page 6, we need to
include the Flotr2 library in our web page and set aside a <div> element to contain
the chart we’ll construct.

22 | Chapter 1
Step 1: Define the Data
The data here is quite straightforward. According to the World Bank (http://www
.newgeography.com/content/003325-alleviating-world-poverty-a-progress-report),
at the end of 2008, 22.4 percent of the world’s population lived on less than
$1.25/day. That’s the fraction that we want to emphasize with our chart.

var data = [[[0,22.4]],[[1,77.6]]];

Here we have an array with two data series: one for the percentage of the
population in poverty (22.4) and a second series for the rest (77.6). Each series itself
consists of an array of points. In this example, and for pie charts in general, there is
only one point in each series, with an x-value and a y-value (which are each stored
together in yet another, inner array). For pie charts, the x-values are irrelevant, so
we simply include the placeholder values 0 and 1.

Step 2: Draw the Chart


To draw the chart, we call the draw() method of the Flotr object. That method
takes three parameters: the element in our HTML document in which to place the
chart, the data for our chart, and any options. We’ll start with the minimum set of
options required for a pie chart.

window.onload = function () {
Flotr.draw(document.getElementById("chart"), data, {
pie: {
show: true
},
yaxis: {
u showLabels: false
},
xaxis: {
v showLabels: false
},
grid: {
w horizontalLines: false,
x verticalLines: false
}
});
}

As you can see, Flotr2 requires a few more options for a minimum pie chart
than it does for other common chart types. For both the x- and y-axes we need to
disable labels, which we do by setting the showLabels property to false at u and v.
We also have to turn off the grid lines, as a grid doesn’t make a lot of sense for a
pie chart. We accomplish that by setting the verticalLines and horizontalLines
properties of the grid option to false at w and x.
Since Flotr2 doesn’t require jQuery, we’re not using any of the jQuery con-
venience functions in this example. If you do have jQuery for your pages, you can
simplify this code a bit.

Graphing Data | 23
Figure 1-13 is a start, but it’s hard to tell exactly what the graph intends
to show.

22.40%

77.60%

FIGURE 1-13: Without effective labeling,


pie charts can be difficult to interpret.

Step 3: Label the Values


The next step is to add some text labels and a legend to indicate what the chart
is displaying. To label each quantity separately, we have to change the structure
of our data. Instead of using an array of series, we’ll create an object to store each
series. Each object’s data property will contain the corresponding series, and we’ll
add a label property for the text labels.

var data = [
{data: [[0,22.4]], label: "Extreme Poverty"},
{data: [[1,77.6]]}
];

With our data structured this way, Flotr2 will automatically identify labels
associated with each series. Now when we call the draw() method, we just need to
add a title option. Flotr2 will add the title above the graph and create a simple
legend identifying the pie portions with our labels. To make the chart a little more
engaging, we’ll pose a question in our title. That’s why we’re labeling only one of
the areas in the chart: the labeled area answers the question in the title.

Flotr.draw(document.getElementById("chart"),data, {
title: "How Much of the World Lives on $1.25/Day?",
pie: {
show: true
},
yaxis: {
showLabels: false
},
xaxis: {
showLabels: false
},

24 | Chapter 1
grid: {
horizontalLines: false,
verticalLines: false
}
});

The chart in Figure 1-14 reveals the data quite clearly.

How Much of the World Lives on $1.25/Day?


Extreme Poverty

22.40%

77.60%

FIGURE 1-14: Labels and titles can help


make a chart engaging.

Although pie charts have a bad reputation in the data visualization com-
munity, there are some applications for which they are quite effective. They’re not
very good at letting users compare multiple values, but as shown in this example,
they do provide a nice and easily understandable picture showing the proportion
of a single value within a whole.

Step 4: Work Around Flotr2 “Bugs”


Be sure to refer to Step 9 of “Creating a Basic Bar Chart” on page 14 to see how
to work around some “bugs” in the Flotr2 library.

Plotting X/Y Data with a Scatter Chart


A bar chart is often most effective for visualizing data that consists primarily of a
single quantity (such as the number of wins in the bar charts we created earlier).
But if we want to explore the relationship between two different quantities, a scat-
ter chart can be more effective. Suppose, for example, we wish to visualize the
relationship between a country’s health-care spending (one quantity) and its life
expectancy (the second quantity). Let’s step through an example to see how to
create a scatter chart for that data.

Graphing Data | 25
Exploring the Variety of Random
Documents with Different Content
with large wing attachments on their arms, and red lights on their
heads.
We were now approaching one of their large airports outside the
city, across one of their rivers, where we were ordered to land and
to wheel the ship into a very large building. Nobody was there to
meet us because all of us including the Martians, were under strict
quarantine.
We again had to undergo the cleansing and disinfecting, but this
time more intensified. Their health inspectors and medical specialists
began to take all kinds of careful tests to be sure we did not bring in
any diseases or that we did not carry any dangerous microbes. We
remained here for three days.
On the last day, after again being thoroughly examined, we were
given a clean bill of health. Our airship leader, who, I was told, was a
first-degree Sun-Rank member, an important dignitary, and who, I
could see, was given honorable recognition and homage by
everyone, appointed himself my host. He said the rest of our boys
were also being taken as guests by other fellow Martian travelers.
Again cautioning every one of us to try his utmost to control his
thoughts, he led me to his private plane. We left the airport for his
home. He gave me a parachute and fastened on his arms a pair of
folded large snow shoes.
"These are flying wings," he said. "I am putting them on in case of
accident. Before we reach my home I want to tell you something
that may please you. The medical reports about you and your
friends are very satisfactory. After a few months with us, if you
follow our health habits, we expect you to become just as healthy
and vigorous as any one of our young Martians. But you will never
acquire our sixth sense of thought reading and transmission, or our
bird-flying motions. But by following our way of living, your life span
will be extended far beyond Earth standards, even if it does not
reach our span of 300 years.
"Our head examiner said it was safe for us to take you to our
homes. If you men desire, you may remain indefinitely among us,
and look for wives among our girls. You all are able to rear families
of healthy Martians. But after consulting with members of our
council, they said that if you decided to remain on Mars, you would
first have to deserve and earn the Martian citizenship. They decided
if you will help me in my plans for your Earth people you will be
elected to honorable citizenship of Mars.
"We are, as you notice, flying very slowly. My home is in the suburbs
of the city, near by, about 500 miles distant. My wife and my fourth-
generation granddaughter, together with other members of our
household are waiting to receive you. I am sure they will find you a
welcome guest. I also wish to tell you that we have learned your
English language. Every one will be able to converse freely with you.
You will feel quite at home. It would be wise if you men learned our
Martian language so that you could mingle with other Martians."
While we were flying, I was constantly looking above and below us
at the innumerable, beautiful airships of all kinds, designs, and sizes
flying in all directions.
Glancing below I was astounded to see a garden of Eden with angel
figures winging their way over an oasis of blended color. While he
had been talking, my companion was preparing to land on his own
landing platform. Attendants were on hand to assist us from the
plane. A woman of dignity and beauty and a charming young girl
were awaiting our arrival. They seemed from another world. No
marks of care and anxiety on their faces. They looked to me like the
angels I remembered from childhood on Christmas cards. They were
dressed in flowing Roman stolas, that appeared to be of very fine
linen, falling to their feet, fastened at the shoulders and upper arms
by ornamented atomic battery buttons. They wore beautiful
bracelets on their arms. Their stolas, girdled at the waist, were semi-
décolleté reflecting their healthy, white skin. Two ribbons running
over the shoulders crossed themselves in front and back to reach the
girdle belt. On the sides under the arms, the gowns were
ornamented and fell in a cascade effect into folds, open from the
knees down and trailing on the ground at the back.
Their hair was dressed with wavy small curls in front from ear to ear.
In the back it fell in beautiful waves.
The older woman wore an inch wide gold fillet band encircling her
head.
They welcomed us in a most friendly manner. Introducing his wife to
me as Lady Sylvia Banard and the young lady as Miss Xora Savona,
he took hold of his wife's arm, indicating that I do the same with
Miss Savona. We followed them into their sumptuous dining room for
dinner.
The conversation centered on his adventure to Earth and back
again, while all the members of the party kept watching me. I
especially noticed the friendly, slightly curious side glances of Xora.
Evidently these girls on Mars had some of the nice traits of our girls.
At least they were feminine enough to be curious. I had difficulty
keeping my mind on the conversation but I remembered my
manners and tried to join in. After dinner we went into their library,
and I remained until I was left alone with Sun-Rank Banard.
One thought was in my mind, which he knew, but he let me
question him. "May I ask an important, but perhaps a personal
question without offending?"
"I know your question. There is no offense. Ask it."
"You told me that Miss Xora Savona is your grandchild of the fourth
generation, so I presume you are over one hundred Earth years old.
You and Lady Banard and other Martians of your age look so
youthful that, no doubt, you are still virile. How do you people
control the overpopulation of Mars?"
He answered, "We limit, and control our birth rate, preventing its
overpopulation. Our method of control is very simple. Whereas in
many parts of your Earth, with all your preventives, aborti-facients,
and your criminal dangerous abortion operations, your population is
increasing to a dangerous point of saturation, creating scarcity,
undernourishment, famine, and starvation. Chaos will soon overtake
you, unless you control these over-birth rates. By our process we
control not only the number of coming children, but their sex as
well. We can maintain an even balance in sex and also prevent the
unfortunates who are not fit to have children from having them.
Even with our large population, our planet is as yet hardly half
populated. If it were fully populated, our production of all necessities
of life would still be more than ample for our needs. In one year, we
can produce enough for three years. We always have a generous
surplus of everything, because our storage facilities are perfect, and
we have no waste.
"We protect our lands against dust storms and other causes of
erosion. We do not allow their abandonment; we do not allow any
waste. All our soils are constantly analyzed and suitably fertilized to
prevent a lack of necessary elements. This treatment results in
plants of above-average food value, and of a balanced mineral
nutrition, a combination promoting good health.
"The drying up of marshlands and other wastelands plus the perfect
irrigation of our deserts has helped us considerably to increase our
production, and to almost exterminate pestilent insects.
"Lands not in active production are forested or put to rich grazing
use. Our permanent large pumping, drenching, and sprinkling
system, with our large sprinkler planes, are used to irrigate our
deserts, and other lands suffering from drought and rain scarcity. It
is also used in putting out forest fires started either by sun rays or
combustion.
"We draw the waters from our great number of immense reserve
storage reservoirs, which are directly diverted to them from the run-
offs of heavy river water flows. Saving us from overflowing rivers,
flood control, levee construction, inundation damage, and disasters,
at the same time increasing generating power of our dams. We have
an efficient drainage system for our tropical crops in rain-soaked
lands, excess waters of which also flow into these reservoirs. Sun
rays are available to treat our vegetation, when necessary.
"We limit and regulate agricultural production all over Mars. We have
always an overabundance, because we have also completely
reclaimed, irrigated, and fertilized our arid areas, distant from our
surface water and reservoir supply, by mapping and using their
underground water resources; we have converted them into rich
productive farm lands. We have also mastered our jungle lands and
made them all very productive.
"You are reluctant to ask me a few more questions you feel I may be
sensitive about answering. You are puzzled about a fourth
generation. Since our generation is thirty Earth years, I would have
to be about 150 years old to have a fourth generation grandchild. I
am now 175 years old, and Xora is now twenty-six Earth years old,
which makes her my fourth generation grandchild. Xora has been
appointed as your guide; she will take you tomorrow to her home,
where you will meet her family and friends. You will be free to
mingle among and closely observe us. You will find out for yourself
that we have high standards and happy life.
"'Regnant populi.' The people rule, with a political regime really 'of
the people, by the people, and for the people,' through their short
term elected representatives; a truly democratic form of
government, as defined by your Webster's Dictionary, 'Democracy:
Government by the people collectively by elected representatives;
political, or social equality,' united for common interests, rights and
privileges, in political, economic, and social equality. We have strong
doctrines of individual freedom, 'Lalus populi suprema est lex,' the
welfare of the people is the supreme law.
"Our government officials are elected for two or five years,
depending upon location and departments. They are not allowed to
succeed themselves. Dictatorship is non-existent nor would it be
tolerated. We have no ruling class. We are ruled by the people. We
have no secrecy in our government, nor in our political parties, no
party cliques and party discipline. Important decisions are voted for,
or against, by all our citizens.
"You are curious and want to know if all Martians live in the same
splendor and style as I do. No, they do not. We have ten grades and
ten Sun-Rank degrees. Between every grade and every degree there
are ten points to be earned. Every one of us must earn all ten points
for promotion into the next degree.
"Promotion into the honorable Sun-Ranks is obtained only if we have
achieved something outstanding, such as an improvement or
invention, a scientific discovery, a disease prevention and cure.
These higher advancements are voted upon and approved by our
supreme house of council, and are given to us after judgment has
been passed by impartial judges of all races from different parts of
our planet.
"The type of living quarters of members in the Sun-Rank degrees
depends on the degree. The members not only are honored for their
attainment, but the higher ranking members are given, for their
lifetime or for as long as they desire, mansions in both summer and
winter resorts. They have large yachts and planes assigned to them
and enjoy comforts and luxuries. They all have their duties to
perform during their hours of employment. There is no ostentation
in their way of life; for their entertainment, they attend the same
theatres and halls as the lowest grade degree members. Stalls,
boxes, and the best orchestra seats are always first reserved for the
aged, and the next for rank members. Some of them prefer to
occupy seats in the balcony with their lower degree families and
friends.
"Many of our highest rank members prefer to remain in their old
homes where they began as citizens. Many others go back to them if
they are still available. Rank members are not envied. Respect and
desire to emulate them spur all of us on.
"I have only reached my Sun-Rank first degree very recently. None
of my children have as yet reached my rank. They and their children
can visit me for a short time, but it would not be ethical for me to
keep them, nor would any of them want to remain in our home
permanently.
"The children of our Sun-Rank members, at their maturity, revert to
the living standards of our lowest grade degree members.
"Now it's getting late, and no doubt you are bewildered and tired."
To an attendant, who suddenly appeared, he said, "Please lead
Lieutenant Balmore to his sleeping chamber. Good night."
CHAPTER III
Amboria the Paradise
When we met next day, he handed me his third chapter.
The next morning after breakfast en famille, Xora led me outside and
into a hangar, where a few planes of different sizes were standing.
She went to a corner closet where there was an assortment of what
I would call large, light weight snow shoes. They had two parts,
hinged together and pliable, similar to those I saw in Sun-Rank
Banard's plane. They were covered by a thin fabric with clasps on
one surface and were of different colors to blend with her garments.
She fastened them tightly on both her arms, and flapping them like
bird wings, she swiftly lifted herself off the ground. She flew around
gracefully showing me all kinds of tricks. When she came down, Xora
told me that it was too bad I did not know how to bird-fly, but that
we could take her small tandem.
She picked up a few small contraptions which I helped her carry
outside. The piece I carried seemed to be a double seat of a swing
with attachable back and legs and with metal ropes. I thought she
was going to hang it somewhere and do some swinging; but no, she
next hooked on two flat oval pieces like oars or wings. She also
screwed onto it tightly a small propeller smokeless jet engine. When
the legs were lowered, it became a double bench seat. She sat down
on one end and asked me to sit down beside her, carefully fastening
her wings on her arms. When she gave me a bundle to strap on (she
afterwards told me it was a parachute), I obeyed, puzzled. She
covered our knees with a blanket and touched a button near the
engine. To my great astonishment, we both were lifted slowly off the
ground.
Laughing at my surprise, she explained, "This is my old portable
tandem plane. It can travel 500 miles an hour. I can control its
speed, and bring it to a dead stop on any surface. It's driven by
perpetual atomic energy. First, we'll go sight-seeing above the city,
and then we'll land on the roof of my home in the city. I want you to
meet my parents and my sister and brother."
As I sat beside her, the pleasant scent of her hair, the nearness and
warmth of her body, and the occasional light touch of her hands
thrilled me so much that I almost lost control of myself. I told myself
I was acting like a school boy, instead of a grown man. By the faint
color in her cheeks she showed she was aware of my predicament.
"You are so lovely," I said, "that all these other marvels seem
secondary. How do you expect me to concentrate on them? By the
way, isn't there a Martian boy who will be jealous of the time you are
spending with me?"
She hesitated a minute before she answered. "Not seriously," she
finally said. "Of course I have friends, but as yet I haven't made any
decision."
My heart gave an extra thump. Then there was hope for me. I asked
her if she wanted to marry a man of high rank or of low rank. She
answered, "Nowadays very few young men reach the rank degrees,
but many of my friends are hoping to marry such. But I first want
one whom I love. He must be noble, lovable, intelligent, ambitious
and capable of achieving honor by an outstanding action of which I
may be proud."
Our talk and thoughts had so confused Xora that she was forgetting
to apply her flying rules. We were dodging and barely escaping
collisions with planes which seemed suddenly to be cluttering the
sky. A small plane came alongside us. The occupant was in uniform,
which I recognized as an air policeman's. Recognizing Xora, he
cautioned her and indicated that she was out of her flying altitude.
She immediately followed the instructions he gave. After he had left,
she told me he was a schoolmate of hers and was now serving his
first year in the general army of service, of which all policemen were
members.
"He certainly went against the rules by not giving me a summons. I
suppose he was being considerate of you as an Earth visitor to
Mars."
During this time, I had been almost unaware of the city below. Xora
now called my attention to the view. She said the city had been
constructed five years before. It looked more like a large park than a
city. There were no streets, but wide park lanes, criss-crossing each
other. There was a large round lake in the center, surrounded by
beautiful buildings.
Carefully kept lawns, gardens, and buildings covered all the surface
space. The roof tops were pleasant to see with no unsightly water
tanks, chimneys, signs, wiring, smoke, and junk. There were no
broken-down hulks of unoccupied buildings, no dirty, drab, or sooty
walls, no fire escapes. The flat or slanting roofs were all covered
with well kept verdure and flower beds.
There were courts of different shapes, five or six clustered together,
surrounded by green markings like a hedge, with a very visible letter
in the Martian calligraphy within a center flowerbed denoting, I
suppose, its number and location.
Along the rivers, busy waterways with freight ships and pleasure
yachts, were clean flat beaches. On the Amboria city side of the
river, on the edge and over part of the river on the extreme southern
end, many large buildings covered a space equivalent to about two
hundred and fifty New York city blocks. I asked Xora what these
large buildings were.
She answered, "They are our general stores."
"Why so large?" I wanted to know.
"They are the only stores we have for our city," she explained. "They
have the capacity to daily receive, unload, and store the contents of
one thousand large freight airplanes landing on their roofs, two
hundred fifty large freight ships, two hundred fifty freight
submarines, all sailing under and unloading inside the buildings, and
two hundred fifty long freight trains. If necessary, they can double
this capacity."
"You mean to say," I asked her, "that these stores not only store
away, but also distribute everything needed for every individual? Is
your city population large?"
"Yes," she replied. "I will take you through one of the buildings on
the next shopping day when the people in our section are allowed to
shop. That will be Monday.
"The city is divided into six zones, and the inhabitants of each zone
are allowed to shop only on their appointed day. The stores are
never overcrowded."
"If you shop only one day a week," I interrupted, "then you must
order for the whole week in advance."
"Oh, yes, we must submit our list a week in advance."
"Suppose you haven't the time or you are sick?"
"Then, I order either by telephone or by mail from the catalogue, or
I can leave my list at our commissary department."
"You just told me you have only one set of stores. Then you also
have commissary departments?"
"Our commissary department," she said, "is only the distributing
point where we get our daily food and beverages. We don't have to
shop for them in the large, center stores."
We now came above a round court fringed around by private homes.
Slowly descending, we landed on the roof of one of the houses,
where Xora's family, who were expecting us, were waiting to receive
us.
Xora introduced me to her mother, father, young sister and brother.
All welcomed me with cordiality. There is no need for me to describe
them. Nature had been kind to them.
As I was following them down to their living room, her father said,
"Lieutenant Balmore, you must feel strange landing so suddenly on
our planet, but we are your friends, and we will try our utmost to
make you feel at home.
"Of course, since everything on Mars is unfamiliar to you, you must
be anxious to see everything. Let me begin by showing you our
home. It is large enough for our family and for guests. It is fully
insulated; weather, water, fire, germ, and insect proof, outside and
inside. We use concentrated sun rays for heat and light, and atomic
energy for power and cooking. It is air conditioned. We get the
desired temperature and humidity in all seasons; the inside
temperature thermostat is set by our health officer, who does not
allow too cold or over-heated living quarters. The house is
thoroughly dust proof. The electronic dust catcher and dirt remover
cleans our walls, floors, ceilings, and even our furniture, and frees
the air of all foreign articles.
"Each room is fully exposed at different times of the day to full
sunlight. Sun-ray health lamps are always operating in every room
and within the air conditioning unit to destroy all microbes that
happen to evade our other guards. These lamps are in every living,
work and office room.
"The comforts of our home equal those in all the homes of our
citizens from the first to the tenth grade degree. All the furniture,
furnishings, clothes, even paper are fire-proof. By our process we
fire-proof 100% all inflammable materials, including even the
thickest of lumber. We take no risk of destruction by fire. We do not
need a fire department, nor firemen. We do not allow conditions to
exist to which Earth people are accustomed. I find that in your Brick
and Clay Record Magazine, February 1947 issue:
"Last year you built in the United States a half million
permanent homes, but at the same time 400,000 were
burned down or damaged, and this situation is going to
get worse. You are building tinder boxes and firetraps at
the greatest rate in your history and with the
encouragement of your government. And this is in the
face of some of the worst fire disasters you have ever
known.
"Your fire losses last year were up 30%. They cost 11,000
lives. They wasted $500,000,000. You burned to death
3,000 children in their homes. Yet your Federal
Government is encouraging, even subsidizing the building
of homes, virtually every part of which above the ground,
including the interior wall finish, is combustible. When fire
hits such homes they will burn so fast the occupants won't
have time to save themselves, let alone the home."[15]
"New York (AP)—Fire losses in the United States reached
an appalling all time high of $700,000,000 this year."[16]
He led me through their living room, bedrooms, library, fumigating
and disinfecting closets, toilet and shower closets without bathtubs.
When I asked him about the tubs, he said bathtubs were not used
on Mars, as they were unsanitary and unsafe.
We then went into their spacious dining room, where Mrs. Savona
was arranging the table. "I have arranged to serve luncheon in
privacy here; this room is thought transmission proof, so we can
freely talk. I want you to be comfortable. Our guest room is ready
for you. You can occupy it as long as you are on this planet. Mr.
Savona and Xora will keep you busy showing you around. In a few
days you will find your way by yourself, and you will be able to
locate and visit your fellow Earth men."
Passing through the dining room, we went into the kitchen, which
had all kinds of improved machines to help make kitchen work more
efficient and pleasant. Walls, floors, and ceilings were of glossy
white. But there was no sink. I asked about it.
"In our small homes we did away with that drudgery and servants
long ago. Our dishes and silverware are cleaned at our central
dishwashing department."
He led me to a closet with a continuous moving escalator dumb-
waiter. "After our meal we place our dishes, silverware, and
glassware, all of which have our name and number, on trays going
down. When they reach the bottom, they automatically land on a
conveyor belt which takes them directly to the central dishwashing
and sterilizing machine; they come back, clean and sanitary, the
same way."
"What do you do with your garbage and rubbish?"
He took hold of the knob of a small door in the wall beside the dumb
waiter.
"Oh," I said, "that's your incinerator."
"No," he replied, "we do not burn such valuable materials. We put
our garbage into paper bags, seal it, and throw it into this opening.
It reaches a garbage car which takes it to a large factory where it is
turned into fertilizer. Our rubbish is wrapped up and sent down the
dumb-waiter. The belt conveyor takes it to the assorting room, and
again by belt conveyors for long distances to our factories. Very little
is wasted.
"The kitchen in our home is seldom used. Underneath the court
there is a large central kitchen, where any housewife can have her
dinner cooked. She either just brings her raw food to the chef, or
gives him directions over the phone, telling him for how many
people and the time to be served. If the chef needs raw foods, he
sends to the commissary department.
"The commissary department supplies foods and beverages to all the
residents of a community of five or more courts. It is also an
ordering and receiving station from our main depots, which you have
seen from the air. Daily supplies are shipped from the depot by our
underground freight cars. Emergency shipments are made by
messenger planes."
"Does the commissary department ever run short of supplies
because of an unusual demand?" I asked.
"If it does, it can then requisition from another nearby department,"
he answered. "If people are inclined to be gluttonous, and it
happens at times, even here, we ration them. That situation doesn't
arise frequently, however, and when it does, we study the individual
to find out what causes this unhealthy habit and help him to
eliminate it. Individuals are very quickly cured from such an
unhealthy inclination.
"In the court along the kitchen, there is a public dining room where
each family has a permanently reserved table. Menus are made up
daily, by competent dietitians, who offer nourishing dishes adapted
to the special needs of age, activity, and physical condition of the
individual. When we wish a specially cooked dinner, we must notify
our chef about the change of our menu. Sometimes my wife cooks a
special dinner herself, in one of the small kitchenettes adjoining this
large kitchen. It is only when we have special company that we dine
in our homes."
Mrs. Savona announced luncheon. A metal cooker on the table did
the roasting right in front of us by electronic high frequency short
wave radio. The heat generated in the food cooked it in seconds. It
was so wonderfully flavored and tasty that I enjoyed several
helpings. I complimented my hostess on her good cooking, asking
her if all housewives on Mars were such good cooks.
"Oh, yes, and some are better. A great many are specialists in the
different branches of culinary arts. But we all stress a wholesome
diet. All our girls must take courses in home economics as well as in
practical nursing, pediatrics, and at what you call baby sitting; they
are frequently called to care for children when their parents go out.
We all get, in our court, a week's turn to work and help in our
kitchen. Kitchens in every court are operated by the residents, other
residents operate our dining rooms; but it is all done under the
supervision of our chef and head waiter.
"We live in what you earth people would call a community style.
Every community has five or six courts, as you must have seen from
the air, laid out in cluster near each other. The young couples like
ourselves who bring up families and who need more rooms occupy
single homes or two family homes. The four-story apartment
houses, which surround the larger courts, are occupied by people
who have already raised their families and who need less space.
"Every community has its preliminary school, hospital, and with
provisions for one bed for every twenty persons and one physician
for every fifty adults or twenty-five couples and their families in the
community. There are also a drug store, theatre, moving picture and
television house, gymnasium, dance hall, for the young boys and
girls, social clubs for the young and the aged, music band, skating
rink during the winter, and indoor and outdoor playgrounds for the
very young children. Of course, there is constant intermingling,
between those living in adjoining and other communities.
"We also have our own court of justice presided over by a conciliator
chosen from our retired aged residents every year. This court settles
our personal disputes. If we wish, we can call in an outside impartial
arbitrator. We also have in this city a superior court of appeal,
presided over by ten retired, aged Martians who are elected by all
our city residents for a four year term. Anyone can appeal his case
and get a hearing. Our court, comparable to your Supreme Court, is
also located in Amboria."
Mrs. Savona addressed Xora. "Do not forget that after the next two
weeks you will take your turn as nurse's aide in the hospital. You
had better make the most of your time now in showing around our
Earth guest."
Luncheon over, Xora suggested taking a walk. "It's a favorite
diversion of ours," she said. "You can more readily observe our
ground surface while we are strolling."
We went into a spacious outside court with trees, and close cut
lawns. She led me out of the court through an opening in a
beautifully trimmed hedge which she told me surrounded the five or
six courts forming their community. Beyond the hedge, running east
and west, one hundred fifty feet away, was another hedge. The
space between was a street without sidewalks. Along the hedges on
both sides were lines of beautifully shaped shade trees, at equal
distances from each other, carefully pruned to allow shade as well as
sunshine and beauty. There were comfortable benches under them.
Parallel to both hedges were two twenty-five foot strips of beautiful
green lawns in lieu of sidewalks. Between these strips were two
twenty-five foot pathways, paved with a cork or ocean tree lumber
surface, easy and resilient to walk on. In the center and between
these pathways was a fifty foot wide full length flower bed with
passages every 200 feet leading to fountains and statues in the
midst of the flower beds. Happy couples, both young and old,
strolled arm in arm or sat on the comfortable benches. The sweet
scents of beautiful flowers, the freshness of vegetation, and the
pleasant chirping of birds were unspoiled by traffic, and industrial
noises. At the end of these hedges, we came to a very wide cross
street or avenue, lined with pruned and beautifully shaped shade
trees. It seemed as if every street had its own style of trees.
I asked Xora, "I noticed from the air the absence of vehicles on your
streets, and I see none now; don't you use your streets even for
deliveries?"
"No, all our traffic for deliveries and collections is done underground.
To avoid accidents, individuals are forbidden to drive vehicles on the
streets or to walk in our subways. Nor are children allowed to ride
bicycles on the surface as they do on earth. We have no streets, as
you call them. We call them parkways, and they are used exclusively
for our pedestrians, who can walk, rest, and cross in perfect safety,
even in the dark."
"Then you have no street accidents, and even an unattended blind
man can safely at any time cross your parkways in any part of your
city?"
"Yes," she answered, "providing he knows directions and carries a
blind man's feeling compass."
It was a relief to cross safely without trying to find traffic lights, or
stopping to look both ways for approaching automobiles. My
precautions in crossing remained with me for some time, to the
merriment of Martians with whom I happened to be walking.
However, back here in New York I have almost been run over several
times because of my forgetfulness. I did not see a street policeman
there of any kind; a fact which impressed me then, and occurred to
me later. What a relief not to have to run across streets dodging
automobiles and fire engines! The indescribable pleasure of children
playing and the birds twittering added to my feeling. I was in a land
of enchantment.
In the center of the crossroads was an attractive pavilion with
awnings all around it, and with dainty little umbrella tables outside.
Many people were sitting around the tables with refreshments. Xora
led me to a vacant one where a courteous attendant seated us and
gave us a menu with a list of all kinds of ice creams, drinks, fruits,
cakes, and dainty candies. My companion gave the order, after
translating the menu for me. Everyone enjoyed these simple
refreshments in a happy orderly manner. No barkeepers, with their
noisy customers guzzling alcoholic drinks, no disgusting drunkards,
no promiscuous petting, no attempt at pick-ups, no vulgarity, and no
high class "Cafe Society."
In a very comfortable corner spot, there were about five vacant
tables decorated with pennants on top of the umbrella poles. I asked
Xora why these tables were vacant. She said they were reserved for
the over-aged and high ranking members and their immediate
families. So were the best seats in all public assemblies. Others had
to take seats according to their rank and grade degree. Her family
had to take balcony seats, because neither of her parents had as yet
reached higher than the fifth grade.
Bowls of beautiful fresh, conserved, and dried fruits and nuts of
many varieties were placed on our table. Xora said they were not the
best of their kind. The choicest food from the commissary and the
best articles from the general stores were first allotted to the
crippled, the disabled, the sick, the aged, and the high ranking
members and their families.
Momentarily forgetting what her grandfather had told me, I reached
into my pocket for some gold pieces to pay for the refreshments.
She started to laugh and said there was no payment.
"In that event," I said, "I can sit here all day and gorge these, and
go to other pavilions when the supply here is low."
"You can do that," she said, "but you will soon become satiated and
you will not take advantage of such privilege. It's only the small
children who are tempted to partake of more than is good for them.
They are not served without their parents, and they are taught
restraint. These pavilions are at every crossing and are supplied
continually by one of the four adjoining communities for a week
each in their turn. Each community tries to outdo the other in quality
and service, so as to attract more guests. Pavilions and benches on
all our streets contribute a great deal to our social intermingling,
especially during the afternoon teas."
"To whom are all these refreshments charged? There must be an
enormous supply consumed daily."
"They are charged against the account of public supply," she
answered.
"Is there no payment for anything you get here?"
"No! It certainly looks very droll to us when we observe your
payments, your nuisance taxes and all other taxes and licenses you
impose on your citizens.
"Think of your federal, state, county, and city taxes, your licenses,
assessments, permits, and tariffs. How about your large army of
salespeople, cashiers, bookkeepers, examiners, accountants, and
others? Cash registers and office machinery and other derivative
occupations pertaining to your money handling, including your
assessors, collectors and other employees, all wasting their time in
these your boundless non-productive occupations."
For a minute I didn't answer. Then I commented, "your street
cleaners certainly keep your streets in perfect condition. I see no
dust, rubbish, leaves, or papers flying around."
"Of course not," she answered in an offended manner. "We have no
street cleaners, no garbage collectors who, like your Earth ones,
collect rubbish and openly spill it into their wagons, fouling the air of
the whole street for the passersby. Our volunteer gardeners prune
our trees and shrubberies, cut and trim our hedges and lawns, and
plant and keep our flower beds. They have up-to-date tools and
machinery, as well as strong vacuum pumps to take up the dust, and
dead leaves from lawns and walks. The leaves are used for fertilizer.
They take great pride in their work, and each group tries to outdo
the other in keeping the parkways and streets clean and beautiful.
In the winter time we have no snow, ice accumulations, or slippery
walks, because they all are provided with hot water pipes below the
surface."
"I have not seen a foot policeman anywhere. Don't you have them,
or need them?"
"We do not need them," she replied, "with the exception of a few as
directors of air traffic, and one in every court of justice. Neither do
we have or tolerate your tyrannical secret police, or investigating
agents. Have you noticed that we have no locks on our doors or
latches on our windows? No one possesses anything that someone
else would take away or could not obtain himself. We have nothing
of such value that it has to be hidden under lock and keys, put into
safes or safe deposit boxes, or protected by burglar alarms."
"I am surprised," I told her, "that I haven't seen any people of
another race on your walks or in your pavilion. There were many
blue and green Martians on your grandfather's flight ship. Would you
serve any of them at this pavilion?"
She answered with astonishment, "Why not? They would receive the
same service you had."
"Do they live in separate quarters in this city?"
"Oh, no, they don't live among us. But those that visit us, or are
tourists or members of our council, reside here temporarily with us.
They, with their families, occupy some of the best suites in our
largest and best hotels, where travelers and tourists from other cities
and continents of all races reside while in Amboria. They mingle
freely with us, without discrimination, mainly in the center of the
city. When we visit there, you will see many of them."
"You mean that only the people of the white race are permanent
residents of this city?"
"You seem surprised. You're probably judging us by Earth standards.
There, even good citizens supposedly, calling themselves Christians,
practice forms of discrimination. They have no tolerance of other
religious faiths; no tolerance of racial groups. Even in social life,
clubs and other organizations by gentleman's agreement exclude
certain races and creeds. In business a man's ability counts less than
his social connections. This to us seems unfair."
"But how can you eliminate such castes," I asked. "You have your
principles of democracy," she answered. "If your people would follow
them, even follow the principles of their religious creeds sincerely,
intolerance, injustices, and bigotry would soon vanish.
"I have learned in school the history of Earth through moving
pictures taken from our television. We've used television for
thousands of years. We actually see what has happened and what is
now happening on your Earth. We have no white supremacy. Our
white race has never wanted to enslave, exploit or govern our other
races. We have no underprivileged groups of our own or any race.
We have found it best for every race to permanently occupy and
reside within the continent and climate where nature originally
planted it and to have its own territory and sphere of influence. It
takes all our races combined to amicably govern the inhabitants of
our planet; we cooperate with each other, and compete in our
achievements, for the benefit of us all. All our continents and races
are amicably and completely interdependent.
"Scientists, inventors, students, and teachers of one race often
attend universities of other races to learn of their new discoveries
and improved methods and mechanics. Ideas, information, and even
machines are freely exchanged between our races. We equally share
with other continents and races those natural, mineral, and other
products, that we have, and they need. They do the same with us.
We even ration among us the scarce products. Unlike your greedy
nations, we do not forcibly grab or extort from other continents.
"Each race has its own schools of all types, cultural, professional and
trade.
"There is equal representation in our Supreme Government Council.
The President of our Council, or of Mars, can be either male or
female and of any race. In fact, quite often our President is not of
the white race.
"Our other races are just as careful and as proud to maintain their
purity of race as we are. Our laws in that respect are very strict all
over Mars. All of us up to the tenth grade degree, including adult
children of Sun-Rank members, on this globe have the same
standard of living, and we are happy together; difference in race is
no problem to us."
"I certainly am impressed," I answered, "you people certainly solved
that problem easily. You have done away with intolerance, and all
the grievances of discrimination. Tell me more about your governing
class."
"We have no class or racial distinction, no titled nobility, no high and
low castes of society, no dollar aristocracies, no so-called upper
classes, and no retired rich idlers nor jobless poor ones.
"We have one governing upper class, our aged citizens. They have
the intelligence and wisdom that come from maturity and
experience. They act on committees of conciliation and arbitration
between workers, foremen and executives. If their physical and
mental abilities show a natural decline with age, they apply and are
elected to the more easy government and municipal offices,
according to their capabilities. Our factories have separate
apprentice craft training and finishing school shops, where
productive speed is non-existent. The shops are staffed by our
qualified aged, as teachers. Skilled aged workers are frequently used
for precision work.
"By this method, we are able to keep our older people busy and
contented. They give us the best of their experience as long as they
feel able to do so. They keep their self-respect as useful citizens.
"They are our government elected executives, and officials. They are
selected and nominated by their parties, and elected by the people,
as an honor, and as a duty. But only of those who have not reached
the Sun-Rank degrees. Sun-Rank degree members do not and are
not allowed to occupy these offices. A government office with us in
an honorary position without any extra emoluments. Whereas on
your earth very often loyal party members and those who liberally
contribute to its political campaigns reach and get lucrative offices,
and favors."
"How about political parties?" I asked.
"In every one of our races we have sometimes as many as five
political parties, although we don't make a career of politics.
Government executives and officials are not allowed to influence or
bring pressure in favor of or against candidates.
"Because of our system, we don't need homes for the aged, where
every day some of the inmates die, and where they talk of death
and plan and prepare for it years in advance. We give them a full
life. They do not sit around stagnating. They are carefully watched
by our medical department. Our aim is to have them live the longest
possible time and not get tired of it. Thus, most of them live longer
than they would otherwise, and die in harness. Our love and respect
for them intensify our desire to have our aged parents, relations,
and all others live their full life span. They are no burden to us, and
we have nothing to gain by their early death. We are not like some
of you on Earth, eagerly looking forward to their demise to inherit
their fortune. All soft jobs, as you call them, such as employment
bureaus, government and municipal libraries, museums, and other
public offices are exclusively directed and staffed by them. These
appointments are made on a merit basis only. To the contrary, in
your country; so many high and low positions are filled from the
ranks of the politically faithful.
"We on Mars are wondering why your government has created what
you call the Federal Old Age and Survivors Insurance, through your
Social Security Boards, for your old people; and then provide them
with such a small pension. Not only are the old people neglected, it
seems to us, but money which could help them is lavishly spent on
sumptuous Social Security Board offices staffed by young, and high
salaried officials."
By this time my mind was alert. I listened even more carefully as she
summed up her argument.
"We know you have many healthy, self-respecting, sagacious old
people who would fill all those positions better and, I dare say, more
efficiently. At the same time, while thus employed, they would save
your Social Security Board a great deal in old age security
payments."
We were thus absorbed in our conversation at the pavilion. Now she
arose and asked me if I were ready to take a brisk ten mile walk to
the center of the city. "We all walk at least five or ten miles a day,
rain or shine."
I was surprised. "Don't you find taking such long walks harmful to
your feet?"
"Oh, no," she said, "on the contrary, it makes them stronger. It's
exhilarating and invigorating to walk and breathe fresh air. We enjoy
our walks because our shoes are comfortable and soft inside, and do
not deform our feet. They are made to order from lasts of perfect
molds of our feet and fit their functional requirements in motion. In
fact, with few exceptions, all our garments are and must be soft and
loose, so as not to create pressure, or friction to our skin. We believe
in plenty of exercise. Our women do not need, or use your corsets
and your other body torturing contraptions.
"While we walk, I shall try my best to explain to you the layout of
our city. This city, between its east and west rivers, is a little more
than twenty-five terrestrial miles wide. Let us call the pathways
running east and west, streets, and those running north and south,
avenues. They run parallel and at equal distances from each other.
All our communities cover equal surface space, a square fifteen
hundred by fifteen hundred terrestrial feet or 2,250,000 square feet.
All the communities except those adjoining the center oval are
bordered into exact squares by hedges, even though the buildings
within may be laid out in different shapes, so as to make the entire
plan symmetrical and harmonious.
"In the exact center of the city we have a large oval running north
and south. This oval is about five miles wide at the center and
narrows down at both ends to less than a mile; its full length is
twenty miles. The center part is the active spot. I know what you are
thinking—factories, office buildings, business houses. Oh, no. A few
of our manufacturing plants are across the rivers, but all of them are
located on our planet nearest to their natural sources of production,
as you already have been told."
We were so intent in our conversation that I was surprised when she
told me that we had reached the center. I have seldom on earth
covered such a distance in such a short time. I did not feel tired; it
was a pleasure to walk on the resilient pavements.
We were at the edge of a large lake where a great many people
were resting, sitting alongside or rowing in all kinds of boats.
Rainbow-colored fishes, of sizes up to 18 inches, freely and
fearlessly and swiftly glided in the water among all kinds of beautiful
swimming birds.
Xora pointed to an island in the center of the lake with a very large
pavilion. "Our Symphony Orchestra plays there in the late afternoon
tea period, and after dinner in the evening. This lake-shore is very
popular with our people. Others in their homes or sick in hospitals
hear it over their radios.
"There are three large artificial lakes here. The round center one is
the largest. The two oval ones at each end are both larger than your
New York Central Park. In the winter time they are covered with
young and old people skating and playing ice games. All about the
edges of this center are located our libraries, museums, opera
houses, theatres, hotels, stadiums, universities, theological seminary,
dance halls, and public buildings, as well as the stately building of
our Supreme Council of the Planet Mars."
"Where are your temples of worship, and to what kind of religion do
you people profess?"
"Our temples for religious services are located in this city within this
center. In our monotheistic religion we are not like you on Earth with
your many religious faiths which cause disruptions."
So I said, "I recall reading an article by Rev. Harry Emerson Fosdick,
in which he said we must face the fact that religion has helped make
the world a mess. Fosdick is a well-known writer and thinker. He said
that religious differences and prejudices set man against man.
Instead of unifying mankind, religion seems to divide it."[17]
"That's very true," Xora replied. "And at the same time your Earth
babel of over 2,500 languages divide your people too. Here in Mars
with a universal language and a universal deity we can come close
to the ideal of man understanding man."
"What kind of athletic games do you people indulge in?" I asked.
"Now coming back to this center; at both ends and middle sides of
it, we have large stadiums, each seating one hundred thousand
persons. We have games like your football, baseball, basketball,
tennis, running, figure skating, hockey. We also have our own body
flying stunts, for physical upbuilding and enjoyment. Large
exhibitions, performances, and circuses often take place here, but
with no brutal, hazardous and dangerous feats, such as your boxing,
wrestling, high trapeze swinging, wire rope walking, rodeos, bull
fighting, or wild animal training spectacles.
"Now, during our summer or early fall, it is not so crowded here.
This is our vacation and traveling period. Many people frequent the
seashores and the river beaches on both sides of Amboria."
I asked her, "Do you allow swimming in those rivers with all your city
sewers flushing into them?"
"Oh, no," she replied. "We are allowed to swim only in ocean or river
waters, where there are constant water changes, and not in rivers
where waters are used for drinking, and not, as you Earth people do,
in swimming pools. Moreover, our city sewers from toilets, and
dishwashing machines do not run into our rivers; they are too
valuable to be wasted. The sewerage is run or pumped to large
reservoirs with our garbage. The solid matter is taken out and
reprocessed into fertilizers, and the liquids are pumped to fertilize
our deserts and other lands that need it.
"The clean rain water washing down from roofs of buildings through
our rain spouts goes into another sewer line which spills it far out
into the ocean; the rain water from our streets is absorbed by the
soil of our lawns. We do not allow the pollution of our fresh river
drinking waters or our ocean beaches. Not like on your Earth where
many drinking water sources are simply open sewers, with one town
drinking sewage from the next upriver town. One of the worst
offenders is New York. It empties millions of gallons of inadequately
treated sewage into the harbor each day, consequently it makes
swimming at nearby beaches risky.
"Neither do we allow the pollution of our fresh air, as you Earth
people do with your sewage, gases permeating the air on your
streets and through roof vent pipes. These gases are absorbed by
our vacuum pumps and made use of either as fertilizers or as other
elements.
"We have read how you Earth people are made ill from poisonous
fumes that permeate the air in all your manufacturing cities. Los
Angeles with its smog is one of the worst offenders. We know that
chimney soot definitely produces cancer and that asthmatics' hearts
give out because they can scarcely breathe when the air is thick with
smog."
I asked her, "Don't the workers at these sewer pumps and fertilizing
plants feel a strong aversion for their work?"
"On the contrary," she answered, "for these services we have a long
waiting list of applicants from our most brilliant young volunteers.
Some of them have made very meritorious achievements, and a few
have reached our rank degrees. A youth is disgraced and ostracized
by our girls who does not put in his full volunteer year working
diligently at what you Earth people call the lowest menial
occupations.
"The youth who does the most menial work is the one we admire
the most, and the one we consider most honorable. Why should it
be menial, when after all, it is a mutual human service? We give to
each other, to the healthy and to the sick, service for their comforts.
Would you call the duties of mothers, nurses or physicians menial?
"We are shocked and amazed to see on your Earth so many of your
young, healthy, robust, energetic young men who without pride or
shame are engaged in many non-productive occupations as well as
in some which are detrimental to the rest of you. Our youths, in fact
all our workers, would indignantly spurn such employments.
"Nor would any of our youths marry a young lady who did not put in
her volunteer year as practical, probation, and aid nurse in our
hospitals.
"All these menial duties are done only by our young; these menial
duties are not so unpleasant as you may think. With our
improvements in automatic machinery, pumps, and vacuum
cleaners, there is little direct handling. Sanitary gloves and breathing
masks are worn when working at malodorous duties; thereby we are
completely protected from dirt and contamination."
All this conversation was certainly amazing to me. Finally, however,
Xora returned to explaining the city's plan to me.
"Let us go back to our city plan, I want to explain to you so that you
will be able soon to get around by yourself and find your Earth
friends.
"This oval, which, as you know, we call the center, divides our city
from north to south in half, with one part east of it, and the other
part west of it. The street number system is similar to yours in part
of New York. It is in Martian and not in your roman or arabic
numbers. Communities along the center east start with No. 1, First
Street. First Street begins at the most southern point near the ocean
and runs north, and all the other streets are parallel to it. Buildings
around the center are numbered, beginning at the southern end
with No. 1, Center Street East and No. 1, Center Street West, and
going northward on both sides.
"I have another surprise for you. For the last thousand years, our
forebears have anticipated that we would be able to carry off a
number of Earth men to our planet. Whenever they started to travel
in airplanes through the stratosphere. That is the reason we planned
this city when it was recently constructed, in this simple pattern.
When the Earth men came, we thought they could find their way
about more easily. We do not need such careful marking places for
we are like some of your animals, birds and fish. Your homing
pigeon can find its home from long distances; so can your fish, and
often your dog, cat, and horse. They have an acute development of
the sense of direction, and so have we. From land, sea, or in the air,
we can easily find our way and destination. When we are back
home, you will no doubt receive letters from your friends with their
addresses. Would you be able to find them now?"
"Of course I could, quite easily, when I have mastered your number
system; but if they live at distant points, I will have to travel. Will
you at first take me until I can find my own way?"
"Yes, I shall be happy to," she replied. "In the meantime, I want you
to know that my father has made an application for a license for
you. You will soon be called to our traffic bureau and instructed how
to operate our planes, and about our traffic rules. When you have
mastered both, you may select your plane and travel about by
yourself. For short distances, we either walk or use underground
conveyances. Now we will ride back to my home by underground.
"Our subway transits cover most of our city, going north and south
and east and west; every community has its stop-offs, both for
freight and for passenger trains."
We were by now on the same street as the community court. We
went down the escalator at the corner to the passenger train
platform. In place of a ticket window, a trestle, or a coin deposit slot,
I saw a very pleasingly decorated space with comfortable seats, an
attendant who was very anxious to make us comfortable, and clean
comfort stations, which we could safely use without the fear of being
bludgeoned and robbed. The train soon arrived; the conductor with
courtesy led us to two individual seats similar to those in our
Pullman cars. Each seat had a little stand or table upon which were
the latest magazines and newspapers. But we were interested in our
conversation, and paid no attention to the news of the day.
Xora showed me a daily bulletin printed by her community. She told
me that every zone in every city has its own daily newspaper and
radio station. I examined it with interest. The east side of this city
was divided into three zones, and so was the west side. There were
also general dailies for every race on the planet covering all of the
globe news or intercontinental happenings without any display,
classified or other advertisements.
"We have full liberty of the press, radio, pictures and television,"
Xora said. "Our government has no right to censor them unless for
unmoral causes. Otherwise their freedom is inviolable. We are at
liberty to think, talk, broadcast, write about, and criticize our
government executives, or our political, and economic defects, from
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookfinal.com

You might also like