Exemple #1
0
                    marks={i: 'Label {}'.format(i)
                           for i in range(1, 6)},
                    value=5,
                    step=1,
                    id='slider')

smoothe_slider = dcc.Slider(
    min=0,
    max=9,
    marks={},
    value=5,
    step=0.01,
    id='sslider',
)

button = html.Button('Print Everything', id='the-button')
printEverything = html.P(children=[], id='print-everything-id')
sliderValue = html.P(children=[], id='slider-callback')

###########################################################
###########################################################

# Layout
allElems = [
    title,
    breakTag,
    dropdown,
    breakTag,
    breakTag,
    multiSelectDropDown,
    breakTag,
Exemple #2
0
 def leftpanel():
     return html.Div(
         className="three columns",
         id="options-div",
         style={"padding": "10px"},
         children=[
             Card(
                 [
                     dcc.Dropdown(
                         id="reduction-dropdown",
                         searchable=False,
                         clearable=False,
                         options=[
                             {
                                 "label": "PCA",
                                 "value": "pca",
                             },
                             {
                                 "label": "TSNE",
                                 "value": "tsne",
                             },
                             {
                                 "label": "UMAP",
                                 "value": "umap",
                             },
                         ],
                         placeholder="select a reduction algorithim",
                         value="tsne",
                     ),
                     NamedInlineRadioItems(
                         name="Number of Dimensions",
                         short="number-of-dimensions",
                         options=[
                             {
                                 "label": " 2",
                                 "value": "2",
                             },
                             {
                                 "label": " 3",
                                 "value": "3",
                             },
                         ],
                         val="3",
                     ),
                     NamedInlineRadioItems(
                         name="Show Grid",
                         short="show-grid",
                         options=[
                             {
                                 "label": " on",
                                 "value": "on",
                             },
                             {
                                 "label": " off",
                                 "value": "off",
                             },
                         ],
                         val="on",
                     )
                 ],
                 id="options-card",
             ),
             html.Section([
                 NamedSlider(
                     name="Number of Iterations",
                     short="n_epochs",
                     min=100,
                     max=1000,
                     step=10,
                     val=500,
                     marks={
                         i: str(i)
                         for i in [100, 250, 500, 750, 1000]
                     },
                 )
             ],
                          id="n_epochs_card"),
             html.Section([
                 NamedSlider(
                     name="Number of NN",
                     short="n_neighbors",
                     min=4,
                     max=100,
                     step=None,
                     val=10,
                     marks={i: str(i)
                            for i in [4, 10, 20, 50, 100]},
                 )
             ],
                          id="n_neighbors_card"),
             html.Section([
                 NamedSlider(
                     name="Learning Rate",
                     short="learning_rate",
                     min=10,
                     max=200,
                     step=1,
                     val=100,
                     marks={i: str(i)
                            for i in [10, 50, 100, 200]},
                 )
             ],
                          id="learning_rate_card"),
             html.Section([
                 NamedSlider(
                     name="Perplexity",
                     short="perplexity",
                     min=3,
                     max=100,
                     step=None,
                     val=30,
                     marks={i: str(i)
                            for i in [3, 10, 20, 50, 100]},
                 )
             ],
                          id="perplexity_card"),
             Card(
                 [
                     html.Button(id="reduction-run-button",
                                 children=["Reduce"])
                 ],
                 id='reduction-button-card',
             ),
             Card(
                 id='info-card',
                 style={"padding": "5px"},
                 children=[
                     html.Div(
                         id="div-plot-click-message",
                         style={
                             "text-align": "center",
                             "margin-bottom": "7px",
                             "font-weight": "bold",
                         },
                     ),
                     html.Div(id="div-plot-click-image"),
                     html.Div(id="div-plot-click-wordemb"),
                 ],
             )
         ])
    def _serve_layout():
        session_id = str(uuid.uuid4())
        logging.info("Started new session: %s", session_id)

        return dbc.Container([
            html.Div(session_id, id='session-id', style={'display': 'none'}),
            html.Div([
                html.H1(children='RetaiL Store Generator and Management'),
                html.Img(src=img, style={'width': 300, 'float': 'right'}),
            ], style={'columnCount': 2}),
            dcc.Tabs([
                dcc.Tab([
                    html.H3('Manage your own store and see how it performs!'),
                    dcc.Markdown('''
                    The idea behind this web application is for you to customise your own store! But will you be able to avoid wasting?
                    Once you've opened your brand new store, it is time to define your scoring metric - will it help you in understanding the underlying dynamics?
                    Will you be able to order the right amount of items, to reduce the ecological footprint of your store?
                    '''),
                    html.H3('Store creation'),
                    dcc.Markdown('''
                    The first step is to create your store. Enter below the characteristics to define your store.
                    This will also generate an item assortment, which can be replicated by entering a seed.
                    '''),
                    html.Table(title='Store characteristics', children=[
                        html.Tr([
                            html.Th('Store characteristics',
                                    colSpan='4'),
                            html.Td('Seed'),
                            html.Td(dcc.Input(id="seed", type="number",
                                              placeholder="seed", min=1, max=100000, step=1, size="6")),
                            html.Td('Buckets'),
                            html.Td(dcc.Input(id="daily_buckets",
                                              type="number", value=4, min=1, max=12, step=1, size="6")),
                        ]),
                        html.Tr([
                            html.Td('Customers'),
                            html.Td(dcc.Input(id="n_customers", type="number",
                                              value=500, min=0, max=2000, step=1, size="6")),
                            html.Td('Items'),
                            html.Td(dcc.Input(id="n_items", type="number",
                                              value=30, min=5, max=100, step=1, size="6")),
                            html.Td('Stock size'),
                            html.Td(dcc.Input(id="max_stock", type="number",
                                              value=600, min=0, max=2000, step=1, size="6")),
                            html.Td('Horizon'),
                            html.Td(dcc.Input(id="horizon", type="number",
                                              value=91, min=40, max=1000, step=1, size="6")),
                        ]),
                        html.Tr([
                            html.Td('Bias'),
                            html.Td(dcc.Input(id="bias", type="number",
                                              value=0.0, min=-1, max=1, step=.01, size="6")),
                            html.Td('Variance'),
                            html.Td(dcc.Input(id="variance", type="number",
                                              value=0.0, min=0, max=1, step=.01, size="6")),
                            html.Td('ON Leadtime'),
                            html.Td(dcc.Input(id="leadtime_fast",
                                              type="number", value=0, min=0, max=10, step=1, size="6")),
                            html.Td('ID Leadtime'),
                            html.Td(dcc.Input(id="leadtime_long",
                                              type="number", value=1, min=1, max=10, step=1, size="6")),
                        ]),
                    ]),
                    html.H3('Success metric'),
                    dcc.Markdown('''
                    Now, it is time to define your success metric. You can pick one and specify weights, or select "Custom" and enter your own metric - containing the letters "a" for availability, "s" for sales, and  "w" for waste.
                    '''),
                    dcc.Dropdown(id='utility_fun',
                                    options=[
                                        {'label': 'Cobb-Douglas utility function',
                                         'value': 'cobbdouglas'},
                                        {'label': 'Log Linear utility function',
                                         'value': 'loglinear'},
                                        {'label': 'Linear utility function',
                                         'value': 'linear'},
                                        {'label': 'Custom utility function',
                                         'value': 'custom'}
                                    ],
                                 value='cobbdouglas'),
                    html.Table(id='weights', children=[
                        html.Tr([
                            html.Td('Waste weight'),
                            html.Td(dcc.Input(id="weight_waste", type="number",
                                              min=0, max=3, step=.01, value=0.5)),
                            html.Td('Sales weight'),
                            html.Td(dcc.Input(id="weight_sales", type="number",
                                              min=0, max=3, step=.01, value=0.5)),
                            html.Td('Availability'),
                            html.Td(dcc.Input(id="weight_availability",
                                              type="number", min=0, max=3, step=.01, value=0.5)),
                        ], style={'border-style': 'hidden'}),
                    ]),
                    html.Table(id='custom_utility', children=[
                        html.Tr([
                            html.Td('Custom function definition'),
                            html.Td(dcc.Input(id='utility', type='text',
                                              placeholder="Contains a, w, and s")),
                        ], style={'border-style': 'hidden'}),
                    ]),
                    html.Button('Create store', id='create'),
                    html.H3('Items'),
                    dcc.Markdown('''
                    Below, you can see the items present in your store, with their price and cost.
                    The color indicates how long you can keep them for.
                    '''),
                    dcc.Graph(id='output')
                ], label="STORE GENERATOR"),
                dcc.Tab([
                    html.H3('Freshness level'),
                    dcc.Markdown('''
                    Freshness represents how long your items can be stored before the expiration date. The fresher the item, the shorter the time it can be stored! Overall, you can see this as the difficulty level. Try moving the slider!
                    '''),
                    dcc.Slider('freshness', min=1, max=100, value=1, marks={
                        1: 'Standard',
                        10: 'Fresher items',
                        25: 'Very fresh',
                        50: 'Very very fresh',
                        75: 'Too fresh',
                        100: 'Bakery mode',
                    }),
                    html.H3('Order algorithm'),
                    dcc.Markdown('''
                    The main goal is to adjust the number of each item you order for your store. To do so, you can build an expression around the following:
                    - n_customers, the number of customers expected
                    - forecast, the purchase probability of each of those customers
                    - stock, the current stock (or inventory position) of items.
                    '''),
                    html.Table(children=[
                        html.Tr([
                            html.Td('Order input'),
                            html.Td(
                                dcc.Input(value='forecast*n_customers - stock', type='text', id='order', size="50")),
                        ], style={'border-style': 'hidden'}),
                    ]),
                    html.Br(),
                    html.Button('Order!', id='order_button'),
                    dcc.Graph(id='output2'),
                ], label="ORDERING SIMULATION"),
            ]),
        ], style={'padding': '50px'})
Exemple #4
0
 def __init__(self, parent_name, local_name, buttom_text):
     Component.__init__(self, parent_name, local_name)
     self._register(html.Button(id=self.full_name, children=buttom_text))
             className='four columns offset-by-four'),
                  className='row container'),
         html.Div(html.Div(html.Div(
             [
                 html.Div([
                     html.Label(
                         'Data Query Time Stamp',
                         className='theme-color-quaternary',
                     ),
                 ],
                          className='row'),
                 html.Div([
                     html.B(id='last-query-time',
                            className='eight columns'),
                     html.Button(
                         'Refresh',
                         id='refresh-component',
                         className='three columns offset-by-one')
                 ],
                          className='row')
             ],
             className='panel theme-color-surface-variant'),
                           className='four columns offset-by-four'),
                  className='row container'),
     ],
              className='row',
              id='metabar'),
     html.Div(id='plot-area'),
 ],
          id='master',
          style={'visibility': 'hidden'}),
 #html.Div([
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State, MATCH
import plotly.express as px

