-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataMiningProjectDash.py
More file actions
55 lines (49 loc) · 1.43 KB
/
DataMiningProjectDash.py
File metadata and controls
55 lines (49 loc) · 1.43 KB
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
from dash import Dash, html, dcc, callback, Output, Input
import plotly.express as px
import plotly.graph_objs as go
import pandas as pd
df = pd.read_csv('anomaly_table_v2.csv', delimiter=";")
app = Dash(__name__)
app.layout = html.Div([
html.H1(children="DashBoard"),
# Dropdown to select elements
dcc.Dropdown(
id='element-dropdown',
options=['failed_engine', 'wo', 'nothing'],
value='nothing'
),
# Plotly graph
dcc.Graph(id='graph-content'),
dcc.Graph(id='map', style={'width': '90vh', 'height': '90vh'})
])
@callback(
Output('graph-content', 'figure'),
Input('element-dropdown', 'value')
)
def update_graph(value):
dff = df[df['Anomalie_type']==value]
return px.line(dff, x='lat', y='lon')
@callback(
Output('map', 'figure'),
Input('element-dropdown', 'value')
)
def update_graph(value):
dff = df[df['Anomalie_type']==value]
fig = go.Figure(go.Scattergeo(
lat=dff['lat'],
lon=dff['lon'],
text=dff['mapped_veh_id'],
mode='markers',
marker_color=dff['mapped_veh_id']
)).update_geos(
visible=False, resolution=50,
showcountries=True, countrycolor="Blue"
).update_layout(
geo=dict(
center=dict(lat=50.5503, lon=4.3517),
projection_scale=80
)
)
return fig
if __name__ == '__main__':
app.run(debug=True)