Treemap Visualisations



Similar documents
UH CMS Basics. Cascade CMS Basics Class. UH CMS Basics Updated: June,2011! Page 1

DreamFactory & Modus Create Case Study

Support/ User guide HMA Content Management System

Using the Bluemix Analytics for Hadoop Service to Analyse Data

Team Members: Christopher Copper Philip Eittreim Jeremiah Jekich Andrew Reisdorph. Client: Brian Krzys

Qlik REST Connector Installation and User Guide

Exercise 1 : Branding with Confidence

Using Adobe Dreamweaver CS4 (10.0)

Step by Step. Use the Cloud Login Website

4/25/2016 C. M. Boyd, Practical Data Visualization with JavaScript Talk Handout

UOFL SHAREPOINT ADMINISTRATORS GUIDE

Portal Version 1 - User Manual

Salesforce Customer Portal Implementation Guide

Chapter 10 Encryption Service

Richmond Systems. Self Service Portal

Administrator s Guide ALMComplete Support Ticket Manager

UHR Training Services Student Manual

Website Builder Documentation

Using the Content Management System

Google Sites: Creating, editing, and sharing a site

Quick Guide to the Cascade Server Content Management System (CMS)

SerialMailer Manual. For SerialMailer 7.2. Copyright Falko Axmann. All rights reserved.

Creating and Managing Online Surveys LEVEL 2

Webmail Instruction Guide

Ingeniux 8 CMS Web Management System ICIT Technology Training and Advancement (training@uww.edu)

Business Intelligence Office of Planning Planning and Statistics Portal Overview

Adobe Dreamweaver CC 14 Tutorial

Attach receipt options:

Wireless Guest Server User Provisioning Instructions

Richmond SupportDesk Web Reports Module For Richmond SupportDesk v6.72. User Guide

5.1 Features Denver CO 80202

USER GUIDE MANTRA WEB EXTRACTOR.

Dreamweaver CS3 THE MISSING MANUAL. David Sawyer McFarland. POGUE PRESS" O'REILLY 8 Beijing Cambridge Farnham Koln Paris Sebastopol Taipei Tokyo

How is it helping? PragmatiQa XOData : Overview with an Example. P a g e Doc Version : 1.3

BusinessObjects Enterprise XI Release 2

Cascade Server CMS Quick Start Guide

Mura CMS. (Content Management System) Content Manager Guide

Microsoft Expression Web

Simply Accounting Intelligence Tips and Tricks Booklet Vol. 1

UNPAN Portal Content Management System (CMS) User Guide

ITP 101 Project 3 - Dreamweaver

Getting Started with Automizy

CUSTOMER+ PURL Manager

ACE: Dreamweaver CC Exam Guide

Online Booking Guide September 2014

Web Development. Owen Sacco. ICS2205/ICS2230 Web Intelligence

Inspiring Creative Fun Ysbrydoledig Creadigol Hwyl. Web Design in Nvu Workshop Session Plan

Wakanda Studio Features

Configuring Apache HTTP Server as a Reverse Proxy Server for SAS 9.3 Web Applications Deployed on Oracle WebLogic Server

Using Internet or Windows Explorer to Upload Your Site

Chapter 15: Forms. User Guide. 1 P a g e

Virtual Exhibit 5.0 requires that you have PastPerfect version 5.0 or higher with the MultiMedia and Virtual Exhibit Upgrades.

Understanding Business Process Management

Building a Personal Website (Adapted from the Building a Town Website Student Guide 2003 Macromedia, Inc.)

Evaluation of Open Source Data Cleaning Tools: Open Refine and Data Wrangler

Creating Codes with Spreadsheet Upload

Data Export User Guide

SETTING UP AND RUNNING A WEB SITE ON YOUR LENOVO STORAGE DEVICE WORKING WITH WEB SERVER TOOLS

Vodafone Business Product Management Group. Hosted Services Announcer Pro V4.6 User Guide

ORACLE USER PRODUCTIVITY KIT USAGE TRACKING ADMINISTRATION & REPORTING RELEASE 3.6 PART NO. E

Net Services: File System Monitor

Sisense. Product Highlights.

Performance Testing for Ajax Applications

38 Essential Website Redesign Terms You Need to Know

Content Management System

2/24/2010 ClassApps.com

WiredContact Enterprise x3. Admin Guide

SAS Visual Analytics 7.2 for SAS Cloud: Quick-Start Guide

Edwin Analytics Getting Started Guide

Novell ZENworks Asset Management 7.5

PASTPERFECT-ONLINE DESIGN GUIDE

PDG Software. Site Design Guide

Course Information Course Number: IWT 1229 Course Name: Web Development and Design Foundation

SiteBuilder E-Shop User Guide

Use ArcGIS Online to Manage

