Tips and techniques for producing graphical charts.
Generally we run a hledger report and select CSV output (and disable unwanted features like the Total row): Eg:
hledger bal assets liabilities --no-total -o report.csv
Then there are many ways to convert CSV to charts.
Drag the CSV file into your favourite spreadsheet app and use its charting tools.
hledger -f examples/bcexample.hledger bal -O csv -N expenses -3 cur:USD \ | sed 's/ USD//' \ | ploterific -m Bar -f account:N -f balance:Q -c account -o a.html \ && open a.html
Let's break down that command line:
-f examples/bcexample.hledger- use this example file in the hledger repo. Omit this to use your default journal.
bal- run a balance report
-O csv- show it as CSV on stdout
-N- disable the final Total row
expenses- limit to accounts whose name contains
-3- summarise accounts to depth 3 and above
cur:USD- limit to balances in
USDcurrency. If you use the
$symbol, it would be
sed 's/ USD//g'- process the output with sed, stripping the
USDsymbols to leave bare numbers for ploterific. With
$it would be
-m Bar- use
Baras the Vega-Lite mark type
-f account:N- use the
accountcolumn as the first feature (X axis), treating values as names
-f balance:Q- use the
balancecolumn as a second feature (Y axis), treating values as quantities
-c account- use
accountvalues to select colours
-o a.html- save into a temporary HTML file
&& open a.html- and view it in your web browser, on Mac; on other systems it might be
Here is the same chart but with the colour set by the balance:
hledger -f examples/bcexample.hledger bal -O csv -N expenses -3 cur:USD \ | sed 's/ USD//' \ | ploterific -m Bar -f account:N -f balance:Q -c balance:Q -o a.html
Check out the tools at https://plaintextaccounting.org/#reports (hreports, ledger-plot, ledger-plots, ludget, r-ledger..)