Coder Social home page Coder Social logo

cartod3's Introduction

CartoD3

A library for creating D3 vizualizations from a Backbone.CartoDB model object.

Usage

First you have to create a CartoDB instance linked to your account:

var CartoDB = Backbone.CartoDB({user: 'examples'});

Then you have to define a collection (see backbone.cartodb for other ways):

var EarthQuakes = CartoDB.CartoDBCollection.extend({
    sql: function () {
        return "SELECT iso_a3, floor(gdp_md_est / 1000) as gdp_md_est, floor(pop_est / 1000000) as pop_est FROM country_population";
    }
});
var eq = new EarthQuakes();

Next, create a new CartoD3 object and pass it your collection definition:

var CartoD3 = Backbone.CartoD3(eq);

Finally, tell your CartoD3 what view of the CartoDB model you would like to create, including what columns to use for major values (this will require document.ready):

var bubble = new CartoD3.Bubble({ el: $("#cartodb_d3"), variable: 'pop_est', label: 'iso_a3', fill: 'gdp_md_est'});

Examples

Take a look at the examples folder:

Requirements

CartoD3 requires D3, Backbone, and Backbone.CartoDB.

Each visualization type requires different D3 extensions, so take a look at the examples.

Next steps

  • add dom_id parameter to each vis type. this will allow you to register a column (or function to create id) from your backbone.cartodb model as the id to dom for each chart element. then links can be created between the chart and the interactivity layer on a cartodb map

  • allow functions not just column names to be passed as the major parameters of each vis type

  • add option params for chart axes labels and key/legend

  • move the data processing step out of each vis type into a data processing function. each D3 chart type requires different models relative to the cartodb model, update the way i'm creating these

  • implement a bus for the data fetch step. this will allow the user to supply new queries that will change the chart drawing using the D3 map features

  • implement D3 map features for each chart type.

  • move all charts to a Chart view that just takes a chart type as a parameter

cartod3's People

Contributors

andrewxhill avatar eightysteele avatar

Watchers

 avatar  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.