GithubHelp home page GithubHelp logo

recline.view.choroplethmap.js's Introduction

Creates choropleth maps for Recline.

Dependencies

https://github.com/NuCivic/leaflet.map.zoomToGeometries.js

Usage

$.ajax({
  url: 'http://example.com/mycsvfile.csv',
  dataType: "text",
  timeout: 500,
  success: function(data) {
    data = data.replace(/(\r\n|\n|\r)/gm,"\n");
    var dataset = new recline.Model.Dataset({
      records: recline.Backend.CSV.parseCSV(data, options)
    });

    var geojson = 'http://example.com/mygeojsonfile.json';

    view = new recline.View.ChoroplethMap({
      // GeoJSON file.
      polygons: geojson,
      // Recline model.
      model: dataset,
      // Column in model that maps to GeoJSON key.
      map_column: "state_code", // As in US State (CA, PA, NY)
      // Optional column to use for choropleth data. If blank all numeric fields
      // are offered.
      selectable_fields: "",
      // Optional breakpoints for data.
      breakpoints: "",
      // GeoJSON property that maps to map_column.
      geojson_key: "stateCode", // Same data as map_column, may have a different name.
      // Human readable name in GeoJSON property list. Optional.
      geojson_label: "stateName,
      // Optional color scale.
      base_color: color_scale,
      // Optional. Can average instead of sum data in selectable fields.
      avg: dataset[0].avg,
      // Opptional. Units for displayed data.
      unitOfMeasure: dataset[0].unitOfMeasure,
    });
  }
});

Output

screen shot 2014-10-27 at 8 33 49 am

Field explanation

viz_entity_explanation

recline.view.choroplethmap.js's People

Contributors

teosibileau avatar acouch avatar topicus avatar ergonlogic avatar msolv avatar

Stargazers

Sajjad Channa avatar Paul Walker avatar  avatar  avatar Andrew Hoppin avatar  avatar georgia bullen avatar

Watchers

Tom Wood avatar Jon Pugh avatar Mike Gifford avatar Avery Smith avatar Janette Day avatar David Sumner avatar Paul Mitchum avatar Josh R. avatar James Cloos avatar Paul Walker avatar Adam Bergstein avatar Andrew Hoppin avatar Federica Pelzel avatar Laura Lanford avatar Andrew Hawks avatar Salah Messaoud avatar Tom Camp avatar Dharizza Espinach B. avatar Grant Dobbe avatar Ethan Teague avatar  avatar Adrienne avatar DKAN Busy Squirrel avatar Krista avatar  avatar Achraf Jeday avatar  avatar Alex Scott avatar  avatar Julie Kramer avatar  avatar devshopbot avatar Dawn McDougall avatar Brian Seek avatar Tiffney Bare avatar  avatar

Forkers

nditech

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.