def Figure(radio, check):
    avialable_Plot = [
        'Bar_Graph', 'Scatter', 'Sunburst', 'Orthographic', 'natural_earth',
        'Continential'
    ]
    if radio is None and check is None:
        layout = html.Div(
            html.H4(html.Center('Select file \n and \n plot type')))
        return layout
    elif radio is None:
        layout = html.Div(
            html.H4(html.Center('Select plot type from available plots')))
        return layout
    elif check is None:
        layout = html.Div(html.H4(
            html.Center('Select file from loaded files')))
        return layout
    else:
        if len(check) == 0:
            layout = html.Div(
                html.H4(html.Center('Select file from loaded files')))
            return layout
        else:
            figure = Plotly_graph(Plot_points(upLoaded_Details, check),
                                  avialable_Plot[int(radio) - 1])
            if avialable_Plot[int(radio) - 1] == 'Bar_Graph' or avialable_Plot[
                    int(radio) - 1] == 'Scatter' or avialable_Plot[
                        int(radio) - 1] == 'Sunburst' or avialable_Plot[
                            int(radio) - 1] == 'Continential':
                layout = html.Div(children=plot_Layouts(figure))
                return layout
            else:
                layout = html.Div(children=dcc.Graph(figure=figure))
                return layout
Exemple #2
0
def generate_growth_indicator(data, change):
    diff = data - change
    if(diff > 0):
        fig = [
            html.Center(
                [
                    html.H2('{:,.2f}'.format(data).replace('.',',')),
                    html.H6('Novos casos a cada 100 mil habitantes')
                ]
            ),
            html.Center(
                [
                    html.H3('▲ ' + '{:,.2f}'.format(diff).replace('.',',')),
                    html.H6('Desde a semana anterior')
                ]
            )
        ]
    else:
        fig = [
                html.Center(
                [
                    html.H2('{:,.2f}'.format(data).replace('.',',')),
                    html.H6('Novos casos a cada 100 mil habitantes')
                ]
            ),
            html.Center(
                [
                    html.H3('▼ ' + '{:,.2f}'.format(diff).replace('.',',').replace('-','')),
                    html.H6('Desde a semana anterior')
                ]
            )
        ]
    return(fig)
def check_attrition(n_clicks, Input_feat1, Input_feat2, Input_feat3,
                    Input_feat4, Input_feat5, Input_feat6, Input_feat7,
                    Input_feat8, Input_feat9, Input_feat10, Input_feat11,
                    Input_feat12, Input_feat13, Input_feat14, Input_feat15,
                    Input_feat16, Input_feat17, Input_feat18):
    if n_clicks == None:
        return 'Please input all features'
    else:
        loadModel = pickle.load(
            open('pickle_Random_Forest_os_best_accuracy.sav', 'rb'))
        loadScaler = pickle.load(open('pickle_Standard_Scaler.sav', 'rb'))
        to_predict = np.array([
            Input_feat1, Input_feat2, Input_feat3, Input_feat4, Input_feat5,
            Input_feat6, Input_feat7, Input_feat8, Input_feat9, Input_feat10,
            Input_feat11, Input_feat12, Input_feat13, Input_feat14,
            Input_feat15, Input_feat16, Input_feat17, Input_feat18
        ]).reshape(1, -1)
        to_predict = loadScaler.transform(to_predict)
        predict = loadModel.predict(to_predict)[0]
        proba = loadModel.predict_proba(to_predict)[0][predict]
        if predict == 0:
            return html.Center(
                html.H1(
                    'The Employee is no Attrition with probability {}'.format(
                        round(proba, 2))))
        else:
            return html.Center(
                html.H1('The Employee is Attrition with probability {}'.format(
                    round(proba, 2))))
Exemple #4
0
def renderIsiTab7():
    return [
        html.Div([
            html.Div([
                html.P('Created By : '),
                dcc.Input(id='filtercreatedbyhistory',
                          type='text',
                          value='',
                          style=dict(width='100%'))
            ],
                     className='col-4'),
        ],
                 className='row'),
        html.Br(),
        html.Div([
            html.Div([
                html.P('Max Row : '),
                dcc.Input(id='filterrowhistory',
                          value=10,
                          type='number',
                          style=dict(width='100%'))
            ],
                     className='col-2'),
        ],
                 className='row'),
        html.Center(html.H2('History Prediction', className='title')),
        html.Center(id='tablehistorydiv',
                    children=generate_table(dfHistoryTable))
    ]
