| 1 |
% This file is embedded in datatool-user.pdf version 3.4.3 2025-12-04 |
| 2 |
% Example 131 Bar Chart With Labels (Action `bar chart') |
| 3 |
% Label: "ex:barchartfruitactionlabels" |
| 4 |
% arara: pdflatex |
| 5 |
% arara: pdfcrop |
| 6 |
\documentclass[12pt]{article} |
| 7 |
\pagestyle{empty} |
| 8 |
% sample CSV file: |
| 9 |
\begin{filecontents}[noheader,overwrite]{fruit.csv} |
| 10 |
Name,Quantity |
| 11 |
"Apples",30 |
| 12 |
"Pears",25 |
| 13 |
"Lemons,Limes",40.5 |
| 14 |
"Peaches",34.5 |
| 15 |
"Cherries",20 |
| 16 |
\end{filecontents} |
| 17 |
|
| 18 |
|
| 19 |
\usepackage{databar} |
| 20 |
|
| 21 |
% Load data from fruit.csv file: |
| 22 |
\DTLsetup{store-datum,default-name=fruit} |
| 23 |
\DTLread{fruit.csv} |
| 24 |
\begin{document} |
| 25 |
\DTLaction |
| 26 |
[ |
| 27 |
key=Quantity, |
| 28 |
options={ |
| 29 |
bar-label={\DTLmapget{key=Name}}, |
| 30 |
upper-bar-label=\DTLbarvalue |
| 31 |
} |
| 32 |
] |
| 33 |
{bar chart} |
| 34 |
\end{document} |