예제 #1
0
            # {'x': res['t'], 'y':res['E'], 'name':'Exposed', 'mode':'lines+markers'},
            {
                'x': res['t'],
                'y': res['R'],
                'name': 'Recovered',
                'mode': 'lines+markers'
            },
        ]
        graph = dcc.Graph(
            figure={
                'data':
                lines,  # data,
                'layout':
                go.Layout(
                    title='Social-connection:{}, Trans-time:{}, Recovery-time:{}'
                    .format(conn_num, trans_time, rec_time),
                    yaxis={'title': 'Population'},
                    hovermode='closest')
            })
        return graph
    else:
        print('loading error')
        return None


if __name__ == "__main__":

    app = dash.Dash(__name__, external_stylesheets=[dbc.themes.UNITED])
    app.layout = load_layout()
    app.run_server()
예제 #2
0
import dash_html_components as html
from dash.dependencies import Input, Output

# layout
import page_by_region
import page_search
import page_model
import homepage

from init import app, server

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


@app.callback(Output('page-content', 'children'), [Input('url', 'pathname')])
def display_page(pathname):
    if pathname == '/by_region':
        return page_by_region.App()
    elif pathname == "/search":
        return page_search.App()
    elif pathname == "/model":
        return page_model.load_layout()
    else:
        return homepage.load_layout()


if __name__ == '__main__':
    app.run_server(debug=False, port=5010, host="0.0.0.0")
예제 #3
0
파일: atop.py 프로젝트: BinYuOnCa/atop
import dash_html_components as html
from dash.dependencies import Input, Output

# layout
import page_by_region
import page_search
import page_model
import homepage

from init import app, server

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


@app.callback(Output('page-content', 'children'), [Input('url', 'pathname')])
def display_page(pathname):
    if pathname == '/by_region':
        return page_by_region.App()
    elif pathname == "/search":
        return page_search.App()
    elif pathname == "/model":
        return page_model.load_layout()
    else:
        return homepage.load_layout()


if __name__ == '__main__':
    app.run_server(debug=False, port=5000)