From: Tero Salminen Date: Sat, 12 Oct 2013 19:53:27 +0000 (+0300) Subject: plotter scripts: Add automatic x-axis tick scaling X-Git-Url: http://git.itanic.dy.fi/?p=log-plotter;a=commitdiff_plain;h=d683f195a949f990d96da62caca0ce716d4200b0 plotter scripts: Add automatic x-axis tick scaling Change the x-tics based on the maximum timestamp. This makes the plot graphs look better when they are being re-plotter real time during charging. Signed-off-by: Tero Salminen Signed-off-by: Timo Kokkonen --- diff --git a/bal.plot b/bal.plot index df161e6..e580b88 100644 --- a/bal.plot +++ b/bal.plot @@ -45,16 +45,16 @@ set grid y set xlabel "Time [minutes]" set format x "%.0f" -# extract the 'time' cell for xtics based on tital time -stats datafile every ::::0 using 3 nooutput -time = int(STATS_min) - -if (time <= 120) set xtics 0.5 nomirror; -if (time <= 300) set xtics 1 nomirror; -if (time <= 900) set xtics 2 nomirror; -if (time <= 1200) set xtics 3 nomirror; -if (time <= 1800) set xtics 5 nomirror; -if (time > 1800) set xtics 10 nomirror; +# extract the 'time' cell for xtics +stats datafile nooutput +stats datafile u (lastdatapoint=$3) every ::STATS_records-1::STATS_records-1 nooutput +time= int(STATS_max) + +#set xtics based on elapsed time +set xtics 1 nomirror +if (time > 300) set xtics 1 nomirror; +if (time > 900) set xtics 2 nomirror; +if (time > 1800) set xtics 5 nomirror; # Count average-value for balance sero-line samples(x) = $0 > 4 ? 5 : ($0+1) diff --git a/cell_volt.plot b/cell_volt.plot index 2c102ba..6266962 100644 --- a/cell_volt.plot +++ b/cell_volt.plot @@ -49,15 +49,15 @@ set format x "%.0f" set grid y # extract the 'time' cell for xtics -stats datafile every ::::0 using 3 nooutput -time = int(STATS_min) - -if (time <= 120) set xtics 0.5 nomirror; -if (time <= 300) set xtics 1 nomirror; -if (time <= 900) set xtics 2 nomirror; -if (time <= 1200) set xtics 3 nomirror; -if (time <= 1800) set xtics 5 nomirror; -if (time > 1800) set xtics 10 nomirror; +stats datafile nooutput +stats datafile u (lastdatapoint=$3) every ::STATS_records-1::STATS_records-1 nooutput +time= int(STATS_max) + +#set xtics based on elapsed time +set xtics 1 nomirror +if (time > 300) set xtics 1 nomirror; +if (time > 900) set xtics 2 nomirror; +if (time > 1800) set xtics 5 nomirror; # Draw the plot based on log-plotter's variable cell-count if (cell_cnt==1) plot datafile using ($3/60):(($7 > 0 ? $7 : NaN)) axes x1y1 with lines title "Cell 1", \ diff --git a/volt_cur.plot b/volt_cur.plot index 4604338..921f3d9 100644 --- a/volt_cur.plot +++ b/volt_cur.plot @@ -48,15 +48,15 @@ set y2tics border set grid y # extract the 'time' cell for xtics -stats datafile every ::::0 using 3 nooutput -time = int(STATS_min) +stats datafile nooutput +stats datafile u (lastdatapoint=$3) every ::STATS_records-1::STATS_records-1 nooutput +time= int(STATS_max) -if (time <= 120) set xtics 0.5 nomirror; -if (time <= 300) set xtics 1 nomirror; -if (time <= 900) set xtics 2 nomirror; -if (time <= 1200) set xtics 3 nomirror; -if (time <= 1800) set xtics 5 nomirror; -if (time > 1800) set xtics 10 nomirror; +#set xtics based on elapsed time +set xtics 1 nomirror +if (time > 300) set xtics 1 nomirror; +if (time > 900) set xtics 2 nomirror; +if (time > 1800) set xtics 5 nomirror; # Draw the plot based on log-plotter's variable cell-count plot datafile using ($3/60):($5) axes x1y1 with lines title "Voltage", \