Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 354b125b authored by Samuël Weber's avatar Samuël Weber
Browse files

harmonisation between apps

parent ed0ea179
......@@ -9,7 +9,6 @@ from dash.dependencies import Input, Output, State
import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
# import dash_table_experiments as dt
import plotly.graph_objs as go
import plotly.express as px
......@@ -565,7 +564,7 @@ def update_box_graph(datatable, temporality, plots_options, groupby_var, species
[State('specie-dropdown', 'value'),
State('source-dropdown', 'value'),
State('options_check', 'value')])
def update_scatter_graph(datatable, tabselected, groupby, species, sources, options):
def update_scatter_graph(datatable, tabselected, xy, species, sources, options):
"""Update the scatter graph
:datatable: TODO
......@@ -609,20 +608,25 @@ def update_scatter_graph(datatable, tabselected, groupby, species, sources, opti
dfdt["Labels"] = np.nan
stations = list(dfdt["Station"].unique())
if groupby == "site":
if len(species+sources) != 2:
figure["layout"]["title"] = "Please select 2 species"
return figure
elif groupby == "specie":
if xy == "site":
hue = "specie"
elif xy == "specie":
hue = "site"
if xy == "site":
if len(stations) != 2:
figure["layout"]["title"] = "Please select 2 stations"
return figure
elif xy == "specie":
if len(species+sources) != 2:
figure["layout"]["title"] = "Please select 2 species"
return figure
# species = set(species) - set(BASE_VAR_SP) - set(notNumeric)
# sources = set(sources) - set(BASE_VAR_SRC)
variables = species + sources
if groupby == "specie":
if xy == "site":
df = dfdt[["Date", "Station"] + variables]
df = df.pivot_table(index=["Date"], columns=["Station"], values=variables)\
.reset_index()\
......@@ -635,9 +639,9 @@ def update_scatter_graph(datatable, tabselected, groupby, species, sources, opti
else:
dfdt = dfdt[variables+["Station", "Date"]].dropna()
x, y = stations if groupby == "specie" else variables
color = "Specie" if groupby == "specie" else "Station"
orders = variables if groupby == "specie" else stations
x, y = stations if hue == "specie" else variables
color = "Specie" if hue == "specie" else "Station"
orders = variables if hue == "specie" else stations
# Plot part ==============================================================
......
......@@ -15,9 +15,7 @@ from django.conf import settings
from django_plotly_dash import DjangoDash
# from .utilities import *
import dashApp.utilities as utilities
# from .app_components_PMall import *
from .app_components import SharedComponent
sc = SharedComponent()
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment