background preloader

Manipulating data like a boss with d3

Manipulating data like a boss with d3
Related:  D3.jsD3

Creating Animations and Transitions With D3 For the ambitious, this is a great intro to creating your own animations and transitions in d3.js. If you get in over your head, drop by the Visually Marketplace to hire one of our talented developers. In interactive visualisation, there is the word reactive. Well, maybe not literally, but close enough. The fact is that reactivity, or the propension of a visualisation to respond to user actions, can really help engage the user in a visualisation, and help them understand its results. So I’ll go ahead and state that animation, if done right, can make any interactive data visualization better. How is that? When coupled with interaction, it’s a very useful way to give feedback to the user. That said, animation can definitely ruin your visualization, too. Animation is very prominent. So we’ve seen how animation is helpful in data visualization. The principle If you know how to draw in d3, you almost know how to animate. Animations are called “transitions” in d3 for a reason. How this is done

How Selections Work Any sufficiently advanced technology is indistinguishable from magic. –Arthur C. Clarke In the past I have presented simplified descriptions of D3’s selections, providing only enough detail to get started. The structure of this article may at first seem arbitrary. D3 is a visualization library, so this article incorporates visual explanations to accompany the text. var array = [42]; Wherever possible, the code that generates the given selection appears immediately above the diagram. Let’s begin. #A Subclass of Array You were probably told that selections are arrays of DOM elements. #Grouping Elements Another reason selections aren’t literally arrays of elements is that they are arrays of arrays of elements: a selection is an array of groups, and each group is an array of elements. var selection = d3.select("body"); In the JavaScript console, try running this command and inspecting the group as selection[0] and the node as selection[0][0]. d3.selectAll("h2"); #Non-Grouping Operations

Data Structures D3.js Accepts The Goal In this section, you will understand how to structure data for better use of D3.js. We will cover where we have been, how D3.js thinks of selections, the basics of JavaScript objects and how to best structure our data. What we have seen thus far Every example we have done with D3.js thus far has included a data set at the top of the example like this one: 1var spaceCircles = [30, 70, 110]; This variable spaceCircles is a JavaScript Array. In the spaceCircles case if we type the following into the JavaScript Console, we'll get: 1var spaceCircles = [30, 70, 110]; 2 3spaceCircles[0] 4 5 6spaceCircles[1] 7 8 9spaceCircles[2] 10 Note: the // characters designate a comment in JavaScript and are not evaluated. JavaScript Arrays can hold any type of information you want to put into them. D3.js Selections are Arrays D3.js Selections are JavaScript Arrays. If you run a simple selection in through the JavaScript console.log in the JavaScript Console: 1console.log(d3.select("body"));

d3.js node.js D3 for Mere Mortals By Luke Francl (look@recursion.org), August 2011 d3.js is a data visualization library by Mike Bostock, who is also the primary creator of Protovis, which D3 is designed to replace. D3 has a steep learning curve, especially if (like me) you are not used to the pixel-precision of graphics programming. To build a visualization with D3, you need to understand JavaScript objects, functions, and the method-chaining paradigm of jQuery; the basics of SVG and CSS; D3's API; and the principles for designing effective infographics. The pay off is that you can create some amazing visualizations with D3 (just look at the examples!). I know very little about D3, but the best way to learn something is to teach it...so here is a very simple introduction to D3 from the beginning. D3 shares similarities with its predecessor Protovis. SVG provides basic shape primitives like line, rect, and circle as well as text and path to build complicated lines and shapes. The result looks like this. Drawing a Bar Chart

The world’s top 50 billionaires: A demographic breakdown. Top 50 Billionaire Breakdown If you asked anyone to picture the wealthiest person in the world at any given time, you could bet on some common denominators: probably a man; probably somehow attached to the words “multinational” or “conglomerate”; probably on a yacht off a private island. With Slate’s Top 50 Billionaire Breakdown, we attempt to visualize the richest of the rich by paring them into demographic categories: age, location, industry, source of wealth, education, and religious affiliation. Some of the sortings are heartening: There are more self-made men than born-rich kids in the top 50, and the self-made billionaires’ total wealth is bigger. Some are less so: The entire African continent has the same number of billionaires as Canada (one each), and there isn’t a single woman in the top 50 who’s self-made. Correction, Nov. 18, 2013: The interactive originally mislabeled the Koch brothers as Jewish.

CSV To JSON Converter Convert CSV to JSON Use the tool on this page to convert CSV data to JSON From CSV/Excel To CSV/Excel Data Tools What can this tool do? What are my options? Choose your attribute names to be upper or lower case Choose to limit the number of records processed Select the fields to output and also rearrange JSON fields Filter JSON output by using the query tool Create nested JSON output by using / in the column headings of CSV. What else? NEW -You can now Save the complete data and settings, and then later Load them from your saved file. Step 1: Select your input Option 1 - Choose a CSV/Excel file Encoding Option 2 - Enter a URL Option 3 - Paste content into text box below: Input Records- Header: false Data: Separator: , Fields: 0 Records: 0 Step 2: Choose input options (optional) Step 3: Choose output options (optional) Step 4: Create Custom Output via Template (optional) Step 5: Generate output Choose Conversion Type: .json

A Brief History of Human Computer Interaction Technology Brad A. Myers Carnegie Mellon University School of Computer Science Technical Report CMU-CS-96-163and Human Computer Interaction Institute Technical Report CMU-HCII-96-103 December, 1996 Please cite this work as: Brad A. Myers. Human Computer Interaction Institute School of Computer Science Carnegie Mellon University Pittsburgh, PA 15213-3891 bam@a.gp.cs.cmu.edu Abstract This article summarizes the historical development of major advances in human-computer interaction technology, emphasizing the pivotal role of university research in the advancement of the field. Copyright (c) 1996 -- Carnegie Mellon University A short excerpt from this article appeared as part of "Strategic Directions in Human Computer Interaction," edited by Brad Myers, Jim Hollan, Isabel Cruz, ACM Computing Surveys, 28(4), December 1996 This research was partially sponsored by NCCOSC under Contract No. Keywords: Human Computer Interaction, History, User Interfaces, Interaction Techniques. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11.

Meteor

Related: