gnuplot is supported again (-j and -J)
This commit is contained in:
parent
7610aec86d
commit
71e8d50657
3 changed files with 43 additions and 9 deletions
28
NEWS
28
NEWS
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
* 2.0
|
||||
|
||||
- The code base has been rewritten for clarity and consistency. The
|
||||
code is now simpler, more robust, and a fair bit faster.
|
||||
- The code base was rewritten for clarity and consistency. It is now
|
||||
simpler, more robust, and faster.
|
||||
|
||||
- The most significant feature addition in this version is the use of
|
||||
"value expressions". These are now used in many places to indicate
|
||||
|
|
@ -22,9 +22,33 @@
|
|||
"-f" flag was seen (i.e., if the LEDGER environment variable is
|
||||
used).
|
||||
|
||||
- New "-o FILE" option will output data to the given FILE. If FILE is
|
||||
"-", the output is the same as the default (stdout).
|
||||
|
||||
- New -j and -J options replace the old -G (gnuplot) option. -j
|
||||
reports the values column in a way gnuplot can consume, and -J
|
||||
reports the totals column. An example can be found in
|
||||
scripts/report.
|
||||
|
||||
- New "-y DATEFMT" options will change the date format used throughout
|
||||
ledger. The default is "%Y/%m/%d".
|
||||
|
||||
- New -Y and -W options prints yearly and weekly subtotals, just as
|
||||
the -M option printed monthly subtotals in the previous version.
|
||||
|
||||
- New "-z INTERVAL" allows for more flexible interval reporting. The
|
||||
sublanguage used will probably mature over time, but for now it
|
||||
supports expression like:
|
||||
|
||||
monthly
|
||||
every week
|
||||
every 3 quarters
|
||||
weekly from 12/20
|
||||
|
||||
Note that when using the "from" date, this does not constrain the
|
||||
report. It is only used for aligning report dates, for example if
|
||||
you wish weekly reporting to start on Sundays.
|
||||
|
||||
- Regexps specified after the command name now apply to account names
|
||||
only. To search on a payee, use "--" to separate the two kinds of
|
||||
regexps. For example, to find a payee named "John" within all
|
||||
|
|
|
|||
14
main.cc
14
main.cc
|
|
@ -15,6 +15,8 @@ static const std::string bal_fmt = "%20T %2_%-n\n";
|
|||
static const std::string reg_fmt
|
||||
= "%D %-.20P %-.22N %12.66t %12.80T\n\
|
||||
%/ %-.22N %12.66t %12.80T\n";
|
||||
static const std::string plot_value_fmt = "%D %t\n";
|
||||
static const std::string plot_total_fmt = "%D %T\n";
|
||||
static const std::string print_fmt
|
||||
= "\n%D %X%C%P\n %-34N %12o\n%/ %-34N %12o\n";
|
||||
static const std::string equity_fmt
|
||||
|
|
@ -219,7 +221,7 @@ int main(int argc, char * argv[])
|
|||
int c, index;
|
||||
while (-1 !=
|
||||
(c = getopt(argc, argv,
|
||||
"+ABb:Ccd:DEe:F:f:Ghi:L:l:MnOo:P:p:QRrS:sT:t:UVvWXYy:Zz:"))) {
|
||||
"+ABb:Ccd:DEe:F:f:Ghi:JjL:l:MnOo:P:p:QRrS:sT:t:UVvWXYy:Zz:"))) {
|
||||
switch (char(c)) {
|
||||
// Basic options
|
||||
case 'h':
|
||||
|
|
@ -435,6 +437,16 @@ int main(int argc, char * argv[])
|
|||
total_expr = "MD(MT/(1+(((t-d)/(30*86400))<0?0:((t-d)/(30*86400)))))";
|
||||
break;
|
||||
|
||||
case 'j':
|
||||
value_expr = "S" + value_expr;
|
||||
format_string = plot_value_fmt;
|
||||
break;
|
||||
|
||||
case 'J':
|
||||
total_expr = "S" + total_expr;
|
||||
format_string = plot_total_fmt;
|
||||
break;
|
||||
|
||||
default:
|
||||
assert(0);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1,17 +1,15 @@
|
|||
#!/bin/sh
|
||||
|
||||
args=("$@")
|
||||
last=${args[`expr ${#args} - 3`]}
|
||||
#!/bin/bash
|
||||
|
||||
cd /tmp
|
||||
ledger "$@" | stripreg > $last
|
||||
ledger -j reg "$@" > report
|
||||
|
||||
gnuplot <<EOF
|
||||
set terminal png
|
||||
set output "report.png"
|
||||
set xdata time
|
||||
set timefmt "%Y/%m/%d"
|
||||
plot "$1" using 1:2 with linespoints
|
||||
plot "report" using 1:2 with linespoints
|
||||
EOF
|
||||
|
||||
rm -f report
|
||||
open report.png
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue