Metadata-Version: 2.1
Name: django-plotly-dash
Version: 0.2.0
Summary: Django use of plotly dash apps through template tags
Home-page: https://github.com/GibbsConsulting/django-plotly-dash
Author: Mark Gibbs
Author-email: django_plotly_dash@gibbsconsulting.ca
License: MIT
Project-URL: Documentation, http://django-plotly-dash.readthedocs.io/
Project-URL: Source, https://github.com/GibbsConsulting/django-plotly-dash
Project-URL: Tracker, https://github.com/GibbsConsulting/django-plotly-dash/issues
Description: # django-plotly-dash
        
        Expose [plotly dash](https://plot.ly/products/dash/) apps as [Django](https:://www.djangoproject.com/) 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>
        
        
        ## 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, just add `django_plotly_dash` to `INSTALLED_APPS` in your Django `settings.py` file
        
            INSTALLED_APPS = [
                ...
                'django_plotly_dash.apps.DjangoPlotlyDashConfig',
                ...
                ]
        
        ## Demonstration
        
        The source repository contains a demo application. To clone the repo and lauch the demo:
        
        ```bash
        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_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](https://dash.plot.ly/) documentation:
        
        ```python
        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:
        
        ```jinja2
        {% load plotly_dash %}
        
        {% plotly_item 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.
        
        
Keywords: django plotly plotly-dash dash dashboard
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3
Description-Content-Type: text/markdown
