import pandas as pd import plotly.express as px from dash import Dash, dcc, html, Input,…
- User
import pandas as pd import plotly.express as px from dash import Dash, dcc, html, Input, Output, dash_table, State, callback_context import locale import base64 import io from datetime import datetime # Importar datetime para obter a data atual import logging
Configurar o logging para facilitar a depuração
logging.basicConfig(level=logging.INFO) logger = logging.getLogger(name)
Inicializar o Dash app
app = Dash(name)
Layout do dashboard
app.layout = html.Div([ html.H1("Dashboard de Performance Executiva", style={'textAlign': 'center'}),
# Componente de upload de arquivos estilizado como um botão dcc.Upload( id='upload-data', children=html.Button('Selecionar Arquivo CSV', style={ 'fontSize': '18px', 'padding': '12px 24px', 'borderRadius': '5px', 'border': '1px solid #ccc', 'background-color': '#00AEEF', 'color': 'white', 'cursor': 'pointer' }), style={ 'display': 'flex', 'justifyContent': 'center', 'marginBottom': '20px' }, # Permitir apenas um arquivo multiple=False ), # Armazenar os dados processados dcc.Store(id='processed-data'), # Botão para selecionar todos html.Div([ html.Button('Selecionar Todos', id='selecionar-todos', n_clicks=0, style={ 'fontSize': '16px', 'padding': '10px 20px', 'borderRadius': '5px', 'border': 'none', 'background-color': '#003366', 'color': 'white', 'cursor': 'pointer', 'marginBottom': '20px' }) }, style={'display': 'flex', 'justifyContent': 'center'}), # Caixa de seleção para selecionar executivos html.Div([ html.Label('Selecione os Executivos:', style={'fontSize': '20px', 'fontWeight': 'bold'}), dcc.Checklist( id='executivo-checkbox', options=[], # Será preenchido dinamicamente value=[], # Valor inicial vazio inline=True, inputStyle={"margin-right": "10px"}, labelStyle={"display": "block"} ), ], style={'margin': '0 50px'}), # Dropdown para selecionar a ordem html.Div([ html.Label('Selecione a Ordem:', style={'fontSize': '20px', 'fontWeight': 'bold', 'marginTop': '20px'}), dcc.Dropdown( id='ordem-dropdown', options=[ {'label': 'Do Maior para o Menor', 'value': 'desc'}, {'label': 'Do Menor para o Maior', 'value': 'asc'} ], value='desc', clearable=False, style={'fontSize': '18px'} ), ], style={'margin': '0 50px'}), # Botão para baixar o gráfico como imagem html.Div([ html.Button('Baixar Gráfico em Alta Resolução', id='download-image', n_clicks=0, style={ 'fontSize': '16px', 'padding': '12px 24px', 'borderRadius': '5px', 'border': 'none', 'background-color': '#28a745', 'color': 'white', 'cursor': 'pointer', 'marginTop': '20px', 'marginBottom': '20px' }) ], style={'display': 'flex', 'justifyContent': 'center'}), # Componente para gerenciar o download dcc.Download(id="download"), # Gráfico: Comparação das Métricas por Executivo dcc.Graph(id='grafico-diario'), # Tabela: Dados das Métricas por Executivo dash_table.DataTable( id='tabela-executivos', style_table={'overflowX': 'auto'}, style_cell={ 'textAlign': 'left', 'padding': '10px', 'minWidth': '150px', 'width': '200px', 'maxWidth': '250px', 'fontSize': '16px' }, style_header={ 'backgroundColor': '#003366', 'color': 'white', 'fontWeight': 'bold', 'fontSize': '18px' } ) - Assistant
- User
ficou muito simples, preciso de alguma coisa mais apresentavel
- Assistant
- User
preciso de rotulos no grafico
- Assistant