Giter Club home page Giter Club logo

pivot-chart-demo's Introduction

Pivot Chart Demo

This is a project that uses ElasticSearch, Flask, and the d3 library XCharts to demonstrate pivot charts and graphs based on aggregation queries to ElasticSearch. The front-end uses BackboneJS and Twitter Bootstrap. The backend runs on Tornado web server and Flask.

Requirements

You need to have the latest ElasticSearch (tested on 2.1.1) installed to run this project.

Setup

Check out a fresh copy and enter the directory:

$ git clone https://github.com/chaimpeck/pivot-chart-demo.git
$ cd pivot-chart-demo

Install the Python dependencies:

$ pip install -r requirements.txt

You need to set up the schema in ElasticSearch (which should already be running):

$ curl -XPUT "http://localhost:9200/pivot-demo/" -d'
{
   "mappings": {
      "entry": {
         "properties": {
            "gender": {
               "type": "string"
            },
            "age": {
               "type": "integer"
            },
            "household_income": {
                "type": "integer"
            },
            "favorite_color": {
                "type": "string",
                "index": "not_analyzed"
            },
            "QS6_6": {
                "type": "string",
                "index": "not_analyzed"
            },
            "Q30b": {
                "type": "string",
                "index": "not_analyzed"
            },
            "Q31_1": {
                "type": "string",
                "index": "not_analyzed"
            }
         }
      }
   }
}'

Generate 100k sample entries:

python generate-random-data.py -n 100000  > sample-data.json

Load the sample data into ElasticSearch:

python load-es.py sample-data.json

Run the demo:

python pivot_demo_service.py -p 8080

You should now be able to view the demo in a web browser: http://localhost:8080

If you are accessing it remotely, you will need to supply the username/password: pivot/demo

The Front-end

The front-end consists of three views:

  • Pivot Table: Demonstrates pivot tables that dynamically generated based on a query to elastic search
  • Filters: Allows user interaction to modify the filters by adjusting sliders and checkboxes. The graph changes with the user's actions
  • Search: Send raw queries to elasticsearch - mostly useful for debugging.

Screenshots

This is the graph view: Alt text

And this is the chart view: Alt text

pivot-chart-demo's People

Contributors

jeffp123 avatar

Stargazers

有育哥无奔波 avatar philippe avatar Ruchir Chawdhry avatar  avatar Andy Edmonds avatar

Watchers

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