Metadata-Version: 2.4
Name: pyxll-dash
Version: 0.0.1
Summary: Adds Plotly Dash support to PyXLL for integrating Dash apps into Microsoft Excel.
Author-email: Tony Roberts <tony@pyxll.com>
License-Expression: MIT
Project-URL: Repository, https://github.com/pyxll/pyxll-dash
Project-URL: Issues, https://github.com/pyxll/pyxll-dash/issues
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: Microsoft :: Windows
Description-Content-Type: text/markdown
License-File: LICENSE.md
Requires-Dist: pyxll
Requires-Dist: dash
Requires-Dist: werkzeug
Dynamic: license-file

# PyXLL-Dash

Plotly Dash Integration for Microsoft Excel.

See the [Plotly Dash Apps In Excel](https://www.pyxll.com/blog/plotly-dash-apps-in-excel).

# Installation

To install this package use:

    pip install pyxll-dash

The PyXLL Excel add-in must also be installed. See [PyXLL](https://www.pyxll.com).

# Usage

Once installed, the `pyxll.plot` function can be called with a dash app object.

Calling `pyxll.plot` with a dash app object from a PyXLL function will display the app in an embedded web control in Excel in the same way as other supported PyXLL plot types.

See [PyXLL Plotting](https://www.pyxll.com/docs/userguide/plotting/index.html) for details of
how to use the `pyxll.plot` function.

# Example

```python
from pyxll import xl_func, plot
from dash import Dash, html, dcc, callback, Output, Input
import plotly.express as px
import pandas as pd


@xl_func
def dash_app():

    df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/gapminder_unfiltered.csv')

    app = Dash()

    app.layout = [
        html.H1(children='Title of Dash App', style={'textAlign':'center'}),
        dcc.Dropdown(df.country.unique(), 'Canada', id='dropdown-selection'),
        dcc.Graph(id='graph-content')
    ]

    @app.callback(
        Output('graph-content', 'figure'),
        Input('dropdown-selection', 'value')
    )
    def update_graph(value):
        dff = df[df.country==value]
        return px.line(dff, x='year', y='pop')

    # Show the dash app in Excel using PyXLL's plot function.
    # This requires the "pyxll-dash" package to be installed.
    plot(app)

    return app
```