Exemple #5
0
def renderIsiTab4():
    return [
        html.Div(
            [
                html.Div(
                    [
                        html.P('UserID : '),
                        # dcc.Input(id='userPredict', type='text', value='',style=dict(width='100%'))
                        dcc.Dropdown(
                            id='userHist',
                            options=[{
                                'label': i,
                                'value': i
                            } for i in dfUserRating['userId'].unique()],
                            value='')
                    ],
                    className='col-2')
            ],
            className='row'),
        html.Br(),
        html.Div([
            html.Div([
                html.Button(
                    'Search', id='buttonsearchist', style=dict(width='100%'))
            ],
                     className='col-2'),
        ],
                 className='row'),
        # html.Div([
        #     html.P('Max Row : '),
        #     dcc.Input(id='rowMaxHist', value=10, type='number', max=len(dfUserRating))
        # ], className='col-'),
        html.Center([html.H3('User Rating History', className='title')]),
        html.Center(id='tableDataHist')
    ]
Exemple #6
0
def predict(n_clicks, hr, trx, old_amt_org, new_amt_org, old_amt_dest, new_amt_dest):
    if hr == '':
        return html.Center(html.H1('Please Fill the Value'))
    else:
        loadModel = pickle.load(open(r'ps_co.sav', 'rb'))
        prediction = loadModel.predict(np.array([hr, trx, old_amt_org, new_amt_org, old_amt_dest, new_amt_dest]).reshape(1, -1))[0]
        proba = loadModel.predict_proba(np.array([hr, trx, old_amt_org, new_amt_org, old_amt_dest, new_amt_dest]).reshape(1, -1))[0][prediction]
        out = ['Not-Fraud', 'Fraud']
        return html.Center(html.H1('Your Transaction is {} with probability {}'.format(out[prediction], round(proba, 2))))
Exemple #7
0
def update_output2(value):
    if value == 'DB':
        body = html.Div([
                html.Center(
                        html.Div(children = [html.Br(),
                                             html.H3(children = 'Comfort v. Back Discomfort')
                                             ]
                            )
                        ),
                html.Center(
                    html.Div(                                                   
                            dash_table.DataTable(id = 'table8',
                                                 columns = [{"name": i, "id": i} for i in df_DB],
                                                 data = df_DB.to_dict('records'),
                                                 style_table={'width': '60%'},
                                                 style_cell={
                                                         'height': 'auto',
                                                         'maxWidth': '80px',
                                                         'whiteSpace': 'normal'}
                                                 )
                            )
                        ),
                html.Div(dbc.Row(data4))
                    ]
                    )
    elif value == 'DF':
        body = html.Div([
                html.Center(
                        html.Div([html.Br(),
                                  html.H3(children = 'Comfort v. Foot Discomfort')
                                  ]
                            )
                        ),
                html.Center(  
                    html.Div(
                            dash_table.DataTable(id = 'table7',
                                                 columns = [{"name": i, "id": i} for i in df_DF],
                                                 data = df_DF.to_dict('records'),
                                                 style_table={'width': '60%'},
                                                 style_cell={
                                                         'height': 'auto',
                                                         'maxWidth': '80px',
                                                         'whiteSpace': 'normal'}
                                                 )
                            )
                        ), 
                html.Div(dbc.Row(data3))
                ]
                )
    else:
        body = html.Div([

                ]
                )                        
    return body
