Skip to content

john-guerra/flask_d3_example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flask + D3 example

A simple demo that shows how to create a full stack visualization application that leverages the backend for loading only the data necessary (based on user parameters) for visualizing in the Front End.

This demo uses data from data.gov (Sorry I lost the detailed link), with historical information for th US States. It shows a choropleth map of the states, with the total Revenue per state. See a demo here: http://people.ischool.berkeley.edu/~jguerra/w209/

How to run it?

Make sure you have Flask installed (if having problems make sure to check the Flask documentation on installation )

$ pip install Flask
$ pip install pandas

Then run it like this:

$ FLASK_APP=w209.py flask run

Then open your browser on http://localhost:5000

Structure:

Your backend goes on /w209.py, the one on this example simply loads a csv file using pandas, and sends a JSON response with the states revenues for each year, try it with [http://localhost:5000/getData/2008]

The frontend is a simple HTML file that you can find on /templates/index.html, and that loads all of its resources from the /static folder. There are folders for /static/js, /static/css and /static/data

About

An example combining Flask and d3 to load an US map

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published