# gapminderデータを読み込む
gapminder = px.data.gapminder()
# 横に2つのコンポーネントを並べるためのスタイル
half_style = {"width": "50%", "display": "inline-block"}

app = dash.Dash(__name__)

# 2つのコンポーネントを持つレイアウト
app.layout = html.Div([
    html.Button("PUSH ME", id="add_drop", n_clicks=0),
    html.Div(id="my_div", children=[]),
])


# ➊ コールバック1
@app.callback(
    Output("my_div", "children"),
    Input("add_drop", "n_clicks"),
    State("my_div", "children"),
    prevent_initial_call=True,
)
def update_layout(n_clicks, children):
    new_layout = html.Div(
        [
            dcc.Dropdown(
                   style={
                       "margin-bottom": "20px",
                       "background-color": "#31302F",
                       "color": "white"
                   }),
         html.H6('Number of Iterations'),
         dcc.Input(id='num_iter',
                   type='number',
                   value=30,
                   style={
                       "margin-bottom": "20px",
                       "background-color": "#31302F",
                       "color": "white"
                   }),
         html.Br(),
         html.Button('Run', id='run'),
         # html.P('''Visualising time series with Plotly - Dash'''),
         # html.P('''Pick one or more stocks from the dropdown below.''')
     ]),  # Define the left element
 html.Div(className='eight columns div-for-charts bg-grey',
          children=[
              html.Div(className='eight rows div-for-iter',
                       children=[
                           html.Br(),
                           dcc.Slider(
                               id='iter_slider',
                               min=1,
                               max=10,
                               marks={
                                   i: '{}'.format(i)
                                   for i in range(11)
            },
        ],
    )


single_ingredients_table = MakeIngredientsTable('table-single-ingredients')
recipe_ingredients_table = MakeIngredientsTable('table-recipe-ingredients')

# tags from database (must be reloaded to find new ones)
tags_empty = list(range(25))
tag_buttons = []
for tag in tags_empty:
    tmp = html.Button(id='tag-%d-button' % (tag),
                      children='button %d' % (tag),
                      n_clicks=0,
                      style={
                          'display': 'inline-block',
                          'verticalAlign': 'middle'
                      })
    tmp_div = html.Div(id='tag-%d-div' % (tag),
                       children=tmp,
                       style={
                           'display': 'inline-block',
                           'verticalAlign': 'middle',
                           'display': 'none'
                       })
    tag_buttons.append(tmp_div)


# This one determines whether the button div is visible or not
# Also the button names
def layout():
    data = chart_utils.get_loaded_data("SCHEDULEREPORTS_VISITSBYSTATUS","DATASET")
    remove_cols = ['BRANCH','COLUMN_MAPPING', 'COLUMN_PARAMETERS']

    max_date = datetime.now()

    children = html.Div(
        [
            ddk.Row(
                [
                    ddk.ControlCard(
                        [
                            html.Details(
                                [
                                    html.Summary("About this app"),
                                    html.P(
                                        """Select attributes to fine tune graphs and tables."""
                                    ),
                                ]
                            ),
                            ddk.ControlItem(
                                dcc.Dropdown(
                                    options=[
                                        {"label": status, "value": status,}
                                        for status in sorted(
                                            [
                                                patient
                                                for patient in data["STATUS"].unique()
                                                if patient
                                            ]
                                        )
                                    ],
                                    multi=True,
                                    placeholder="Select Status",
                                    id="status-selector",
                                    value=["Not Yet Started", "Saved"],
                                )
                            ),
                            ddk.ControlItem(
                                dcc.Dropdown(
                                    options=[
                                        {"label": clinician, "value": clinician,}
                                        for clinician in sorted(
                                            [
                                                patient
                                                for patient in data[
                                                    "ASSIGNED_TO"
                                                ].unique()
                                                if patient
                                            ]
                                        )
                                        if clinician
                                    ],
                                    multi=True,
                                    placeholder="Select a Clinician",
                                    id="clinician-selector",
                                )
                            ),
                            ddk.ControlItem(
                                dcc.Dropdown(
                                    multi=True,
                                    placeholder="Select a Patient",
                                    id="patient-selector",
                                )
                            ),
                            ddk.ControlItem(
                                dcc.DatePickerRange(
                                    id="date-picker",
                                    min_date_allowed=pd.to_datetime(
                                        data["SCHEDULED_DATE"].min()
                                    ),
                                    max_date_allowed=max_date,
                                    initial_visible_month=max_date,
                                    start_date=max_date - timedelta(days=30),
                                    end_date=max_date,
                                ),
                            ),
                            ddk.ControlItem(
                                html.Button(
                                    id="select-all-rows",
                                    children="Select all matching records",
                                    style={"margin": "auto"},
                                    n_clicks=0,
                                )
                            ),
                            html.Div(
                                [
                                    ddk.Modal(
                                        id="modal-btn-outer",
                                        children=[
                                            html.Button(
                                                id="expand-modal-2",
                                                n_clicks=0,
                                                children="Take action",
                                            ),
                                        ],
                                        target_id="modal-content",
                                        hide_target=True,
                                        style={"float": "right"},
                                    ),
                                ],
                                style={"margin": "auto"},
                            ),
                        ],
                        width=30,
                        style={"overflow": "scroll"},
                    ),
                    ddk.Card(id="time-series"),
                ]
            ),
            ddk.Row(id="pie-charts"),
            ddk.Card(
                children=[
                    ddk.CardHeader(
                        title="Table of selected tasks",
                        children=[
                            html.Div(
                                [
                                    ddk.Modal(
                                        id="modal-btn-outer",
                                        children=[
                                            html.Button(
                                                id="expand-modal",
                                                n_clicks=0,
                                                children="Take action",
                                            )
                                        ],
                                        target_id="modal-content",
                                        hide_target=True,
                                        style={"float": "right"},
                                    ),
                                    ddk.Block(
                                        id="modal-content",
                                        children=html.Div(id="modal-div"),
                                        style={
                                            "width": "50%",
                                            "margin": "auto",
                                            "overflow": "scroll",
                                        },
                                    ),
                                ]
                            ),
                        ],
                    ),
                    ddk.Block(
                        ddk.DataTable(
                            columns=[
                                {"name": i.replace("_", " ").title(), "id": i}
                                for i in data.columns if (i not in remove_cols)
                            ],
                            data = data.sort_values(by="SCHEDULED_DATE").to_dict("records"),
                            filter_action="native",
                            page_action="native",
                            page_size=25,
                            row_selectable="multi",
                            id="data-table",
                            style_cell={'fontSize': 12, 'font-family': 'sans-serif'}
                        ),
                        style={"overflow": "scroll"}
                    ),
                ]
            ),
        ]
    )
    return children
Exemple #10
0
                                    'type': 'bar',
                                    'name': 'USA'
                                },
                            ],
                            'layout': {
                                'plot_bgcolor': colors['background'],
                                'paper_bgcolor': colors['background'],
                                'font': {
                                    'color': colors['text']
                                }
                            }
                        })
          ]),
 html.Div(children=[
     dcc.ConfirmDialogProvider(
         children=html.Button('Click ME'),
         id='danger-danger',
         message='Danger danger. Are you sure you want to continue?'),
     html.Div(children=[
         html.H4(children='multi output'),
         dcc.Input(id='num', type='number', value=5),
         html.Table([
             html.Tr([html.Td(['x', html.Sup(2)]),
                      html.Td(id='square')]),
             html.Tr([html.Td(['x', html.Sup(3)]),
                      html.Td(id='cube')]),
             html.Tr([html.Td(['2', html.Sup('x')]),
                      html.Td(id='twos')]),
             html.Tr([html.Td(['3', html.Sup('x')]),
                      html.Td(id='threes')]),
             html.Tr([html.Td(['x', html.Sup('x')]),
             datetime.timedelta(
                 days=1),
             date=None,
             placeholder=
             "Select a day",
             with_portal=True,
             display_format=
             'D-MMM-Y'),
         html.Button(
             id='extract_data',
             n_clicks=0,
             children=
             "Lancer l'extraction",
             style={
                 'display':
                 'block',
                 'background-color':
                 '#F700CA',
                 'margin-top':
                 '5px',
                 'color':
                 'white'
             })
     ],
     style={'display': 'block'
            }),
 html.Div(
     id='add_day_form_01',
     children=[
         html.Button(
             id='add_day',
Exemple #12
0
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State

app = dash.Dash()

app.layout = html.Div([
    dcc.Input(
        id='number-in',
        value=1,
        style={'fontSize':28}
    ),
    html.Button(
        id='submit-button',
        n_clicks=0,
        children='Submit',
        style={'fontSize':28}
    ),
    html.H1(id='number-out')
])

@app.callback(
    Output('number-out', 'children'),       # Input triggers the underlying function, with the option to use it's own Input value
    [Input('submit-button', 'n_clicks')],   # when the Input value(n_clicks) changes, it **triggers** the output function,
    [State('number-in', 'value')])          # which uses both the Input value and the State Value to update the Output.
def output(n_clicks, number):   # notice how n_clicks is linked to n_clicks(Input), and value is linked to the value(State)
    return number               # The Input value(n_click) isn't used in the output function, it serves purely as a **trigger**.

# Input and State are basically the same, the main difference being
# that State doesn't have the ability to trigger the underlying function.
Exemple #13
0
def main():
    external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']

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

    colors = {'background': '#FFFFFF', 'text': '#000000'}

    input_style = {
        'width': '50%',
        'height': '40px',
        'lineHeight': '60px',
        'borderWidth': '1px',
        'borderRadius': '5px',
        'textAlign': 'center',
        'margin': '10px',
    }

    label_style = {'margin': '10px'}

    upload_style = {
        'width': '60%',
        'height': '60px',
        'lineHeight': '60px',
        'borderWidth': '1px',
        'borderStyle': 'dashed',
        'borderRadius': '5px',
        'textAlign': 'center',
        'margin': '10px'
    }

    result_list_style = {
        'width': '30%',
        'display': 'inline-block',
        'textAlign': 'center',
        'margin': '30px'
    }

    app.layout = html.Div(
        style={'backgroundColor': colors['background']},
        children=[
            html.H1(children='Meeting Bingo',
                    style={
                        'textAlign': 'center',
                        'color': colors['text']
                    }),
            html.Div(
                children='A bingo card generator for your Meeting Bingo! ',
                style={
                    'textAlign': 'center',
                    'color': colors['text']
                }),
            html.Div(  #Div breaking page in 3
                [
                    html.Div([
                        html.Div([
                            html.Label('Number of Rows', style=label_style),
                            dcc.Input(id='n_rows',
                                      type='number',
                                      value=4,
                                      min=1,
                                      max=15,
                                      style=input_style)
                        ],
                                 style={'display': 'inline-block'}),
                        html.Div([
                            html.Label('Number of Columns', style=label_style),
                            dcc.Input(id='n_cols',
                                      type='number',
                                      value=4,
                                      min=1,
                                      max=15,
                                      style=input_style),
                        ],
                                 style={'display': 'inline-block'}),
                        html.Label('Bingo Entries File', style=label_style),
                        dcc.Upload(id='upload_entries',
                                   children=html.Div([
                                       'Drag and Drop or ',
                                       html.A('Select Files')
                                   ]),
                                   style=upload_style),
                        html.Div(id="entries_filename"),
                        html.Label('E-mail Addresses List File',
                                   style=label_style),
                        dcc.Upload(id='upload_emails',
                                   children=html.Div([
                                       'Drag and Drop or ',
                                       html.A('Select Files')
                                   ]),
                                   style=upload_style),
                        html.Ul(id="emails_filename"),
                        dcc.Loading(id='loading-1',
                                    children=[
                                        html.Button(id='submit_button',
                                                    n_clicks=0,
                                                    children='Submit',
                                                    style=label_style),
                                    ]),
                        html.Div(id="result"),
                    ],
                             style={
                                 'width': '30%',
                                 'display': 'inline-block'
                             }),
                    html.Div(
                        [
                            #html.Label('Bingo Entries', style=label_style),
                            html.Div(id='entries_list')
                        ],
                        style=result_list_style),
                    html.Div(
                        [
                            #html.Label('Emails', style=label_style),
                            html.Div(id='emails_list')
                        ],
                        style=result_list_style)
                ],
                style={'display': 'flex'})
        ])

    @app.callback(
        [
            Output("entries_filename", "children"),
            Output("entries_list", "children")
        ],
        [
            Input("upload_entries", "filename"),
            Input("upload_entries", "contents")
        ],
    )
    def process_entries_file(filename, contents):
        if contents is None:
            return [], []

        entries = parse_contents(contents)

        df = pd.DataFrame(entries, columns=['Bingo Entries'])
        table = dash_table.DataTable(
            id='entries_filled',
            columns=[{
                "name": i,
                "id": i
            } for i in df.columns],
            data=df.to_dict("rows"),
            style_cell={'textAlign': 'left'},
        )

        return [html.H6(filename)], [table]

    @app.callback(
        [
            Output("emails_filename", "children"),
            Output("emails_list", "children")
        ],
        [
            Input("upload_emails", "filename"),
            Input("upload_emails", "contents")
        ],
    )
    def process_emails_file(filename, contents):
        if contents is None:
            return [], []

        entries = parse_contents(contents)

        df = pd.DataFrame(entries, columns=['E-mail Addresses'])
        table = dash_table.DataTable(
            id='emails_filled',
            columns=[{
                "name": i,
                "id": i
            } for i in df.columns],
            data=df.to_dict("rows"),
            style_cell={'textAlign': 'left'},
        )

        return [html.H6(filename)], [table]

    @app.callback(Output("result", "children"),
                  [Input("submit_button", "n_clicks")], [
                      State("upload_entries", "filename"),
                      State("upload_entries", "contents"),
                      State("upload_emails", "filename"),
                      State("upload_emails", "contents"),
                      State("n_rows", "value"),
                      State("n_cols", "value")
                  ])
    def submit(n_clicks, entries_filename, entries_contents, emails_filename,
               emails_contents, n_rows, n_cols):
        if entries_contents is None or emails_contents is None:
            return []

        entries = parse_contents(entries_contents)

        emails = parse_contents(emails_contents)

        for email in emails:
            send_bingo_card(email, entries, n_rows, n_cols)

        return [
            html.H5("Sent {:d}x{:d} cards to {:d} e-mail addresses!".format(
                n_rows, n_cols, len(emails))),
        ]

    app.run_server(debug=True)
Exemple #14
0
                     className = "update_box",
                     children = [
                         html.P("Total Recovered: {}" .format(daily_df['Recovered Cases'].sum()))
                     ]
                 ),
                 html.Div(
                     className ='last_update_box',
                     children = [
                         html.P("Cases for Past 7 Days: {}" .format(one_week_trend))
                 ]),
         ], style = {'font-family':'Lucida Grande', 'font-weight':'bold',
             'font-size':18,'color':'#7d7d7d'}),
         html.Div(
             className = 'daily_cases_container',
             children = [
                 html.Button('Daily Cases', id = 'btn-nclicks-1', n_clicks=1, className ='Buttons'),
                 html.Button('7 Day Average', id = 'btn-nclicks-2', n_clicks=0, className = 'Buttons'),
                 html.Div(id = 'graphs_container')
         ]),
     ]),
 html.Div(
     className = "radioitem_container",
     children = [
         dcc.RadioItems(
             className = 'radioitem_active_total',
             id = 'active_total_radioitem',
             options = [{'label':i, 'value':i} for i in ['Active Cases', 'Total Cases', 'Recovered Cases']],
             value = 'Active Cases'),
     ]),
 html.Div(
     className = 'bot_graph_container',
Exemple #15
0
             html.Div(
                 className="form-group",
                 children=[
                     dcc.Checklist(
                         options=[{
                             'label': "Remember me",
                             'value': 'me'
                         }])
                 ]),
             html.Div(
                 className=
                 "d-flex justify-content-center mt-3 login_container",
                 children=[
                     html.Button(
                         type="button",
                         className="btn login_btn",
                         children=["Login"],
                         id="login-button")
                 ])
         ])
     ],
     className=
     "d-flex justify-content-center form_container"),
 html.Div(
     className="mt-4",
     children=[
         html.Div(
             className=
             "d-flex justify-content-center links",
             children=[
                 "Don't have an account?",
             }),
    html.Div([
        html.Div([
            dcc.Slider(min=0,
                       max=5,
                       value=0,
                       marks={i: ''.format(i + 1)
                              for i in range(6)},
                       id='slider'),
        ],
                 className='row',
                 style={'margin-bottom': '10px'}),
        html.Div([
            html.Div([
                html.Button('Back',
                            id='back',
                            style={'display': 'inline-block'}),
                html.Button('Next',
                            id='next',
                            style={'display': 'inline-block'})
            ],
                     className='two columns offset-by-two'),
            dcc.Markdown(id='text', className='six columns'),
        ],
                 className='row',
                 style={'margin-bottom': '10px'}),
        dcc.Graph(id='graph', style={'height': '60vh'}),
    ],
             id='page'),
])
Exemple #17
0
    def main(self, db):

        def good_categories_items(db):
            """
            Получение всех категорий товаров в базе данных
            """
            good_categories = db.get_unique_categories()
            res = []
            for category in good_categories:
                res.append({'label': category.capitalize().replace('_', ' '), 'value': category})
            return res

        self.app.layout = html.Div(children=[
            html.H1('АНАЛИТИКА ПО САЙТУ "ВСЕ НА ДНО!"'),
            html.H2('Выполнил: Андрей Попов'),

            dcc.Dropdown(
                id='menu',
                options=[
                    {'label': 'Посетители из каких стран совершают больше всего действий на сайте '
                              '(unknown - список не распознанных стран)',
                     'value': 'top_countries'},

                    {'label': 'Посетители из какой страны чаще всего интересуются товарами из определенных категорий?',
                     'value': 'top_countries_in_category'},

                    {'label': 'В какое время суток чаще всего просматривают определенную категорию товаров?',
                     'value': 'category_interest'},

                    {'label': 'Нагрузка на сайт', 'value': 'site_load'},
                    {'label': 'Количество неоплаченных корзин за определенный период', 'value': 'unpaid_carts'},
                ],
                value='top_countries',
                placeholder='Выберете интересующую информацию...'
            ),

            dcc.Dropdown(id='good_categories',
                         options=good_categories_items(self.db),
                         style={'display': 'block'},
                         placeholder='Выберете интересующую категорию...'
                         ),

            dcc.DatePickerSingle(
                id='date_picker',
                min_date_allowed=dt.date.fromisoformat(self.db.get_min_date()),
                max_date_allowed=dt.date.fromisoformat(self.db.get_max_date()),
                display_format="YYYY-MM-DD",
                style={'display': 'block'},
                placeholder="Начальная дата"
            ),

            dcc.DatePickerSingle(
                id='date_picker_range',
                min_date_allowed=dt.date.fromisoformat(self.db.get_min_date()),
                max_date_allowed=dt.date.fromisoformat(self.db.get_max_date()),
                display_format="YYYY-MM-DD",
                style={'display': 'block'},
                placeholder="Конечная дата"
            ),

            html.Button('Обновить информацию', id='button'),

            dcc.Graph(
                id='graph',
                style={'display': 'block'}
            ),

            html.Div(
                id='msg',
                children='',
                style={'display': 'block'}
            )
        ])

        # Функция отслеживающая запрос из меню
        @self.app.callback(
            [Output(component_id='good_categories', component_property='style'),
             Output(component_id='date_picker', component_property='style'),
             Output(component_id='date_picker_range', component_property='style'),
             Output(component_id='graph', component_property='style'),
             Output(component_id='msg', component_property='style')
             ],
            [Input(component_id='menu', component_property='value')])
        def output_format(menu_value):
            """
            menu_value - параметр, который приходит из меню
            out_format - список определяющий, какие элементы будут отрисованы на странице
                0 - не отрисовывать элемент
                1 - отрисовывать
                out_format[0] - good_categories
                out_format[1] - date_picker
                out_format[2] - date_picker_range
                out_format[3] - graph
                out_format[4] - msg
            """
            out_format = [0]*5

            if menu_value == 'top_countries':
                out_format[3] = 1
            elif menu_value == 'top_countries_in_category':
                out_format[0] = 1
                out_format[3] = 1
            elif menu_value == 'category_interest':
                out_format[0] = 1
                out_format[3] = 1
            elif menu_value == 'site_load':
                out_format[1] = 1
                out_format[3] = 1
            elif menu_value == 'unpaid_carts':
                out_format[1] = 1
                out_format[2] = 1
                out_format[4] = 1
            return [{'display': 'block'} if i else {'display': 'none'} for i in out_format]

        # Функция отрисовывающая вэб страницу
        @self.app.callback(
            [Output(component_id='graph', component_property='figure'),
             Output(component_id='msg', component_property='children')],
            [Input(component_id='button', component_property='n_clicks')],
            [State(component_id='menu', component_property='value'),
             State(component_id='good_categories', component_property='value'),
             State(component_id='date_picker', component_property='date'),
             State(component_id='date_picker_range', component_property='date')
             ])
        def show_graph(n_clicks, menu_value, category_value, date_value, end_date_value):

            figure = {}
            msg = ''

            def get_countries_entries(countries_entry, countries_num):
                countries_entry = sorted(list(countries_entry), key=lambda x: x['count'])[-countries_num:]
                countries = []
                entries = []
                for d in countries_entry:
                    countries.append(d['_id'])
                    entries.append(d['count'])
                return countries, entries

            if menu_value == 'top_countries':
                countries_entry = db.count_countries()
                countries_num = 10
                countries, entries = get_countries_entries(countries_entry, countries_num)
                figure = {
                    'data': [{
                            'x': countries,
                            'y': entries,
                            'type': 'bar',
                            'name': 'Суммарное число запросов от указанной страны'
                    }],
                    'layout': {
                        'title': '10 cтран с самым большим количеством запросов на сайте',
                        'showlegend': True,
                        'legend': {
                            'x': 0,
                            'y': 1
                        },
                    },
                }

            elif menu_value == 'top_countries_in_category':
                countries_entry = db.interest_by_country(category_value)
                countries_num = 10
                countries, entries = get_countries_entries(countries_entry, countries_num)
                figure = {
                     'data': [{
                         'x': countries,
                         'y': entries,
                         'type': 'bar',
                         'name': 'Суммарное число просмотров от указанной страны'
                     }],
                     'layout': {
                         'title':
                             f'10 стран с самым большим количеством просмотров товаров категории '
                             f'\"{category_value.capitalize().replace("_", " ")}\"',
                         'showlegend': True,
                         'legend': {
                             'x': 0,
                             'y': 1
                         }
                     }
                }

            elif menu_value == 'category_interest':
                categories_entries = db.interest_by_time(category_value)
                timestamps_num = 24
                figure = {
                     'data': [{
                         'x': [dt.datetime(2000, 1, 1, i, 0, 0).time() for i in range(timestamps_num)],
                         'y': categories_entries,
                         'type': 'bar',
                         'name': 'Суммарное число просмотров в указанный час'
                     }],
                     'layout': {
                         'title':
                             f'Суммарное число просмотров товаров категории '
                             f'\"{category_value.capitalize().replace("_", " ")}\" '
                             f'в указанный час',
                     }
                }

            elif menu_value == 'site_load':
                entries = db.get_site_load(date_value)
                timestamps_num = 24
                figure = {
                     'data': [{
                         'x': [dt.datetime(2000, 1, 1, i, 0, 0).time() for i in range(timestamps_num)],
                         'y': entries,
                         'type': 'bar',
                         'name': 'Суммарное число просмотров в указанный час'
                     }],
                     'layout': {
                         'title':
                             f'Нагрузка на сайт в определенную дату',
                     }
                }

            elif menu_value == 'unpaid_carts':
                msg = db.count_unpaid_carts(date_value, end_date_value)

            return figure, msg
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output

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

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