Exemple #8
0
def tab_scatter():
    tab = [
        html.Div(children=[
            html.Div(children=[
                html.P('ID'),
                dcc.Dropdown(id='iddropdown',
                             options=[{
                                 'label': i,
                                 'value': i
                             } for i in test_table['id'].unique()],
                             value='jtl0dijy2j')
            ],
                     className='col-3'),
            html.Div(children=[html.Center(html.H5())],
                     id='result',
                     className='col-9')
        ],
                 className='row'),
        html.Div(html.Button('Recommendation', id='predict')),
        html.Br(),
        html.Div(children=[html.Center(html.H5('ID Information'))]),
        html.Div(children=[
            dash_table.DataTable(id='table_id',
                                 columns=[{
                                     "name": i,
                                     "id": i
                                 } for i in test_table.columns],
                                 data=test_table[test_table['id'] ==
                                                 'vvae4amv11'].to_dict(
                                                     'record'),
                                 page_action='native',
                                 page_current=0,
                                 style_table={'overflowX': 'scroll'},
                                 page_size=1)
        ]),
        html.Br(),
        html.Div(children=[html.Center(html.H5('ID Session'))]),
        html.Div(children=[
            dash_table.DataTable(id='table_sess_id',
                                 columns=[{
                                     "name": i,
                                     "id": i
                                 } for i in sessions.columns],
                                 data=sessions[sessions['user_id'] ==
                                               'vvae4amv11'].to_dict('record'),
                                 page_action='native',
                                 page_current=0,
                                 style_table={'overflowX': 'scroll'},
                                 page_size=5)
        ])
    ]
    return tab
def setting_CheckBOXMW(option):
    if len(option) == 0:
        layout = html.Div(
            [html.Center(html.B('Loaded files')),
             html.P('No files uploaded')])
    else:
        layout = html.Div([
            html.Center(html.B('Loaded files')),
            dcc.Checklist(id='CheckBox_File',
                          options=option,
                          labelStyle={'display': 'inline-block'})
        ])
    return layout
Exemple #10
0
def display_page(pathname):
    if pathname is None:
        return ''
    elif pathname == '/':
        global days
        # Get all the days for which we have gathered data (we need
        # to read each time from the disk because new data might be stored
        # on disk while the server is running)
        days = getAvailableDays()

        daysHtmlList = [
            html.Li([
                dcc.Link(day, href=day),
                dcc.Link(
                    [
                        html.Button('View stats',
                                    style={
                                        'verticalAlign': 'middle',
                                        'margin-left': '2vw'
                                    })
                    ],
                    href='/stats/' + day,
                ),
            ],
                    style={'font-size': '2vw'}) for day in days
        ]

        # This is the index (a.k.a. main) page of the app
        index_page = html.Div([
            html.Center(html.H1("Available days")),
            html.Center(html.Ul(daysHtmlList))
        ])

        return index_page
    elif len(pathname) > 7 and pathname[:7] == '/stats/':
        # Remove the '/stats/' from the beginning of the pathname in order
        # to get the day
        day = pathname[7:]

        if day not in days:
            return '404'
        return statistics_vis.getTabsLayout(day)

    else:
        # Remove the '/' from the beginning of the pathname in order
        # to get the day
        day = pathname[1:]

        if day in days:
            return timeline_vis.getTimelineLayout(day)
        return '404'
Exemple #11
0
def update_output(value):
    if value == 'AS':
        body =  html.Div([
                       html.Center(
                                html.Div(children = [
                                        html.Br(),
                                        html.H3(children = 'Comfort v. Satisfied w/ Amount of Space')
                                        ])
                                ),
                        html.Center(
                                html.Div(
                                        dash_table.DataTable(id = 'table6', 
                                                            columns = [{"name": i, "id": i} for i in df_AS],
                                                            data = df_AS.to_dict('records'),
                                                            style_table={'width': '60%'},
                                                            style_cell={
                                                                    'height': 'auto',
                                                                    'maxWidth': '80px',
                                                                    'whiteSpace': 'normal'}))
                                ),
                        html.Div(dbc.Row(data2))
                                ]
                            )
        
    else:
        body = html.Div([
                html.Center(
                        html.Div(children = [
                            html.Br(),
                            html.H3(children = 'Comfort v. Perceived Control')])
                        
                        ),
                html.Center(
                        html.Div(
                                dash_table.DataTable(id = 'table1',
                                                     columns = [{"name": i, "id": i} for i in df_PC],
                                                     data = df_PC.to_dict('records'),
                                                     style_table={'width': '60%'},
                                                     style_cell={
                                                             'height': 'auto',
                                                             'maxWidth': '80px',
                                                             'whiteSpace': 'normal'}
                                                     ),
                                                     
                                        )),
                html.Div(dbc.Row(data)),                    
                ]
                )
    return body
