Code Monkey home page Code Monkey logo

attention-plotter's Introduction

Attention Plotter

This is a d3.js-based tool for graphing and comparing volumes of content from multiple media sources and word frequencies within that content over a range of dates. It's part of the Controversy Mapper project at the MIT Center for Civic Media.

It's based on Mike Bostocks's "Grouped Bar Chart" and "Multi-Series Line Chart" d3.js examples, as well as Jim Vallandingham's "How to Animate Transitions Between Multiple Charts" tutorial. It uses the Bootstrap, jQuery, and jQuery.popover libaries.

Live demo of the code: http://erhardtgraeff.com/demo/aplotter/aplotter.html

Installation and Use

Copy the whole directory structure to a server folder. A running server instance is necessary to allow javascript to access the data files. You can either use a hosted server or start a local server in the directory, e.g. python -m SimpleHTTPServer 8888 &.

You should change the title and description of the graph in the aplotter.html file:

      <h1 id="title">Title of the Attention Plot</h1>
      <div id="description">
        <p>Description of the graph.</p>

You should add your own data to the data/media.csv and data/words.csv files. It's recommended you use the example data files as templates. You can also add your own data files to the folder and then change the paths in the aplotter.js file.

Here's the parameters you can change in the aplotter.js file:

// Path to csv file containing volumes of media by day
// Column headers should be: date, [media source 1], [media source 2], ...
// Make sure data is already normalized
// Recommended date format: mmm d
var mediacsv = '../data/media.csv';

// Path to csv file containing word frequencies by day
// Column headers should be: date, word, magnitude
// Dates should be formatted identically to those in media.csv
// Recommended metric for magnitude: tf-idf
var wordscsv = '../data/words.csv';

// Dimensions of the graph
var graphwidth = 2000;
var graphheight = 400;

Files

Files unique to this project are all named aplotter.*:

  • aplotter.html
  • css/aplotter.js
  • js/aplotter.js

Required libraries are in the css/libs and js/libs folders.

attention-plotter's People

Contributors

erhardt avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.