Пример #1
0
name = 'dash-3-click-events'
app = Flask(name)
app.debug = True
app.config['key'] = 'secret'
socketio = SocketIO(app)

from example_3_click_events_state import Dash
dash = Dash()

# Write the HTML "includes" blocks to /templates/runtime/dash-3-click-events
# We're using the template "layout_two_column_and_controls" which uses the
# includes blocks: 'controls.html', 'leftgraph.html', and 'rightgraph.html'.
utils.write_templates(
    {
        # 'controls.html' is already written as a raw html file in
        # templates/runtime/dash-3-click-events
        'leftgraph': [graph('bubbles')],
        'rightgraph': [graph('line-chart')]
    }, name
)


@app.route('/')
def index():

    return render_template('layouts/layout_two_column_and_controls.html',
                           app_name=name)


@socketio.on('pong')
def onpong(app_state):
    messages = dash.on_pong(app_state)
Пример #2
0
df_companies = pd.read_csv('companylist.csv')
tickers = list(df_companies['Symbol'])

# Write the HTML "includes" blocks to /templates/runtime/dash-4-tickers
# We're using the template "layout_single_column_and_controls" which uses the
# includes blocks: 'header.html', 'controls.html', and 'main_pane.html'.
utils.write_templates(
    {
        'header': [
            el('H1', {}, 'Yahoo Finance Explorer'),
        ],
        'controls': [
            el('label', {'for': 'ticker'}, 'Ticker'),
            el('input', {
                'name': 'ticker',
                'type': 'text',
                'value': 'GOOG',
                'class': 'u-full-width'
            }, '')
        ],
        'main_pane': [graph('line-chart')]
    }, name
)


@app.route('/')
def index():
    return render_template('layouts/layout_single_column_and_controls.html',
                           app_name=name)
Пример #3
0
name = 'dash-clustering'
app = Flask(name)
app.debug = True
app.config['key'] = 'secret'
socketio = SocketIO(app)

from dash_clustering_iris import Dash
dash = Dash()

# Write the HTML "includes" blocks to /templates/runtime/dash-clustering
# We're using the template "layout_single_column_and_controls" which uses the
# includes blocks: 'controls.html', main_pane.html'.
utils.write_templates(
    {
        'header': [el('h4', {}, 'Iris K-means clustering')],
        # 'controls.html' is already written as a raw html file in
        # templates/runtime/dash-clustering
        'main_pane': [graph('iris')],
    },
    name)


@app.route('/')
def index():

    return render_template('layouts/layout_single_column_and_controls.html',
                           app_name=name)


@socketio.on('pong')
def onpong(app_state):
    messages = dash.on_pong(app_state)
Пример #4
0
app.debug = True
app.config["key"] = "secret"
socketio = SocketIO(app)

from example_3_click_events_state import Dash

dash = Dash()

# Write the HTML "includes" blocks to /templates/runtime/dash-3-click-events
# We're using the template "layout_two_column_and_controls" which uses the
# includes blocks: 'controls.html', 'leftgraph.html', and 'rightgraph.html'.
utils.write_templates(
    {
        # 'controls.html' is already written as a raw html file in
        # templates/runtime/dash-3-click-events
        "leftgraph": [graph("bubbles")],
        "rightgraph": [graph("line-chart")],
    },
    name,
)


@app.route("/")
def index():

    return render_template("layouts/layout_two_column_and_controls.html", app_name=name)


@socketio.on("pong")
def onpong(app_state):
    messages = dash.on_pong(app_state)
Пример #5
0
utils.write_templates(
    {
        'header': [
            el('H1', {}, 'Hello Dash')
        ],

        'controls': [
            el('label', {}, 'Frequency'),
            el('input', {
                'type': 'range',
                'class': 'u-full-width show-values',
                'name': 'frequency',
                'value': 0,
                'min': 1,
                'max': 10,
                'step': 0.1
            }),
            el('label', {}, 'Title'),
            el('input', {
                'type': 'text',
                'name': 'title',
                'placeholder': 'Type away',
                'class': 'u-full-width'
            }, '')
        ],

        'main_pane': [
            graph('sine-wave')
        ]
    }, name
)
Пример #6
0
import dash.utils as utils
from dash.components import element as el
from dash.components import graph

name = __name__
app = Flask(name)
app.debug = True
app.config['key'] = 'secret'
socketio = SocketIO(app)

# Write the HTML "includes" blocks to /templates/runtime/dash-5-push-to-client
# Alternatively, include the HTML yourself in that folder
utils.write_templates(
    {
        'content': [
            el('h1', {}, 'Refresh the data behind the graph'),
            graph('graph')
        ]
    }, name
)


@app.route('/')
def index():
    return render_template('layouts/layout_full_screen.html',
                           app_name=name)


@socketio.on('replot')
def replot(app_state):
    """ Callback for state changes in the front-end
    """