Exemple #12
0
def tab1content():
    content = html.Div([
        html.Center(html.H2("Availability chart")),
        html.Div(children =[
            dbc.Col(children=[
                dcc.Graph(
                    id='example-graph',
                    figure=createGantt()
                )],
            width=12)
        ]),
        html.Center(html.Label("Never in Black Lion Chest: %s" % str(notInBlc), style={'margin-right': '20'}))
    ])

    return content
Exemple #13
0
    def generate_health_report(self):
        """Generate content for report page."""
        pr_creators = self.viz.processing.process_issues_creators()
        issue_creators = self.viz.processing.process_issues_creators()

        # min_date = min(self.viz.processing.issues.values(), key= lambda issue: int(issue['created_at']))
        # max_date = max(self.viz.processing.issues.values(), key= lambda issue: int(issue['created_at']))

        self.app.layout = html.Div(children=[
            html.Center(
                html.H1(
                    children=
                    f"GitHub repository {self.project_name} Health Report")),
            # html.Div(children=f'''
            #     {self.project_name}
            # '''),
            # dcc.RangeSlider(
            #     id='time-setter',
            #     min=min_date,
            #     max=max_date,
            #     step=1,
            #     # value=[5, 15],
            # ),
            html.Center(html.H2(children=f"General PR/Issue information")),
            dcc.Graph(
                id="general section",
                figure=self.general_section(),
            ),
            html.Center(html.H2(children=f"Repository in time")),
            dcc.Graph(id="in time", figure=self.in_time_section()),
            html.Center(html.H2(children=f"Label correlations")),
            dcc.Graph(id="labels",
                      figure=self.viz._visualize_ttci_wrt_labels()),
            html.Center(html.H2(children=f"What about contributors?")),
            dcc.Graph(id="contributos", figure=self.contributor_section(5)),
            dcc.Dropdown(
                id="demo-dropdown",
                options=[{
                    "label": i,
                    "value": i
                } for i in issue_creators],
                value=list(issue_creators.keys())[0],
            ),
            html.Div(id="dd-output-container"),
            dcc.Graph(id="issue-opener"),
            dcc.Graph(id="issue-closer"),
            dcc.Graph(id="inter"),
        ])
def combine_data(options):
    global dataset
    print(options)
 
    labels=[]
    if(options):
        dataset['Solution'] = ''
        columns=list(dataset.columns)
        if(type(options) == int):
            dataset['Solution'] += " "+dataset[columns[options]]
        for col in options:
            dataset['Solution'] += " "+dataset[columns[col]]
            labels.append(columns[col])
        print(labels)
        #dataset['Solution'] = ''
        #for 
        return html.Div([
            html.Center(dcc.Markdown("**Selected Data**")),
            dash_table.DataTable(
                data=dataset[labels+['Solution']].to_dict('records'),
                columns=[{'name': i, 'id': i} for i in dataset[labels+['Solution']].columns],
                style_table={'overflowY': 'scroll'},
                style_cell={'maxWidth':'180px'},
            ),
            html.Hr(),  # horizontal line
            # For debugging, display the raw contents provided by the web browser
        ])
    
    return(str(labels))
Exemple #15
0
def build_map_style_button():

    button = html.Button(children='Afficher les niveaux de risques',
                         id='map_style_button',
                         className='btn btn-warning')

    return html.Center(button)
Exemple #16
0
def build_layer_style_button():

    button = html.Button(children='Activer la vue satellite',
                         id='layer_style_button',
                         className="btn btn-warning")

    return html.Center(button)
