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 import logging import os
Configurar o logging
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', 'fontSize': '36px', 'fontWeight': 'bold'}),
# Componente de upload 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'}, multiple=False ), dcc.Store(id='processed-data'), # Botão 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'}), # Checklist para Executivos html.Div([ html.Label('Selecione os Executivos:', style={'fontSize': '20px', 'fontWeight': 'bold'}), dcc.Checklist( id='executivo-checkbox', options=[], value=[], inline=True, inputStyle={"margin-right": "10px"}, labelStyle={"display": "block", "fontSize": "18px", "fontWeight": "bold"} ), ], style={'margin': '0 50px'}), # Dropdown para 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 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'}), dcc.Download(id="download"), # Gráfico dcc.Graph(id='grafico-diario'), # Tabela dash_table.DataTable( id='tabela-executivos', style_table={'overflowX': 'auto'}, style_cell={ 'textAlign': 'left', 'padding': '10px', 'minWidth': '150px', 'fontSize': '16px' }, style_header={ 'backgroundColor': '#003366', 'color': 'white', 'fontWeight': 'bold', 'fontSize': '18px' } ) - Assistant
- User
retorne o codigo inteiro
- Assistant
- User
- Assistant
- User
as barras estão ultrapassando área do gráfico ajuste por favor
os nomes dos executivos devem ficar em negrito e um pouco maior
mudar o metodo para baixar a imagem, o navegador nao esta permitindo
alterar tambem a primeira coluna com nome primeiro de cada executivo, nao o nome comppelto. tambem mudar a forma que baixamos a tabela, atualmente esta baixanod em csv, preciso em imagem.
- Assistant
- User
as barras do graficos ainda estao muito altas e estao escondendo os rotulos
ajustar a tabela com os dados completos
é possivel colocar os graficos em degrade sendo do azul que ja esta ate o cinza claro para os menores percentuais
- Assistant
- User
Callback error updating ..processed-data.data...executivo-checkbox.options...executivo-checkbox.value..
ameError: name 'dash' is not defined
raceback (most recent call last) File "c:\Users\dourado\OneDrive - Cielo\ENVIADO WELL\teste", line 228, in update_data return dash.no_update, dash.no_update, dash.no_update ^^^^ NameError: name 'dash' is not defined
This is the Copy/Paste friendly version of the traceback.
Traceback (most recent call last): File "c:\Users\dourado\OneDrive - Cielo\ENVIADO WELL\teste", line 228, in update_data return dash.no_update, dash.no_update, dash.no_update ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ NameError: name 'dash' is not defined
aproveite e coloque as barras com uma espessura maior
- Assistant
- User
coloque a legenda na parte inferior do grafico ou retire.
na coluna executivo coloque somente o primeiro nome. retire a ultima coluna.
os nomes do eixo x deve ser em negrito
ao tentar extrair a imagem da tabela gera o seguinte erro.
Callback error updating download-table-img.data
TypeError: '>=' not supported between instances of 'str' and 'int'
Traceback (most recent call last) File "c:\Users\dourado\OneDrive - Cielo\ENVIADO WELL\teste", line 356, in download_table_as_image cmin=0, cmax=df_filtrado.values.max()) ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\ProgramData\anaconda3\Lib\site-packages\numpy\core_methods.py", line 41, in _amax return umr_maximum(a, axis, None, out, keepdims, initial, where) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: '>=' not supported between instances of 'str' and 'int'
This is the Copy/Paste friendly version of the traceback.
Traceback (most recent call last): File "c:\Users\dourado\OneDrive - Cielo\ENVIADO WELL\teste", line 356, in download_table_as_image cmin=0, cmax=df_filtrado.values.max()) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\ProgramData\anaconda3\Lib\site-packages\numpy\core_methods.py", line 41, in _amax return umr_maximum(a, axis, None, out, keepdims, initial, where) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: '>=' not supported between instances of 'str' and
- Assistant
- User
- Assistant
- User
retire a legenda do gráfico.
na tabela deixe sempre ajustado.
porem preciso que na tabela coloque um bullet dentro da célula com as seguinte cores. formando uma condicional
se numero 1 cor #108901 se numero 2 cor #00E396 se numero 3 cor #FEB019 se numero 4 cor #FF2343
- Assistant
- User
DataTable filtering syntax is invalid for query: {{Nº Quartil - set/24}} = 1 (This error originated from the built-in JavaScript code that runs Dash apps. Click to see the full stack trace or open your browser's console.) Error: DataTable filtering syntax is invalid for query: {{Nº Quartil - set/24}} = 1
at t.evaluate (http://127.0.0.1:8050/_dash-component-suites/dash/dash_table/async-table.js:2:203046) at Object.matchesFilter (http://127.0.0.1:8050/_dash-component-suites/dash/dash_table/async-table.js:2:233700) at http://127.0.0.1:8050/_dash-component-suites/dash/dash_table/async-table.js:2:228249 at N (http://127.0.0.1:8050/_dash-component-suites/dash/dash_table/async-table.js:2:5346) at http://127.0.0.1:8050/_dash-component-suites/dash/dash_table/async-table.js:2:5910 at http://127.0.0.1:8050/_dash-component-suites/dash/dash_table/bundle.v5_2_12m1726625511.js:1:25811 at http://127.0.0.1:8050/_dash-component-suites/dash/dash_table/bundle.v5_2_12m1726625511.js:1:23954 at t (http://127.0.0.1:8050/_dash-component-suites/dash/dash_table/bundle.v5_2_12m1726625511.js:1:23707) at http://127.0.0.1:8050/_dash-component-suites/dash/dash_table/async-table.js:2:235616 at http://127.0.0.1:8050/_dash-component-suites/dash/dash_table/async-table.js:2:236822 - Assistant
- User
na tabela coloque apenas uma bolinha ao lado do numero com as respectivas cores
- Assistant
- User
PS C:\Users\dourado\OneDrive - Cielo\ENVIADO WELL> & C:/ProgramData/anaconda3/python.exe "c:/Users/dourado/OneDrive - Cielo/ENVIADO WELL/teste" Traceback (most recent call last): File "c:\Users\dourado\OneDrive - Cielo\ENVIADO WELL\teste", line 120, in dash_table.DataTable( File "C:\Users\dourado\AppData\Roaming\Python\Python311\site-packages\dash\development\base_component.py", line 446, in wrapper return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\dourado\AppData\Roaming\Python\Python311\site-packages\dash\dash_table\DataTable.py", line 1383, in super(DataTable, self).(**args) File "C:\Users\dourado\AppData\Roaming\Python\Python311\site-packages\dash\development\base_component.py", line 157, in raise TypeError( TypeError: The component (version 2.18.1) with the ID "tabela-executivos" received an unexpected keyword argument: Allowed arguments: active_cell, cell_selectable, column_selectable, columns, css, data, data_previous, data_timestamp, derived_filter_query_structure, derived_viewport_data, derived_viewport_indices, derived_viewport_row_ids, derived_viewport_selected_columns, derived_viewport_selected_row_ids, derived_viewport_selected_rows, derived_virtual_data, derived_virtual_indices, derived_virtual_row_ids, derived_virtual_selected_row_ids, derived_virtual_selected_rows, dropdown, dropdown_conditional, dropdown_data, editable, end_cell, export_columns, export_format, export_headers, fill_width, filter_action, filter_options, filter_query, fixed_columns, fixed_rows, hidden_columns, id, include_headers_on_copy_paste, is_focused, loading_state, locale_format, markdown_options, merge_duplicate_headers, page_action, page_count, page_current, page_size, persisted_props, persistence, persistence_type, row_deletable, row_selectable, selected_cells, selected_columns, selected_row_ids, selected_rows, sort_action, sort_as_null, sort_by, sort_mode, start_cell, style_as_list_view, style_cell, style_cell_conditional, style_data, style_data_conditional, style_filter, style_filter_conditional, style_header, style_header_conditional, style_table, tooltip, tooltip_conditional, tooltip_data, tooltip_delay, tooltip_duration, tooltip_header, virtualization PS C:\Users\dourado\OneDrive - Cielo\ENVIADO WELL>
- Assistant
- User
a tabela saiu com o seguinte erro 2
- Assistant