Пример #1
0
import dash
import dash_bootstrap_components as dbc
from flask_caching import Cache
from whitenoise import WhiteNoise

app = dash.Dash(__name__, external_stylesheets=[dbc.themes.PULSE], suppress_callback_exceptions=True)
server = app.server
cache = Cache(app.server, config={
    'CACHE_TYPE': 'filesystem',
    'CACHE_DIR': 'cache-directory'
})

server.wsgi_app = WhiteNoise(
    server.wsgi_app,
    root='assets/',
    prefix='assets/'
)
Пример #2
0
"""
Dash callbacks with graphs
"""

import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Output, Input
import plotly.graph_objs as go
import pandas as pd

# Read the data
df = pd.read_csv('data/gapminderDataFiveYear.csv')

# Create app
app = dash.Dash()

# Create option list of dictionaries
year_options = []
for year in df['year'].unique():
    year_options.append({'label': str(year), 'value': year})

# Create app layout
app.layout = html.Div([
    dcc.Graph(id='graph'),
    dcc.Dropdown(
        id='year-picker',
        options=year_options,
        # Default value for dropdown
        value=df['year'].min())
])
Пример #3
0
    'MN': 'MINNESOTA',
    'MI': 'MICHIGAN',
    'MH': 'MARSHALL ISLANDS',
    'RI': 'RHODE ISLAND',
    'KS': 'KANSAS',
    'MT': 'MONTANA',
    'MP': 'NORTHERN MARIANA ISLANDS',
    'MS': 'MISSISSIPPI',
    'PR': 'PUERTO RICO',
    'SC': 'SOUTH CAROLINA',
    'KY': 'KENTUCKY',
    'OR': 'OREGON',
    'SD': 'SOUTH DAKOTA'
}
external_stylesheets = [dbc.themes.BOOTSTRAP]
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)

df = pd.read_csv(
    r'C:\Users\Arun\PycharmProjects\Predictor\templates/after removing duplicates.csv'
)

