File size: 6,142 Bytes
75c6e74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184

# layout_01.py
from dash import dcc, html
def criar_layout(feat_options):
    """
    Cria o layout do aplicativo Dash
    """
    return  html.Div(

    # ===== CONTAINER GERAL =====
    style={
        'background': '#eef2f7',
        'padding': '20px 30px',
        'fontFamily': 'Roboto'
    },

    children=[

        # ======================================================
        # HEADER (TÍTULO + DROPDOWN)
        # ======================================================
        html.Div(
            style={
                'display': 'grid',
                'gridTemplateColumns': '1fr 300px',
                'alignItems': 'center',
                'marginBottom': '20px'            },
            children=[

                # TÍTULO
                html.Div(
                    style={
                        'background': '#1f2933',
                        'padding': '25px 20px',
                        'borderRadius': '6px'
                    },
                    children=[
                        html.H2(
                            'Painel de Diagnóstico Ambiental Urbano',
                            style={'margin': '0', 'color': 'white'}
                        ),
                        html.P(
                            'Distribuição, ranking, dispersão e análise espacial por bairro',
                            style={'margin': '0', 'color': '#9ca3af', 'fontSize': '13px'}
                        )
                    ]
                ),
                html.Div(
                    style={
                        'justifySelf': 'end',
                        'paddingRight': '20px',
                        'width': '260px',                    },
                    children=[
                        dcc.Dropdown(
                            id='variavel',
                            options=[{'label': opt['label'], 'value': opt['value']} for opt in feat_options],
                            value=feat_options[0]['value'],
                            clearable=False,
                            className='dropdown-alto'
                        ),
                        html.Div(
                            id='descricao-variavel',
                            style={
                                'marginTop': '10px',
                                'padding': '10px',
                                'borderLeft': '3px solid #007bff',
                                'backgroundColor': '#f8f9fa',
                                'fontSize': '10px'  # Opcional: ajustar tamanho da fonte
                            }
                        )
                    ]
                )

            ]
        ),

        html.Div(
            id='kpis',
            style={
                'display': 'grid',
                'gridTemplateColumns': 'repeat(4, 1fr)',
                'gap': '15px',  # Mínimo
                'marginBottom': '10px',
                'padding': '0px',  # Remove padding interno
            }
        ),

        # ======================================================
        # MAPA + RANKING
        # ======================================================
        html.Div(
            style={
                'display': 'grid',
                'gridTemplateColumns': '3fr 1.2fr',
                'gap': '20px',
                'marginBottom': '25px'
            },
            children=[

                # MAPA
                html.Div(
                    style={
                        'background': 'white',
                        'padding': '10px',
                        'borderRadius': '8px'
                    },
                    children=[
                        html.Iframe(
                            id='mapa',
                            style={
                                'width': '100%',
                                'height': '520px',
                                'border': 'none'
                            }
                        )
                    ]
                ),

                # RANKING TOP 10
                html.Div(
                    style={
                        'background': 'None',
                        'padding': '10px',
                        'borderRadius': '8px'
                    },
                    children=[
                        dcc.Graph(
                            id='fig_rank',
                            style={'height': '520px'}
                        )
                    ]
                )
            ]
        ),

        # ======================================================
        # GRÁFICOS ANALÍTICOS (3 COLUNAS)
        # ======================================================
        html.Div(
            style={
                'display': 'grid',
                'gridTemplateColumns': 'repeat(3, 1fr)',
                'gap': '20px',
                'marginBottom': '25px'
            },
            children=[

                html.Div(
                    style={'background': 'None', 'padding': '10px', 'borderRadius': '8px'},
                    children=[dcc.Graph(id='fig_hist')]
                ),

                html.Div(
                    style={'background': 'None', 'padding': '10px', 'borderRadius': '8px'},
                    children=[dcc.Graph(id='fig_box')]
                ),

                html.Div(
                    style={'background': 'None', 'padding': '10px', 'borderRadius': '8px'},
                    children=[dcc.Graph(id='fig_scatter')]
                )
            ]
        ),

        # ======================================================
        # RODAPÉ ANALÍTICO
        # ======================================================
        html.Div(
            style={
                'background': 'white',
                'padding': '15px',
                'borderRadius': '8px'
            },
            children=[
                html.P(
                    'Estatísticas complementares, observações analíticas e notas metodológicas.',
                    style={'margin': '0', 'fontSize': '13px', 'color': '#374151'}
                )
            ]
        )

    ]
)