Exemple #17
0
def generate_welcome_page():
    # Load app config
    mode_config = get_mode_config(current_app)

    # Contructs the assets_url_path for image sources:
    assets_url_path = os.path.join(mode_config['DASH_STATIC_PATHNAME'],
                                   'assets')

    return html.Div(
        id='welcome-container',
        className='container',
        children=[
            html.Div(
                html.Img(src='{}/network-graph.svg'.format(assets_url_path))),
            html.H2([
                html.Span('Welcome to '),
                html.Span(
                    html.Img(src='{}/tipo-logo-networks.svg'.format(
                        assets_url_path)), ),
            ],
                    style={'display': 'flex'}),
            html.Center([
                html.
                P('Select one wiki and one network type from the sidebar on the left and press "generate" to start.',
                  style={'font-size': 'large'}),
            ])
        ])
def populationGroup(value1, value2, value3, value4, value5, value6, value7):
    if value1 is None and value2 is None and value3 is None and value4 is None and value5 is None and value6 is None and value7 is None:
        layout = html.Div(
            html.Center('*Fill in the field above',
                        style={"color": "rgb(255,0,0)"}))
    else:
        layout = html.Div('')
    if value1 != None:
        popu = ['Esan', 'The Gambia', 'Luhya', 'Menda', 'Ibadan']
        PharmacoInformation[1] = popu[int(value1) - 1]
    if value2 != None:
        popu = ['Dai', 'Beijing', 'Tokyo', 'Kibh', 'Han']
        PharmacoInformation[1] = popu[int(value2) - 1]
    if value3 != None:
        popu = ['Bengali', 'Punjabi']
        PharmacoInformation[1] = popu[int(value3) - 1]
    if value4 != None:
        popu = ['Colombian', 'Peruvian', 'Puerto_Rican']
        PharmacoInformation[1] = popu[int(value4) - 1]
    if value5 != None:
        popu = [
            'Telugu', 'Tami', 'African', 'Caribbean', 'Gujarati', 'Mexican'
        ]
        PharmacoInformation[1] = popu[int(value5) - 1]
    if value6 != None:
        popu = ['British/Scotish', 'Finnish', 'Lberian', 'Toscani']
        PharmacoInformation[1] = popu[int(value6) - 1]
    return layout
Exemple #19
0
def generate_asset_page(asset_code):
    asset_code = re.sub(r'^([0-9]+)([a-zA-Z]+)$', r'\1.\2', asset_code).upper()
    layout = html.Div([
        dcc.Store(id='asset-code', data=asset_code),
        html.Div(id='asset-info'),
        dbc.Checklist(
            id='show-asset-money',
            options=[{'label': '显示金额', 'value': 'show'}],
            value=[],
            switch=True,
        ),
        html.Hr(),
        dcc.Graph(
            id='asset-prices-graph',
            config={
                'displayModeBar': False
            },
        ),
        html.Center(
            [
                dbc.RadioItems(
                    id="asset-history-range",
                    className='btn-group',
                    labelClassName='btn btn-light border',
                    labelCheckedClassName='active',
                    options=[
                        {"label": "近一月", "value": "1m"},
                        {"label": "近三月", "value": "3m"},
                        {"label": "近半年", "value": "6m"},
                        {"label": "近一年", "value": "12m"},
                        {"label": "今年以来", "value": "thisyear"},
                        {"label": "本月", "value": "thismonth"},
                        {"label": "本周", "value": "thisweek"},
                        {"label": "所有", "value": "all"},
                        {"label": "自定义", "value": "customized"},
                    ],
                    value="all",
                ),
            ],
            className='radio-group',
        ),
        html.Div(
            id='customized-asset-history-range-container',
            children=[
                dcc.RangeSlider(
                    id='customized-asset-history-range',
                    min=2018,
                    max=2022,
                    step=None,
                    marks={year: str(year) for year in range(2018, 2023)},
                    value=[2018, 2022],
                )
            ],
            className='my-auto ml-0 mr-0',
            style={'max-width': '100%', 'display': 'none'}
        ),
        html.Hr(),
        html.Div(id='asset-deals'),
    ])
    return layout