controls = dbc.Card(
    [
        dbc.FormGroup([
            dbc.Label("State", color='light'),
            dcc.Dropdown(id="state",
                         options=[{
                             'label': postal[i],
                             'value': i
                         } for i in df['State'].unique()],
                         value=[],
Пример #4
0
import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly
import plotly.express as px
import os

gapminder = plotly.data.gapminder()
btm = html.Div([
    dcc.Link("メニューに戻る test", href="/")
], style={"textAlign": "center"})

app = dash.Dash(__name__)
app.config.suppress_callback_exceptions = True

server = app.server

app.layout = html.Div([
    dcc.Location(id="url"),
    html.Div([
        html.P("Dash-Samples", style={"fontSize": 30,
                                      "textAlign": "center", "color": "lime"})
    ]),
    html.Div(id="page-contents"),
], style={"width": "85%", "margin": "auto"})

index_page = html.Div([
    html.Div([
        dcc.Link("Dash入門 - DashのグラフにPlotlyを利用する - 散布図のアニメーション",
                 href="/scatter-animation", style={"textDecoration": "none"})], style={"margin": 30}),
    html.Br(),
Пример #5
0
import dash
import dash_bootstrap_components as dbc
import dash_html_components as html
from dash.dependencies import Input, Output

app = dash.Dash(
    __name__,
    external_stylesheets=['css/bootstrap.min.css']
)

app.layout = html.Div(
    dbc.Container(
        [
            html.Br(),
            html.Br(),
            html.Br(),
            dbc.Row(
                [
                    dbc.Col(
                        dbc.Input(id='input1'),
                        width=4
                    ),
                    dbc.Col(
                        dbc.Label(id='output1'),
                        width=4
                    )
                ]
            ),
            dbc.Row(
                [
                    dbc.Col(
Пример #6
0
import dash
import dash_core_components as dcc
import dash_html_components as html

import colorlover as cl
import datetime as dt
import flask
from flask_cors import CORS
import os
import pandas as pd
from pandas_datareader.data import DataReader
import time

app = dash.Dash('stock-tickers',
                url_base_pathname='/dash/gallery/stock-tickers/')
server = app.server
CORS(server)

if 'DYNO' in os.environ:
    app.config.routes_pathname_prefix = '/dash/gallery/stock-tickers/'
    app.config.requests_pathname_prefix = 'https://dash-stock-tickers.herokuapp.com/dash/gallery/stock-tickers/'

app.scripts.config.serve_locally = False
dcc._js_dist[0][
    'external_url'] = 'https://cdn.plot.ly/plotly-finance-1.28.0.min.js'

colorscale = cl.scales['9']['qual']['Paired']

df_symbol = pd.read_csv('tickers.csv')

app.layout = html.Div([
Пример #7
0
        {'property': 'og:description',
         "content": "Hi! My name is Jordan. Here is my COVID-19 tracking application built in Dash and served by Flask and AWS. It is updated with various scraping APIS. Timescale Resolution."
         }

    ]

    return meta_tags


# external CSS stylesheets
external_stylesheets = [
    'https://cdnjs.cloudflare.com/ajax/libs/weather-icons/2.0.9/css/weather-icons.min.css',
    'https://cdnjs.cloudflare.com/ajax/libs/weather-icons/2.0.9/css/weather-icons-wind.min.css']


app = dash.Dash(__name__, meta_tags=get_meta(), external_stylesheets=external_stylesheets)
app.title = "COVID-19 Bored"

app.config['suppress_callback_exceptions'] = True
app.index_string = open('assets/customIndex.html').read()

# Serve layout in a function so we can update it dynamically
# Must go after the app is initialized


def serve_layout():
    callbacks.serve_data(serve_local=False)
    return html.Div([
        dcc.Location(id='url', refresh=False),
        html.Div(id='page-layout')])
Пример #8
0
import dash_grid_layout as dgl
import dash
import dash_html_components as html
import dash_core_components as dcc
from dash.exceptions import PreventUpdate

app = dash.Dash('')

app.scripts.config.serve_locally = True


def generate_new_dash_item(idx,
                           x=0,
                           y=0,
                           w=4,
                           h=4,
                           grid_width=150,
                           grid_height=150):
    return html.Div(
        key=idx,
        children=[
            html.Div(className="widget-drag-handle",
                     children="{} another draggable bit".format(idx)),
            # dcc.Graph(
            #         id='{}-example-graph'.format(idx),
            #         style={'height': '{}px'.format(h * grid_height), 'width': '{}px'.format(w * grid_width)},
            #         figure={
            #             'data': [
            #                 {'x': [1, 2, 3], 'y': [4, 4, 4], 'type': 'bar', 'name': idx},
            #                 {'x': [1, 2, 3], 'y': [1, 1, 1], 'type': 'bar', 'name': u'Montr?al'},
            #             ],
Пример #9
0
from sqlalchemy import create_engine

engine = create_engine(
    'postgresql://*****:*****@dash-demo.cp4nbyprm5jt.us-east-2.rds.amazonaws.com/strategy'
)
df = pd.read_sql("SELECT * from trades",
                 engine.connect(),
                 parse_dates=('Entry time', ))

#df = pd.read_csv('aggr.csv', parse_dates=['Entry time'])
#df = df.sort_values('Entry time') # if you are going to calcucate raturns base on the final and initial date, you should sort the data by date
df['YearMonth'] = pd.to_datetime(df['Entry time'].dt.strftime('%b %Y'))

app = dash.Dash(__name__,
                external_stylesheets=[
                    'https://codepen.io/uditagarwal/pen/oNvwKNP.css',
                    'https://codepen.io/uditagarwal/pen/YzKbqyV.css'
                ])

app.layout = html.Div(children=[
    html.Div(children=[
        html.H2(children="Bitcoin Leveraged Trading Backtest Analysis",
                className='h2-title'),
    ],
             className='study-browser-banner row'),
    html.Div(
        className="row app-body",
        children=[
            html.Div(
                className="twelve columns card",
                children=[
Пример #10
0
simple_classifier_dashboard = ExplainerDashboard(
    clas_explainer,
    title="Simplified Classifier Dashboard",
    simple=True,
    server=app,
    url_base_pathname="/simple_classifier/")

simple_regression_dashboard = ExplainerDashboard(
    reg_explainer,
    title="Simplified Classifier Dashboard",
    simple=True,
    server=app,
    url_base_pathname="/simple_regression/")

index_app = dash.Dash(__name__,
                      server=app,
                      url_base_pathname="/",
                      external_stylesheets=[BOOTSTRAP])

index_app.title = 'explainerdashboard'
index_app.layout = index_layout
register_callbacks(index_app)


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


@app.route('/classifier')
def classifier_dashboard():
    return clas_dashboard.app.index()
import re
from typing import Collection

import dash
import dash_html_components as html
import dash_core_components as dcc
import dash_bootstrap_components as dbc
from dash.dependencies import Output, Input
from dash.exceptions import PreventUpdate
import plotly.graph_objects as go
import plotly.express as px
import pandas as pd

app = dash.Dash(__name__, external_stylesheets=[dbc.themes.COSMO])

poverty_data = pd.read_csv('../data/PovStatsData.csv')
poverty = pd.read_csv('../data/poverty.csv', low_memory=False)

gini = 'GINI index (World Bank estimate)'
gini_df = poverty[poverty[gini].notna()]

regions = [
    'East Asia & Pacific', 'Europe & Central Asia',
    'Fragile and conflict affected situations', 'High income',
    'IDA countries classified as fragile situations', 'IDA total',
    'Latin America & Caribbean', 'Low & middle income', 'Low income',
    'Lower middle income', 'Middle East & North Africa', 'Middle income',
    'South Asia', 'Sub-Saharan Africa', 'Upper middle income', 'World'
]

population_df = poverty_data[~poverty_data['Country Name'].isin(regions) & (
Пример #12
0
    def __init__(self, explainer):
        """
        Init on class instantiation, everything to be able to run the app on server.
        Parameters
        ----------
        explainer : SmartExplainer
            SmartExplainer object
        """
        # APP
        self.server = Flask(__name__)
        self.app = dash.Dash(
            server=self.server,
            external_stylesheets=[dbc.themes.BOOTSTRAP],
        )
        self.app.title = 'Shapash Monitor'
        self.explainer = explainer

        # SETTINGS
        self.logo = self.app.get_asset_url('shapash-fond-fonce.png')
        self.color = '#f4c000'
        self.bkg_color = "#343736"
        self.settings_ini = {
            'rows': 1000,
            'points': 1000,
            'violin': 10,
            'features': 20,
        }
        self.settings = self.settings_ini.copy()
        self.predict_col = ['_predict_']
        self.explainer.features_imp = self.explainer.state.compute_features_import(
            self.explainer.contributions)
        if self.explainer._case == 'classification':
            self.label = self.explainer.check_label_name(
                len(self.explainer._classes) - 1, 'num')[1]
            self.selected_feature = self.explainer.features_imp[-1].idxmax()
            self.max_threshold = int(
                max([
                    x.applymap(lambda x: round_to_1(x)).max().max()
                    for x in self.explainer.contributions
                ]))
        else:
            self.label = None
            self.selected_feature = self.explainer.features_imp.idxmax()
            self.max_threshold = int(
                self.explainer.contributions.applymap(
                    lambda x: round_to_1(x)).max().max())
        self.list_index = []
        self.subset = None

        # DATA
        self.dataframe = pd.DataFrame()
        self.round_dataframe = pd.DataFrame()
        self.init_data()

        # COMPONENTS
        self.components = {
            'menu': {},
            'table': {},
            'graph': {},
            'filter': {},
            'settings': {}
        }
        self.init_components()

        # LAYOUT
        self.skeleton = {'navbar': {}, 'body': {}}
        self.make_skeleton()
        self.app.layout = html.Div(
            [self.skeleton['navbar'], self.skeleton['body']])

        # CALLBACK
        self.callback_fullscreen_buttons()
        self.init_callback_settings()
        self.callback_generator()
Пример #13
0
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html

from layouts import get_app_layout
from app_callbacks import set_app_callbacks
from resources import external_scripts, external_stylesheets, meta_tags


db_url = os.environ.get('db_url')

app_name = 'GreenNet'

app = dash.Dash(app_name,
		            external_scripts = [
                  dbc.themes.BOOTSTRAP] + external_stylesheets,
                meta_tags = meta_tags,
               )

app.title = app_name

server = app.server

app.config.suppress_callback_exceptions = True

set_app_callbacks(app, db_url)

app.layout = get_app_layout(app, app_name)

if __name__ == '__main__':
    app.run_server(debug=True, host="0.0.0.0")
Пример #14
0
        } for row in data_to_use.to_dict('rows')],
        tooltip_duration=None,
        #style_table={'overflowX': 'auto'},
        page_action="native",
        page_current=0,
        page_size=10,
        filter_action='native',
        cell_selectable=False)


external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']

server = Flask(__name__)

app = dash.Dash(__name__,
                external_stylesheets=external_stylesheets,
                server=server)

app.layout = html.Div(children=[
    html.Div(children=[
        html.H1(children='WAF Dashboard'),
        html.Div(children='''
            Dashboard for simple WAF created in Python!
        ''')
    ]),
    html.Div(id='graph',
             children=[
                 dcc.Graph(id='example-graph1',
                           figure=make_subplots(rows=1,
                                                cols=3,
                                                specs=[[{
Пример #15
0
import dash_html_components as html
import dash_bootstrap_components as dbc
import plotly.graph_objects as go

# Data wrangling
import numpy as np
import pandas as pd
import json
import os

from layout.layout import *

#APP_DIR = '/home/michael/Desktop/Biophysics/Dev/KineticsApp'
APP_DIR = os.getcwd()

app = dash.Dash(__name__, external_stylesheets=[dbc.themes.FLATLY])
server = app.server

app.title = "Kinetics Data Ion Channels"
app.config['suppress_callback_exceptions'] = True

CONTENT_STYLE = {
    "margin-left": "18rem",
    "margin-right": "2rem",
    #"padding": "2rem 1rem",
}

app.layout = html.Div([
    produce_sidebar(),
    dcc.Location(id="url"),
    html.Div(id="page-content", style=CONTENT_STYLE),
# Create a list that is required for the slider:
suicide_dataset['year'] = pd.to_datetime(suicide_dataset.year, format='%Y')
suicide_dataset['year'] = suicide_dataset['year'].dt.year
date_list = suicide_dataset['year'].unique().tolist()
date_label = [str(i) for i in date_list]
zipobj = zip(date_label, date_label)
dic_date = dict(zipobj)
# dict_date_hard_code = {i : '{}'.format(i) for i in range(1987,2016, 3)}

# Create an array for year:
year_value = [1985, 2016]
year_value = pd.to_datetime(pd.Series(year_value), format='%Y')
year_value = year_value.dt.year

app = dash.Dash(external_stylesheets=[dbc.themes.SLATE])
server = app.server

app.layout = dbc.Container([
    html.H1('SUICIDES : A GLOBAL IMPERATIVE', style={'text-align': 'center'}),
    html.
    H5('Our dashboard provides an interactive exploration of suicide rates overview from 1985 to 2016. The data is visualized by age, country, gender and generation'
       ),
    html.Br(),
    html.Div([
        dbc.Row([
            dbc.Col(
                [
                    dbc.Card(
                        dbc.CardBody([
                            html.P([
Пример #17
0
import dash
import dash_bootstrap_components as dbc

external_stylesheets = [
    dbc.themes.SKETCHY,  # Bootswatch theme
    'https://use.fontawesome.com/releases/v5.9.0/css/all.css',  # for social media icons
]

meta_tags = [{
    'name': 'viewport',
    'content': 'width=device-width, initial-scale=1'
}]

app = dash.Dash(__name__,
                external_stylesheets=external_stylesheets,
                meta_tags=meta_tags)
app.config.suppress_callback_exceptions = True  # see https://dash.plot.ly/urls
app.title = 'Pothole Predictions'  # appears in browser title bar
server = app.server
Пример #18
0
    fig.update_layout(
        showlegend=False, margin=dict(l=0, r=0, t=0, b=0, pad=0), height=200, yaxis={'title_text': '#words'}
    )

    return fig


args = parse_args()
print('Loading data...')
data, wer, cer, wmr, mwa, num_hours, vocabulary, alphabet, metrics_available = load_data(
    args.manifest, args.disable_caching_metrics, args.vocab
)
print('Starting server...')
app = dash.Dash(
    __name__,
    suppress_callback_exceptions=True,
    external_stylesheets=[dbc.themes.BOOTSTRAP],
    title=os.path.basename(args.manifest),
)


figure_duration = plot_histogram(data, 'duration', 'Duration (sec)')
figure_num_words = plot_histogram(data, 'num_words', '#words')
figure_num_chars = plot_histogram(data, 'num_chars', '#chars')
figure_word_rate = plot_histogram(data, 'word_rate', '#words/sec')
figure_char_rate = plot_histogram(data, 'char_rate', '#chars/sec')

if metrics_available:
    figure_wer = plot_histogram(data, 'WER', 'WER, %')
    figure_cer = plot_histogram(data, 'CER', 'CER, %')
    figure_wmr = plot_histogram(data, 'WMR', 'WMR, %')
    figure_word_acc = plot_word_accuracy(vocabulary)
Пример #19
0
                dbc.Collapse(sidebar, id="sidebar-collapse", navbar=True),
                dbc.Collapse(button, id="button-collapse", navbar=True)
            ],
            align="center",
            no_gutters=True,
        ), ), )
content = html.Div(id="page-content", style=CONTENT_STYLE)

data1 = html.Div([
    html.H4('Substation Data Live Feed'),
    html.Table(id="live-update-text"),
],
                 style={"overflowX": "scroll"})

app = dash.Dash(__name__,
                server=server,
                external_stylesheets=[dbc.themes.BOOTSTRAP, FA])

app.config['suppress_callback_exceptions'] = True


def table(devices):
    table_header = [
        html.Thead(
            html.Tr([
                html.Th('Dev'),
                html.Th('tstamp'),
                html.Th('rphV'),
                html.Th('yphV'),
                html.Th('bphV'),
                html.Th('rphI'),
Пример #20
0
meeples = 'https://mykindofmeeple.com/wp-content/uploads/2019/01/many-meeples-1602-27042020.jpg'

with open('../nodes/artists-nodesfile.data', 'rb') as filehandle:
    # read the data as binary data stream
    nodes = pickle.load(filehandle)


with open('../edges/artist-edgesfile.data', 'rb') as filehandle:
    # read the data as binary data stream
    edges = pickle.load(filehandle)


elm_list = nodes + edges

app = dash.Dash(__name__, external_stylesheets=[dbc.themes.SIMPLEX])

default_stylesheet = [
    {
        'selector': 'node',
        'style': {
            'background-color': '#000000',
            'label': 'data(label)',
            'width': "data(node_size)",
            'height': "data(node_size)",
            'font-size': '5px'
        }
    },
    {
        'selector': 'edge',
        'style': {
Пример #21
0
import pandas as pd
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
import dash_table
import plotly.graph_objs as go
from Layout import tab1 as t1
from Functions import API_data_extraction as aq

app = dash.Dash(
    __name__,
    meta_tags=[{
        "name": "viewport",
        "content": "width=device-width, initial-scale=1"
    }],
)
server = app.server
app.config["suppress_callback_exceptions"] = True

key = 'RGAPI-9724b32a-f354-408c-8cde-8fdcc35e01fa'
champions = aq.championsid(key)
queues = aq.get_queuesid(key)

app.layout = html.Div(
    id="big-app-container",
    children=[
        dcc.Store(id="summoner-name"),
        dcc.Store(id="account-id"),
        dcc.Store(id="match-list"),
        dcc.Store(id="game-id"),
Пример #22
0
'''graph에 보여질avg 데이터 사이즈 를 초기화 하는 함수 '''


def initParam(c, max, min):
    global count, Max, Min
    count = c
    Max = max
    Min = min


initialDequeSize(20)
initGraph()
initParam(0, 100, 0)
'''html figure '''
app = dash.Dash(__name__,
                external_stylesheets=es,
                routes_pathname_prefix='/graph/')

avgGraphConfig = go.Figure(layout=go.Layout(plot_bgcolor=colors['background'],
                                            paper_bgcolor=colors['background'],
                                            title='AVG'))
avgGraphConfig.add_trace(go.Scatter(name='CPU', line=dict(color='firebrick')))
avgGraphConfig.add_trace(go.Scatter(name='GPU', line=dict(color='green')))

cpuGraphConfig = go.Figure(data=[go.Scatter(fill='tonexty', )],
                           layout=go.Layout(title='CPU',
                                            plot_bgcolor=colors['background'],
                                            paper_bgcolor=colors['background'],
                                            xaxis=dict(showgrid=False),
                                            yaxis=dict(showgrid=False)))
def create_EDA(server):
    dash_app = dash.Dash(name='EDA', server=server, url_base_pathname='/EDA/', external_stylesheets=[
                             dbc.themes.BOOTSTRAP,
                             '/static/dist/css/styles.css',
                             'https://fonts.googleapis.com/css?family=Lato',
                             'https://codepen.io/chriddyp/pen/bWLwgP.css',
                             'https://codepen.io/chriddyp/pen/bWLwgP.css'
                             ]
                    )
    dash_app.index_string = html_layout

    # df = pd.read_csv(FILE_PATH)
    # df.to_csv(BACK_UP_PATH)

    left_margin = 200
    right_margin = 100
    
    dash_app.layout = server_layout


    @dash_app.callback([dash.dependencies.Output("hidden-div", "children"),dash.dependencies.Output("interval-component", "disabled")],
              [dash.dependencies.Input("interval-component", "n_intervals")])
    def update_df(n):
        global global_df 
        global_df= pd.read_csv(FILE_PATH)
        if(global_df.memory_usage(index=True).sum()<1000):
            return [dash.no_update, False]
        return [dash.no_update, True]


    @dash_app.callback(dash.dependencies.Output('dropdown_content', 'children'),
                       [dash.dependencies.Input('dropdown_section_name', 'value')])

    def render_tab_preparation_multiple_dropdown(value):
        for key in dictionary_name:
            if key == value:
                return_div = html.Div([
                    html.Br(),
                    dcc.Dropdown(
                        id='dropdown',
                        options=[
                            {'label': i, 'value': i} for i in dictionary_name[key]
                        ],
                        placeholder="Select Feature",
                        value='features'
                    ),
                    html.Div(id='single_commands'),
                ])
                return return_div




    @dash_app.callback(
        dash.dependencies.Output('dd-notice', 'children'),
        [dash.dependencies.Input('dropdown', 'value'),])
    def update_selected_feature_div(value):
        result = []
        for key, values in dictionary[value].items():
            result.append('{}:{}'.format(key, values))
        div = html.Div([
            html.Div([
                html.H3('Feature Informatation')
            ]),
            html.Div([
                html.Ul([html.Li(x) for x in result])
            ]),
        ])

        return div

    @dash_app.callback(
        [dash.dependencies.Output('dd-output-container', 'children'),
         dash.dependencies.Output('graph_plot', 'children')],
        # [dash.dependencies.Input('dropdown', 'value'), dash.dependencies.Input("hidden-div", 'children')])
        [dash.dependencies.Input('dropdown', 'value')])

    def preparation_tab_information_report(value):
        str_value = str(value)
        global global_df
        R_dict = global_df[str_value].describe().to_dict()
        result = []
        for key in R_dict:
             result.append('{}: {}'.format(key, R_dict[key]))

        div = html.Div([
            html.Div([
                html.H3('Feature Statistics')
            ]),
            html.Div([
                html.Ul([html.Li(x) for x in result])
            ]),
        ])
        
        g = dcc.Loading(id='graph_loading', children=[
                            dcc.Graph(
                            figure={"layout": {
                                "xaxis": {"visible": False},
                                "yaxis": {"visible": False},
                                "annotations": [{
                                    "text": "Please Select the Feature you would like to Visualize",
                                    "xref": "paper",
                                    "yref": "paper",
                                    "showarrow": False,
                                    "font": {"size": 28}
                                }]
                            }}, id='dd-figure'),
                        ])
        return [div, g]

        # Define a function for drawing box plot for selected feature

    @dash_app.callback(
        dash.dependencies.Output('dd-figure', 'figure'),
        # [dash.dependencies.Input('dropdown', 'value'),dash.dependencies.Input("hidden-div", 'children')])
        [dash.dependencies.Input('dropdown', 'value')])

    def preparation_tab_visualize_features(value):
        global global_df
        integers = categories[0]
        floats = categories[1]
        str_value = str(value)
        if str_value in integers:
            fig = px.histogram(global_df[str_value], y=str_value)
        elif str_value in floats:
            fig = px.box(global_df[str_value], y=str_value)
        else:
            fig = px.histogram(global_df[str_value], y=str_value)
        return fig

    @dash_app.callback(
        # [dash.dependencies.Output("modal", "is_open"), dash.dependencies.Output('hidden-div', 'children')],
        dash.dependencies.Output("modal", "is_open"),
        [dash.dependencies.Input("open", "n_clicks"),dash.dependencies.Input("close", "n_clicks")],
        [dash.dependencies.State("modal", "is_open")],
    )
    def toggle_modal(n1, n2, is_open):
        if n1 or n2:
            return not is_open
        return is_open



    if __name__ == '__main__':
        dash_app.run_server(debug=True)
Пример #24
0
from loan_analytics.Test_Loans import *

import pandas as pd
import numpy as np
# from matplotlib import pyplot as plt


#%%

# Index
# Page 1: Individual Loan
# Page 2: Loan Portfolio
# Page 3: Contribution Impact


app = dash.Dash(__name__, suppress_callback_exceptions=True)


layout = dict(
    title_align_style = 'center'
    )

app.layout = html.Div([
    dcc.Location(id='url', refresh=False),
    html.Div(id='page-content')
])

#%%

index_page = dbc.Container(
    [
Пример #25
0
import plotly.express as px




# global vars
dirname = os.path.dirname(__file__)
#path_d = os.path.join(dirname, 'diagnostics/')
lst_baa = ['FG', 'DUK', 'ALGAMS']
lst_periods = ['S_SP1', 'S_SP2', 'S_P', 'S_OP', 'W_SP', 'W_P', 'W_OP', 'H_SP', 'H_P', 'H_OP']





app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])
server = app.server  # for Heroku deployment


NAVBAR = dbc.Navbar(
    children=[
        html.A(
            # Use row and col to control vertical alignment of logo / brand
            dbc.Row(
                [
                    dbc.Col(html.Img(src=app.get_asset_url('branding.png'), height='40px')),
                    dbc.Col(
                        dbc.NavbarBrand('Dash Storyboard', className='ml-2')
                    ),
                ],
                align='center',
Пример #26
0
for city in city_ordered:
    city_options.append({'label': str(city), 'value': str(city)})

# df_city = df[['city', 'available_bike_stands', 'available_bikes', 'bike_stands']]
df_city = df.groupby('city', as_index=False).agg({
    'available_bike_stands': 'sum',
    'available_bikes': 'sum',
    'bike_stands': 'sum',
    'status': 'count'
})

######## App core ########

external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']

app = dash.Dash(external_stylesheets=external_stylesheets)
auth = dash_auth.BasicAuth(app, USERNAME_PASSWORD_PAIRS)
server = app.server
app.title = 'JCDecaux Bikes Tracking'

app.layout = html.Div(children=[
    refresher(),
    generate_alert(),
    html.P(id='live-update-text'),
    html.H1('JCDecaux Worldwide Bike Share Service Dashboard',
            style=dict(textAlign='center')),
    html.H4('Projet de Big Data Architecture', style=dict(textAlign='center')),
    dcc.Markdown(markdown_text),
    html.H2(id='counter_text', style={'fontWeight': 'bold'}),
    dcc.Graph(id='live-update-graph'),
    # count_diff_stations(producer),
Пример #27
0
Файл: app.py Проект: jm-cc/gcvb
import dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html

app = dash.Dash(__name__, external_stylesheets=["/assets/bootstrap.min.css"])
server = app.server
app.config.suppress_callback_exceptions = True
app.css.config.serve_locally = True
app.scripts.config.serve_locally = True
Пример #28
0
show_channels = html.Div(id="related_channels", style={"diplay": "flex"})

final_div = html.Div(id="final", style={"color": "white"})

# Loading in an external stylesheet to change the font of the App
external_stylesheets = [
    {
        "href": "https://fonts.googleapis.com/css2?family=Lato",
        "rel": "stylesheet",
    },
]

# Creating a Dash App Instance and Changing it's Title
app = dash.Dash(
    __name__,
    external_stylesheets=external_stylesheets,
    suppress_callback_exceptions=True,
    prevent_initial_callbacks=True,
)

server = app.server

app.title = "Search Box"

# Forming the layout for the App
app.layout = html.Div(children=[header, search, show_channels, final_div])


# Defining a callback to ...
@app.callback(
    Output("related_channels", "children"),
    [Input(
Пример #29
0
from datetime import datetime

import dash
import dash_bootstrap_components as dbc
import flask
from dash.dependencies import Input, Output

from service.SavingsAccountService import SavingsAccountService
from view.AppLayout import AppLayout
from view.home.dashboard import amount_deposited_withdrawn_initial_data
from view.savings.dashboard import savings_account_opened_chart_fig

STATIC_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                           'static')

app = dash.Dash(external_stylesheets=[dbc.themes.PULSE])
app.css.config.serve_locally = True
app.scripts.config.serve_locally = True


# TODO: move to another file
@app.server.route('/static/<path:path>')
def serve_static(path):
    return flask.send_from_directory(STATIC_PATH, path)


data_deposit = dict(x=deque(maxlen=20), y=deque(maxlen=20))
data_withdraw = dict(x=deque(maxlen=20), y=deque(maxlen=20))

app.layout = AppLayout.app_layout()
Пример #30
0
app2.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///MCPBase.db'

db = SQLAlchemy(app2)


class MCP(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    date = db.Column(db.DateTime, nullable=False)
    price_tl = db.Column(db.Float, nullable=False)
    price_usd = db.Column(db.Float, nullable=False)
    price_eur = db.Column(db.Float, nullable=False)


app = dash.Dash(__name__,
                meta_tags=[{
                    "name": "viewport",
                    "content": "width=device-width"
                }])

server = app.server

PATH = pathlib.Path(__file__).parent
DATA_PATH = PATH.joinpath("data").resolve()

# Loading historical tick data
currency_pair_data = {
    "EURUSD":
    pd.read_csv(DATA_PATH.joinpath("EURUSD.csv"),
                index_col=1,
                parse_dates=["Date"]),
    "USDJPY":