GithubHelp home page GithubHelp logo

0xbageltoes / subgrounds_visualization_with_dash Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tachikoma000/subgrounds_visualization_with_dash

0.0 0.0 0.0 43 KB

This repo provides explorations and examples of using subgrounds to build dashboards and data analytics web apps.

Python 41.85% Jupyter Notebook 58.15%

subgrounds_visualization_with_dash's Introduction

Subgrounds_visualization_with_dash

This repo provides explorations and examples of using subgrounds to build dashboards and data analytics web apps.

Subgrounds

Subgrounds is a framework for querying, manipulating and visualizing data indexed on The Graph network.

WARNING

Subgrounds is still in the very early stages of development. APIs can and will change (now is the time to make suggestions!). Some features are still incomplete. Documentation is sparse (but getting better). Expect the Subgrounds API to change frequently.

Installation

IMPORTANT: Subgrounds requires Python version 3.10 or higher

Subgrounds is available on PyPi. To install it, run the following:
pip install subgrounds.

Subgrounds uses DASH for visualization, and will install Dash for you. However, if needed, run the following
pip install dash

If you prefer Jupyter notebook or JupyterLab as your development environment, installing jupyter-dash by running the the following
pip install jupyter-dash

A lot of examples utilize the dash bootstrap component. Please install dash bootstrap using the following
pip install dash-bootstrap-components

Quick example

Subgrounds provides wrappers for Plotly objects and Dash components to facilitate visualization of data from The Graph.

Plotly wrappers can be found in the subgrounds.plotly_wrappers submodule. The wrappers include a Figure wrapper as well as wrappers for most Plotly traces (see https://plotly.com/python/reference/). All Plotly trace wrappers accept the same arguments as their underlying Plotly trace with the notable difference being that Subgrounds FieldPath objects can be used as arguments wherever one would usually provide data to the traces.

from subgrounds.plotly_wrappers import Bar, Figure
from subgrounds.dash_wrappers import Graph

borrows = aaveV2.Query.borrows(
  orderBy=aaveV2.Borrow.timestamp,
  orderDirection='desc',
  first=100
)

repays = aaveV2.Query.repays(
  orderBy=aaveV2.Repay.timestamp,
  orderDirection='desc',
  first=100
)

# Dashboard
app = dash.Dash(__name__)

app.layout = html.Div(
  html.Div([
    html.H4('Entities'),
    html.Div([
      # Subgrounds Graph Dash component
      Graph(
        # A Subgrounds Plotly figure 
        Figure(
          subgrounds=sg,
          traces=[
            # Subgrounds Plotly traces
            Bar(x=borrows.reserve.symbol, y=borrows.amount),
            Bar(x=repays.reserve.symbol, y=repays.amount)
          ]
        )
      )
    ])
  ])
)

Generates the following Dash dashboard (at time of writing): Alt text

subgrounds_visualization_with_dash's People

Contributors

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