Giter Club home page Giter Club logo

flask-graphs's Introduction

Simple python+flask API demo and d3/c3 data visualization.

Clone and do the setup:

mkvirtualenv flask-graphs
pip install -r requirements.txt

Run an app:

python application.py

Open API app: http://localhost:5000/static/index.html.

Or access API directly:

When application is started, it generates 10000 test data records. Under the hood it uses super-simple in-memory database to store data, so if you re-start an app the data is lost. To add more data - run python generator.py or POST data to /data endpoint:

curl -H "Content-Type: application/json" --data '[{
    "player": "Jack",
    "floor": "Ground",
    "position": {
        "x": 5,
        "y": 7
    },
    "ts": 1420070450
}]' http://localhost:5000/data

Sample data describes a game where we have some stats about players:

  • player - player name
  • floor - the floor player is on now (Underground, Ground, etc)
  • position - current x/y player's position
  • ts - current timestamp

Frontend is a pure html / js application. It queries data via API and then displays a d3 line chart (based on this example) and a c3-based line chart. Chars show count of players for each day.

Also frontend page displays heatmaps of visit count for each X,Y coordinate of each floor. Heatmap is based on this example. If you hover a heatmap cell the tooltip will show X,Y and count of visits.

The frontend page looks like this:

screenshot

flask-graphs's People

Contributors

serebrov avatar

Watchers

James Cloos 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.