| 1 |
% This file is public domain. |
| 2 |
\documentclass[captions=tableheading]{scrartcl} |
| 3 |
|
| 4 |
\usepackage{datapie} |
| 5 |
|
| 6 |
\DTLloaddb{marks}{sample-student-records.csv} |
| 7 |
|
| 8 |
\begin{document} |
| 9 |
|
| 10 |
% Compute average mark for each student: |
| 11 |
\DTLforeach{marks}{% |
| 12 |
\assignI=Assignment 1,% |
| 13 |
\assignII=Assignment 2,% |
| 14 |
\assignIII=Assignment 3}{% |
| 15 |
\DTLmeanforall{\theMean}{\assignI,\assignII,\assignIII}% |
| 16 |
\DTLround{\theMean}{\theMean}{0}\DTLclip{\theMean}{\theMean}% |
| 17 |
\DTLappendtorow{Average}{\theMean}} |
| 18 |
|
| 19 |
% Sort according to average mark |
| 20 |
\DTLsort{Average=descending}{marks} |
| 21 |
|
| 22 |
\begin{table} |
| 23 |
\caption{Student Marks} |
| 24 |
\centering |
| 25 |
\DTLdisplaydb[Address,RegNum,Title]{marks} |
| 26 |
\end{table} |
| 27 |
|
| 28 |
\begin{figure} |
| 29 |
\caption{Pie Chart} |
| 30 |
\centering |
| 31 |
\DTLpiechart{variable=\Average,outerlabel={\Surname, \FirstName},rotateouter}{marks}% |
| 32 |
{\Average=Average,\Surname=Surname,\FirstName=First |
| 33 |
Name} |
| 34 |
\end{figure} |
| 35 |
|
| 36 |
\end{document} |