Hi guys, i need a help in aggrid
Basically i want to build a streamlit to help me rebalance portfolios.
So far i got a pretty good result in showing the data of the portfolio diveded by asset classes. And the result of new investment in individual assets (collumns “APLICACAO” and “RESULTADO”
Here is a print of what it look like so far.
The problem is that i want the (%) to be dinamic, the one showing is based on the pandas calculation that i did before, so it does not change with nem applications
Here is the code for it.
gb.configure_column(field="FUNDO", header_name="FUNDO", width=300, rowGroup=True, hide=True)
gb.configure_column(field="SUB_TIPO", header_name="SUB_TIPO", rowGroup=True, width=400, hide=True)
gb.configure_column(field="NOME COMERCIAL", header_name="NOME COMERCIAL", width=300)
gb.configure_column(field="FINANCEIRO", header_name="FINANCEIRO", type=["numericColumn"], aggFunc="sum",
pivot=True, width=200, valueFormatter="'R$ ' + value.toLocaleString()")
gb.configure_column(field="APLICACAO", header_name="APLICACAO", editable=True, type=["numericColumn"],
aggFunc="sum", pivot=True, width=200, valueFormatter="'R$ ' + value.toLocaleString()")
gb.configure_column(field="%", header_name="%", type=["numericColumn"], aggFunc="sum", pivot=True, width=200, valueFormatter="value.toLocaleString() + ' %'")
gb.configure_column(field="RESULTADO", header_name="RESULTADO", valueGetter='(Number(data.FINANCEIRO) + Number(data.APLICACAO))',
cellRenderer='agAnimateShowChangeCellRenderer', editable='false', type=['numericColumn'], aggFunc="sum", valueFormatter="'R$ ' + value.toLocaleString()")
My first guess was to look at the valueGetter documentation, to do something like ‘(Number(data.RESULTADO) / Number(data.RESULTADO).sum())’, but i did not find nothing. Someone already had to do something like this?
Grateful in advance.