2 # Tero Salminen 2013 for project Log-plotter
3 # Timo Kokkonen http://git.itanic.dy.fi/?p=log-plotter
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 # Commandline usage with example values unless ran from log-plotter
20 # gnuplot -e "datafile='log.log' ; chg_name='iCharger 3010B' ; cell_cnt='6' ; sizex='800' ; sizey='480'" volt_cur.plot
22 set output "volt_cur.png"
25 ttext1=" - Battery voltage & charged capacity "
27 set title chg_name.ttext1.cell_cnt.ttext2
29 # Setting the graphics size from log-plotter variables
32 set term png size gsizex,gsizey
34 # Setting layout and label & legends etc
38 set datafile separator ";"
39 set key out bot hor center samplen 2
40 set timestamp "%d.%m.%Y - %H:%M" top offset -1,-1 font ",8"
41 set ylabel "Voltage [V]"
44 set xlabel "Time [minutes]"
46 set y2label "Capacity [mAh]"
50 # extract the 'time' cell for xtics
51 stats datafile every ::::0 using 3 nooutput
54 if (time <= 120) set xtics 0.5 nomirror;
55 if (time <= 300) set xtics 1 nomirror;
56 if (time <= 900) set xtics 2 nomirror;
57 if (time <= 1200) set xtics 3 nomirror;
58 if (time <= 1800) set xtics 5 nomirror;
59 if (time > 1800) set xtics 10 nomirror;
61 # Draw the plot based on log-plotter's variable cell-count
62 plot datafile using ($3/60):($5) axes x1y1 with lines title "Voltage", \
63 datafile using ($3/60):($19) axes x1y2 with lines title "Capacity"