app.layout = html.Div([
    dcc.Input(id="input-1-state", type="text", value="Montreal"),
    dcc.Input(id="input-2-state", type="text", value="Canada"),
    html.Button(id='submit-button-state', n_clicks=0, children='Submit'),
    html.Div(id="output-state"),
])


@app.callback(
    Output("output-state", "children"),
    Input('submit-button-state', 'n_clicks'),
    Input("input-1-state", "value"),
    Input("input-2-state", "value"),
)
def update_output(n_clicks, input1, input2):
    return u'The Button has been pressed {} times,Input 1 is "{}" and Input 2 is "{}"'.format(
        n_clicks, input1, input2)


if __name__ == '__main__':
    app.run_server(debug=True)
Exemple #19
0
                         className="fancyValue",
                         id="privacy-cost",
                     ),
                 ]),
                 html.P(
                     "Percentage of personal privacy budget this query will consume",
                     className="help",
                 ),
             ],
             style={"margin": "10px 0 0 0"},
         ),
         html.Div(
             [
                 html.Button(
                     "Submit Query",
                     id="submit",
                     className="button-primary",
                 )
             ],
             style={"margin": "20px 0"},
         ),
     ],
     className="six columns inputsContainer",
 ),
 html.Div(
     [
         html.H2(children="Results"),
         html.Div(
             [
                 html.H3("845", id="total-projects"),
                 html.P("Total Projects"),
            # header
        html.Div(children= u'Turbulance variability (µas)',
            style={'textAlign': 'center','font-weight': 'bold','color': colors['text']}
                ),
            # input tab
        html.Div([
        dcc.Input(id='TV-id', value=1, type='number',min=1,max=1,
        style={'textAlign': 'center','margin-left': '70px','width':'70%'}),
           
                ]),

            ],style={'backgroundColor': '#111111','opacity': '.8','width': '32%','float': 'right','display': 'inline-block','margin-right': '25px','margin-left': '25px','height': '420px'}),
    
###################### output ############################################
    
    html.Button(id = 'Calculate',n_clicks=0,children='Calculate', style={'width': '10%','backgroundColor': 'white','opacity': '1','font-weight': 'bold','color': 'black', 'float':'center', 'display': 'inline-block'}),

    html.Div(id='ls-id',
        style={'width': '30%', 'color': 'white','font-weight': 'bold','float':'center', 'display': 'inline-block'}),

    html.Div(id='final_output-id',
#        style={'width': '30%', 'float':'right', 'display': 'inline-block'}),
        style={'color': 'white', 'font-weight': 'bold','textAlign':'center','font-size':'25px','margin-top': '-15px'}),

    
    
    html.Div(id='butt-state')

    # 

        ], style={'background-image': 'url(https://www.ipac.caltech.edu/system/activities/images/20/large/thirty-meter-telescope-illustration-nao-japan.jpg)',}),
