|
|
@ -14,6 +14,7 @@ df = pd.read_csv(csv_name)
|
|
|
|
df.iloc[:, 1:] = np.round(df.iloc[:, 1:] * 100) / 100
|
|
|
|
df.iloc[:, 1:] = np.round(df.iloc[:, 1:] * 100) / 100
|
|
|
|
|
|
|
|
|
|
|
|
variables = {
|
|
|
|
variables = {
|
|
|
|
|
|
|
|
'location': '',
|
|
|
|
'H_sig': 'o',
|
|
|
|
'H_sig': 'o',
|
|
|
|
'H_1%': 'x',
|
|
|
|
'H_1%': 'x',
|
|
|
|
'H_max': '□',
|
|
|
|
'H_max': '□',
|
|
|
@ -22,7 +23,7 @@ variables = {
|
|
|
|
'Tp1': '',
|
|
|
|
'Tp1': '',
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
df = df[['location'] + list(variables.keys())]
|
|
|
|
df = df[variables.keys()]
|
|
|
|
|
|
|
|
|
|
|
|
# add an id column and set it as the index
|
|
|
|
# add an id column and set it as the index
|
|
|
|
# in this case the unique ID is just the country name, so we could have just
|
|
|
|
# in this case the unique ID is just the country name, so we could have just
|
|
|
@ -41,9 +42,9 @@ app.layout = html.Div([
|
|
|
|
'id': key
|
|
|
|
'id': key
|
|
|
|
} for key, val in variables.items()],
|
|
|
|
} for key, val in variables.items()],
|
|
|
|
data=df.to_dict('records'),
|
|
|
|
data=df.to_dict('records'),
|
|
|
|
editable=True,
|
|
|
|
editable=False,
|
|
|
|
filter_action="native",
|
|
|
|
# filter_action="native",
|
|
|
|
sort_action="native",
|
|
|
|
sort_action='native',
|
|
|
|
sort_mode='multi',
|
|
|
|
sort_mode='multi',
|
|
|
|
row_selectable='multi',
|
|
|
|
row_selectable='multi',
|
|
|
|
row_deletable=False,
|
|
|
|
row_deletable=False,
|
|
|
@ -81,8 +82,8 @@ def update_graphs(row_ids, selected_row_ids, active_cell):
|
|
|
|
active_row_id = active_cell['row_id'] if active_cell else None
|
|
|
|
active_row_id = active_cell['row_id'] if active_cell else None
|
|
|
|
|
|
|
|
|
|
|
|
colors = [
|
|
|
|
colors = [
|
|
|
|
'#FF69B4' if id == active_row_id else
|
|
|
|
'#FF69B4' if i == active_row_id else
|
|
|
|
'#7FDBFF' if id in selected_id_set else '#0074D9' for id in row_ids
|
|
|
|
'#7FDBFF' if i in selected_id_set else '#0074D9' for i in row_ids
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
return [
|
|
|
|
return [
|
|
|
@ -119,9 +120,9 @@ def update_graphs(row_ids, selected_row_ids, active_cell):
|
|
|
|
# check if column exists - user may have deleted it
|
|
|
|
# check if column exists - user may have deleted it
|
|
|
|
# If `column.deletable=False`, then you don't
|
|
|
|
# If `column.deletable=False`, then you don't
|
|
|
|
# need to do this check.
|
|
|
|
# need to do this check.
|
|
|
|
for column in ['pop', 'lifeExp', 'gdpPercap'] if column in dff
|
|
|
|
for column in ['H_sig', 'H_1%', 'H_max'] if column in dff
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
if __name__ == '__main__':
|
|
|
|
app.run_server(debug=False)
|
|
|
|
app.run_server(debug=True)
|
|
|
|