Пример #1
0
        ],style={'backgroundColor': 'rgba(255,255,255,0.5)','padding':'10px 5px 10px 20px'})
    ], style={'backgroundColor': 'rgba(255,255,255,0.5)','left':'3vw','top':'-25vh','width':'242px'}),

], fluid=True, id='map_section', style={'height':'90vh'})

timeline_section=dbc.Container([
    dbc.Card([
        dbc.CardHeader([
            html.H4('TIMELINE', className='d-inline' ),
            dbc.Button(html.I('info', className='material-icons md-24 logoColor'),color='link',id='info1',
                       className='float-right p-0'),
            dbc.Modal([
                dbc.ModalHeader("INFORMATION"),
                dbc.ModalBody([
                    html.H5('Data Selection', className='font-weight-bold'),
                    dcc.Markdown(md1),
                    html.Br(),
                    html.H5('Data Split', className='font-weight-bold'),
                    dcc.Markdown(md2),
                    html.Br(),
                    html.H5('Definition', className='font-weight-bold'),
                    dcc.Markdown(md3),
                ]),
                dbc.ModalFooter(dbc.Button("Close", id="close", className="ml-auto")),
            ],id="modal", size='lg', scrollable=True, style={'Height': '40vh'})
        ]),

        dbc.CardBody([
            dbc.Row([
                dbc.Col([
                    dbc.Label('Region', html_for='timeline_dd_region'),
Пример #2
0
import dash_html_components as html
from textwrap import dedent as s

from components import Example, Syntax
import tools

examples = {
    'basic-input': tools.load_example('tutorial/examples/basic-input.py'),
    'basic-state': tools.load_example('tutorial/examples/basic-state.py')
}

layout = html.Div([
    html.H1('Dash State'),
    dcc.Markdown(
        s('''
        In the previous chapter on
        [basic dash callbacks](/dash/getting-started-part-2),
        our callbacks looked something like:
    ''')),
    Syntax(examples['basic-input'][0]),
    Example(examples['basic-input'][1]),
    dcc.Markdown(
        s('''
        In this example, the callback function is fired whenever any of the
        attributes described by the `dash.dependencies.Input` change.
        Try it for yourself by entering data in the inputs above.

        `dash.dependencies.State` allows you to pass along extra values without
        firing the callbacks. Here's the same example as above but with the
        `dcc.Input` as `dash.dependencies.State` and a button as
        `dash.dependencies.Input`.
    ''')),
Пример #3
0
                                    'fontFamily': 'Times',
                                    'fontSize': 40,
                                    'color': "#3D4E76"}),
                      html.Span(children=' Dev. 0.0.3',
                                style={
                                    'textAlign': 'left',
                                    'fontFamily': 'monospace',
                                    'font-style': 'italic',
                                    'fontSize': 20,
                                    'color': "#69BFB0"}),
                      ], style={'verticalAlign': 'baseline'}),
             # className="wrapper_header"
             ),
    html.Hr(),
    # intro section
    html.Div(dcc.Markdown(children=[INTRODUCTION], style=MARKDOWN_STYLE_NORMAL, dedent=False)),
    # Each "page" will modify this element
    html.Div(id='content-container'),
    # html.Hr(),
    # This Location component represents the URL bar
    dcc.Location(id='url', refresh=False),

    html.Hr(),
    # # reset graph
    # html.Button(id='submit-button-state', n_clicks=0, children='Reset')

    # foot
    dcc.Markdown(FOOT, style=MARKDOWN_STYLE_SMALL),
    html.Hr(),

], className="container")
Пример #4
0
                     ['[1,0,-9,11]', '{"Name":"Status")', '(5,8,string)']],
             align=['left', 'center'],
             fill=dict(color=["yellow", "white"]),
             font=dict(color='black', size=10))
trace = go.Table(header=header, cells=cells)
data = [trace]
layout = dict(width=1000, height=400)
f4 = dict(data=data, layout=layout)

app = dash.Dash()
server = app.server
app.css.append_css(
    {'external_url': 'https://codepen.io/chriddyp/pen/bWLwgP.css'})
app.layout = html.Div([
    html.Div([dcc.Markdown('''

# Basics of Python
''')],
             className='row',
             style={'text-align': 'center'}),
    html.Div([
        dcc.Markdown('''
### Starting from simple: What is Python?
'''),
        dcc.Markdown('''
##### *Python is a general purpose programming language.*
'''),
        dcc.Markdown('''
### What can we do with Python?
'''),
        dcc.Markdown('''
#####
        dcc.Graph(
            id='pie_rusia_angola',
            figure={
                'data': [{
                    'values': values_rusia_angola,
                    'labels': labels_rusia_angola,
                    'type': 'pie'
                }],
                'layout': {
                    'title':
                    'Porcentaje casos confirmados y muertes (Rusia y Angola)',
                    'plot_bgcolor': colors['fondo'],
                    'paper_bgcolor': colors['fondo'],
                    'font': {
                        'color': colors['texto']
                    }
                }
            }),
        dcc.Markdown(children="""
    ## Elaboración propia con datos de COVID 19 API https://covid19api.com/ 
    

    """,
                     style={
                         'color': colors['texto'],
                         "font-size": 10
                     })
    ])

if __name__ == "__main__":
    app.run_server(debug=True)
Пример #6
0
    dcc.DatePickerSingle(
        date= dt(2019,1,1),
        display_format="YYYY-MM-DD"
    ),

    html.Br(), html.Br(),

    dcc.DatePickerRange(
        start_date=dt(2019, 1, 1),
        end_date=dt(2020, 1, 1),
        display_format="DD-MM-YYYYY"
    ),

    html.Br(),

    dcc.Markdown(markdown),

    dcc.Tabs(
        children=[
            dcc.Tab(
                label="Java",
                children=[
                    dcc.Markdown(
                        """
                        ```
                        print("hello word!")
                        ```   
                        """
                    )
                ]
            ),
Пример #7
0
def update_site_label(v):
    site_uptime = TM.sites[v].uptime
    alive = TM.sites[v].alive
    return dcc.Markdown(f"#### Site {v}:\n* Uptime = {site_uptime}\n* Alive = {alive}")
Пример #8
0
def create_content():
    """ Compose widgets into a layout. """
    # Start with an empty dataframe, gets populated by callbacks anyway.
    df = pd.DataFrame()
    # Create widgets.
    upload_widget = generate_upload_component('upload-data')
    filter_hint = "You can filter numerical and string columns by =, !=, <, <=, >=, >. " \
                  "You can also type parts of a string for filtering."
    # ToDo: Hint that you can hide/show items by clicking/dbl-clicking the legend.

    trials_graph = html.Div(
        className='six columns',
        children=[
            html.Div([
                html.Button(
                    id='refresh-btn',
                    n_clicks=0,
                    children='Refresh from DB',
                ),
                generate_daterange_picker(),
            ],
                     style={'marginBottom': '3rem'}),
            html.Div(className='pretty_container',
                     children=[
                         dcc.Graph(id='scatterplot-trials',
                                   style={'height': theme['height']})
                     ]),
            html.Div(style={
                'display': 'flex',
                'flex-wrap': 'wrap',
                'justify-content': 'space-between',
                'align-items': 'baseline',
                'margin': '1rem auto',
            },
                     children=[
                         generate_user_select(df),
                         dcc.Checklist(
                             id='pca-checkbox',
                             options=[{
                                 'label': 'Principal Components',
                                 'value': 'Show'
                             }],
                             value=['Show'],
                         ),
                         dcc.Checklist(
                             id='ellipses-checkbox',
                             options=[{
                                 'label': 'Ellipses',
                                 'value': 'Show'
                             }],
                             value=['Show'],
                         ),
                         html.Span(children=[
                             html.Label("Contamination",
                                        style={
                                            'marginInline': '5px',
                                            'display': 'inline-block'
                                        }),
                             dcc.Input(
                                 id='contamination',
                                 type="number",
                                 inputMode='numeric',
                                 min=0.0,
                                 max=0.5,
                                 value=0.05,
                                 step=0.001,
                                 style={'width': '8rem'},
                             ),
                         ], ),
                     ]),
            dcc.Markdown(
                "*Figure 3.* Final state values of degrees of freedom 1 and 2, "
                "colored by block. "
                "The subspace of task goal 1 is presented as a line. The 2 possible "
                "goals for the concurrent tasks are represented as larger discs."
                " Only one of these goals is selected for a constrained block. "
                "Principle components are displayed as arrows. "
                "A threshold for outliers calculated using the robust covariance "
                "method is drawn as a thin black line. Set the contamination rate "
                "to adjust the threshold.")
        ],
    )

    trials_table = get_table_div(
        generate_table(df, 'trials-table'), 1,
        "Final state values of slider positions",
        "The goal of task 1 is to match the sum of df1 and df2 "
        "to be equal to 125. Outliers are identified using the robust "
        "covariance method and are colored in red.  \n" + filter_hint)

    grab_onset_graph = get_figure_div(
        dcc.Graph(id='onset-dfs'), 4,
        "Onset of sliders for df1 and df2 being grabbed.")

    grab_duration_graph = get_figure_div(
        dcc.Graph(id='duration-dfs'), 5,
        "Duration of sliders for df1 and df2 being grabbed.")

    qq_plot_dfs = get_figure_div(
        dcc.Graph(id='qq-plot-dfs', style={'height': theme['height']}), 6,
        "QQ-plots for comparing final states distribution of degrees of freedom to normal "
        "distributions. "
        "The Filliben’s formula was used to estimate the theoretical quantiles."
    )

    qq_plot_sum = get_figure_div(
        dcc.Graph(id='qq-plot-sum', style={'height': theme['height']}), 7,
        "QQ-plots for comparing the distribution of the sum of final states to a normal "
        "distribution. The Filliben’s formula was used to estimate the theoretical quantiles."
    )

    hist_graph_dfs = get_figure_div(
        dcc.Graph(id='histogram-dfs'), 8,
        "Histograms of final state values for df1 and "
        "df2 compared to normal distributions.")

    hist_graph_sum = get_figure_div(
        dcc.Graph(id='histogram-sum'), 9,
        "Histogram of the sum of df1 and df2 "
        "compared to a normal distribution.")

    dof_line_plot = get_figure_div(
        dcc.Graph(id='df-line-plot'), 11,
        "Mean final state values per degree of freedom "
        "and participant. Vertical bars represent "
        "standard deviations.")

    proj_line_plot = get_figure_div(
        dcc.Graph(id='proj-line-plot'), 12,
        "Projection variance per direction to UCM for "
        "each participant.")

    dof_violin_plot = get_figure_div(
        dcc.Graph(id='df-violin-plot'), 13,
        "Mean final state values per degree of "
        "freedom and block across participants.")

    proj_violin_plot = get_figure_div(
        dcc.Graph(id='proj-violin-plot'), 14,
        "Variance of projections onto subspace "
        "parallel and orthogonal to UCM across "
        "participants.")

    corr_table = get_table_div(
        generate_simple_table(df, 'corr-table'), 2,
        "Pairwise Spearman correlation coefficients",
        "There is a reciprocal suppression when: "
        "r(sum,df1) > 0, r(sum, df2)>0, r(df1,df2)<0.")

    pca_graph = get_figure_div(
        dcc.Graph(id='barplot-pca'), 10,
        "Explained variance by different principal components (PC) in percent."
    )
    pca_graph.style = {
        'marginTop': '70px'
    }  # Match it to the table y position next to it.

    pca_table = get_table_div(
        generate_simple_table(df, 'pca-table'), 3,
        "Divergence between principal components (PC) "
        "and the space parallel or orthogonal to the theoretical UCM")

    var_graph = get_figure_div(
        dcc.Graph(id='barplot-variance', style={'height':
                                                theme['height']}), 15,
        "**A** Variance of the sum of df1 and df2 grouped by block and participant. **B** "
        "Mean of the sum of df1 and df2.")

    # Table of descriptive statistics and synergy indices.
    # ToDo: When LaTeX rendering is supported in dash Markdown, convert.
    desc_table = html.Div(
        className='twelve columns',
        children=[
            generate_table(df, 'desc-table'),
            html.P("Table 4"),
            html.P(
                "Descriptive statistics, synergy index ($\\Delta V$) and Fisher "
                "z-transformed synergy index ($\\Delta V_{z}$)",
                style={'font-style': 'italic'}),
            # Following text contains math formulas.
            html.Span([
                html.I("Note: "),
                html.Span(
                    "The absolute averages are formed by the lengths of the "
                    "projections. Projections are the coefficients $a$ and $b$ in "
                    "$\\vec{x}-\\bar{x} = a\\hat{v}_{\parallel UCM} + "
                    "b\\hat{v}_{\\perp UCM}$ "
                    "with $\\vec{x}$ being a 2-dimensional data point "
                    "$\\vec{x}=[df1 \\; df2]$ and $\\bar{x}$ "
                    "being the mean vector. $\\hat{v}_{\parallel UCM}$ and "
                    "$\\hat{v}_{\perp UCM}$ are unit base vectors ("
                    "$\\|\\hat{v}_{\parallel UCM}\\|=\\|\\hat{v}_{\\perp UCM}\\|=1$).",
                )
            ]),
            dcc.Markdown(filter_hint)
        ])

    anova_table = get_table_div(
        generate_simple_table(df, 'anova-table'), 5,
        "3 x (3) Two-way mixed-design ANOVA of $\\Delta V_z$ with between-factor condition "
        "and within-factor block",
        "If the between-subject groups are unbalanced (unequal sample sizes), "
        "a type II sums of squares will be computed (no interaction is assumed)."
    )

    posthoc_table = get_table_div(
        generate_simple_table(df, 'posthoc-table'), 6,
        "Posthoc pairwise T-tests of $\\Delta V_z$",
        "Only pay attention to this table if the ANOVA results merit further investigation "
        "(formerly known as statistical significance). The p-corr values are corrected "
        "p-values using the Benjamini-Hochberg False Discovery Rate method.")

    # Tie widgets together to layout.
    content = html.Div([
        dcc.Store(id='datastore', storage_type='memory'),
        dcc.Store(id='proj-store', storage_type='memory'),
        dcc.Store(id='contour-store', storage_type='memory'),
        dcc.Store(id='pca-store', storage_type='memory'),
        html.Div(
            id='div-data-upload',
            children=[upload_widget],
            # Hide Div in non-debug environment.
            style={
                'paddingTop': '20px',
                'display': 'none'
            }),
        html.Div(id='output-data-upload'),

        # Figures and Tables.
        html.Div(
            style={'textAlign': 'left'},
            children=[
                *dash_row(
                    trials_graph, trials_table,
                    html.Div([
                        html.P(id='removal-hint', style={'display': 'inline'}),
                        html.P(id='filtered-hint', style={'display': 'inline'})
                    ],
                             className='six columns')),
                *dash_row(grab_onset_graph, grab_duration_graph),
                *dash_row(qq_plot_dfs, qq_plot_sum),
                *dash_row(hist_graph_dfs, hist_graph_sum),
                #*dash_row(corr_table),  # Doesn't account for repeated measures
                *dash_row(pca_graph, pca_table),
                *dash_row(desc_table),
                *dash_row(dof_line_plot, proj_line_plot),
                *dash_row(dof_violin_plot, proj_violin_plot),
                *dash_row(var_graph, wilcoxon_rank_result()),
                *dash_row(anova_table, posthoc_table),
            ]),
    ])
    return content
Пример #9
0
with open('toc_files.json','r') as infile:
    co2_dict = json.load(infile)

external_stylesheets = ["https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"]

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


####-----App layout----####

app.layout=html.Div(
    [
    dbc.Row(dbc.Col(
        dcc.Markdown('''
        # MODTRAN Infrared Light in the Atmosphere

        -----------------------------------
        ''', 
        style={'width': '100%', 'display': 'inline-block'})
        ,width={"size": 8, "offset": 3},)
        ),

    dbc.Row(
        [
        dbc.Col(dcc.Markdown('''
        ## Select parameters:
        '''), width={"size": 3, "offset": 3}),
        dbc.Col(dcc.Markdown('''
        ## Select x-axis data:
        '''),width={"size": 3, "order": "last","offset": 2})
    ],
    no_gutters=True,
Пример #10
0
3- le troisième graphique est un **Bubble Charts**, la couleur et taille des bulles est en fonction du nombre total d'étudiants par university
'''

texte2 = '''
### Le deuxième graphique "Historgamme"
'''

colors = {'background': 'white', 'text': 'black'}

external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash('auth', external_stylesheets=external_stylesheets)

app.layout = html.Div([
    dcc.Markdown(children=markdown_text,
                 style={
                     'textAlign': 'center',
                     'color': colors['text']
                 }),
    html.Div([dcc.Markdown(children=texte1)]),
    html.Div([
        html.H2(children='Scatter Plots',
                style={
                    'textAlign': 'center',
                    'color': colors['text']
                })
    ]),
    html.Div([
        dcc.Graph(
            id='num',
            figure={
                'data': [
import plotly.graph_objects as go

# Imports from this application
from app import app

## for chloropleth mapbox usage
mapboxt = open("./amazon/token.txt").read()

# style for controls
style = {'padding': '1.5em'}

# controls start here
layout = html.Div([
    dcc.Markdown("""
        ### Predict
        Use the controls below to update your predicted location, based on 
        area in km^2, day, month, year and state.
        *(Predictions based on sample dataset using XGboost model. Check the [Process](https://amazon-deforestation.herokuapp.com/process) page why.)*
    """),
    html.Div([
        dcc.Markdown('###### Area in km^2'),
        dcc.Slider(
            id='area',
            min=0.062,
            max=1.440,
            step=0.040,
            value=0.090,
            marks={n: f'{n:.2f}'
                   for n in np.arange(0.006, 1.440, 0.040)}),
    ],
             style=style),
    html.Div([
Пример #12
0
submit = dbc.Button("Submit",
                    id='submit-val',
                    color="primary",
                    n_clicks=0,
                    href='/predictions')

form = dbc.Form([activity, goodboy, timeoverride, location, description])

column1 = dbc.Col([
    dcc.Markdown("""
        
            # Sora Activity Log
            
            Enter Sora's activity and click '*Submit*'. **(GOBAT FAMILY USE ONLY)**
            
            🐶 Blank activities won't be submitted.
            🐶 *Hour* and *Minute* must *both* be entered to override the time.


            """),
    form,
], )


#Keep PLaceholders updated
@app.callback(
    [Output('date', 'placeholder')],
    [Input(component_id='interval', component_property='n_intervals')])
def update_minute(input_value):
    now = dt.date.today()
Пример #13
0
bupu = cl.scales['3']['div']['RdYlBu']
# Create figure
fig2 = px.scatter(df, x="mag", y="State", color="depth",
                 size='gap', hover_data=['mag'],
                title="North American Location and Earthquake magnitude",
                color_continuous_scale=bupu)
column1 = dbc.Col(
    [
        dcc.Markdown(
            """

            ## Understanding Earthquakes
            To understand earthquakes, we need to understand magnitude.
            magnitude is a measurement of vibration from the surfact of the
            Earth's crust, usually taken on a Richter Scale. There are several
            different classifications of earthquake magnitude, which can be
            found [here.](https://earthquake.usgs.gov/learn/topics/mag-intensity/magnitude-types.php) \
            Natural earthquakes occur near fault lines, where tectonic plates
            converge against once another, shifting and sliding, causing the
            Earth's crust to vibrate.
            """

        ),
        dcc.Markdown(
            """
            ## Fault-lines
            The more, and greater the fault lines in a particular region
            contribute to the likelihood of an Earthquake occurring. For example,
            Earthquakes in the United States can frequently be found in locations
            like California and Hawaii, which are located along fault-lines.
            """
Пример #14
0
        vis.line(X=torch.tensor([[t, t, t, t, t]]),
                 Y=torch.tensor([[
                     time_series1[t], time_series2[t], time_series3[t],
                     time_series4[t], time_series5[t]
                 ]]),
                 win=window,
                 update='append',
                 opts=opts)
    return 'Real-Time Analysis is over.'


################################## CODEBLOCK ##################################
################################## DASHBOARD ##################################
O = {}
O['T,0,0'] = dcc.Graph(figure=fig)
O['T,0,1'] = dcc.Markdown(description)
O['T,1,0'] = None
O['T,1,1'] = None
C = {
}  # color code : primary, secondary, info, success, warning, danger, light, dark
C['T,0,0'] = [
    dbc.Card([dbc.CardHeader('Linkedin List'),
              dbc.CardBody(O['T,0,0'])],
             color='light',
             inverse=False,
             outline=True)
]
C['T,0,1'] = [
    dbc.Card([dbc.CardHeader('T,0,1'),
              dbc.CardBody(O['T,0,1'])],
             color='light',
Пример #15
0
email_count = pd.read_csv('./app_data/email_count.csv')
state_email = pd.read_csv('./app_data/city_phone.csv')
loc_data = pd.read_csv('./app_data/map_data.csv')

layout = dbc.Container([
    html.H1('Facebook 2021 Data Breach'),
    dbc.Card([
        dbc.Row([
            dbc.Col([
                dbc.CardBody([
                    html.H4("Background"),
                    html.Hr(),
                    dcc.Markdown(
                        "Early on April 3rd, 2021 approximately 553 million Facebook accounts were leaked online."
                        " Accounts from around the globe are effected in this breach,"
                        " along with 32 million from the United States. The dataset includes phone number,"
                        " date of birth, first name, last name, location (city, state), email address, employer, and gender"
                        " with varying degrees of completion based on the corresponding Facebook page."
                    ),
                    dcc.Markdown(
                        "In September 2019, [Motherboard](https://www.vice.com/en/article/xgz7bd/facebook-phone-numbers-bot-telegram) reported"
                        " on a Telegram bot that takes a phone number as input and looks the corresponding Facebook profile."
                        " This was discovered as a vulnerability by Facebook, fixing the vulnerability by"
                        " early Aug 2019. The data's legitimacy was also confirmed by Motherboard in the same report."
                    ),
                    dcc.Markdown(
                        "While the exact source of the vulnerability cannot be determined, it is likely tied"
                        " to a [similar vulnerability](https://www.forbes.com/sites/zakdoffman/2019/09/12/new-instagram-hack-exclusive-facebook-confirms-user-accounts-and-phone-numbers-at-risk/?sh=7b2f5b482200),"
                        " first identified by @ZHacker13 (ZH), targeting Instagram account creation and contact syncing."
                        " It should be noted that Facebook owns Instagram."
                        " ZH notified Facebook of the vulnerability in early August 2019 and Facebook confirmed"
Пример #16
0
# Imports from 3rd party libraries
import dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output

# Imports from this application
from app import app

# 1 column layout
# https://dash-bootstrap-components.opensource.faculty.ai/l/components/layout
column1 = dbc.Col([
    dcc.Markdown("""
        
            ## Insights


            """),
    dcc.Markdown("""
            Throughout its rich history, the NFL has turned into one of the most engaging yet 
            most complicated sport of the modern era. For a team to be successful, there are many 
            factors that can contribute in a variety of ways. Judging from the baseline, I can 
            comfortably assume that the game has developed to a point where teams are relying on the 
            passing game far more heavily than the run as the baseline indicates that approximately 60%
            of all playcalls were run plays.
            """),
    dcc.Markdown("""
            The graph below shows how much weight each feature has in the prediction of the type of 
            play about to be run. It can be observed that the formation of the offense has the most affect
            on the play type they are about to run and the personnel on either the defense or offense, do not
            hold significant weight. This can be due to the fact that some positions are very flexible, where a
Пример #17
0
    )


global_latent_factors = 10
global_learning_rate = 0.001
global_number_epochs = 10

ratings_matrix = ratings.pivot_table(index=['userId'], columns=['movieId'], fill_value=0.0).values
model = SGD(ratings_matrix, global_latent_factors, np.double(global_learning_rate), global_number_epochs)

layout = html.Div([
    html.H3('Recommendations page'),
    html.A("Go Back", href="/"),
    html.Div([
        html.Div([
            dcc.Markdown('''**Model**: ''',
                         dangerously_allow_html=True),
        ], className="two columns"),
        html.Div([
            html.Button('Train Model', id='button-train')
        ], className="two columns"),
        html.Div([
            dcc.Markdown('Status: `no existe un modelo entrenado`', id='msg-model')
        ], className="three columns"),
        html.Div([
            dcc.Markdown('', id='msg-training')
        ], className="two columns"),
        html.Div([
            dcc.Markdown('', id='msg-epochs')
        ], className="two columns"),
        html.Div([], id='plot-errors', className="twelve columns"),
    ], className="row"),
Пример #18
0
def make_layout():
    return html.Div(children=[
        html.Div(
            className="row",
            children=[
                html.Div(
                    className="four columns div-user-controls",
                    children=[
                        html.Div(
                            id="invisible-div-callback-trigger"
                        ),  # needed for the plots in combi with the auto update
                        html.H1("HEGIC OPTIONS ANALYTICS TOOL"),
                        dcc.Markdown("""
                                Interactive charts displaying active ETH/WBTC option amount (bubble size) updated every 5min from [*subgraph*](https://thegraph.com/explorer/subgraph/ppunky/hegic-v888).
                                """),
                        html.Div(html.H2("SYMBOL")),
                        html.Div(
                            className="div-for-radio",
                            children=[
                                dcc.RadioItems(
                                    id="symbol",
                                    options=[
                                        {
                                            "label": "WBTC",
                                            "value": "WBTC"
                                        },
                                        {
                                            "label": "ETH",
                                            "value": "ETH"
                                        },
                                    ],
                                    value="WBTC",  # default
                                    labelStyle={"display": "inline-block"},
                                    className="dropdown_selector",
                                ),
                            ],
                        ),
                        html.Div(html.H2("PERIOD OF HOLDING (IN DAYS)")),
                        html.Div(
                            className="div-for-dropdown",
                            children=[
                                dcc.Dropdown(
                                    id="period",
                                    options=[
                                        {
                                            "label": "1",
                                            "value": "1"
                                        },
                                        {
                                            "label": "7",
                                            "value": "7"
                                        },
                                        {
                                            "label": "14",
                                            "value": "14"
                                        },
                                        {
                                            "label": "21",
                                            "value": "21"
                                        },
                                        {
                                            "label": "28",
                                            "value": "28"
                                        },
                                    ],
                                    value=["1", "7", "14", "21", "28"
                                           ],  # default
                                    multi=True,
                                    className="dropdown_selector",
                                ),
                            ],
                        ),
                        html.Div(html.H2("SELECT OPTION-SIZE BY DECILE")),
                        html.Div(
                            className="div-for-slider",
                            children=[
                                dcc.RangeSlider(
                                    id="amounts",
                                    min=0,
                                    max=10,
                                    step=None,
                                    marks={
                                        int(i): str(i)
                                        for i in np.arange(0, 11, 1)
                                    },
                                    value=[1, 10],
                                    allowCross=False,
                                    className="dropdown_selector",
                                ),
                            ],
                        ),
                        html.Div(
                            html.
                            P("Deciles 0-1 covers the lowest 10% of options, deciles 9-10 the top 10% of options etc."
                              )),
                        html.Div(html.H2("SEARCH BY OPTION ID or ACCOUNT")),
                        html.Div(
                            className="div-for-input",
                            children=[
                                dcc.Input(
                                    id="id",
                                    type="text",
                                    placeholder="ID or Account",
                                    className="input_selector",
                                    multiple=False,
                                )
                            ],
                        ),
                        html.Div(
                            html.
                            P("Clear the search box to return to options overview."
                              )),
                        html.Div(html.H2("GENERAL INFO")),
                        html.Div(
                            className=
                            "div-for-dropdown",  # to shorten the distance btw header and text
                            children=[
                                html.
                                P("Click-and-select directly on the plots to filter to a specific date range/cluster of options."
                                  )
                            ],
                        )
                    ],
                ),
                html.Div(
                    className="eight columns div-for-charts bg-grey",
                    children=[
                        dbc.Row(
                            dbc.Col(
                                dcc.Graph(
                                    id="chart2d_bubble",
                                    config={"displayModeBar": False},
                                ),
                                xs=12,
                                xl=
                                12,  # xs is for phones to use the full width of the device, need xl in here as well to make sure the layout for large screens is being kept as defined in the css
                            ), ),
                        dbc.Row([
                            dbc.Col(
                                dcc.Graph(
                                    id="chart2d_pnl_pct_change",
                                    config={"displayModeBar": False},
                                ),
                                xs=12,
                                xl=6,
                            ),
                            dbc.Col(
                                dcc.Graph(
                                    id="chart2d_pnl",
                                    config={"displayModeBar": False},
                                ),
                                xs=12,
                                xl=6,
                            ),
                        ]),
                        dbc.Row([
                            dbc.Col(
                                dcc.Graph(
                                    id="chart2d_balance",
                                    config={"displayModeBar": False},
                                ),
                                xs=12,
                                xl=6,
                            ),
                            dbc.Col(
                                dcc.Graph(
                                    id="chart2d_putcall",
                                    config={"displayModeBar": False},
                                ),
                                xs=12,
                                xl=6,
                            ),
                        ]),
                        dbc.Row(
                            dbc.Col(
                                dcc.Graph(
                                    id="chart2d_open_interest",
                                    config={"displayModeBar": False},
                                ))),
                    ],
                ),
            ],
        )
    ])
Пример #19
0
        cols = [{"name": i, "id": i} for i in after_image.columns]
        data = after_image.to_dict('records')
        
        children = [
            m,
            html.H6('After images:'),
            dash_table.DataTable(id='transaction_after_image',columns=cols,data=data)
        ]
        return(children)
    
# Build App
app = Dash(__name__, external_stylesheets=external_stylesheets)
app.layout = html.Div([
    html.H1(f"RepCRec State"),
    html.H6(f"Test file:{t}"),
    dcc.Markdown(id='test-script',style={'padding-bottom':25,"white-space": "pre"}),
    html.Button('Tick', id='ticker', n_clicks=0),
    html.H4("Time = 0",id='clock',style={'padding-bottom':25}),
    html.H4("Choose a Site:",id='site-header',style={'padding-top':25}),
    dcc.Slider(id='site',min=1,max=10,value=1,step=None,marks={v:str(v) for v in range(1,11)}),
    html.Div(id='slider-output',style={'padding-top':25}),
    html.Div([html.Img(id = 'cur_plot', src = '')], id='plot_div'),
    html.Div([dash_table.DataTable(id='detailed_site_table')],style={'padding-bottom':25}),
    html.H4("Choose a transaction:",id='transaction-header',style={'padding-top':25}),
    dcc.Dropdown(id='transaction-dropdown',placeholder='Select transaction'),
    html.Div(id='transaction-summary'),
    html.H4("Transaction manager:",id='TM-header',style={'padding-top':25}),
    html.Div(id='tm-summary'),
    html.H4("Standard output:",id='output-header',style={'padding-top':25}),
    html.Div(id='stdout')
])
Пример #20
0
     className='div-for-dropdown',
     children=[
         ## Dropdown Menu for State ##
         dcc.Dropdown(
             id='stateselector',  # id for callback-input
             options=get_options(df_state['state'].unique(
             )),  # 'state' for callback-input
             multi=True,
             value=['OH', 'MA', 'NH', 'TX'
                    ],  # choose a default state
             style={'backgroundColor': '#1E1E1E'},
             className='stateselector')
     ]),
 html.P('Dotted line represents WHO recommended target'),
 dcc.Markdown('''
              __________________
              '''),
 html.H2('Historic Covid19 Cases in the World'),  # headline
 html.P(
     'Pick one or more countries from the dropdown below.'
 ),  # paragraph
 html.Div(
     className='div-for-dropdown',
     children=[
         ## Dropdown Menu for Country ##
         dcc.Dropdown(
             id='ctryselector',  # id for callback-input
             options=get_options(
                 df_world['location'].unique()),
             multi=True,
             value=['United States', 'Hungary'
Пример #21
0
def update_stdout(T):
    return(dcc.Markdown(buff.getvalue(),style={"white-space": "pre"}))
Пример #22
0
import dash_html_components as html
import pandas as pd
from app import app
from dash.dependencies import Input, Output
from pickle import load, loads

pickled_column_values = load(open('model/models/column_values.p', 'rb'))
column_values = loads(pickled_column_values)

columns = list(column_values.keys())
style = {'padding': '1em'}

layout = html.Div([
    dcc.Markdown("""
        ### Predict

        Select from the dropdown menus to see if a medical screening for diabetes is recommended by the model.
    
    """),
    html.Div([
        dcc.Markdown(f'###### {columns[0]}'),
        dcc.Dropdown(id=columns[0],
                     options=[{
                         'label': purpose,
                         'value': purpose
                     } for purpose in column_values[columns[0]]],
                     value=column_values[columns[0]][0]),
    ],
             style=style),
    html.Div([
        dcc.Markdown(f'###### {columns[1]}'),
        dcc.Dropdown(id=columns[1],
Пример #23
0
import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objs as go
from dash.dependencies import Input, State, Output, Event

app = dash.Dash(__name__)
app.title = 'Dash Skeleton'

# If you need to run your app locally
#app.scripts.config.serve_locally = True

app.layout = html.Div([
    dcc.Markdown("""
# Dash Demo app

This demo app counts the number of characters in the text box and updates a bar
chart with their frequency as you type."""),
    html.Div(
        dcc.Textarea(
            id='text-input',
            value='Type some text into me!',
            style={
                'width': '40em',
                'height': '5em'
            },
        )),
    html.Div('Sort by:'),
    dcc.RadioItems(id='sort-type',
                   options=[
                       {
Пример #24
0
images_B = anomaly.eval(evalfolder)  #np array
for image in images:
    #prepare for mse
    image_A = io.imread(images[I], as_grey=True)
    image_A = image_A.reshape(resX, resY, 1)
    image_A = np.array(image_A).astype('float32')
    images_A.append(image_A)

app.layout = html.Div(
    children=[
        html.H1(children='Geospatial Anomaly Detection'),
        dcc.Markdown('''
    #### Dash and Markdown

    Dash supports [Markdown](http://commonmark.org/help).

    Markdown is a simple way to write and format text.
    It includes a syntax for things like **bold text** and *italics*,
    [links](http://commonmark.org/help), inline `code` snippets, lists,
    quotes, and more.
    '''),
        dcc.Graph(id='live-graph', animate=True),
        html.H2('Original Image & Attempted Regeneration:',
                style={'display': 'inline-block'}),
        html.Div(style={'display': 'inline-block'}),
        html.H4(''),
        html.Div(html.Img(id='original-img',
                          src='data:image/png;base64,{}'.format(
                              encoded_images[0].decode())),
                 style={'display': 'inline-block'}),
        html.Div(html.Img(id='predicted-img',
                          src='data:image/png;base64,{}'.format(
Пример #25
0
fig.update_layout(clickmode='event+select')

fig.update_traces(marker_size=20)

app.layout = html.Div([
    dcc.Graph(
        id='basic-interactions',
        figure=fig
    ),

    html.Div(className='row', children=[
        html.Div([
            dcc.Markdown("""
                **Hover Data**

                Mouse over values in the graph.
            """),
            html.Pre(id='hover-data', style=styles['pre'])
        ], className='three columns'),

        html.Div([
            dcc.Markdown("""
                **Click Data**

                Click on points in the graph.
            """),
            html.Pre(id='click-data', style=styles['pre']),
        ], className='three columns'),

        html.Div([
                    html.Div([
                        html.Div(
                            [dcc.Dropdown(id='field-picker-x', options=Field_options, value=Field_options[0]['value'])],
                            style={'width': '45%', 'display': 'inline-block'}),
                        html.Div(
                            [dcc.Dropdown(id='field-picker-y', options=Field_options, value=Field_options[0]['value'])],
                            style={'width': '45%', 'display': 'inline-block'})
                    ], style={'width': '40%', 'margin-left': '1000px'}),
                    html.Div([
                        dcc.Graph(id='scatter')
                    ])
                ])
            ]),
            dcc.Tab(label='Reference', children=[
                html.Div([
                    dcc.Markdown(children=markdown_text, style={"white-space": "pre"})
                ])
            ])
        ])
    ],style={'backgroundColor':background})
],style={'backgroundColor':background})


# ----------------------------------------------------------------------------------------------------------
## ---- Page 1 Callback ----
@app.callback(Output('useronly_Pie', 'figure'),
              [Input('type-picker2', 'value')])
def update_pie(selected_type):
    label_1 = df_user.groupby('type').size().to_frame().reset_index()['type']
    value_1 = df_user.groupby('type').size().to_frame().reset_index()[0]
    label_2 = df_user.groupby('type_2').size().to_frame().reset_index()['type_2']
Пример #27
0
def serve_layout():
    layout = html.Div([
        dbc.NavbarSimple(
            children=[
                dbc.NavItem(dbc.NavLink("Home", href="/")),
                dbc.NavItem(
                    html.A(
                        "Help",
                        href="https://github.com/kyle-kroll/BIOT670-Spring-2021",
                        target="_blank",
                        className="nav-link"
                    )
                ),
            ],
            brand="QuadViewer",
            brand_href="#",
            color="primary",
            dark=True,
        ),
        # The following dbc.Row contains the 2 column layout where settings are on the left
        # and the plot is the column to the right
        dbc.Row([
            dbc.Col([
                html.Div(className='six columns', children=[
                    dcc.Upload(
                        id='upload-data',
                        children=html.Div([
                            html.Button('Click Here to Select File(s)')
                        ]),
                        style={
                            'width': '100%',
                            'height': '60px',
                            'lineHeight': '60px',
                            'textAlign': 'center',
                            'margin': '10px'
                        },
                        # Allow multiple files to be uploaded
                        multiple=True
                    ),
                    html.Div(id='file-selector'),
                    html.Div(id='file-name'),
                    html.Div(id='output-data-upload'),

                    html.Div(id='dropdown-items'),
                    html.Label('Plot Axis Scale'),
                    html.Div(children=[
                        dcc.RadioItems(
                            id='scale-radio',
                            options=[
                                {'label': 'Linear', 'value': 'lin'},
                                {'label': 'Log10', 'value': 'log'}
                            ],
                            value='lin',
                            labelStyle={'display': 'block'}
                        )]),
                ])
            ], width={"size": 2}

            ),
            # Figure plot
            dbc.Col(

                html.Div(className='six columns', children=[

                    dcc.Graph(
                        id='basic-interactions',
                        clear_on_unhover=True,
                        config={
                            'toImageButtonOptions': {
                                'format': 'svg',  # one of png, svg, jpeg, webp
                                'filename': 'custom_image',
                                'height': 800,
                                'width': 800,
                                'scale': 1  # Multiply title/legend/axis/canvas sizes by this factor
                            },

                        },

                    )
                ]), width={"size": 6,},style={"height": "100vh"}
            ),
            dbc.Col([
                html.Div([
                    dcc.Markdown("""
                                        **Hover Data**

                                        Mouse over values in the graph.
                                    """),
                    html.Pre(id='hover-data')
                ])
            ], width={"size": 4})
            # Second row is for the hover data which only has a single, centered column
        ])
    ])

    return layout
Пример #28
0
information_flow = InformationFlow()

information_flow_tab = dcc.Tab(
    label='Information Flow',
    children=[
        html.Div(
            className="row",
            children=[
                ##############################################left side two input components
                html.Div(
                    className="two columns",
                    children=[
                        dcc.Markdown(
                            d("""
                            **Flow Threshold**

                           	Remove low flow edges.
                            """)),
                        html.Div(
                            className="twelve columns",
                            children=[
                                dcc.Slider(
                                    id='information_flow_threshold',
                                    min=0,
                                    max=1,
                                    step=0.05,
                                    value=0.5,
                                    # {i: str(i) for i in [0,46,47,69]}
                                ),
                                html.Br(),
                                html.Div(
Пример #29
0
def display_page(pathname):
    if pathname == '/':
        return html.Div([
            html.Hr(),
            # Step 1
            html.Div(
                [
                    html.H3(children="Step 1", style=MARKDOWN_STYLE_LARGE, className="wrapper_subheader"),
                    html.Span(children=SPECIFY_DATA, style=MARKDOWN_STYLE_NORMAL)
                ]
            ),
            html.Div(
                [
                    html.Tr(
                        [
                            # upload
                            html.Th([
                                dcc.Upload(
                                    id='upload',
                                    children=html.Div([
                                        'DRAG and DROP or ',
                                        html.A('SELECT A FILE')]),
                                    style={
                                        'lineHeight': '60px',
                                        'borderWidth': '1px',
                                        'borderStyle': 'dashed',
                                        'borderRadius': '5px',
                                        'textAlign': 'center',
                                        'margin': '10px',
                                        'fontFamily': 'monospace',
                                        'fontSize': 16,
                                        'color': '#2D2D2D'},
                                ),
                            ], style={'height': '40px', 'width': '500px', "borderBottom": 'none'}),
                        ],
                    )
                ]
            ),

            html.Hr(),
            # Step 2
            html.Div(
                [
                    dcc.Markdown(children='Step 2', style=MARKDOWN_STYLE_LARGE, className="wrapper_subheader"),
                    dcc.Markdown(children=FILE_CHECK, style=MARKDOWN_STYLE_NORMAL),
                    dcc.Markdown(id='feedback', dedent=True,
                                 style={'fontFamily': 'monospace',
                                        'fontSize': 16}),
                ]
            ),

            html.Hr(),
            # Step 3
            # generate graph
            html.Div(
                [
                    dcc.Markdown(children='Step 3', style=MARKDOWN_STYLE_LARGE, className="wrapper_subheader"),
                    dcc.Markdown(children=GENERATE_DTA, style=MARKDOWN_STYLE_NORMAL),
                    html.Button(id='visualize', children='Visualize Topic Flow', disabled=False,
                                style={'height': "60px",
                                       'width': "480px",
                                       'margin': '10px',
                                       'fontFamily': 'monospace',
                                       'fontSize': 16,
                                       'color': '#2D2D2D'}),
                    html.Div(id='dta_graph'),
                    html.Br(),
                    html.Div([dcc.RadioItems(
                        id='hide_show_button',
                        options=[{'label': x, 'value': x}
                                 for x in ['Show Text', 'Hide Text']],
                        value='Show Text',
                        labelStyle={'display': 'inline-block'},
                        style=MARKDOWN_STYLE_SMALL)]),
                    # show accumulated/mean semantic distance/mean semantic distance only counting Ps
                    html.Div(id='mean_semantic_distance', style=MARKDOWN_STYLE_SMALL),
                    html.Div(id='accumulated_semantic_distance', style=MARKDOWN_STYLE_SMALL),
                    html.Div(id='mean_semantic_distance_only_for_P', style=MARKDOWN_STYLE_SMALL),
                    # dcc.Store stores the uploaded file
                    dcc.Store(id='shared_file')
                ]

            ),
            # to show ends
        ])
    elif pathname == '/demo':
        return html.Div([
            html.Hr(),
            # demo opening
            dcc.Markdown('Choose an example.', style=MARKDOWN_STYLE_NORMAL),
            # dropdown
            html.Th([
                dcc.Dropdown(
                    id='dropdown',
                    options=[
                        {'label': 'en_whole.txt', 'value': 'example_whole'},
                        {'label': 'en_citizen3_1.txt', 'value': 'example_citizen'},
                        {'label': 'zh_danmu.xlsx', 'value': 'example_danmu'}
                    ],
                ),
            ], style={'height': '30px', 'width': '450px', "borderBottom": 'none'}),
            # graph to show [TODO]
            html.Div(id='drop_down_show_graph'),
            html.Br(),
            html.Div([dcc.RadioItems(
                id='hide_show_button_demo',
                options=[{'label': x, 'value': x}
                         for x in ['Show Text', 'Hide Text']],
                value='Show Text',
                labelStyle={'display': 'inline-block'},
                style=MARKDOWN_STYLE_SMALL
            )]),
            # show accumulated/mean semantic distance
            html.Div(id='mean_semantic_distance_demo', style=MARKDOWN_STYLE_SMALL),
            html.Div(id='accumulated_semantic_distance_demo', style=MARKDOWN_STYLE_SMALL),
            html.Div(id='mean_semantic_distance_only_for_P_demo', style=MARKDOWN_STYLE_SMALL),
            html.Br(),
            # go back home
            dcc.Link(dcc.Markdown('Go Back Home'), href="/", style=MARKDOWN_STYLE_NORMAL),
        ])
    elif pathname == '/template':
        return html.Div([
            html.Hr(),
            # template opening
            dcc.Markdown('Download the template.', style=MARKDOWN_STYLE_NORMAL),
            html.Br(),
            # download
            html.Div([html.Button("Download the template", id="btn_download_template",
                                  style={'height': "60px",
                                         'width': "480px",
                                         'margin': '10px',
                                         'fontFamily': 'monospace',
                                         'fontSize': 16,
                                         'color': '#2D2D2D'}),
                      Download(id="download_template")
                      ]),
            html.Br(),
            # go back home
            dcc.Link(dcc.Markdown('Go Back Home'), href="/", style=MARKDOWN_STYLE_NORMAL),
        ])
    else:
        # feedback error 404
        return dcc.Markdown('Error: no content available', style=MARKDOWN_STYLE_LARGE)
Пример #30
0
            ],
                       className='five columns'),
        ],
                 className='row'),
    ]),
    html.Div([
        html.Div([dcc.Graph(id='my-graph', )], className='six columns'),
        html.Div([dcc.Graph(id='subplot')], className='six columns')
    ],
             style={'width': '100%'}),
    html.Div([
        html.Div([dcc.Graph(id='graph3', )], className='twelve columns'),
        html.Div([dcc.Graph(id='graph4')], className='eight columns'),
    ]),
    html.Div([
        dcc.Markdown("""**Tweet**"""),
        html.Pre(id='hover-data', className='normal')
    ],
             className='two columns')
],
                      className='row')


@app.callback(Output('select-username', 'options'),
              [Input('data-dropdown', 'value')])
def update_drop(selected_dropdown1):
    options = [{
        'label': str(selected_dropdown1) + ' handle',
        'value': 1
    }, {
        'label': 'Users',