Skip to content

Commit

Permalink
Adicionando Multi-Selects na página 4 para seccionamento dos dados (e…
Browse files Browse the repository at this point in the history
…xperimental)
  • Loading branch information
Oesterd committed Mar 3, 2024
1 parent 4b14718 commit e5adcc4
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 31 deletions.
21 changes: 0 additions & 21 deletions src/Reusables/Sidebars.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,27 +154,6 @@ def pg3():



def pg4():
content = \
html.Div([
html.Div(
[
html.H2("Opções", style={"color": "black"}),
],
style={'text-align': 'center'}
),

html.Div([
dmc.Select(id='dropdown41', label='Escolha o eixo y:', value='Média turma',
data=['Média turma', 'AP', 'RM', 'RF', 'RMF'], clearable=False),
]),
]
)

return content



def pg5():
content = \
html.Div([
Expand Down
64 changes: 55 additions & 9 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@
server = app.server


Dados_notas = pd.read_excel('https://github.com/Oesterd/Dash-learning-analytics/raw/master/dados_teste.xlsx')
Notas_df = Dados_notas.iloc[:, 0:10]
Notas_df = Notas_df.to_dict('records')


Turmas_df = pd.read_excel('https://github.com/Oesterd/Dash-learning-analytics/raw/master/Dados_turma.xlsx')
Dados = pd.DataFrame(Turmas_df)
Disc = Dados['Disciplina'].unique()
Prof = Dados['Professor'].unique()
Disc.sort(), Prof.sort()
Turmas_df = Turmas_df.to_dict('records')



page = list(dash.page_registry.values())


Expand Down Expand Up @@ -98,7 +112,7 @@
dmc.Col(
html.Div(
children=[
"Estatísticas acadêmicas"
"Estatísticas acadêmicas (GS)"
],
style={'fontSize': 30, 'textAlign': 'left'}),
span='content', offset=2),
Expand Down Expand Up @@ -131,7 +145,12 @@
'styles': {
'root': {'width': '95%'}
}
}
},
'MultiSelect': {
'styles': {
'root': {'width': '95%'}
}
},
}
},
children=[
Expand All @@ -142,7 +161,7 @@
width={"base": navwidth},
position='right',
style={
"overflow": "hidden",
"overflow": "auto",
"transition": "width 0.3s ease-in-out",
"background-color": "#f4f6f9",
},
Expand Down Expand Up @@ -180,11 +199,7 @@







#---------------------------------------------------------------------------------------------------------
#--------------------------------------------------------------------
filename = 'Reusables/Sidebars.py'
exec(open(filename, encoding="utf-8").read())

Expand All @@ -208,6 +223,37 @@ def gather_data(n_intervals):

return Notas_df, Turmas_df

def pg4():

content = \
html.Div([
html.Div(
[
html.H2("Opções", style={"color": "black"}),
],
style={'text-align': 'center'}
),


html.Div([
dmc.MultiSelect(id='Mdropdown41', label='Escolha a(s) disciplina(s)', value=[],
data=Disc, searchable=True, clearable=True)
]),

html.Div([
dmc.MultiSelect(id='Mdropdown42', label='Escolha o(s) professor(es)', value=[],
data=Prof, searchable=True, clearable=True)
]),


html.Div([
dmc.Select(id='dropdown41', label='Escolha o eixo y:', value='Média turma',
data=['Média turma', 'AP', 'RM', 'RF', 'RMF'], clearable=False),
]),
]
)

return content



Expand Down Expand Up @@ -244,7 +290,7 @@ def nav_content(url):
def drawer_demo(opened, width):

if width["base"] == navwidth:
return {"base": 250}
return {"base": 400}
else:
return {"base": navwidth}

Expand Down
13 changes: 12 additions & 1 deletion src/pages/pg4.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,21 @@
@callback(
Output('grid3', 'rowData'),
Input('Dados_turmas', 'data'),
Input(component_id='Mdropdown41', component_property='value'),
Input(component_id='Mdropdown42', component_property='value'),
)


def Grid_maker(data):
def Grid_maker(data, mdrop1, mdrop2):
df = pd.DataFrame(data)

if mdrop1:
df = df[df['Disciplina'].isin(mdrop1)]

if mdrop2:
df = df[df['Professor'].isin(mdrop2)]

data = df.to_dict('records')
return data


Expand Down

0 comments on commit e5adcc4

Please sign in to comment.