Exemple #1
0
def display_output(n_clicks):
    if n_clicks > 0:
        return html.Div([
            html.Div(id='datatable-output'),
            DataTable(id='datatable', rows=[{
                'Column 1': i
            } for i in range(5)])
        ])
def display_config(value):
    parameters = 'parameters.txt'
    filepath = path + value + '/' + parameters
    lines = load_file(filepath)
    return html.Div([
        html.Div(id='config_output'),
        DataTable(id='datatable', rows=[{
            'Key': line
        } for line in lines])
    ])
Exemple #3
0
def lerz_hypos():
    return Col([
        Row(Col(H3('Seismicity', style=dict(textAlign='center')))),
        Row([
            Col(dcc.RadioItems(id='lerz-hypos-radio',
                               options=[{
                                   'label': 'Time',
                                   'value': 'T'
                               }, {
                                   'label': 'Depth',
                                   'value': 'A'
                               }],
                               value='A'),
                bp='md',
                size=6,
                **dict(className='text-center')),
            Col(dcc.Dropdown(id='lerz-seismic-time-dropdown',
                             options=[{
                                 'label': i.split('_')[1],
                                 'value': PERIODS[i]
                             } for i in sorted(list(PERIODS.keys()))],
                             value=28800000,
                             searchable=False,
                             clearable=False),
                bp='md',
                size=2)
        ]),
        Row([
            Col(
                Col([
                    Iframe(id='lerz-hypos-plot',
                           srcDoc='',
                           width='100%',
                           height=400),
                    Img(id='lerz-hypos-legend', src='', width='100%')
                ],
                    bp='md',
                    size=11,
                    **dict(className='offset-md-1'))),
            Col(
                Col(DataTable(
                    rows=[{}],
                    columns=('date', 'lat', 'lon', 'depth', 'prefMag'),
                    column_widths=[None, 125, 125, 75, 75],
                    filterable=True,
                    sortable=True,
                    id='lerz-datatable-hypos'),
                    bp='md',
                    size=11))
        ])
    ],
               bp='md',
               size=12)
Exemple #4
0
def main_layout_header():
    """Dash layout with a top-header"""
    return Div([
        Div(id="header",
            children=[
                Header(),
                Div(id=server.config['NAVBAR_CONTAINER_ID']),
            ]),
        Div(className='container-fluid',
            children=Row(Col(id=server.config['CONTENT_CONTAINER_ID']))),
        dcc.Location(id='url', refresh=False),
        Div(DataTable(rows=[{}]), style={'display': 'none'})
    ])
Exemple #5
0
def display_vehicular_data(last_readings):
    print("LAST", last_readings)
    if last_readings is None:
        # button hasn't been clicked as yet
        return ''

    now = time.time()
    duration = 30  # last 30s of readings
    db_conn = sqlite3.connect(DB_FILE)
    df = pd.read_sql_query(
        'SELECT Timestamp, EncryptedData '
        'FROM {} '
        #'WHERE Timestamp > "{}" AND Timestamp <= "{}" '
        'ORDER BY Timestamp DESC;'.format(DB_NAME),  #, now - duration, now),
        db_conn)
    rows = df.to_dict('rows')

    return html.Div([
        html.Div(id='datatable-output'),
        DataTable(
            id='datatable',
            rows=rows,
        )
    ])
Exemple #6
0
import dash
from dash.dependencies import Input, Output
import dash_html_components as html
import dash_core_components as dcc
from dash_table_experiments import DataTable
import json

app = dash.Dash()
app.config['suppress_callback_exceptions'] = True
app.layout = html.Div([
    html.Button(id='button', n_clicks=0, children='Show table'),
    html.Div(id='content'),
    html.Div(DataTable(rows=[{}]), style={'display': 'none'})
])


@app.callback(Output('content', 'children'), [Input('button', 'n_clicks')])
def display_output(n_clicks):
    if n_clicks > 0:
        return html.Div([
            html.Div(id='datatable-output'),
            DataTable(id='datatable', rows=[{
                'Column 1': i
            } for i in range(5)])
        ])


