params = pathparts[-1][2:].split(',') pathparts = pathparts[:-1] else: params = None return params, pathparts @app.callback(dash.dependencies.Output('page-content', 'children'), [dash.dependencies.Input('url', 'pathname')]) def display_page(pathname): try: params, pathparts = parse_path(pathname) if not (pathparts[0] == app.url_base_pathname.strip('/')): raise Exception('Unknown page') if (len(pathparts) == 1): return pages['map'] if pathparts[1] in pages: return pages[pathparts[1]] else: raise Exception('Unknown page') except: return dcc.Link('No content here. return to app root', href='/app/') if __name__ == '__main__': # app.scripts.config.serve_locally = False app.config.supress_callback_exceptions = True app.run_server(debug=False, port=10012, threaded=True, host='0.0.0.0')
y=df['smoothed'] ) ] return { 'data': data, 'layout': { 'height': 300, 'yaxis': {'range': [0, int(df.smoothed.max())+100]}, 'title': 'Date Distribution for ' + facet_value.replace('_', ' ').title() } } else: data = [ go.Scatter( x=list(range(1800, 2016)), y=[0]*(2013-1800) ) ] return { 'data': data, 'layout': { 'height': 300, 'yaxis': {'range': [0, 100000]}, 'title': 'Select a ' + group.replace('_', ' ') + ' to see date distribution' } } if __name__ == '__main__': # app.scripts.config.serve_locally = False app.config.supress_callback_exceptions = True app.run_server(debug=True, port=8080, threaded=True, host='0.0.0.0')
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import sys import dash import dash_core_components as dcc import dash_html_components as html import django from dash.dependencies import Output, Input os.environ.setdefault("DJANGO_SETTINGS_MODULE", "catalog.settings") sys.path.insert(2, '/code') sys.path.insert(3, '/code/visualization/util') django.setup() from common import app from publication_counts_archival_status import publication_archived_status app.layout = html.Div([ dcc.Location(id='url', refresh=False), dcc.Markdown('''# Agent Based Modeling Bibliographic Visualization '''), publication_archived_status([]) ]) if __name__ == '__main__': app.run_server(debug=True, port=8000, host='0.0.0.0')