Joomla! template Blendvision v 1.0 Customization Manual

JTouch Mobile Extension for Joomla! User Guide

Getting Started with Access 2007

WebSpy Vantage Ultimate 2.2 Web Module Administrators Guide

How To Use Query Console

Marketing. User Guide. July Welcome to AT&T Website Solutions SM

MailChimp Instruction Manual

Lecture 9 Chrome Extensions

Umbraco v4 Editors Manual

Introduction to Ingeniux Forms Builder. 90 minute Course CMSFB-V6 P

CA Spectrum and CA Service Desk

Table of Contents. Table of Contents 3

Broner Issue Tracking System User Guide

Designing portal site structure and page layout using IBM Rational Application Developer V7 Part of a series on portal and portlet development

BT CONTENT SHOWCASE. JOOMLA EXTENSION User guide Version 2.1. Copyright 2013 Bowthemes Inc.

WatchDox Administrator's Guide. Application Version 3.7.5

Chapter 1: Introduction. Chapter 2: Website Overview. Chapter 3: DAM Overview. Chapter 4: Editing a Page

Wavecrest Certificate

Microsoft Dynamics CRM Clients

Transcription:

Treemap Visualisations This exercise aims to be a getting started guide for building interactive Treemap visualisations using the D3 JavaScript library. While data visualisation has existed for many years and the theory is well established, recent improvements in technology and browser performance has enabled the provision of interactive visualisations for huge datasets. Treemaps, a rich visualisation for representing numeric data, are especially suited for analysing distribution of resources in large organisations. Introduction This exercise is built around web technologies that, when put together, build powerful and interactive HTML5 web pages. A core part of HTML5 is action, specified using the Javascript language. While Javascript is commonly used for manipulating elements on a web page, more advanced features include graphics and visualisation libraries. D3, one of these libraries, is built especially for multi-dimensional, interactive visualisation of large datasets. The Dataset UK Home Office Flight Data This dataset contains data about flights taken by members of the home office during 2011. This dataset lists items including: Destination region Flight operator (e.g. British Airways) Ticket class Ticket price A treemap visualisation is ideal for this dataset as each of these items, except price, will likely contain many duplicates in the dataset, thus the data can be grouped. For example there are only three different destination regions in the entire dataset. In order to explore and clean the dataset it is recommended that a tool such as Open Refine be used to ensure that the data is ready for visualisation and does not contain any inconsistencies.

GitHub.com To effectively prototype our visualisation, we are going to use GitHub, an online version control tool. One major advantage of using GitHub is that this service provides you with free online web hosting for your project once completed. NOTE: You will need a GitHub account with a verified email address in order to complete this exercise. Step 1 Exploring the Repository For the purposes of this exercise, an example GitHub repository has been created at the following location: https://github.com/ukodi-training/infographics Opening a web browser at this location should show you the main GitHub screen with the Code tab highlighted on the right hand side. The repository contains a website, to view the website simply remix the URL to point at a GitHub.io address: http://ukodi-training.github.io/infographics/ Feel free to browse around this website. It contains a multitude of infographics templates that are used in different exercises. For these exercise we are interested in completing the treemap visualisation. Step 2 Fork the Repository This repository belongs to the ukodi-training user. In order to edit it you will need your own copy; a process known as forking. This process can be carried out from the main github.com repository site (the first url above). To fork the repository, ensure you are logged in and then click the fork button: Once you have forked the repository you will be re-directed to a location from which you can make changes.

Step 3 Exploring the repository Before we can edit the repository, lets have a look at the different parts of the treemap folder. Inside this folder you will find 3 directories and a file called index.html. 1. The index.html page is your web page and defines the structure of the page and locations of related style and action files. 2. The css directory contains cascading style sheets that define the appearance of the web page (colours and font size etc) 3. The js directory contains javascript action files that define how the page interacts with the user. It is in here that we control both the infographic and its interactivity. 4. The data directory contains your data files (csv, json, xml etc) that are loaded by the action scripts and displayed on the web page. Essentially any treemap can be drawn by uploading some data into the data directory and then editing the js/control.js file to define what to do with this data. Step 4 Making the treemap http://your-username.github.io/infographics/ Before we begin, make sure you can see your website but opening the URL above in a new tab alongside your GitHub code repository. You will need the treemap directory for this exercise in both cases. From the GitHub code repository, browse into the data directory note the presence of a file called Home_Office_Air_Travel_Data_2011.csv, click on this file and take a look through the data. In order to create a treemap from this data, we must first decide how to group the data in order to create a hierarchical dataset. Take a lot through the CSV file and note below the order of the columns that you wish to display on your treemap at the various parent child levels. An example for the air travel dataset is given. Air Travel Dataset Destination Supplier_name Ticket_class_description Paid_fare In this example the top level of the tree will split the data by destination (3 options) then by carrier (supplier) and finally by class of ticket. The final element is the numerical paid fare for each ticket; here each ticket represents a leaf of the tree. More on hierarchical data, parent-child relationships and treemaps can be found at the end of this exercise.

