Ejemplo n.º 1
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]),
             )),
     ]
Ejemplo n.º 2
0
 def get_body(self):
     return [
         lay.card(
             dcc.Graph(
                 id="plot_liquid_evo",
                 config=c.dash.PLOT_CONFIG,
                 figure=plots.liquid_plot(DFS[c.dfs.LIQUID],
                                          c.dash.DEFAULT_SMOOTHING),
             )),
         lay.card(
             dcc.Graph(
                 id="plot_liquid_vs_expenses",
                 config=c.dash.PLOT_CONFIG,
                 figure=plots.plot_expenses_vs_liquid(
                     DFS[c.dfs.LIQUID], DFS[c.dfs.TRANS],
                     c.dash.DEFAULT_SMOOTHING),
             )),
         lay.card(
             dcc.Graph(
                 id="plot_liquid_months",
                 config=c.dash.PLOT_CONFIG,
                 figure=plots.plot_months(DFS[c.dfs.LIQUID],
                                          DFS[c.dfs.TRANS],
                                          c.dash.DEFAULT_SMOOTHING),
             )),
     ]
Ejemplo n.º 3
0
 def get_body(self):
     return [
         lay.card([
             dcc.Graph(
                 id="plot_comp_1",
                 config=c.dash.PLOT_CONFIG,
                 figure=plots.ts_gradient(DFS[c.dfs.TRANS], c.names.INCOMES,
                                          c.dash.DEFAULT_SMOOTHING),
             ),
             dbc.RadioItems(
                 id="radio_comp_1",
                 options=self.radio_opt,
                 value=c.names.INCOMES,
                 inline=True,
             ),
         ]),
         lay.card([
             dcc.Graph(
                 id="plot_comp_2",
                 config=c.dash.PLOT_CONFIG,
                 figure=plots.ts_gradient(DFS[c.dfs.TRANS],
                                          c.names.EXPENSES,
                                          c.dash.DEFAULT_SMOOTHING),
             ),
             dbc.RadioItems(
                 id="radio_comp_2",
                 options=self.radio_opt,
                 value=c.names.EXPENSES,
                 inline=True,
             ),
         ]),
     ]
Ejemplo n.º 4
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,
                     ),
                 )),
         ]),
     ]
Ejemplo n.º 5
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"),
     ]
Ejemplo n.º 6
0
 def get_body(self):
     return [
         lay.card(dcc.Graph(id="plot_evol", config=c.dash.PLOT_CONFIG)),
         lay.card([
             dcc.Graph(id="plot_evo_detail", config=c.dash.PLOT_CONFIG),
             dbc.RadioItems(
                 id="radio_evol_type",
                 options=lay.get_options(
                     [c.names.EXPENSES, c.names.INCOMES]),
                 value=self.def_type,
                 inline=True,
             ),
         ]),
         lay.get_dummy_div("evo_aux"),
     ]
Ejemplo n.º 7
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")]
Ejemplo n.º 8
0
 def get_body(self):
     return [
         lay.card([
             dcc.Graph(id="plot_comp_1", config=c.dash.PLOT_CONFIG),
             dbc.RadioItems(
                 id="radio_comp_1",
                 options=self.radio_opt,
                 value=c.names.INCOMES,
                 inline=True,
             ),
         ]),
         lay.card([
             dcc.Graph(id="plot_comp_2", config=c.dash.PLOT_CONFIG),
             dbc.RadioItems(
                 id="radio_comp_2",
                 options=self.radio_opt,
                 value=c.names.EXPENSES,
                 inline=True,
             ),
         ]),
         lay.get_dummy_div("comp_aux"),
     ]
Ejemplo n.º 9
0
 def get_body(self):
     return [
         lay.card(
             dcc.Graph(
                 id="plot_evol",
                 config=c.dash.PLOT_CONFIG,
                 figure=plots.plot_timeserie(DFS[c.dfs.TRANS],
                                             c.dash.DEFAULT_SMOOTHING,
                                             self.def_tw),
             )),
         lay.card([
             dcc.Graph(
                 id="plot_evo_detail",
                 config=c.dash.PLOT_CONFIG,
                 figure=plots.plot_timeserie_by_categories(
                     DFS[c.dfs.TRANS],
                     DFS[c.dfs.CATEG],
                     c.dash.DEFAULT_SMOOTHING,
                     self.def_type,
                     self.def_tw,
                 ),
             ),
             dbc.RadioItems(
                 id="radio_evol_type",
                 options=lay.get_options(
                     [c.names.EXPENSES, c.names.INCOMES]),
                 value=self.def_type,
                 inline=True,
             ),
         ]),
         lay.card(
             dcc.Graph(
                 id="plot_evo_savings",
                 config=c.dash.PLOT_CONFIG,
                 figure=plots.plot_savings_ratio(DFS[c.dfs.TRANS],
                                                 c.dash.DEFAULT_SMOOTHING,
                                                 self.def_tw),
             )),
     ]
Ejemplo n.º 10
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
Ejemplo n.º 11
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"),
     ]
Ejemplo n.º 12
0
    def get_body(self):
        body = [
            lay.card(
                dcc.Graph(
                    id="plot_invest_total_worth",
                    config=c.dash.PLOT_CONFIG,
                    figure=plots.total_worth_plot(DFS[c.dfs.LIQUID],
                                                  DFS[c.dfs.WORTH],
                                                  c.dash.DEFAULT_SMOOTHING),
                )),
            lay.card([
                dcc.Graph(
                    id="plot_invest_passive_income",
                    config=c.dash.PLOT_CONFIG,
                    figure=plots.passive_income_vs_expenses(
                        DFS[c.dfs.WORTH],
                        DFS[c.dfs.TRANS],
                        c.dash.DEFAULT_SMOOTHING,
                        self.def_smooth,
                    ),
                ),
                dbc.RadioItems(
                    id="radio_invest_smooth",
                    options=[
                        {
                            "label": "Don't smooth",
                            "value": False
                        },
                        {
                            "label": "Smooth passive income",
                            "value": True
                        },
                    ],
                    value=self.def_smooth,
                    inline=True,
                ),
            ]),
            lay.card(
                dcc.Graph(
                    id="plot_invest_performance",
                    config=c.dash.PLOT_CONFIG,
                    figure=plots.total_worth_plot(DFS[c.dfs.INVEST],
                                                  DFS[c.dfs.WORTH],
                                                  c.dash.DEFAULT_SMOOTHING),
                )),
            lay.card([
                dcc.Graph(
                    id="plot_invest_detail",
                    config=c.dash.PLOT_CONFIG,
                    figure=plots.invest_evolution_plot(
                        DFS[c.dfs.INVEST], c.dash.DEFAULT_SMOOTHING),
                ),
                dbc.RadioItems(
                    id="radio_invest_wor_inv",
                    options=lay.get_options([c.names.WORTH, c.names.INVESTED]),
                    value=c.names.WORTH,
                    inline=True,
                ),
            ]),
        ]

        return body