-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
63 lines (48 loc) · 1.79 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
from dataset import load_dataset
from charts import *
from components import *
import pandas as pd
from dash import Dash, html, dcc, callback, Output, Input
import dash_bootstrap_components as dbc
# update and load dataset
df = load_dataset("dataset", update=True)
f = list(frequencies.keys())
app = Dash(__name__, external_stylesheets=[dbc.themes.DARKLY])
server = app.server
app.layout = dbc.Container([
html.Br(),
html.Br(),
dbc.Row([
dbc.Col([
dcc.Markdown("# Fréquentation des Pistes Cyclables", style={ 'text-align' : 'center'}, className="title")
], width=12)
]),
map_container(prepare_map_data(df)),
html.Hr(),
station_container(df),
html.Hr(),
stats_container(df),
html.Hr(),
heatmap_container(df),
html.Hr(),
line_plot_container(df),
html.Hr(),
bar_plot_container(df),
])
# dcc.Dropdown(f,f[0], id="frequency-dropdown")
@callback(*line_plot_Output, *line_plot_Input)
def update_line_plot(selected_counter, name, frequency, start_date, end_date):
date_value = pd.to_datetime(start_date)
return line_plot(df,[selected_counter, name], frequency, start_date=start_date, end_date=end_date)
@callback(*bar_plot_Output, *bar_plot_Input)
def update_bar_plot(selected_counter, name, frequency, start_date, end_date):
return bar_plot(df,[selected_counter, name], frequency, start_date=start_date, end_date=end_date)
@callback(*map_Output, *map_Input)
def update_map(selected_time):
return render_map(df, selected_time, geojson_data, data_localisation)
@callback(*heatmap_Output, *heatmap_Input)
def update_heatmap(selected_counter, frequency, start_date, end_date):
return plot_heatmap(df,selected_counter, frequency, start_date, end_date)
if __name__ == '__main__':
app.run(port=8000)
print("[+] Done")