Step 5 Editing the control file (js/control.js) In order to edit the control file we need to navigate to the js directory, view the control file and then click the edit button. The control defines a single function that executes when the rest of the web page (document) has loaded (ready). This means that the client s web browser has loaded the structure and style files and is ready to execute actions; you cannot perform actions on something that is not loaded. The action in this case is to load some data, translate it into hierarchical form and then draw a treemap. 5a Load some data You first line of code in our control file calls the d3.csv function. This function loads a file and returns its contents as a csv data object (csv_data). Change this function call to point to the data file in the data direction you want to use. Once the data is loaded, the function returns csv_data which can then be manipulated in terms of columns and rows. d3.csv essentially loads a tabular csv file into a tabular data structure ready to be manipulated. 5b Change data from tabular to hierarchical The second stage involves changing our data structure from tabular to hierarchical using the structure that you defined in Step 4. To do this we can use the d3.nest() function which will give us back our hierarchical nested_data. In order to define the order of the nesting, change d.grand_parent, d.parent and d.child to the column titles at each level. The follow example corresponds with that given in Step 4. NOTE: Do not define the last element by which the summation of the treemap is done (e.g. Paid_fare), this is done in the next step. If you need more levels of nesting, add another.key(.. row above the final.entries(.. line.

5c Define the column that contains the values that represent the size of each treemap square The final stage of preparing the control file is to define which column contains the numeric values that will be used to define the size of each area of the treemap. This can be done by editing the column name called in the resortroot() function. The resortroot function parses our new hierarchical dataset and changed the column title of your defined column to the pre-defined values title required for using the data with off-the-shelf treemap implementations in D3. Although we could change the column title in the data itself, this would lose the context of what data the column contains and is considered bad practice. With the data now transformed and translated into the correct form to create a treemap we can now simply hand the data (called root) to the function that draws the treemap (loaddata). In the example this is already done for us. 5d Commit and reload In order to save your control file, scroll to the bottom of the page and fill in some comments about your changes and the click commit changes. As this is a version control system, it is polite to let people know what changes have been made and why at each stage. Additionally you might need to come back later to fix any bugs and typos. Step 6 Viewing the result Simply browse to your treemap example web page in your browser and see if it worked. http://your-username.github.io/infographics/treemap/ If it worked, well done, proceed to step 8. If it didn t proceed to step 7.

Step 7 Debugging If you managed to show a map, fantastic! If not then this section is for you. Many web browsers come with nifty tools to help debug errors on a web site, for the purposes of this exercise we are going to use the Web Inspector in Google Chrome. To access this first ensure you have your broken web page displayed and then right click anywhere on the page itself and click Inspect Element. The web inspector is a very powerful tool and allows you to view the source of a web page, view its performance as well as browse locally stored data. The feature we are interested in is the console, where errors in our scripts will be displayed. In the case of this exercise some of the errors you might see may include: Failed to load resource: the server responded with a status of 404 (Not Found) o Probably an error in your config or the data file is missing Failed to parse, unexpected o You forgot to close a bracket or have too many/few commas and semi-colons in your config file. Uncaught typeerror o The data file is not a csv? Step 8 Extension exercise The challenge here is to redo the exercise with your own dataset, if you haven t done so already. Here is the recipe to get you started: 1. Upload your data to the data directory (you can create a new file and then copy/paste the data) 2. Change the config.js file to point at the new dataset 3. Add the hierarchical structure to the config.js file. 4. Define the column name that dictates the size of each element of the tree 5. Save and view.

Tabular data and hierarchical data In order to draw a treemap, we need our data to in a hierarchical form. Such data has a clear parent-child relationship between every element; the deeper you go, the more children you have and thus the greater the number of grandparents. Grandparent Child Parent As CSV is a tablular format, we are going to need to translate our data from one format to the other. Helpfully we can get a computer to do this for us. Additionally the D3 library works best when data is in the JavaScript Object Notation (JSON) format. Below is an example of a hierarchical dataset in JSON format: { } "name": "Grandparent", "children": [ { "name": "Parent1", "children": [ { "name": "Child_1", "value": 15 }, { "name": "Child_2", "value": 24 }, { "name": "Child_3", "value": 28 }, ] }, { "name": "Parent2", "children": [ { "name": "Child_4", "value": 7 }, { "name": "Child_2", "value": 8 }, ] } ] Grandparent Parent Children While we could translate CSV into this format by hand, we are going to use the d3 nest function.