Change net income figure; Add table

This commit is contained in:
2024-01-07 18:54:24 +01:00
parent 7c75bd3c37
commit e9a218bb88
2 changed files with 47 additions and 22 deletions

View File

@@ -38,13 +38,13 @@
\newcommand{\slice}[6]{
\pgfmathparse{0.5*#1+0.5*#2}
\let\midangle\pgfmathresult
% slice
\fill[thick,color=#5] (0,0) -- (#1:1) arc (#1:#2+1:1) -- (0,0);
% outer label
\node[label=\midangle:#4] at (\midangle:1) {};
% inner label
\pgfmathparse{min((#2-#1-10)/110*(-0.3),0)}
\let\temp\pgfmathresult
@@ -58,13 +58,13 @@
\newcounter{pieSliceB}
\newcommand{\pie}[1]{
% Count elements
\setcounter{pieElem}{0}%
\setcounter{pieElem}{0}%
\foreach\pieElem in {#1}{\stepcounter{pieElem}}%
\edef\numElements{\arabic{pieElem}}
% Draw pie chart
\setcounter{pieSliceA}{0}%
\setcounter{pieSliceB}{0}%
\setcounter{pieSliceA}{0}%
\setcounter{pieSliceB}{0}%
\foreach \xi/\t [count=\xk from 0] in {#1} {
% Get colors
\pgfmathparse{1000 / (\numElements - 1) * \xk}
@@ -81,16 +81,16 @@
\newcommand{\csvPie}[1]{
% Count elements
\setcounter{pieElem}{0}%
\setcounter{pieElem}{0}%
\csvreader[head to column names]{#1}{}{%
\stepcounter{pieElem}
}
\edef\numElements{\arabic{pieElem}}
% Draw pie chart
\setcounter{pieElem}{0}%
\setcounter{pieSliceA}{0}%
\setcounter{pieSliceB}{0}%
\setcounter{pieElem}{0}%
\setcounter{pieSliceA}{0}%
\setcounter{pieSliceB}{0}%
\csvreader[head to column names]{#1}{}{%
% Get colors
\pgfmathparse{1000 / (\numElements - 1) * \thepieElem}
@@ -157,7 +157,7 @@
]
% Dummy plot to set x axis ticks
\addplot[draw=none]
table[col sep=comma, x=t, y=value]
table[col sep=comma, x=t, y=net]
{net_income.csv};
% Dummy plot to set x axis scale
@@ -165,11 +165,17 @@
table[col sep=comma, x=t, y expr=0]
{detailed_balance.csv};
\addplot[ybar, color=scol2, fill=scol2, line width=1pt]
table[col sep=comma, x=t, y=value, discard if lt={value}{0}]
\addplot[ybar, bar width=0.4cm, draw=none, fill=scol2!30, line width=1pt]
table[col sep=comma, x=t, y=income]
{net_income.csv};
\addplot[ybar, color=scol0, fill=scol0, line width=1pt]
table[col sep=comma, x=t, y=value, discard if gt={value}{0}]
\addplot[ybar, bar width=0.4cm, draw=none, fill=scol0!30, line width=1pt]
table[col sep=comma, x=t, y=expenses]
{net_income.csv};
\addplot[ybar, bar width=0.3cm, draw=none, fill=scol0, line width=1pt]
table[col sep=comma, x=t, y=net, discard if gt={net}{0}]
{net_income.csv};
\addplot[ybar, bar width=0.3cm, draw=none, fill=scol2, line width=1pt]
table[col sep=comma, x=t, y=net, discard if lt={net}{0}]
{net_income.csv};
\end{axis}
\end{tikzpicture}
@@ -211,6 +217,13 @@
\caption{Development of account balance over time}
\end{figure}
\begin{figure}
\centering
\csvautotabular{net_income.csv}
\end{figure}
\begin{figure}[H]
\centering
@@ -218,7 +231,7 @@
% Read table
\pgfplotstableread[col sep=comma]{expenses_by_category.csv}\expbycattable
\pgfplotstablegetcolsof{\expbycattable}
\pgfmathtruncatemacro\NumCols{\pgfplotsretval-1}
\pgfmathtruncatemacro\NumCols{\pgfplotsretval-1}
\begin{subfigure}[c]{\textwidth}
\centering