All Projects → GibbsConsulting → Django Plotly Dash

GibbsConsulting / Django Plotly Dash

Licence: mit
Expose plotly dash apps as django tags

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Django Plotly Dash

Interactive-Dashboards-and-Data-Apps-with-Plotly-and-Dash
Interactive Dashboards and Data Apps with Plotly and Dash, published by Packt
Stars: ✭ 181 (-36.93%)
Mutual labels:  plotly, plotly-dash
dash-mantine-components
Plotly Dash components based on Mantine React Components
Stars: ✭ 263 (-8.36%)
Mutual labels:  plotly, plotly-dash
covid-19
Coronavirus COVID-19 Dashboard - Global Kaggle Data
Stars: ✭ 31 (-89.2%)
Mutual labels:  plotly, plotly-dash
Dash
Analytical Web Apps for Python, R, Julia, and Jupyter. No JavaScript Required.
Stars: ✭ 15,592 (+5332.75%)
Mutual labels:  plotly-dash, plotly
rasterly
Rapidly generate raster images from large datasets in R with Plotly.js
Stars: ✭ 42 (-85.37%)
Mutual labels:  plotly, plotly-dash
Dash.jl
Dash for Julia - A Julia interface to the Dash ecosystem for creating analytic web applications in Julia. No JavaScript required.
Stars: ✭ 248 (-13.59%)
Mutual labels:  plotly-dash, plotly
gaitutils
Extract and visualize gait data
Stars: ✭ 28 (-90.24%)
Mutual labels:  plotly, plotly-dash
Plotly.py
The interactive graphing library for Python (includes Plotly Express) ✨
Stars: ✭ 10,701 (+3628.57%)
Mutual labels:  plotly-dash, plotly
dash-admin
CLI tool for initiating dash boilerplate
Stars: ✭ 22 (-92.33%)
Mutual labels:  plotly, plotly-dash
dash-redis-celery-periodic-updates
Demo apps now maintained in https://github.com/plotly/dash-enterprise-docs
Stars: ✭ 47 (-83.62%)
Mutual labels:  plotly, plotly-dash
Slapdash
Boilerplate for bootstrapping scalable multi-page Dash applications
Stars: ✭ 225 (-21.6%)
Mutual labels:  plotly-dash, plotly
plotly-resampler
Visualize large time-series data in plotly
Stars: ✭ 200 (-30.31%)
Mutual labels:  plotly, plotly-dash
Plotly.js
Open-source JavaScript charting library behind Plotly and Dash
Stars: ✭ 14,268 (+4871.43%)
Mutual labels:  plotly-dash, plotly
Covid19 Dashboard
🦠 Django + Plotly Coronavirus dashboard. Powerful data driven Python web-app, with an awesome UI. Contributions welcomed! Featured on 🕶Awesome-list
Stars: ✭ 100 (-65.16%)
Mutual labels:  django, plotly
Dash Sample Apps
Open-source demos hosted on Dash Gallery
Stars: ✭ 2,090 (+628.22%)
Mutual labels:  plotly-dash, plotly
2019-nCoV-dash
新型冠状病毒(2019-nCoV)肺炎(COVID-19)疫情展示
Stars: ✭ 13 (-95.47%)
Mutual labels:  plotly, plotly-dash
Front End
Coronavirus COVID19 US Cases Dashboard
Stars: ✭ 42 (-85.37%)
Mutual labels:  plotly-dash, plotly
Fitly
Self hosted web analytics for endurance athletes
Stars: ✭ 65 (-77.35%)
Mutual labels:  plotly-dash, plotly
dash-lollapalooza-brasil-2018
🎟Using Plotly to visualize data from Lollapalooza
Stars: ✭ 23 (-91.99%)
Mutual labels:  plotly, plotly-dash
dash-flexbox-grid
Wrapper around react-flexbox-grid for Plotly Dash
Stars: ✭ 19 (-93.38%)
Mutual labels:  plotly, plotly-dash

django-plotly-dash