@app.callback(Output('datatable-output', 'children'),
              [Input('datatable', 'rows')])
def update_output(rows):
    return html.Pre(json.dumps(rows, indent=2))
Exemple #7
0
            ],
            style={
                'width': '23%',
                'height': '500px',
                'float': 'inline-start',
                'padding': '0em 0.5em',
                'display': 'inline-block',
                'backgroundColor': 'mintcream',
                'border': '1px #ccc solid',
                'border-radius': '5px'
            }),
        html.Div([
            html.Div(id='content'),
            html.Div(DataTable(rows=[{}],
                               id='table',
                               filterable='True',
                               min_height=20,
                               max_rows_in_viewport='900'),
                     style={'display': 'none'}),
        ],
                 style={
                     'flex': '3',
                     'margin': '5px',
                 })
    ],
             style={
                 'display': 'flex',
                 'align-items': 'flex-start'
             })
],
                        style={'backgroundColor': 'orange'})
Exemple #8
0
def display_output(btn0, btn1, btn2, btn3, btn4, btn5, btn6, btn7, btn8, btn9,
                   btn10, btn11, btn12):
    j = [
        int(btn0),
        int(btn1),
        int(btn2),
        int(btn3),
        int(btn4),
        int(btn5),
        int(btn6),
        int(btn7),
        int(btn8),
        int(btn9),
        int(btn10),
        int(btn11),
        int(btn12)
    ]
    if j[0] == max(j):
        return html.Div([
            dcc.Markdown('''Welcome to Talent-Bridge Africa'''),
            dcc.Markdown('''Start your journey today'''),
            dcc.Markdown(
                '''click on the checklist and select your prefered options to activate the buttons'''
            ),
            dcc.Markdown('''@2018'''),
            DataTable(rows=[{}])
        ])

    elif j[1] == max(j):
        return html.Div([
            DataTable(
                rows=know_1.to_dict('records'),
                row_selectable=True,
                filterable=True,
                sortable=True,
                selected_row_indices=[],
                # max_rows_in_viewport=10,
                resizable=True,
                column_widths=[])
        ])

    elif j[2] == max(j):
        # df_skills = pd.read_sql(skills, conn)
        return html.Div([
            DataTable(
                rows=skl_1.to_dict('records'),
                row_selectable=True,
                filterable=True,
                sortable=True,
                selected_row_indices=[],
                # max_rows_in_viewport=10,
                resizable=True,
                column_widths=[])
        ])
    elif j[3] == max(j):
        # df_abilities = pd.read_sql(abilities, conn)
        return html.Div([
            DataTable(
                rows=able_1.to_dict('records'),
                row_selectable=True,
                filterable=True,
                sortable=True,
                selected_row_indices=[],
                # max_rows_in_viewport=10,
                resizable=True,
                column_widths=[])
        ])

    elif j[4] == max(j):
        df_interests = pd.read_sql(interests, conn)
        return html.Div([
            DataTable(
                rows=df_interests.to_dict('records'),
                row_selectable=True,
                filterable=True,
                sortable=True,
                selected_row_indices=[],
                # max_rows_in_viewport=12,
                resizable=True,
                column_widths=[])
        ])

    elif j[5] == max(j):
        return html.Div([
            DataTable(
                rows=[{}],
                row_selectable=True,
                filterable=True,
                sortable=True,
                selected_row_indices=[],
                # max_rows_in_viewport=12,
                resizable=True,
                column_widths=[])
        ])

    elif j[6] == max(j):
        df_t2 = pd.read_sql(t2, conn)
        return html.Div([
            DataTable(
                rows=df_t2.to_dict('records'),
                row_selectable=True,
                filterable=True,
                sortable=True,
                selected_row_indices=[],
                # max_rows_in_viewport=12,
                resizable=True,
                column_widths=[])
        ])

    elif j[7] == max(j):
        return html.Div([
            DataTable(
                rows=[{}],
                row_selectable=True,
                filterable=True,
                sortable=True,
                selected_row_indices=[],
                # max_rows_in_viewport=12,
                resizable=True,
                column_widths=[])
        ])

    elif j[8] == max(j):
        return html.Div([
            DataTable(
                rows=[{}],
                row_selectable=True,
                filterable=True,
                sortable=True,
                selected_row_indices=[],
                # max_rows_in_viewport=12,
                resizable=True,
                column_widths=[])
        ])

    elif j[9] == max(j):
        df_titles = pd.read_sql(titles, conn)
        return html.Div([
            DataTable(
                rows=df_titles.to_dict('records'),
                row_selectable=True,
                filterable=True,
                sortable=True,
                selected_row_indices=[],
                # max_rows_in_viewport=12,
                resizable=True,
                column_widths=[])
        ])

    elif j[10] == max(j):
        df_alternate = pd.read_sql(alternate, conn)
        return html.Div([
            DataTable(
                rows=df_alternate.to_dict('records'),
                row_selectable=True,
                filterable=True,
                sortable=True,
                selected_row_indices=[],
                # max_rows_in_viewport=12,
                resizable=True,
                column_widths=[])
        ])

    elif j[11] == max(j):
        df_desc = pd.read_sql(desc, conn)
        return html.Div([
            DataTable(
                rows=df_desc.to_dict('records'),
                row_selectable=True,
                filterable=True,
                sortable=True,
                selected_row_indices=[],
                # max_rows_in_viewport=12,
                resizable=True,
                column_widths=[])
        ])

    elif j[12] == max(j):
        return html.Div([
            DataTable(
                rows=[{}],
                row_selectable=True,
                filterable=True,
                sortable=True,
                selected_row_indices=[],
                # max_rows_in_viewport=12,
                resizable=True,
                column_widths=[])
        ])

    else:
        return html.Div([dash_table.DataTable(rows=[{}])])
