Skip to content

Commit

Permalink
Fix assetalloc_class chart (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
aldur authored Apr 11, 2024
1 parent 1c78027 commit f41b22c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions fava_investor/modules/assetalloc_class/libassetalloc.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def serialise(self, currency):
"balance_children": {currency: self.balance_children},
"balance": {currency: self.balance},
"children": children,
"has_txns": False,
}

def pretty_print(self, indent=0):
Expand Down
10 changes: 6 additions & 4 deletions fava_investor/templates/Investor.html
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,13 @@ <h3>What not to buy</h3>
{% if (module == 'aa_class') %}
<h2>Portfolio: Asset Allocation by Class</h2>

{% set chart_data = [] %}
{% set results = extension.build_assetalloc_by_class() %}

{% set serialised_tree = results[0].serialise(results[0]['currency']) %}
{% set chart_data = [{ 'type': 'hierarchy', 'label': 'Asset Allocation', 'data': serialised_tree }] %}
{% set chart_data = [{
'type': 'hierarchy',
'label': "Asset Allocation",
'data': results[0].serialise(results[0]['currency'])
}]
%}
<svelte-component type="charts"><script type="application/json">{{ chart_data|tojson }}</script></svelte-component>

{{ asset_tree(results[0]) }}
Expand Down

0 comments on commit f41b22c

Please sign in to comment.