Пример #7
0
# Write the HTML "includes" blocks to /templates/runtime/dash-1-hello-world
# Alternatively, include the HTML yourself in that folder
utils.write_templates(
    {
        'header': [el('H1', {}, 'Hello Dash')],
        'controls': [
            el('label', {}, 'Frequency'),
            el(
                'input', {
                    'type': 'range',
                    'class': 'u-full-width show-values',
                    'name': 'frequency',
                    'value': 0,
                    'min': 1,
                    'max': 10,
                    'step': 0.1
                }),
            el('label', {}, 'Title'),
            el(
                'input', {
                    'type': 'text',
                    'name': 'title',
                    'placeholder': 'Type away',
                    'class': 'u-full-width'
                }, '')
        ],
        'main_pane': [graph('sine-wave')]
    }, name)


@app.route('/')
Пример #8
0
            'data': fig['data'],
            'layout': fig['layout']
        }]

        return messages


dash = Dash()

# Write the HTML "includes" blocks to /templates/runtime/dash-clustering
# We're using the template "layout_single_column_and_controls" which uses the
# includes blocks: 'controls.html', main_pane.html'.
utils.write_templates(
    {
        'header': [el('h4', {}, 'Histogram of @python_tip likes')],
        # 'controls.html' is already written as a raw html file in
        # templates/runtime/dash-clustering
        'main_pane': [graph('hist')],
    },
    name)


@app.route('/')
def index():

    return render_template('layouts/layout_single_column_and_controls.html',
                           app_name=name)


@socketio.on('pong')
def onpong(app_state):
    messages = dash.on_pong(app_state)
Пример #9
0
df_companies = pd.read_csv('companylist.csv')
tickers = list(df_companies['Symbol'])

# Write the HTML "includes" blocks to /templates/runtime/dash-4-tickers
# We're using the template "layout_single_column_and_controls" which uses the
# includes blocks: 'header.html', 'controls.html', and 'main_pane.html'.
utils.write_templates(
    {
        'header': [
            el('H1', {}, 'Yahoo Finance Explorer'),
        ],
        'controls': [
            el('label', {'for': 'ticker'}, 'Ticker'),
            el(
                'input', {
                    'name': 'ticker',
                    'type': 'text',
                    'value': 'GOOG',
                    'class': 'u-full-width'
                }, '')
        ],
        'main_pane': [graph('line-chart')]
    }, name)


@app.route('/')
def index():
    return render_template('layouts/layout_single_column_and_controls.html',
                           app_name=name)
Пример #10
0
app = Flask(name)
app.debug = True
app.config['key'] = 'secret'
socketio = SocketIO(app)

from example_3_click_events_state import Dash

dash = Dash()

# Write the HTML "includes" blocks to /templates/runtime/dash-3-click-events
# We're using the template "layout_two_column_and_controls" which uses the
# includes blocks: 'controls.html', 'leftgraph.html', and 'rightgraph.html'.
utils.write_templates(
    {
        # 'controls.html' is already written as a raw html file in
        # templates/runtime/dash-3-click-events
        'leftgraph': [graph('bubbles')],
        'rightgraph': [graph('line-chart')]
    },
    name)


@app.route('/')
def index():

    return render_template('layouts/layout_two_column_and_controls.html',
                           app_name=name)


@socketio.on('pong')
def onpong(app_state):
    messages = dash.on_pong(app_state)
utils.write_templates(
    {
        'header': [
            el('H1', {}, 'Dash to investigate realised vol')
        ],

        'controls': [
            el('label', {}, 'Frequency 5 to 60 mins'),
            el('input', {
                'type': 'range',
                'class': 'u-full-width show-values',
                'name': 'frequency',
                'value': 0,
                'min': 5,
                'max': 60,
                'step': 5
            }),
            el('label', {}, 'Period 1 to 20 days'),
            el('input', {
                    'type': 'range',
                    'class': 'u-full-width show-values',
                    'name': 'period',
                    'value': 0,
                    'min': 1,
                    'max': 20,
                    'step': 1
                }),
            el('label', {}, 'Title'),
            el('input', {
                'type': 'text',
                'name': 'title',
                'placeholder': 'Type away',
                'class': 'u-full-width'
            }, '')
        ],

        'main_pane': [
            graph(graph_id)
        ]
    }, name
)
Пример #12
0
utils.write_templates(
    {
        'header': [
            el('H1', {}, 'Etch-a-sketch')
        ],

        'controls': [
            el('label', {}, 'X Position'),
            el('input', {
                'type': 'range',
                'class': 'u-full-width show-values',
                'name': slider_x_id,
                'value': 0,
                'min': 10,
                'max': 2000,
                'step': 10
            }),

            el('label', {}, 'Y Position'),
            el('input', {
                'type': 'range',
                'class': 'u-full-width show-values',
                'name': slider_y_id,
                'value': 0,
                'min': 10,
                'max': 2000,
                'step': 10
            }),

            el('label', {}, 'Title'),
            el('input', {
                'class': 'u-full-width',
                'type': 'text',
                'placeholder': 'Type away',
                'name': title_input_id})
        ],

        'main_pane': [
            graph(graph_id)
        ]
    }, name
)