name = 'dash-4-tickers'
app = Flask(name)
app.debug = True
app.config['key'] = 'secret'
socketio = SocketIO(app)

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
)

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')
import dash.utils as utils
from dash.components import element as el
from dash.components import graph

name = 'dash-1-hello-world'
app = Flask(name)
app.debug = True
app.config['key'] = 'secret'
socketio = SocketIO(app)

# 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', {
import dash.utils as utils
from dash.components import element as el
from dash.components import graph

name = 'dash-1-hello-world'
app = Flask(name)
app.debug = True
app.config['key'] = 'secret'
socketio = SocketIO(app)

# 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', {
Exemple #5
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
Exemple #6
0
            'task': 'newPlot',
            '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')
Exemple #7
0
name = 'dash-4-tickers'
app = Flask(name)
app.debug = True
app.config['key'] = 'secret'
socketio = SocketIO(app)

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)

# define properties for application
name = 'dash-realised-vol-slide'
app = Flask(name)
app.debug = True
app.config['key'] = 'secret'
app.config['last'] = time.time()
socketio = SocketIO(app)
spot = load_data()
graph_id = 'realised-vol-slider'

# 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', {}, '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', {
app.debug = True
app.config['key'] = 'secret'
socketio = SocketIO(app)


graph_id = 'main-graph'
slider_x_id = 'X'
slider_y_id = 'Y'
title_input_id = 'title'

# Write the HTML "includes" blocks to /templates/runtime/dash-2-etch-a-sketch
# Alternatively, include the HTML yourself in that folder
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'),