Exemple #20
0
def getTimelineLayout(selectedDate):
    dateDir = config.LOGS_DIR + config.TIMELINE_DIR + selectedDate + '/'
    hourFiles = os.listdir(dateDir)

    if len(hourFiles) == 0:
        return 'There is no data available for this day.'
    # Return the layout with the correspondent data

    hourFiles.sort()

    return html.Div([
        html.Div(html.Center(html.H1('Timeline')), ),
        html.Div(
            dcc.Link(
                [html.Button('View stats')],
                href='/stats/' + selectedDate,
            ), ),
        html.Br(),
        html.Div(id='page-1-content'),
        dcc.Dropdown(id='my-dropdown',
                     options=[{
                         'label': hourFile,
                         'value': hourFile
                     } for hourFile in hourFiles],
                     value=hourFiles[-1]),
        html.Div(children=selectedDate, id='date', style={'display': 'none'}),
        dcc.Graph(id='timeline'),
        html.Br(),
        dcc.Link('Go back to home', href='/'),
    ])
Exemple #21
0
def build_user_selection_area():
    """
    This function builds upon all the methods defined above to output the user selection area,
    common to both alerts and risks views and placed in the blank space on the left of the map.

    It returns a list of Dash core and HTML components to be used below in the Homepage function.
    """
    return [dcc.Markdown('---'),

            # Map filters added below
            html.H5(("Filtres Cartes"), style={'text-align': 'center'}),

            # Button allowing users to change the map style (alerts / risks)
            html.P(build_map_style_button()),
            dcc.Markdown('---'),

            # Radio button allowing users to display or not past fires as markers on the map
            html.Center(dcc.Markdown("Afficher l'historique des feux :")),
            html.P(build_historic_fires_radio_button()),
            dcc.Markdown('---'),

            # Opacity slider for the risks view
            html.P(id="hp_slider")

            ]
Exemple #22
0
def build_historic_fires_radio_button():
    """
    This function allows users to select whether to display past fires as markers on the map.

    It instantiates and returns the appropriate radio button (inside a html.Center wrapping).
    """

    historic_fires_radio_button = dcc.RadioItems(
        options=[
            {
                'label': 'Oui',
                'value': 1
            },
            {
                'label': 'Non',
                'value': 0
            },
        ],
        value=1,
        labelStyle={
            'display': 'inline-block',
            'margin': '0 10px'
        },
        id='historic_fires_radio_button')

    return html.Center(historic_fires_radio_button)
def body(data):
    return html.Center(
        dbc.Container([
            dbc.Row([
                dbc.Col([
                    html.Br(),
                    html.H1("Card Game Data (From {date})".format(
                        date=data[0].start_date)),
                    html.Hr()
                ])
            ]),
            dbc.Row([
                dbc.Col([
                    html.Br(),
                    html.H2("Average Game Length"),
                    dcc.Graph(figure=game_length.get_graph(data))
                ]),
            ]),
            dbc.Row([
                dbc.Col([
                    html.Br(),
                    html.H2("Game Winners"),
                    dcc.Graph(figure=winners.get_graph(data))
                ])
            ]),
            dbc.Row([
                dbc.Col([
                    html.Br(),
                    html.H3("Individual Guess Data"),
                    dcc.Graph(figure=attempts.get_graph(data))
                ])
            ])
        ]))
Exemple #24
0
def generate_welcome_page():
    return html.Div(
        id='welcome-container',
        className='container',
        children=[
            html.Div(html.Img(src='assets/line-graph.svg')),
            html.H2([
                'Welcome to ',
                html.Span(html.Img(src='assets/tipo-logo.svg'),
                          style={'vertical-align': 'text-bottom'})
            ]),
            html.Center([
                html.
                P('Select some wikis and metrics from the sidebar on the left and press compare to start.',
                  style={'font-size': 'large'}),
                html.P([
                    'You can read more info about WikiChron basic concepts and assumptions ',
                    html.
                    A('here',
                      href=
                      'https://github.com/Grasia/WikiChron/wiki/Basic-concepts',
                      target='_blank'), '.'
                ],
                       style={'font-size': 'large'})
            ])
        ])
