preview draw.sh
parent
1fc7d76e26
commit
747dc90e9b
|
|
@ -0,0 +1,41 @@
|
|||
#! /bin/bash
|
||||
|
||||
cd "$(dirname "$(realpath "$BASH_SOURCE")")"
|
||||
|
||||
go run . \
|
||||
-json \
|
||||
-group-date ^20..-.. \
|
||||
-group-name '^[^:]*:[^:]*' \
|
||||
-like-name '(AssetAccount|Debts|Stock|Retirement)' \
|
||||
-foo reg \
|
||||
"$@" ./macro.d/* \
|
||||
| jq -c '.[] | {label: .name, x: .delta.Date, y: .balance[(.delta.Currency)], z: .delta.Currency}' \
|
||||
| grep '"z":"\$"' \
|
||||
| python3 -c '
|
||||
# line chart
|
||||
import matplotlib.pyplot as plt
|
||||
import json
|
||||
from sys import stdin
|
||||
|
||||
fig = plt.figure()
|
||||
plot = fig.add_subplot()
|
||||
|
||||
label_z_x_y = {}
|
||||
for line in stdin.readlines():
|
||||
if not line:
|
||||
continue
|
||||
d = json.loads(line)
|
||||
if not d["label"] in label_z_x_y:
|
||||
label_z_x_y[d["label"]] = {}
|
||||
if not d["z"] in label_z_x_y[d["label"]]:
|
||||
label_z_x_y[d["label"]][d["z"]] = {}
|
||||
label_z_x_y[d["label"]][d["z"]][d["x"]] = d["y"]
|
||||
for label in label_z_x_y:
|
||||
for z in label_z_x_y[label]:
|
||||
xs = sorted([i for i in label_z_x_y[label][z].keys()])
|
||||
ys = [label_z_x_y[label][z][x] for x in xs]
|
||||
plot.plot(xs, ys, label=f"{label} ({z})")
|
||||
|
||||
plot.legend()
|
||||
plt.show()
|
||||
'
|
||||
|
|
@ -13,7 +13,7 @@ import (
|
|||
|
||||
func main() {
|
||||
foo := flag.String("foo", "bal", "bal or reg")
|
||||
likeName := flag.String("like", ".", "regexp to match")
|
||||
likeName := flag.String("like-name", ".", "regexp to match")
|
||||
likeBefore := flag.String("like-before", "9", "date str to compare")
|
||||
likeAfter := flag.String("like-after", "0", "date str to compare")
|
||||
likeLedger := flag.Bool("like-ledger", false, "limit data to these -like-* rather than zoom to these -like-*")
|
||||
|
|
|
|||
Loading…
Reference in New Issue