clean up files

This commit is contained in:
jllord 2013-05-27 13:57:42 -07:00
parent 9b56244484
commit 57fe85f917
11 changed files with 2 additions and 625 deletions

View File

@ -36,7 +36,7 @@ a.button {border: none;}
#wrapper {margin: 0px auto; max-width: 900px; padding-top: 40px; /*margin-left: 250px;*/}
pre {word-wrap: break-word; padding: 14px; background: #F0F0F0; }
code {font-family: "Consolas", "Ubuntu Mono", monospace; line-height: 22px; font-size: 13px; color: #636363; font-weight: normal;}
.button {padding: 5px 4px; background-color: #fff; font-size: 10px;}
.button {padding: 5px 4px; background-color: #FF7031; font-size: 10px; color: #fff;}
.dotted {margin: 20px -28px; padding: 20px 28px; background-color: #CCF4FF; border: 8px solid #47CCFC; margin-top: 44px; padding-top: 0px;}
.dotted li {padding: 0px 2px;}
.dotted h2 {margin-top: inherit;}
@ -49,7 +49,7 @@ code {font-family: "Consolas", "Ubuntu Mono", monospace; line-height: 22px; font
#latestSpot li, #selectedSpot li{line-height: 34px;}
#hackSpotsTable {cursor: pointer; margin-top: 80px;}
#hackSpotsTable .tHeader {padding: 4px 8px; background: #FF7031;}
#hackSpotsTable .tHeader:hover {color: #FF7031;}
.spotRow:hover {color: #FF7031;}
.spotRow {border-left: 3px solid #ff00ff;}
.hideRow {display: none;}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

View File

@ -1,22 +0,0 @@
<html>
<head>
<title>Hack Spots</title>
<link rel="stylesheet" href="style.css">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript" src="js/lettering.js"></script>
<script>
$(document).ready(function() {
$(".page-title").lettering();
});
</script>
</head>
<body>
<h1 class="page-title">Hack Spots </h1>
<h1></h1>>Hack Spots </h1>
</body>
</html>

View File

@ -1,36 +0,0 @@
<html>
<head>
<style type="text/css">
#myTypingText {
width:700px;
height:120px;
padding:12px;
color:#333;
font-family: Helvetica, sans-serif;
font-size:100px;
line-height:1.5em;
}
#myTypingText::before {
border-left: 2px solid blue;
}
</style>
</head>
<body>
<div id="myTypingText"></div>
<script type="text/javascript" language="javascript">
var myString = "Hack Spots";
var myArray = myString.split("");
var loopTimer;
function frameLooper() {
if(myArray.length > 0) {
document.getElementById("myTypingText").innerHTML += myArray.shift();
} else {
clearTimeout(loopTimer);
}
loopTimer = setTimeout('frameLooper()',100);
}
frameLooper();
</script>
</body>
</html>

View File

@ -1,21 +0,0 @@
<html>
<head>
<title>Hack Spots</title>
<link rel="stylesheet" href="scrap.css">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript" src="js/lettering.js"></script>
<script>
// $(document).ready(function() {
// $(".page-title").lettering();
// });
</script>
</head>
<body>
<h1 class="page-title">Hack Spots<span>&nbsp;</span> </h1>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@ -1,66 +0,0 @@
/*global jQuery */
/*!
* Lettering.JS 0.6.1
*
* Copyright 2010, Dave Rupert http://daverupert.com
* Released under the WTFPL license
* http://sam.zoy.org/wtfpl/
*
* Thanks to Paul Irish - http://paulirish.com - for the feedback.
*
* Date: Mon Sep 20 17:14:00 2010 -0600
*/
(function($){
function injector(t, splitter, klass, after) {
var a = t.text().split(splitter), inject = '';
if (a.length) {
$(a).each(function(i, item) {
inject += '<span class="'+klass+(i+1)+'">'+item+'</span>'+after;
});
t.empty().append(inject);
}
}
var methods = {
init : function() {
return this.each(function() {
injector($(this), '', 'char', '');
});
},
words : function() {
return this.each(function() {
injector($(this), ' ', 'word', ' ');
});
},
lines : function() {
return this.each(function() {
var r = "eefec303079ad17405c889e092e105b0";
// Because it's hard to split a <br/> tag consistently across browsers,
// (*ahem* IE *ahem*), we replaces all <br/> instances with an md5 hash
// (of the word "split"). If you're trying to use this plugin on that
// md5 hash string, it will fail because you're being ridiculous.
injector($(this).children("br").replaceWith(r).end(), r, 'line', '');
});
}
};
$.fn.lettering = function( method ) {
// Method calling logic
if ( method && methods[method] ) {
return methods[ method ].apply( this, [].slice.call( arguments, 1 ));
} else if ( method === 'letters' || ! method ) {
return methods.init.apply( this, [].slice.call( arguments, 0 ) ); // always pass an array
}
$.error( 'Method ' + method + ' does not exist on jQuery.lettering' );
return this;
};
})(jQuery);

View File

@ -1,43 +0,0 @@
@-webkit-keyframes typing {
from { width: 100%; }
to { width:0; }
}
@-webkit-keyframes blink-caret {
from, to { border-color: transparent }
50% { border-color: #07D6FF }
}
@-moz-keyframes typing {
from { width: 100% }
to { width:0 }
}
@-moz-keyframes blink-caret {
from, to { border-color: transparent }
50% { border-color: #07D6FF }
}
h1 {
position: relative;
float: left;
font-size:350%;
font-family: Inconsolata, Courier, monospace;
}
h1 span {
position:absolute;
top:0;
right:0;
width:0;
background: #fff; /* same as background */
border-left: .1em solid #07D6FF;
-moz-box-sizing: border-box;
box-sizing: border-box;
-webkit-animation: typing 10s steps(10, end), /* # of steps = # of characters */
blink-caret 1s step-end infinite;
-moz-animation: typing 10s steps(10, end), /* # of steps = # of characters */
blink-caret 1s step-end infinite;
}

View File

@ -1,65 +0,0 @@
body {font-family: Helvetica, Arial, sans-serif;}
h1 {font-size: 600%;}
/*.char2, .char3, .char4, .char5, .char6, .char7, .char8, .char9, .char10, .char11 {color: fff;}*/
.char1, .char2, .char3, .char4, .char5, .char6, .char7, .char8, .char9, .char10 {
color: #fff;
border-right: 6px solid transparent;
-webkit-animation: typing .5s;
-webkit-animation-fill-mode: forwards;
}
.char10 {
color: #fff;
padding-right: 2px;
border-right: .1em solid transparent;
-webkit-animation: typing 1s infinite;
}
.char1 {
-webkit-animation-delay: .5s;
}
.char1::after {
-webkit-animation-delay: 1s;
}
.char2 {
-webkit-animation-delay: 1.5s;
}
.char3 {
-webkit-animation-delay: 2s;
}
.char4 {
-webkit-animation-delay: 2.5s;
}
.char5 {
-webkit-animation-delay: 3s;
}
.char6 {
-webkit-animation-delay: 3.5s;
}
.char7 {
-webkit-animation-delay: 4s;
}
.char8 {
-webkit-animation-delay: 4.5s;
}
.char9 {
-webkit-animation-delay: 5s;
}
.char10 {
-webkit-animation-delay: 5.5s;
}
.char11 {
-webkit-animation-delay: 6s;
}
@-webkit-keyframes typing {
from, to {color: #333; border-color: #07D6FF; }
/* 25% {border-color: transparent; }
75% {border-color: #07D6FF;}*/
to {color: #333; border-color: transparent;}
}
box.addEventListener( 'webkitTransitionEnd',
function( event ) { alert( "Finished transition!" ); }, false );

View File

@ -1,48 +0,0 @@
<html>
<head>
<title>Typing, Ma!</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript" src="js/lettering.js"></script>
<script>
$(document).ready(function() {
$(".page-title").lettering();
});
</script>
<style>
body {font-family: Helvetica;}
h1 {font-size: 100px;}
.char1, .char2, .char3 {
color: #fff;
border-right: .1em solid transparent;
-webkit-animation: typing .5s;
-webkit-animation-fill-mode: forwards;
}
.char1 {-webkit-animation-delay: .5s;}
.char2 {-webkit-animation-delay: 1s;}
/* or whatever your last character is */
.char3 {
padding-right: 2px;
-webkit-animation: typing 1s infinite;
-webkit-animation: blink 1s infinite;
-webkit-animation-delay: 1.5s;
}
@-webkit-keyframes typing {
from, to {color: #333; border-color: transparent; }
70% {color: #333; border-color: #07D6FF; }
}
@-webkit-keyframes blink {
from, to {color: #333; border-color: transparent; }
50% {border-color: #07D6FF;}
}
</style>
</head>
<body>
<h1 class="page-title">Hi.</h1>
</body>
</html>

View File

@ -1,320 +0,0 @@
<p><em>This is the WIP server-side version, client side version is here: <a href="http://github.com/jllord/sheetsee.js">github.com/jllord/sheetsee.js</a></em></p>
<h3>Server-side Hookup</h3>
<p>The server-side version is in the repo <a href="http://www.github.com/jllord/sheetsee-cache">sheetsee-cache</a>. It uses <a href="http://www.nodejs.org">Node.js</a> to go to Google, get the spreadsheet data (with a Node.js version of <a href="http://npmjs.org/tabletop">Tabletop.js</a>, thanks Max Ogden!) and save it on the server. This means every user that visits the page doesn&#39;t have to wait on Google&#39;s response to load the charts from the data.</p>
<p>When the server builds your page, it will build in your data as the variable gData. All you need to do is add your scripts to the bottom of the page. For the tables/templating you&#39;ll need to wrap them in an event listener so that it doesn&#39;t try and build them before the data has settled. </p>
<pre><code>&lt;script type=&quot;text/javascript&quot;&gt;
document.addEventListener(&#39;DOMContentLoaded&#39;, function() { // IE6 doesn&#39;t do DOMContentLoaded
// table/templating things the rest can be in their own script tags if you&#39;d like
})
&lt;/script&gt;</code></pre>
<h4>Running Locally</h4>
<p>You can run this locally and it will check your internet connection - if you&#39;re not online it will use the last saved data allowing you to develop offline, yay! </p>
<p>Once you download the repo, navigate there in Terminal and type:</p>
<pre><code>npm install
node server.js</code></pre>
<p>This will launch a local server you can visit and develop locally with in your browser. </p>
<p><img src="https://raw.github.com/jllord/sheetsee-cache/master/img/sheetsee-03.png" alt="sheetsee"></p>
<h1>Sheetsee.js</h1>
<p>Sheetsee.js is a JavaScript library, or box of goodies, if you will, that makes it easy to use a Google Spreadsheet as the database feeding the tables, charts and maps on a website. Once set up, any changes to the spreadsheet will auto-saved by Google and be live on your site when a visitor refreshes the page.</p>
<p>Using Google Spreadsheets as the backend database is awesome because it is easy to use, share and collaborate with.</p>
<p>To use sheetsee.js you&#39;ll definitely need to know HTML, CSS and know JavaScript or be not afraid of it and just type what these docs tell you to type. Also, see <a href="http://www.jsforcats.com">JavaScript for Cats</a>, <a href="http://eloquentjavascript.net/">Eloquent JavaScript</a> or <a href="https://developer.mozilla.org/en-US/docs/JavaScript">Mozilla&#39;s Developer Network</a>.</p>
<h3>Dependencies</h3>
<p>Sheetsee.js depends on a few other awesome JavaScript libraries to make all this happen. First, <a href="http://builtbybalance.com/Tabletop/">Tabletop.js</a> gets the data from the Google Spreadsheet and makes it nice. Once you have your data Sheetsee.js makes it easy to set up tables or templates with <a href="http://icanhazjs.com/">IChanHas.js</a>(built on <a href="http://mustache.github.io/">mustache.js</a>), maps with <a href="http://mapbox.com/mapbox.js/example/v1.0.0/">Mapbox.js</a>, and charts with <a href="http://d3js.org/">d3.js</a>. And <a href="http://jquery.com/">jQuery</a> of course powers most of the interactions. It also has many sorting and filtering functions built in so that you can display different parts of your data if you want. Each of these are explained in more detail below.</p>
<h3>CSS</h3>
<p>Sheetsee.js comes with a bare minimum stylesheet. This way you can customize your site to look the way you want to it or to match an existing site&#39;s design.</p>
<h3>Client-side or Server-side</h3>
<p>Sheetsee.js comes in two flavors, <a href="">client-side</a> and <a href="">server-side</a>. The client-side is the most approachable and straightforward, you just include sheetsee.js and the dependencies on your page and use sheetsee.js as normal.</p>
<p>The server-side version is built with <a href="http://www.nodejs.org">Node.js</a> and you&#39;ll need to understand Node and be publishing to a server that runs Node.js apps. This version saves the data on the server so that the browser doesn&#39;t have to fetch from Google at every request, which can sometimes be slow. You can set when the cache expires. It also allows for offline development, huzzah!</p>
<h2>The Short &amp; Sweet</h2>
<ol>
<li>Link to Sheetsee.js and dependencies in your HTML header.</li>
<li>Create a place holder <code>&lt;div&gt;</code> in your HTML for any chart, map or table you want to have.</li>
<li>Create templates for tables in <code>&lt;script&gt;</code> tags.</li>
<li>Create a script tag that waits for the document to load and then executes any of the map, chart or tables you&#39;ve specified in it.</li>
<li>Set it and forget. Now all you need to do is edit the spreadsheet and visitors will get the latest information everytime they load the page.</li>
</ol>
<h2>Bare Minimum Setup</h2>
<p>Ignoring some HTML things to conserve space, you get the point. This gives you a page with a map of your spreadsheets points.</p>
<pre><code>&lt;html&gt;
&lt;head&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://api.tiles.mapbox.com/mapbox.js/v1.0.0/mapbox.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;js/ICanHaz.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;js/jquery.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;js/d3.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;js/sheetsee.js&quot;&gt;&lt;/script&gt;
&lt;link href=&#39;http://api.tiles.mapbox.com/mapbox.js/v1.0.0/mapbox.css&#39; rel=&#39;stylesheet&#39; /&gt;
&lt;/head&gt;
&lt;style&gt; #map {height: 600px; width: 600px;} &lt;/style&gt;
&lt;body&gt;
&lt;div id=&quot;map&quot;&gt;&lt;/div&gt;
&lt;script&gt;
var geoJSON = Sheetsee.createGeoJSON(gData, featureElements)
var map = Sheetsee.loadMap(&quot;map&quot;)
Sheetsee.addTileLayer(map, &#39;examples.map-20v6611k&#39;)
var markerLayer = Sheetsee.addMarkerLayer(geoJSON, map)
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre>
<h2>Awesome Possibilities</h2>
<ol>
<li>Small newsrooms with data for stories but small dev teams.</li>
<li>Friends or groups collaborating on data for a website/project.</li>
<li>Using <a href="http://www.ifttt.com">iftt.com</a> to auto populate spreadsheets which are hooked to a website with Sheetsee.js.</li>
</ol>
<h2>Examples</h2>
<ol>
<li>Hack Spots</li>
<li>Pennies</li>
<li><a href="https://twitter.com/jugglingnutcase">James Sconfitto</a> make a <a href="https://github.com/jugglingnutcase/katiejamie">map of his relationship</a> with his wife &lt;3</li>
</ol>
<h2>Getting Started</h2>
<p>This bit is the same for both client-side and server-side versions.</p>
<h3>Your Data</h3>
<p><img src="https://raw.github.com/jllord/sheetsee-cache/master/img/spreadsheettodata.png" alt="sheetsee"></p>
<p>Your Google Spreadsheet should be set up with row one as your column headers. Row two and beyond should be your data. Each header and row becomes an oject in the final array that Tabletop.js delivers of your data.</p>
<p><img src="https://raw.github.com/jllord/sheetsee-cache/master/img/nonos.png" alt="sheetsee"></p>
<p>There shouldn&#39;t be any breaks or horizontal organization in the spreadsheet. But, feel free to format the style of your spreadsheet as you wish; borders, fonts and colors and such do not transfer or affect your data exporting.</p>
<pre><code>[{&quot;name&quot;:&quot;Coco&quot;,&quot;breed&quot;:&quot;Teacup Maltese&quot;,&quot;kind&quot;:&quot;Dog&quot;,&quot;cuddlability&quot;:&quot;5&quot;,&quot;lat&quot;:&quot;37.74832&quot;,&quot;long&quot;:&quot;-122.402158&quot;,&quot;picurl&quot;:&quot;http://distilleryimage8.s3.amazonaws.com/98580826813011e2bbe622000a9f1270_7.jpg&quot;,&quot;hexcolor&quot;:&quot;#ECECEC&quot;,&quot;rowNumber&quot;:1}...]</code></pre>
<h4>Hexcolor</h4>
<p><img src="https://raw.github.com/jllord/sheetsee-cache/master/img/hexcolors.png" alt="sheetsee"></p>
<p>You must add a column to your spreadsheet with the heading <em>hexcolor</em> (case insensitive). The maps, charts and such use colors and this is the easiest way to standardize that. The color scheme is up to you, all you need to do is fill the column with hexidecimal color values. This <a href="http://color.hailpixel.com/">color picker</a> by <a href="https://twitter.com/hailpixel">Devin Hunt</a> is really nice. #Funtip: Coloring the background of the cell it&#39;s hexcolor brings delight! </p>
<h4>Geocoding</h4>
<p>If you intend to map your data and only have addresses you&#39;ll need to geocode the addresses into lat/long coordinates. Mapbox built a <a href="http://mapbox.com/tilemill/docs/guides/google-docs/#geocoding">plugin</a>
that does this for you in Google Docs. You can also use websites like <a href="http://www.latlong.net/">latlong.net</a> to get the coordinates and paste them into rows with column headers <em>lat</em> and <em>long</em>.</p>
<blockquote>
<p>image of lat and long column headers</p>
</blockquote>
<h4>Publishing Your Spreadsheet</h4>
<p><img src="https://raw.github.com/jllord/sheetsee-cache/master/img/publish.png" alt="sheetsee"></p>
<p>You need to do this in order to generate a unique key for your spreadsheet, which Tabletop.js will use to get your spreadsheet data. In your Google Spreadsheet, click <em>File</em> &gt; <em>Publish to the Web</em>. Then in the next window click <em>Start Publishing</em>; it will then turn into a <em>Stop Publishing</em> button.</p>
<p><img src="https://raw.github.com/jllord/sheetsee-cache/master/img/key.png" alt="sheetsee"></p>
<p>You should have an address in a box at the bottom, your key is the portion between the = and the &amp;. You&#39;ll retrieve this later when you hook up your site to the spreadsheet.</p>
<h3>Your Website</h3>
<p>Before you get started with Sheetsee.js you should plan out your website. Design it, create the basic markup and stylesheet.</p>
<p>For now, create empty <code>div</code> placeholders for the map, chart and tables you plan on including.</p>
<h2>Hooking Up Your Data</h2>
<p>Here the paths diverge:</p>
<h3>Client-side Hookup</h3>
<p>For client-siders, all you need to do is include the depences and sheetsee in your HTML <code>&lt;head&gt;</code> and then in a script tag at the bottom of your page, right before the <code>&lt;/body&gt;</code> tag, you&#39;ll include this:</p>
<pre><code>&lt;script type=&quot;text/javascript&quot;&gt;
document.addEventListener(&#39;DOMContentLoaded&#39;, function() {
var gData
var URL = &quot;0AvFUWxii39gXdFhqZzdTeU5DTWtOdENkQ1Y5bHdqT0E&quot;
Tabletop.init( { key: URL, callback: showInfo, simpleSheet: true } )
})
function showInfo(data) {
gData = data
//
//everything you do with sheetsee goes here
//
}
&lt;/script&gt;</code></pre>
<p>The <strong>URL</strong> variable is the key from your spreadsheet&#39;s longer URL, explained above. <code>Tabletop.init()</code> takes that URL and execute&#39;s Tabletop, when it&#39;s done generating the table it executes the callback <code>showInfo</code> function. It&#39;s inside of this function that you&#39;ll then use your spreadsheet data, <strong>gData</strong>, to do all the Sheetsee.js goodness with. </p>
<h3>Server-side Hookup</h3>
<p>The server-side version is in the repo <a href="http://www.github.com/jllord/sheetsee-cache">sheetsee-cache</a>. It uses <a href="http://www.nodejs.org">Node.js</a> to go to Google, get the spreadsheet data (with a Node.js version of <a href="http://npmjs.org/tabletop">Tabletop.js</a>, thanks Max Ogden!) and save it on the server. This means every user that visits the page doesn&#39;t have to wait on Google&#39;s response to load the charts from the data.</p>
<p>When the server builds your page, it will build in your data as the variable gData. All you need to do is add your scripts to the bottom of the page. For the tables/templating you&#39;ll need to wrap them in an event listener so that it doesn&#39;t try and build them before the data has settled. </p>
<pre><code>&lt;script type=&quot;text/javascript&quot;&gt;
document.addEventListener(&#39;DOMContentLoaded&#39;, function() { // IE6 doesn&#39;t do DOMContentLoaded
// table/templating things the rest can be in their own script tags if you&#39;d like
})
&lt;/script&gt;</code></pre>
<h4>Running Locally</h4>
<p>You can run this locally and it will check your internet connection - if you&#39;re not online it will use the last saved data allowing you to develop offline, yay! </p>
<p>Once you download the repo, navigate there in Terminal and type:</p>
<pre><code>npm install
node server.js</code></pre>
<p>This will launch a local server you can visit and develop locally with in your browser. </p>
<h2>Working With Your Data</h2>
<p>Tabletop.js will return all of your data and it will be passed into your site as an <em>array of objects</em> called <strong>gData</strong>. Sheetsee.js has functions built in to help you filter or use that data in other ways if you&#39;d like.</p>
<h3>Sheetsee.getGroupCount(data, groupTerm)</h3>
<p>This takes in your data, an <em>array of objects</em>, and searches for a <em>string</em>, <strong>groupTerm</strong>, in each piece of your <strong>data</strong> (formerly the cells of your spreadsheet). It returns the number of times it found the <strong>groupTerm</strong>.</p>
<pre><code>getGroupCount(gData, &quot;cat&quot;)
// returns 2</code></pre>
<h3>Sheetsee.getColumnTotal(data, column)</h3>
<p>Given your <strong>data</strong>, an <em>array of objects</em> and a <em>string</em> <strong>column</strong> header, this functions sums each cell in that column, so they best be numbers.</p>
<pre><code>getColumnTotal(gData, &quot;cuddlability&quot;)
// returns 11</code></pre>
<h3>Sheetsee.getAveragefromColumn(data, column)</h3>
<p>A really simple function that builds on <code>getColumnTotal()</code> by returning the average number in a <strong>column</strong> of numbers.</p>
<pre><code>getColumnAverage(gData, &quot;cuddlability&quot;)
// returns 1.8333333333333333</code></pre>
<h3>Sheetsee.getMin(data, column)</h3>
<p>This will return an <em>array</em> of <em>object</em> or <em>objects</em> (if there is a tie) of the element with the lowest number value in the <strong>column</strong> you specify from your <strong>data</strong>.</p>
<pre><code>getMin(gData, &quot;cuddlability&quot;)
// returns {breed: &quot;Fat&quot;, cuddlability: &quot;0&quot;, hexcolor: &quot;#CDCF83&quot;...}, {breed: &quot;Grey&quot;, cuddlability: &quot;0&quot;, hexcolor: &quot;#9C9B9A&quot;...}, {breed: &quot;Creepy&quot;, cuddlability: &quot;0&quot;, hexcolor: &quot;#918376&quot;...}</code></pre>
<h3>Sheetsee.getMax(data, column)</h3>
<p>This will return an <em>array</em> of <em>object</em> or <em>objects</em> (if there is a tie) of the element with the highest number value in the <strong>column</strong> you specify from your <strong>data</strong>.</p>
<pre><code>getMax(gData, &quot;cuddlability&quot;)
// returns {breed: &quot;Teacup Maltese&quot;, cuddlability: &quot;5&quot;, hexcolor: &quot;#ECECEC&quot;, kind: &quot;Dog&quot;, lat: &quot;37.74832&quot;, long: &quot;-122.402158&quot;, name: &quot;Coco&quot;...}</code></pre>
<h3>Don&#39;t Forget JavaScript Math</h3>
<p>Create variables that are the sums, differences, multiples and so forth of others. Lots of info on that <a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math">here on MDN</a>.</p>
<pre><code>var profit09 = Sheetsee.getColumnTotal(gData, &quot;2009&quot;)
var profit10 = Sheetsee.getColumnTotal(gData, &quot;2010&quot;)
var difference = profit09 - profit10</code></pre>
<h4>What These Little Bits are Good For</h4>
<p>You don&#39;t have to just create tables of your data. You can have other portions of your page that show things like, &quot;The difference taco consumption between last week and this week is...&quot; These are easy to create with javascirpt math functions and knowing a little bit more about <a href="http://icanhazjs.com/">icanhas.js</a>. View source on this page to see how I created &quot;Most Cuddlable&quot;.</p>
<h3>Sheetsee.getMatches(data, filter, category)</h3>
<p>Takes <strong>data</strong> as an <em>array of objects</em>, a <em>string</em> you&#39;d like to <strong>filter</strong> and a <em>string</em> of the <strong>category</strong> you want it to look in (a column header from your spreadsheet).</p>
<pre><code>getMatches(gData, &quot;dog&quot;, &quot;kind&quot;)</code></pre>
<p>Returns an <em>array of objects</em> matching the category&#39;s filter.</p>
<pre><code>[{&quot;name&quot;: &quot;coco&quot;, &quot;kind&quot;: &quot;dog&quot;...}, {&quot;name&quot;: &quot;wolfgang&quot;, &quot;kind&quot;: &quot;dog&quot;...},{&quot;name&quot;: &quot;cooc&quot;, &quot;kind&quot;: &quot;dog&quot;...} ]</code></pre>
<h3>Sheetsee.getOccurance(data, category)</h3>
<p>Takes <strong>data</strong> as an <em>array of objects</em> and a <em>string</em> for <strong>category</strong> (a column header from your spreadsheet) you want tally how often an element occured.</p>
<pre><code>getOccurance(gData, &quot;kind&quot;)</code></pre>
<p>Returns an object with keys and values for each variation of the category and its occurance.</p>
<pre><code>{&quot;dog&quot;: 3, &quot;cat&quot;: 3}</code></pre>
<h3>Sheetsee.makeColorArrayOfObject(data, colors)</h3>
<p>If you use <code>getOccurance()</code> and want to then chart that data with d3.js, you&#39;ll need to make it into an <em>array</em> (instead of an object) and add colors back in (since the hexcolor column applies to the datapoints in your original dataset and not this new dataset).</p>
<p>This function takes in your data, as an <em>object</em>, and an <em>array</em> of hexidecimal color strings which you define.</p>
<pre><code>var kinds = getOccurance(gData, &quot;kind&quot;)
var kindColors = [&quot;#ff00ff&quot;, &quot;#DCF13C&quot;]
var kindData = makeColorArrayOfObjects(mostPopBreeds, breedColors)</code></pre>
<p>It will return an array of objects formatted to go directly into a d3 chart with the appropriate <em>units</em> and <em>label keys</em>, like so:</p>
<pre><code>[{&quot;label&quot;: &quot;dog&quot;, &quot;units&quot;: 2, &quot;hexcolor&quot;: &quot;#ff00ff&quot;}, {&quot;label&quot;: &quot;cat&quot;, &quot;units&quot;: 3, &quot;hexcolor&quot;: &quot;#DCF13C&quot;}]</code></pre>
<p>If you pass in an array of just one color it will repeat that color for all items. If you pass fewer colors than data elements it will repeat the sequences of colors for the remainder elements.</p>
<h3>Sheetsee.addUnitsLabels(arrayObj, oldLabel, oldUnits)</h3>
<p>If you&#39;re using gData, the data directly from Tabletop, you&#39;ll need to format it before you use the d3 charts. You&#39;ll need to determine what part of your data you want to chart - what will be your label, what your charting, and what will be your units, how many of them are there (this should be a number).</p>
<pre><code>var gData = [{&quot;name&quot;: &quot;coco&quot;, &quot;kind&quot;: &quot;dog&quot;, &quot;cuddablity&quot;: 5}, {&quot;name&quot;: &quot;unagi&quot;, &quot;kind&quot;: &quot;cat&quot;, &quot;cuddlability&quot;: 0}]</code></pre>
<p>For istance, if from our original data above we want to chart the age of each cat, we&#39;ll use:</p>
<pre><code>Sheetsee.addUnitsLabels(gData, &quot;name&quot;, &quot;cuddlability&quot;)</code></pre>
<p>Which will return an array, ready for the d3 charts:</p>
<pre><code>[{&quot;label&quot;: &quot;coco&quot;, &quot;kind&quot;: &quot;dog&quot;, &quot;units&quot;: 5}, {&quot;label&quot;: &quot;unagi&quot;, &quot;kind&quot;: &quot;cat&quot;, &quot;units&quot;: 0}]</code></pre>
<h2>Make a Map</h2>
<p>Sheetsee.js uses <a href="http://mapbox.com/mapbox.js">Mapbox.js</a>, a <a href="http://leafletjs.com/">Leaflet.js</a> plugin, to make maps.</p>
<p>Create an empty <code>&lt;div&gt;</code> in your HTML, with an id.</p>
<pre><code>&lt;div id=&quot;map&quot;&gt;&lt;/div&gt;</code></pre>
<p>Next you&#39;ll need to create geoJSON out of your data so that it can be mapped.</p>
<h3>Sheetsee.createGeoJSON(data, optionsJSON)</h3>
<p>This takes in your <strong>data</strong> and the parts of your data, <strong>optionsJSON</strong>, that you plan in your map&#39;s popups. If you&#39;re not going to have popups on your markers, don&#39;t worry about it then and just pass in your data. </p>
<pre><code>var optionsJSON = [&quot;name&quot;, &quot;breed&quot;, &quot;cuddlability&quot;]
var geoJSON = Sheetsee.createGeoJSON(gData, optionsJSON)</code></pre>
<p>It will return an <em>array</em> in the special geoJSON format that map making things love. </p>
<pre><code>[{
&quot;geometry&quot;: {&quot;type&quot;: &quot;Point&quot;, &quot;coordinates&quot;: [long, lat]},
&quot;properties&quot;: {
&quot;marker-size&quot;: &quot;small&quot;,
&quot;marker-color&quot;: lineItem.hexcolor
},
&quot;opts&quot;: {the options you pass in},
}}</code></pre>
<h3>Sheetsee.loadMap(mapDiv)</h3>
<p>To create a simple map, with no data, you simply call `.loadMap() and pass in a <em>string</em> of the <strong>mapDiv</strong> (with no #) from your HTML.</p>
<pre><code>var map = Sheetsee.loadMap(&quot;map&quot;)</code></pre>
<h3>Sheetsee.addTileLayer(map, tileLayer)</h3>
<p>To add a tile layer, aka a custom map scheme/design/background, you&#39;ll use this function which takes in your <strong>map</strong> and the source of the <strong>tileLayer</strong>. This source can be a Mapbox id, a URL to a TileJSON or your own generated TileJSON. See <a href="http://mapbox.com/mapbox.js/api/v1.0.2/#L.mapbox.tileLayer">Mapbox&#39;s Documentation</a> for more information.</p>
<pre><code>Sheetsee.addTileLayer(map, &#39;examples.map-20v6611k&#39;)</code></pre>
<p>You can add tiles from awesome mapmakers like <a href="examples.map-20v6611k">Stamen</a> or create your own in Mapbox&#39;s <a href="http://www.mapbox.com/tilemill">Tilemill</a> or <a href="https://tiles.mapbox.com/newmap#3.00/0.00/0.00">online</a>.</p>
<h3>Sheetsee.addMarkerLayer(geoJSON, map)</h3>
<p>To add makers to your map, use this function and pass in your <strong>geoJSON</strong> so that it can get the coordinates and your <strong>map</strong> so that it places the markers there.</p>
<pre><code>var markerLayer = Sheetsee.addMarkerLayer(geoJSON, map)</code></pre>
<h3>Sheetsee.addPopups(map, markerLayer)</h3>
<p>To customize the marker popup content in your map you&#39;ll need to use this entire function on your website.</p>
<pre><code>function addPopups(map, markerLayer) {
markerLayer.on(&#39;click&#39;, function(e) {
var feature = e.layer.feature
var popupContent = &#39;&lt;h2&gt;&#39; + feature.opts.name + &#39;&lt;/h2&gt;&#39; +
&#39;&lt;h3&gt;&#39; + feature.opts.breed + &#39;&lt;/h3&gt;&#39;
e.layer.bindPopup(popupContent,{closeButton: false,})
})
}</code></pre>
<p>You will edit the <strong>popupContent</strong> variable however you&#39;d like your popups to look. To reference the data you sent to you geoJSON you&#39;ll use <code>feature.opts</code> and then one of the column headers you passed into <code>createGeoJSON().</code></p>
<h2>Make a Table</h2>
<p>Sheetsee.js supports making multiple tables or templates with IcanHas.js. It currently supports sorting and filtering on just one table. For each of these you&#39;ll need a <code>&lt;div&gt;</code> in your html, a <code>&lt;script&gt;</code> template and a <code>&lt;script&gt;</code> that calls table making functions.</p>
<h4>Your HTML Placeholder <code>&lt;div&gt;</code></h4>
<p>This is as simple as an empty <code>&lt;div&gt;</code> with an id. This id should match the script tempate id in the next section.</p>
<pre><code> &lt;div id=&quot;siteTable&quot;&gt;&lt;/div&gt;</code></pre>
<h4>Your <code>&lt;script&gt;</code> Template</h4>
<p>Your template is the mockup of what you&#39;d like your table to look like and what content it should show. Most of this is up to you but if you want users to be able to click on headers and sort that column you must make a table row with table headers with the class <em>tHeader</em>.</p>
<p>The variables inside the {{}} must match the column headers in your spreadsheet. Lowercase (?) and remember spaces are ommited, so &quot;Place Name&quot; will become &quot;placename&quot;.</p>
<pre><code>&lt;script id=&quot;siteTable&quot; type=&quot;text/html&quot;&gt;
&lt;table&gt;
&lt;tr&gt;&lt;th class=&quot;tHeader&quot;&gt;City&lt;/th&gt;&lt;th class=&quot;tHeader&quot;&gt;Place Name&lt;/th&gt;&lt;th class=&quot;tHeader&quot;&gt;Year&lt;/th&gt;&lt;th class=&quot;tHeader&quot;&gt;Image&lt;/th&gt;&lt;/tr&gt;
{{#rows}}
&lt;tr&gt;&lt;td&gt;{{city}}&lt;/td&gt;&lt;td&gt;{{placename}}&lt;/td&gt;&lt;td&gt;{{year}}&lt;/td&gt;&lt;td&gt;{{image}}&lt;/td&gt;&lt;/tr&gt;
{{/rows}}
&lt;/table&gt;
&lt;/script&gt;</code></pre>
<h4>Your <code>&lt;script&gt;</code> Execution</h4>
<pre><code>&lt;script type=&quot;text/javascript&quot;&gt;
document.addEventListener(&#39;DOMContentLoaded&#39;, function() { // IE6 doesn&#39;t do DOMContentLoaded
Sheetsee.makeTable(gData, &quot;#siteTable&quot;)
Sheetsee.initiateTableFilter(gData, &quot;#tableFilter&quot;, &quot;#siteTable&quot;)
})
&lt;/script&gt;</code></pre>
<p>To create another table, simply repeat the steps except for <code>initiateTableFilter()</code></p>
<pre><code>&lt;div id=&quot;secondTable&quot;&gt;&lt;/div&gt;
&lt;script id=&quot;secondTable&quot;&gt; // your table template here &lt;/script&gt;
&lt;script&gt;Sheetsee.makeTable(otherData, &quot;#secondTable&quot;)&lt;/script&gt;</code></pre>
<p> Learn more about the things you can do with <a href="http://mustache.github.io/">mustache.js</a>.</p>
<h3>Sheetsee.makeTable(data, targetDiv)</h3>
<p>You&#39;ll call this to make a table out of a <strong>data</strong> and tell it what <strong>targetDiv</strong> in the html to render it in (this should also be the same id as your script template id).</p>
<pre><code>Sheetsee.makeTable(gData, &quot;#siteTable&quot;)</code></pre>
<h2>Table Filter/Search</h2>
<p>If you want to have an input to allow users to search/filter the data in the table, you&#39;ll add this to your html:</p>
<pre><code>&lt;input id=&quot;tableFilter&quot; type=&quot;text&quot; placeholder=&quot;filter by..&quot;&gt;&lt;/input&gt;
&lt;span class=&quot;clear button&quot;&gt;Clear&lt;/span&gt;
&lt;span class=&quot;noMatches&quot;&gt;no matches&lt;/span&gt;</code></pre>
<h3>Sheetsee.initiateTableFilter(data, filterDiv, tableDiv)</h3>
<p>You will then call this function to make that input live:</p>
<pre><code>Sheetsee.initiateTableFilter(gData, &quot;#TableFilter&quot;, &quot;#siteTable&quot;)</code></pre>
<h2>Make a Chart</h2>
<p>Sheetsee.js comes with a d3.js bar, pie and line chart. Each requires your data be an <em>array of objects</em>, formatted to contain &quot;label&quot; and &quot;units&quot; keys. See the section above on Your Data to learn about formatting.</p>
<p>You&#39;ll have to experiement with the charts to find the correct size your <code>&lt;div&gt;</code> will need to be to hold the chart with your data in it nicely.</p>
<p>You can also make your own d3 chart in a separate .js file, link to that and pass your data on to it. I&#39;d love to see people building some other charts that will work with Sheetsee.</p>
<h3>Bar Chart</h3>
<p>To create a bar chart you&#39;ll need to add a placeholder <code>&lt;div&gt;</code> in your HTML with an id.</p>
<pre><code>&lt;div id=&quot;barChart&quot;&gt;&lt;/div&gt;</code></pre>
<p>In your CSS, give it dimensions.</p>
<pre><code>#barChart {height: 400px; max-width: 600px; background: #F8CDCD;}</code></pre>
<p>In a <code>&lt;script&gt;</code> tag set up your options.</p>
<pre><code>var barOptions = {m: [60, 60, 30, 150], w: 600, h: 400, div: &quot;#barChart&quot;, xaxis: &quot;no. of pennies&quot;, hiColor: &quot;#FF317D&quot;}</code></pre>
<ul>
<li><strong>m</strong> is margins: top, right, bottom, left</li>
<li><strong>w</strong> and <strong>h</strong> are width and height, this should match your CSS specs</li>
<li><strong>div</strong> is the id for the <code>&lt;div&gt;</code> in your HTML</li>
<li><strong>xaxis</strong> is optional text label for your x axis</li>
<li><strong>hiColor</strong> is the highlight color of your choosing!</li>
</ul>
<p>Then call the <code>d3BarChart()</code> function with your <strong>data</strong> and <strong>options</strong>.</p>
<pre><code>Sheetsee.d3BarChart(data, barOptions)</code></pre>
<h3>Line Chart</h3>
<p>To create a line chart you&#39;ll need to add a placeholder <code>&lt;div&gt;</code> in your html with an id.</p>
<pre><code>&lt;div id=&quot;lineChart&quot;&gt;&lt;/div&gt;</code></pre>
<p>In your CSS, give it dimensions.</p>
<pre><code>#lineChart {height: 400px; max-width: 600px; background: #F8CDCD;}</code></pre>
<p>In a <code>&lt;script&gt;</code> tag set up your options.</p>
<pre><code>var lineOptions = {m: [80, 100, 120, 100], w: 600, h: 400, div: &quot;#lineChart&quot;, yaxis: &quot;no. of pennies&quot;, hiColor: &quot;#14ECC8&quot;}</code></pre>
<ul>
<li><strong>m</strong> is your margins: top, right, bottom, left</li>
<li><strong>w</strong> and <strong>h</strong> are width and height, this should match your CSS specs</li>
<li><strong>div</strong> is the id for the <code>&lt;div&gt;</code> in your HTML</li>
<li><strong>yaxis</strong> is optional text label for your y axis</li>
<li><strong>hiColor</strong> is the highlight color of your choosing!</li>
</ul>
<p>Then call the <code>d3LineChart()</code> function with your <strong>data</strong> and <strong>options</strong>.</p>
<pre><code>Sheetsee.d3LineChart(data, lineOptions)</code></pre>
<h3>Pie Chart</h3>
<p>To create a bar chart you&#39;ll need to add a placeholder <code>&lt;div&gt;</code> in your html with an id.</p>
<pre><code>&lt;div id=&quot;pieChart&quot;&gt;&lt;/div&gt;</code></pre>
<p>In your CSS, give it dimensions.</p>
<pre><code>#pieChart {height: 400px; max-width: 600px; background: #F8CDCD;}</code></pre>
<p>In a <code>&lt;script&gt;</code> tag set up your options.</p>
<pre><code>var pieOptions = {m: [80, 80, 80, 80], w: 600, h: 400, div: &quot;#pieChart&quot;, hiColor: &quot;#14ECC8&quot;}</code></pre>
<ul>
<li><strong>m</strong> is your margins: top, right, bottom, left</li>
<li><strong>w</strong> and <strong>h</strong> are width and height, this should match your CSS specs</li>
<li><strong>div</strong> is the id for the <code>&lt;div&gt;</code> in your HTML</li>
<li><strong>hiColor</strong> is the highlight color of your choosing!</li>
</ul>
<p>Then call the <code>d3PieChart()</code> function with your <strong>data</strong> and <strong>options</strong>.</p>
<pre><code>Sheetsee.d3PieChart(data, pieOptions)</code></pre>
<h2>Big Time Thanks</h2>
<p>Thanks to <a href="http://www.codeforamerica.org">Code for America</a> for providing the platform me to build the first version of sheetsee.js for Macon, Georga.</p>
<p>Thanks to <a href="http://www.twitter.com/dansinker">Dan Sinker</a> at <a href="http://www.mozillaopennews.org/">Open News</a> for having faith and getting things together to make this Code Sprint happen and thanks to <a href="https://twitter.com/whatsnewmedia">Matt Green</a> at WBEZ for being a willing partner.</p>
<p>Thanks to <a href="http://www.twitter.com/maxogden">Max Ogden</a> for emotional support, teaching me JavaScript and working on the harder parts of Sheetsee.js - especially for making <a href="npmjs.org/tabletop">Tabletop.js for Node.js</a>.</p>
<p>Thanks to all the authors and contributors to Tabletop.js, Mapbox.js, Leaflet.js, jQuery, ICanHas.js and d3.js. Thanks to Google and the Internet for existing and to all those who&#39;ve written tutorials or asked or answered a question on StackOverflow.</p>
<p>Thanks to Mom and Dad for getting a computer in 1996 and the mIRC scripts I started writing that I suppose would eventually lead me here.</p>