Exemple #25
0
def generate_welcome_page():
    mode_config = get_mode_config(current_app)
    assets_url_path = os.path.join(mode_config['DASH_STATIC_PATHNAME'],
                                   'assets')
    return html.Div(
        id='welcome-container',
        className='container',
        children=[
            html.Div(
                html.Img(src='{}/line-graph.svg'.format(assets_url_path))),
            html.H2([
                'Welcome to ',
                html.Span(
                    html.Img(src='{}/tipo-logo.svg'.format(assets_url_path)),
                    style={'vertical-align': 'text-bottom'})
            ]),
            html.Center([
                html.
                P('Select some wikis and metrics from the sidebar on the left and press compare to start.',
                  style={'font-size': 'large'}),
                html.P([
                    'You can read more info about WikiChron basic concepts and assumptions ',
                    html.
                    A('here',
                      href=
                      'https://github.com/Grasia/WikiChron/wiki/Basic-concepts',
                      target='_blank'), '.'
                ],
                       style={'font-size': 'large'})
            ])
        ])
def upload_design(value1, value2, value3, value4, value5, value7, value6,
                  value8, value9, value10, content):
    if (value1 != None or value2 != None or value3 != None or value4 != None
            or value6 != None or value5 != None
            or value7 != None) and (value8 != None or value9 != None
                                    or value10 != None) and (content != None):
        layout = html.Div([html.Br(), html.Center(), button])
        return layout
Exemple #27
0
def build_map_style_button():
    """
    This function instantiates the button which allows users to change the style of the map.
    """
    button = html.Button(children='Afficher les niveaux de risques',
                         id='map_style_button',
                         className='btn btn-warning')

    return html.Center(button)
Exemple #28
0
def build_layer_style_button():
    """
    This function creates and returns the button allowing users to change the map
    background layer (either topographic/schematic or satellite).
    """
    button = html.Button(children='Activer la vue satellite',
                         id='layer_style_button',
                         className="btn btn-warning")

    return html.Center(button)
def analyze_video(n, exercise, link, src):
    print("click")
    print(link)
    print(n)
    if (link != None):
        all_points, fig, fig1, fig2, anglerange, angleavg, smallestang, angles, perf_angles = read_video_red(
            link)
        #fig.show()
        ##update result video
        #return fig
        print(src)
        figure = dcc.Graph(figure=fig)
        figure1 = dcc.Graph(figure=fig1)
        figure2 = dcc.Graph(figure=fig2)
        currentime = time.ctime()
        video = html.Center(
            html.Video(id="resultvid",
                       src="assets/result.mp4?dummy=" + currentime,
                       controls=True))
        dataframe = pd.read_csv('UserData.csv')
        df1 = pd.DataFrame({
            "Range": [anglerange],
            "Avg": [angleavg],
            "Smallest": [smallestang],
            "Good": [perf_angles.get("Good")],
            "Bad": [perf_angles.get("Bad")],
            "Acceptable": [perf_angles.get("Acceptable")],
            "Angles": [str(angles)]
        })
        df1.insert(0, 'TimeStamp', pd.datetime.now().replace(microsecond=0))
        dataframe = dataframe.append(df1, ignore_index=True)

        dataframe.to_csv('UserData.csv', index=False)
        """table = dash_table.DataTable(
            id='table',
            style_data={
                'whiteSpace': 'normal',
                'height': 'auto',
                'lineHeight': '15px'
            },
            style_cell={'maxWidth': '500px', 'textAlign': 'left'},
            columns=[{"name": i, "id": i} for i in dataframe.columns],
            data=dataframe.to_dict('records'),
        )"""
        #print (dataframe.index)
        fig = dcc.Graph(figure=go.Figure(
            go.Scatter(x=dataframe['TimeStamp'],
                       y=dataframe['Avg'],
                       name='Angles over Time')))
        #fig.show()
        ##return table (converted)
        return figure, figure1, figure2, video, anglerange + u"\N{DEGREE SIGN}", angleavg + u"\N{DEGREE SIGN}", smallestang + u"\N{DEGREE SIGN}", fig
    else:
        print("prevent update called")
        return dash.no_update
def return_html_def_building_plot():
    '''Returns the html definition for the interactive building plot to be inserted as a child of a dash app layout.'''
    # Retrieves the interactive plotly figure and the configuration info.
    figure, plotly_configuration = create_building_average_plot()
    html_def = html.Center([
        dcc.Graph(id="interactive_map",
                  figure=figure,
                  config=plotly_configuration),
        html.Br(),
    ])
    return html_def