Exemple #9
0
 html.Td(children=[
     html.Table(id='const_table',
         children=[
         html.Tr(children=[
             html.Td(children='Constraints', className='section_Heading'), 
             html.Td(colSpan='3')]),
         html.Tr(children=[
             html.Td(children=[
                 dcc.Dropdown(id='dd_const_type', clearable=False, value='TEAM SIZE',
                     options=[{'label': 'TEAM SIZE', 'value': 'TEAM SIZE'},
                              {'label': 'STATS', 'value': 'STATS'},
                              {'label': 'POKE TYPES', 'value': 'POKE TYPES'}],
                     style={'width': '180px'})]),
             html.Td(children=[
                 html.Div(children=[
                    DataTable(id='dt_constraints', sortable=False, editable=False, rows=[{}],
                        row_selectable=True, columns=['LEFT HAND SIDE','SIGN','RIGHT HAND SIDE'])],
                    style={'width': '600px', 'display': 'inline-block'})],
                 rowSpan='6', colSpan='3')]),
         html.Tr(children=[
             html.Td(children=dcc.Dropdown(id='dd_const_lhs', clearable=False, value='# OF POKEMON', style={'width': '180px'},
                       options=[{'label': '# OF POKEMON', 'value': '# OF POKEMON'}]))]),
         html.Tr(children=[
             html.Td(children=dcc.Dropdown(id = 'dd_const_sign', clearable=False, value='<=', style={'width': '180px'},
          options=[{'label': '≤', 'value': '<='},{'label': '≥', 'value': '>='}]))]),
         html.Tr(children=[
             html.Td(children=dcc.Input(id='txtbox_const_rhs', placeholder='',type='number', value=0, max=9999, min=0, style={'width': '180px'}))]),
         html.Tr(children=[
             html.Td(html.Button('ADD CONSTRAINT', id='btn_add_constraint'))]),
         html.Tr(children=
             [html.Td(html.Button('REMOVE CONSTRAINT', id='btn_remove_constraint', style={'background-color': 'lightgray'}))])])],
     colSpan='4', rowSpan='7', style={'width': '800px'}),
Exemple #10
0
def get_latest_datatable(df: pd.DataFrame) -> DataTable:
    rows = df.sort_values(by='timestamp', ascending=False).to_dict('rows')
    return DataTable(id='latest-data-table', rows=rows, editable=False)