Beispiel #1
0
 def get_body(self):
     return [
         plt_db.get_summary(DFS),
         lay.two_columns([
             lay.card(
                 dcc.Graph(
                     id="plot_dash_evol",
                     config=c.dash.PLOT_CONFIG,
                     figure=plt_ev.plot_timeserie(
                         DFS[c.dfs.TRANS],
                         avg_month=c.dash.DEFAULT_SMOOTHING,
                         height=self.plot_height,
                     ),
                 )),
             lay.card(
                 dcc.Graph(
                     id="plot_dash_total_worth",
                     config=c.dash.PLOT_CONFIG,
                     figure=plt_inv.total_worth_plot(
                         DFS[c.dfs.LIQUID],
                         DFS[c.dfs.WORTH],
                         c.dash.DEFAULT_SMOOTHING,
                         height=self.plot_height,
                     ),
                 )),
         ]),
         lay.two_columns([
             lay.card(
                 dcc.Graph(
                     id="plot_dash_l_vs_e",
                     config=c.dash.PLOT_CONFIG,
                     figure=plt_li.plot_expenses_vs_liquid(
                         DFS[c.dfs.LIQUID],
                         DFS[c.dfs.TRANS],
                         c.dash.DEFAULT_SMOOTHING,
                         False,
                         height=self.plot_height,
                     ),
                 )),
             lay.card(
                 dcc.Graph(
                     id="plot_dash_liq_months",
                     config=c.dash.PLOT_CONFIG,
                     figure=plt_li.plot_months(
                         DFS[c.dfs.LIQUID],
                         DFS[c.dfs.TRANS],
                         c.dash.DEFAULT_SMOOTHING,
                         False,
                         height=self.plot_height,
                     ),
                 )),
         ]),
     ]
Beispiel #2
0
 def get_body(self):
     return [
         lay.two_columns([
             lay.card(
                 dcc.Graph(
                     id="plot_heat_i",
                     config=c.dash.PLOT_CONFIG,
                     figure=plots.get_heatmap(DFS[c.dfs.TRANS],
                                              c.names.INCOMES),
                 )),
             lay.card(
                 dcc.Graph(
                     id="plot_heat_e",
                     config=c.dash.PLOT_CONFIG,
                     figure=plots.get_heatmap(DFS[c.dfs.TRANS],
                                              c.names.EXPENSES),
                 )),
         ]),
         lay.card(
             dcc.Graph(
                 id="plot_heat_distribution",
                 config=c.dash.PLOT_CONFIG,
                 figure=plots.dist_plot(DFS[c.dfs.TRANS]),
             )),
     ]
Beispiel #3
0
    def get_body(self):
        body = []

        # Add plots and dropdowns
        # One row default with all data, the other with last year
        for num in range(2):

            body.append(
                lay.card([
                    html.Div(
                        dcc.Dropdown(id="drop_pie_{}".format(num),
                                     multi=True)),
                    lay.two_columns([
                        dcc.Graph(
                            id="plot_pie_{}_{}".format(num, c.names.INCOMES),
                            config=c.dash.PLOT_CONFIG,
                        ),
                        dcc.Graph(
                            id="plot_pie_{}_{}".format(num, c.names.EXPENSES),
                            config=c.dash.PLOT_CONFIG,
                        ),
                    ]),
                ]))

        return body + [lay.get_dummy_div("pies_aux")]
Beispiel #4
0
 def get_body(self):
     return [
         lay.two_columns([
             lay.card(dcc.Graph(id="plot_heat_i",
                                config=c.dash.PLOT_CONFIG)),
             lay.card(dcc.Graph(id="plot_heat_e",
                                config=c.dash.PLOT_CONFIG)),
         ]),
         lay.card(
             dcc.Graph(id="plot_heat_distribution",
                       config=c.dash.PLOT_CONFIG)),
         lay.get_dummy_div("heat_aux"),
     ]
Beispiel #5
0
    def get_body(self):
        body = []

        # Add plots and dropdowns
        # One row default with all data, the other with last year
        for num, myears in enumerate([self.all_years, self.last_year_as_list]):

            body.append(
                lay.card([
                    html.Div(
                        dcc.Dropdown(
                            id="drop_pie_{}".format(num),
                            multi=True,
                            options=lay.get_options(self.all_years),
                            # prevent long list selected
                            value=myears if myears != self.all_years else None,
                        )),
                    lay.two_columns([
                        dcc.Graph(
                            id="plot_pie_{}_{}".format(num, c.names.INCOMES),
                            config=c.dash.PLOT_CONFIG,
                            figure=plots.get_pie(DFS[c.dfs.TRANS],
                                                 DFS[c.dfs.CATEG],
                                                 c.names.INCOMES, myears),
                        ),
                        dcc.Graph(
                            id="plot_pie_{}_{}".format(num, c.names.EXPENSES),
                            config=c.dash.PLOT_CONFIG,
                            figure=plots.get_pie(DFS[c.dfs.TRANS],
                                                 DFS[c.dfs.CATEG],
                                                 c.names.EXPENSES, myears),
                        ),
                    ]),
                ]))

        return body
Beispiel #6
0
 def get_body(self):
     return [
         html.Div([
             # Upload widget
             lay.card(
                 dcc.Upload(
                     children=html.Div(
                         ["Drag and Drop or ",
                          html.A("Select a File")]),
                     style=c.styles.STYLE_UPLOAD_CONTAINER,
                     id="upload_container",
                 )),
             # Error message
             dbc.Collapse(
                 lay.card(html.Div(id="upload_error_message"),
                          color="danger"),
                 id="upload_colapse_error_message",
                 is_open=False,
             ),
             # Success message
             dbc.Collapse(
                 lay.card(html.Div(c.io.CONTENT_UPDATED), color="success"),
                 id="upload_colapse_success_message",
                 is_open=False,
             ),
             # Table preview and upload button
             dbc.Collapse(
                 lay.card([
                     lay.two_columns([
                         html.H4(
                             f"Previewing first {self.rows_preview} rows"),
                         dbc.Button("Use this file", id="upload_button"),
                     ]),
                     html.Div(
                         dt.DataTable(id="upload_table_preview",
                                      **self.style_table),
                         style=c.styles.STYLE_INSTRUCTIONS,
                     ),
                 ]),
                 id="upload_colapse_preview",
                 is_open=False,
             ),
             # Instruccions
             lay.card(
                 html.Div(
                     [
                         dcc.Markdown(c.upload.INSTRUCTIONS_1),
                         html.Div(
                             dt.DataTable(
                                 columns=[{
                                     "name": i,
                                     "id": i
                                 } for i in u.dfs.DF_SAMPLE.columns],
                                 data=u.dfs.DF_SAMPLE.head(5).to_dict(
                                     "rows"),
                                 **self.style_table,
                             ),
                             style=c.styles.STYLE_TABLE,
                         ),
                         dcc.Markdown(c.upload.INSTRUCTIONS_2),
                     ],
                     style=c.styles.STYLE_INSTRUCTIONS,
                 )),
         ]),
         html.Div(id="upload_results"),
     ]