Exemple #21
0
 dcc.Dropdown(id='app-1-dropdown',
              options=[{
                  'label': '{}'.format(i),
                  'value': i
              } for i in keywords_to_disease]),
 html.Div(id='app-1-display-value'),
 html.H3('Location'),
 dcc.Dropdown(id='app-2-dropdown',
              options=[{
                  'label': '{}'.format(i),
                  'value': i
              } for i in keywords_to_location]),
 html.Div(id='app-2-display-value'),
 html.Div([
     dcc.Input(id='username', value='Initial Value', type='text'),
     html.Button(id='submit-button', type='submit', children='Submit'),
     html.Div(id='output_div')
 ]),
 html.Div([
     dcc.Interval(
         id="query_update_map",
         interval=int(GRAPH_INTERVAL),
         n_intervals=0,
     ),
     html.H1('Live tweets location'),
     html.Div(id='text-content_map'),
     dcc.Graph(
         id='map',
         animate=True,
         figure={
             'data': [{
     className="eight columns",
 ),
 html.Div(
     [
         html.H4("t-SNE Parameters", id="tsne_h4"),
         input_field("Perplexity:", "perplexity-state", 20, 50,
                     5),
         input_field("Number of Iterations:", "n-iter-state",
                     400, 1000, 250),
         input_field("Learning Rate:", "lr-state", 200, 1000,
                     10),
         input_field("Initial PCA dimensions:", "pca-state", 30,
                     10000, 3),
         html.Button(
             id="tsne-train-button",
             n_clicks=0,
             children="Start Training t-SNE",
         ),
         dcc.Upload(
             id="upload-data",
             children=html.A("Upload your input data here."),
             style={
                 "height": "45px",
                 "line-height": "45px",
                 "border-width": "1px",
                 "border-style": "dashed",
                 "border-radius": "5px",
                 "text-align": "center",
                 "margin-top": "5px",
                 "margin-bottom": "5 px",
             },
Exemple #23
0
    def test_multi_output(self):
        app = dash.Dash(__name__)
        app.scripts.config.serve_locally = True

        app.layout = html.Div([
            html.Button('OUTPUT', id='output-btn'),
            html.Table([
                html.Thead(
                    [html.Tr([html.Th('Output 1'),
                              html.Th('Output 2')])]),
                html.Tbody([
                    html.Tr([html.Td(id='output1'),
                             html.Td(id='output2')]),
                ])
            ]),
            html.Div(id='output3'),
            html.Div(id='output4'),
            html.Div(id='output5')
        ])

        @app.callback(
            [Output('output1', 'children'),
             Output('output2', 'children')], [Input('output-btn', 'n_clicks')],
            [State('output-btn', 'n_clicks_timestamp')])
        def on_click(n_clicks, n_clicks_timestamp):
            if n_clicks is None:
                raise PreventUpdate

            return n_clicks, n_clicks_timestamp

        # Dummy callback for DuplicateCallbackOutput test.
        @app.callback(Output('output3', 'children'),
                      [Input('output-btn', 'n_clicks')])
        def dummy_callback(n_clicks):
            if n_clicks is None:
                raise PreventUpdate

            return 'Output 3: {}'.format(n_clicks)

        # Test that a multi output can't be included in a single output
        with self.assertRaises(DuplicateCallbackOutput) as context:

            @app.callback(Output('output1', 'children'),
                          [Input('output-btn', 'n_clicks')])
            def on_click_duplicate(n_clicks):
                if n_clicks is None:
                    raise PreventUpdate

                return 'something else'

        self.assertTrue('output1' in context.exception.args[0])

        # Test a multi output cannot contain a used single output
        with self.assertRaises(DuplicateCallbackOutput) as context:

            @app.callback(
                [Output('output3', 'children'),
                 Output('output4', 'children')],
                [Input('output-btn', 'n_clicks')])
            def on_click_duplicate_multi(n_clicks):
                if n_clicks is None:
                    raise PreventUpdate

                return 'something else'

        self.assertTrue('output3' in context.exception.args[0])

        with self.assertRaises(DuplicateCallbackOutput) as context:

            @app.callback(
                [Output('output5', 'children'),
                 Output('output5', 'children')],
                [Input('output-btn', 'n_clicks')])
            def on_click_same_output(n_clicks):
                return n_clicks

        self.assertTrue('output5' in context.exception.args[0])

        with self.assertRaises(DuplicateCallbackOutput) as context:

            @app.callback(
                [Output('output1', 'children'),
                 Output('output5', 'children')],
                [Input('output-btn', 'n_clicks')])
            def overlapping_multi_output(n_clicks):
                return n_clicks

        self.assertTrue(
            '{\'output1.children\'}' in context.exception.args[0]
            or "set(['output1.children'])" in context.exception.args[0])

        self.startServer(app)

        t = time.time()

        btn = self.wait_for_element_by_id('output-btn')
        btn.click()
        time.sleep(1)

        self.wait_for_text_to_equal('#output1', '1')
        output2 = self.wait_for_element_by_css_selector('#output2')

        self.assertGreater(int(output2.text), t)
    def test_location_link(self):
        app = dash.Dash(__name__)

        app.layout = html.Div([
            html.Div(id='waitfor'),
            dcc.Location(id='test-location', refresh=False),
            dcc.Link(html.Button('I am a clickable button'),
                     id='test-link',
                     href='/test/pathname'),
            dcc.Link(html.Button('I am a clickable hash button'),
                     id='test-link-hash',
                     href='#test'),
            dcc.Link(html.Button('I am a clickable search button'),
                     id='test-link-search',
                     href='?testQuery=testValue',
                     refresh=False),
            html.Button('I am a magic button that updates pathname',
                        id='test-button'),
            html.A('link to click', href='/test/pathname/a', id='test-a'),
            html.A('link to click', href='#test-hash', id='test-a-hash'),
            html.A('link to click', href='?queryA=valueA', id='test-a-query'),
            html.Div(id='test-pathname', children=[]),
            html.Div(id='test-hash', children=[]),
            html.Div(id='test-search', children=[]),
        ])

        @app.callback(output=Output(component_id='test-pathname',
                                    component_property='children'),
                      inputs=[
                          Input(component_id='test-location',
                                component_property='pathname')
                      ])
        def update_location_on_page(pathname):
            return pathname

        @app.callback(output=Output(component_id='test-hash',
                                    component_property='children'),
                      inputs=[
                          Input(component_id='test-location',
                                component_property='hash')
                      ])
        def update_location_on_page(hash_val):
            if hash_val is None:
                return ''

            return hash_val

        @app.callback(output=Output(component_id='test-search',
                                    component_property='children'),
                      inputs=[
                          Input(component_id='test-location',
                                component_property='search')
                      ])
        def update_location_on_page(search):
            if search is None:
                return ''

            return search

        @app.callback(output=Output(component_id='test-location',
                                    component_property='pathname'),
                      inputs=[
                          Input(component_id='test-button',
                                component_property='n_clicks')
                      ],
                      state=[
                          State(component_id='test-location',
                                component_property='pathname')
                      ])
        def update_pathname(n_clicks, current_pathname):
            if n_clicks is not None:
                return '/new/pathname'

            return current_pathname

        self.startServer(app=app)

        self.snapshot('link -- location')

        # Check that link updates pathname
        self.wait_for_element_by_css_selector('#test-link').click()
        self.assertEqual(
            self.driver.current_url.replace('http://localhost:8050', ''),
            '/test/pathname')
        self.wait_for_text_to_equal('#test-pathname', '/test/pathname')

        # Check that hash is updated in the Location
        self.wait_for_element_by_css_selector('#test-link-hash').click()
        self.wait_for_text_to_equal('#test-pathname', '/test/pathname')
        self.wait_for_text_to_equal('#test-hash', '#test')
        self.snapshot('link -- /test/pathname#test')

        # Check that search is updated in the Location -- note that this goes through href and therefore wipes the hash
        self.wait_for_element_by_css_selector('#test-link-search').click()
        self.wait_for_text_to_equal('#test-search', '?testQuery=testValue')
        self.wait_for_text_to_equal('#test-hash', '')
        self.snapshot('link -- /test/pathname?testQuery=testValue')

        # Check that pathname is updated through a Button click via props
        self.wait_for_element_by_css_selector('#test-button').click()
        self.wait_for_text_to_equal('#test-pathname', '/new/pathname')
        self.wait_for_text_to_equal('#test-search', '?testQuery=testValue')
        self.snapshot('link -- /new/pathname?testQuery=testValue')

        # Check that pathname is updated through an a tag click via props
        self.wait_for_element_by_css_selector('#test-a').click()
        try:
            self.wait_for_element_by_css_selector('#waitfor')
        except Exception as e:
            print(
                self.wait_for_element_by_css_selector(
                    '#_dash-app-content').get_attribute('innerHTML'))
            raise e

        self.wait_for_text_to_equal('#test-pathname', '/test/pathname/a')
        self.wait_for_text_to_equal('#test-search', '')
        self.wait_for_text_to_equal('#test-hash', '')
        self.snapshot('link -- /test/pathname/a')

        # Check that hash is updated through an a tag click via props
        self.wait_for_element_by_css_selector('#test-a-hash').click()
        self.wait_for_text_to_equal('#test-pathname', '/test/pathname/a')
        self.wait_for_text_to_equal('#test-search', '')
        self.wait_for_text_to_equal('#test-hash', '#test-hash')
        self.snapshot('link -- /test/pathname/a#test-hash')

        # Check that hash is updated through an a tag click via props
        self.wait_for_element_by_css_selector('#test-a-query').click()
        self.wait_for_element_by_css_selector('#waitfor')
        self.wait_for_text_to_equal('#test-pathname', '/test/pathname/a')
        self.wait_for_text_to_equal('#test-search', '?queryA=valueA')
        self.wait_for_text_to_equal('#test-hash', '')
        self.snapshot('link -- /test/pathname/a?queryA=valueA')
import dash_html_components as html
from dash_extensions.enrich import Output, Dash, Trigger

app = Dash(prevent_initial_callbacks=True)
app.layout = html.Div([html.Button("Click me", id="btn"), html.Div(id="log")])


@app.callback(Output("log", "children"), Trigger("btn", "n_clicks"))
def func():  # argument is omitted from the function
    return "You clicked the button"


if __name__ == '__main__':
    app.run_server(port=9999)
Exemple #26
0
 html.Div([
     html.Div([
         html.Div([
             html.Div([
                 html.
                 H4(u'Autorisations suspectees',
                    style={
                        'display':
                        'inline'
                    }),
                 html.Button(
                     'Fraud',
                     id="BTN_Fraud",
                     className=
                     "btn btn-danger",
                     style={
                         'float':
                         'right',
                         'margin-right':
                         '15px'
                     }),
                 html.Button(
                     'Valider',
                     id="BTN_Validate",
                     className=
                     "btn btn-primary",
                     style={
                         'float':
                         'right',
                         'margin-right':
                         '15px'
    def index(plotter):

        page = html.Div([

             # first logo:

             html.Div(id='header_container', className =
                 'middle_container', children=[

                 html.Div(id='topleft_logo', children=[
                     html.A([html.Img(src='assets/logo.png')],
                            href='http://www.multiply-h2020.eu/')
                 ]),

                 html.Div(id='main_title_container', children=[
                     html.H1('MULTIPLY Visualisations',
                            id='main_title')
                 ]),

                 html.Div(style={'clear': 'left'})

                 # html.Div(id='descriptor_container',children=[
                 #     html.P('Some filler text',
                 #            id='descriptor')
                 # ])

                ])
             ,

             html.Div(id='data_background', children=[

                 # html.Div(id='subtitle_container',children=[
                 #    html.P('Data Display:', id='subtitle')
                 #    ])
                 #    ,

                 html.Div(className='middle_container', children=[
                     html.Div(id='select_box',children=[

                         html.Div(id='dropdown_container', children=[
                             dcc.Markdown(
                                 id='select_text',
                                 children="Select Parameter:"),
                             plotter.generate_parameter_dropdown()
                         ]),
                         html.Div(id='button_container', children=[
                             html.Button(
                                 id='select',
                                 n_clicks=0,
                                 children='Select')
                            ])
                     ])
                     ,
                     # html.Div(id='unc_expl_container', children=[
                     #     html.P('Some description.', id='unc_expl')
                     # ])

                 ])
                 ,
                 html.Div(style={'clear': 'left'})

                    ,


                 html.Div(className='middle_container', children=[

                    html.Div(id='core_vis_container',
                             className='map_container', children=[

                        html.H2('Derived data', id='core_data_title'),

                        html.Div(id='data_container',children=[
                            dcc.Graph(id='core-map')
                            ]),
                    ])
                    ,
                    html.Div(id='unc_vis_container', className='map_container',
                             children=[

                        html.H2('Uncertainty', id='unc_data_title'),

                        html.Div(id='unc_container', children=[
                            dcc.Graph(id='unc-map')
                            ]),


                    ]),
                    html.Div(style={'clear': 'left'})
                    ]),

                 html.P(id="helptext", className='middle_container',
                        children='The Uncertainty map displays negative '
                        'uncertainty only. The timeseries plot '
                        'below displays both positive and negative '
                        'values. Where the uncertainty is infinity, this is '
                        'represented on the timeseries as the value zero.'),

                 html.Div(id="slider_time_container", className='middle_container',
                          children=[
                    html.Div(id='slider_container', children=[
                        dcc.Slider(id='time-slider')
                    ]),

                    html.Div(dcc.Markdown(id='markdown', children="")),
                  ]),

                 html.Div(id="times_container", className='middle_container',
                          children=[
                     html.Div(id='timeseries_container',children=
                        [dcc.Graph(id='pixel_timeseries')

                        ]),
                     html.Button(
                         id='download_button',
                         style={},
                         n_clicks=0,
                         children=[html.A(
                             'Download Data',
                             id='download_link',
                             download="rawdata.csv",
                             href="",
                             target="_blank")
                         ])
                ])


             ])
                 ,
             html.Div(id='partners_container', children=[
                html.Div(id='p1_container', className="logo_container", children=[
                    html.A([html.Img(id='p1', src='assets/l1.png')
                    ], href='https://ec.europa.eu/')]),

                html.Div(id='p2_container', className="logo_container",
                         children=[
                    html.A([html.Img(id='p2', src='assets/l2.png')],
                           href='http://www.assimila.eu/')
                    ,
                    html.P('© 2019 Assimila Ltd',id='copyright')
                    ]),

                html.Div(id='p3_container', className="logo_container",
                         children=[
                    html.A([html.Img(id='p3',src='assets/l3.png')],
                           href='http://www.multiply-h2020.eu/')
                    ])
                ])


                #      html.Div(
                #          [dcc.Markdown(
                #              id='markdown',
                #              children="default text")]),
                #      plotter.generate_parameter_dropdown(),
                #      html.Button(
                #          id='select',
                #          n_clicks=0,
                #          children='Select'),
                #      html.Div(
                #          id='slider-container',
                #          style={
                #              'width': '80%',
                #              'display':'inline-block',
                #              'margin-bottom':'40px',
                #              'height':'40px'},
                #          children=[dcc.Slider(id='time-slider')]),
                #      html.Div(
                #          style={
                #              'width': '40%',
                #              'float':'left',
                #              'display':'inline-block'},
                #          children=[dcc.Graph(id='core-map')]),
                #      html.Div(
                #          style={
                #              'width': '40%',
                #              'float':'left',
                #              'display':'inline-block'},
                #          children=[dcc.Graph(id='unc-map'),]),
                #      html.Div(
                #          style={
                #              'width': '80%',
                #              'float':'left',
                #              'display':'inline-block'},
                #          children=dcc.Graph(id='pixel_timeseries'))
                 ])

        return page
Exemple #28
0
5.2 The application makes NO use of a VPN connection to connect to the dark web, a TOR proxy is used to crawl the dark
 web. 

5.3 The application stores all content/data from the websites it crawles in the database. By default, the application 
does not block any illegal content and the interface does not provide a way to delete illegal content from the 
database. Neither **FOUR.** or the Hogeschool van Amsterdam are responsible for the possibility of illegal content 
being stored.

###### Article 6 - Usage and searches
6.1 The application provides an interface which enables users to search the database for content. The application does 
not automatically block searches for illegal content, neither **FOUR.** or the Hogeschool van Amsterdam are responsible 
for (illegal) searches done by users of the application. 
''')
    ],
             className="termsText"),
    html.Button('Close', id='closeTerms')
],
                                    className="termsOfUseBox"),
                           className="termsOfUseBackground")

# This is the orange bottom bar of the application which contains a link to the EULA and notifies the user about
# the EULA he/she automatically accepts by using the application.
hive_bottombar = html.Div([
    "By using this application, you agree to the",
    html.Button(
        'License Agreement', className="openTermsButton", id="TermsButton")
],
                          className="termsOfUseBar",
                          id="termsOfUseBar")
          style={
              'width': '65%',
              'float': 'left'
          }),
 html.Div([
     html.Div([
         html.Label('Number of samples'),
         dcc.Slider(id='rg-nsample',
                    min=10,
                    max=100,
                    marks={i: str(i)
                           for i in range(10, 110, 10)},
                    value=50)
     ],
              style={'marginBottom': '30px'}),
     html.Button('Go!', id='rg-go'),
     html.Div([
         html.Label('Number of bins'),
         dcc.Slider(
             id='rg-nbins',
             min=1,
             max=50,
             marks={i: str(i)
                    for i in range(1, 50, 5)},
             value=30,
         )
     ],
              style={
                  'marginTop': '30px',
                  'marginBottom': '30px'
              }),
Exemple #30
0
    return v


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

app.layout = html.Div([
    html.Div(html.H3(f'3D Spot training on {socket.gethostname()}')),
    html.Div([
        html.H5('Enter parameters for training'),
        html.A(children="Click", href='/docs.html', target="_blank")
    ]),
    html.Div(id='input-div',
             children=[inputDiv(*v) for k, v in inputmap.items()]),
    html.Div([
        html.Button("Train", id='button-run', title="Push me"),
        html.Div(id='output', children='Result')
    ])
])


@app.callback(
    #[Output('output', 'children'),
    Output({
        'type': 'val',
        'id': ALL
    }, 'children'),
    Input('button-run', 'n_clicks'),
    State({
        'type': 'input',
        'id': ALL