PyPI version Downloads Develop Branch Build Status Coverage Status Documentation Status

Expose plotly dash apps as Django tags. Multiple Dash apps can then be embedded into a single web page, persist and share internal state, and also have access to the current user and session variables.

See the source for this project here: https://github.com/GibbsConsulting/django-plotly-dash

This README file provides a short guide to installing and using the package, and also outlines how to run the demonstration application.

More detailed information can be found in the online documentation at https://readthedocs.org/projects/django-plotly-dash

An online version of the demo can be found at https://djangoplotlydash.com

Installation

First, install the package. This will also install plotly and some dash packages if they are not already present.

pip install django_plotly_dash

Then, add django_plotly_dash to INSTALLED_APPS in your Django settings.py file

INSTALLED_APPS = [
    ...
    'django_plotly_dash.apps.DjangoPlotlyDashConfig',
    ...
    ]

The application's routes need to be registered within the routing structure by an appropriate include statement in a urls.py file:

urlpatterns = [
    ...
    path('django_plotly_dash/', include('django_plotly_dash.urls')),
]

The name within the URL is not important and can be changed.

For the final installation step, a migration is needed to update the database:

./manage.py migrate

If using version 3.0 or later of Django, then the use of frames within HTML documents has to be enabled by adding to the settings.py file:

X_FRAME_OPTIONS = 'SAMEORIGIN'

Further configuration, including live updating to share application state, is described in the online documentation.

Demonstration

The source repository contains a demo application. To clone the repo and lauch the demo:

git clone https://github.com/GibbsConsulting/django-plotly-dash.git

cd django-plotly-dash

./make_env                # sets up a virtual environment for development
                          #   with direct use of the source code for the package

./prepare_redis           # downloads a redis docker container
                          #   and launches it with default settings
                          #   *THIS STEP IS OPTIONAL*

./prepare_demo            # prepares and launches the demo
                          #   using the Django debug server at http://localhost:8000

Usage

To use existing dash applications, first register them using the DjangoDash class. This replaces the Dash class of the dash package.

Taking a very simple example inspired by the excellent getting started documentation:

import dash
import dash_core_components as dcc
import dash_html_components as html

from django_plotly_dash import DjangoDash

app = DjangoDash('SimpleExample')

app.layout = html.Div([
    dcc.RadioItems(
        id='dropdown-color',
        options=[{'label': c, 'value': c.lower()} for c in ['Red', 'Green', 'Blue']],
        value='red'
    ),
    html.Div(id='output-color'),
    dcc.RadioItems(
        id='dropdown-size',
        options=[{'label': i, 'value': j} for i, j in [('L','large'), ('M','medium'), ('S','small')]],
        value='medium'
    ),
    html.Div(id='output-size')

])

@app.callback(
    dash.dependencies.Output('output-color', 'children'),
    [dash.dependencies.Input('dropdown-color', 'value')])
def callback_color(dropdown_value):
    return "The selected color is %s." % dropdown_value

@app.callback(
    dash.dependencies.Output('output-size', 'children'),
    [dash.dependencies.Input('dropdown-color', 'value'),
     dash.dependencies.Input('dropdown-size', 'value')])
def callback_size(dropdown_color, dropdown_size):
    return "The chosen T-shirt is a %s %s one." %(dropdown_size,
                                                  dropdown_color)

Note that the DjangoDash constructor requires a name to be specified. This name is then used to identify the dash app in templates:

{% load plotly_dash %}

{% plotly_app name="SimpleExample" %}

The registration code needs to be in a location that will be imported into the Django process before any model or template tag attempts to use it. The example Django application in the demo subdirectory achieves this through an import in the main urls.py file; any views.py would also be sufficient.

Whilst this example allows for the direct use of existing Dash applications, it does not provide for the sharing or updating of internal state. The online documentation provides details on using these and other additional features.

Development

The make_env script sets up the development environment, and pulls in the packages specified in the dev_requirements.txt file. The check_code script invokes the test suite (using pytest) as well as invoking pylint on both the package and the associated demo.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].