oetiker / rrdtool-1.x

RRDtool 1.x - Round Robin Database
http://www.rrdtool.org
GNU General Public License v2.0
1.02k stars 264 forks source link

rrdgraph: logarithmic Y-Axis seems to ignore --left-axis-format option #1095

Open inc90 opened 4 years ago

inc90 commented 4 years ago

Describe the bug I am logging electricity usage on a minute by minute basis. In rrdgraph, when the Y-Axis is set to Logarithmic the parameter --left-axis-format seems to have no effect. The left Y-Axis values are always shown in exponential format. I would like to have the left Y-axis values in the format xx.yy as in the attached picture on the right Y-Axis.

I'm using rrdtool version 1.7.0 on Ubuntu 18.04 LTS

To Reproduce I use the following shell script to generate a PNG from an rrd db:

# Generate a graph showing a day of electricity values, one value per minute.
# Define some basic variables

date_string=`date +"%c"`
date_string_escaped=${date_string//:/\\:}
end_time=`date +%s`
start_time=$end_time-86400

rrdtool graph /var/lib/owfs/graphs/meter_fast_IR_Demand_920.png \
              --start $start_time --end $end_time \
              --vertical-label "Instantaneous Power Electricity kW" \
              --units-exponent 0 \
              --left-axis-format %1.2lf \
              --right-axis-format %1.2lf \
              --right-axis 1:0 \
              --logarithmic \
              DEF:meter_Demand=/var/lib/owfs/rrd/meter_fast_IR.rrd:meter_fast_Demand:AVERAGE:step=1 \
              CDEF:scaled_meter_Demand=meter_Demand,1,* \
              VDEF:average_scaled_meter_Demand=scaled_meter_Demand,AVERAGE \
              --width 1600 --height 400 --title 'Electricity Consumption - Last 24h' \
              --lower-limit 0.01 \
              --upper-limit 10.0 \
              --x-grid HOUR:1:HOUR:6:HOUR:6:0:'%a %H:00' \
              --color MGRID#FF0000 \
              TEXTALIGN:center \
              COMMENT:" \n" \
              COMMENT:"Last Updated\: $date_string_escaped\c" \
              COMMENT:" \n" \
              LINE1:scaled_meter_Demand#FE2E64:"Instantaneous Power kW" \
              GPRINT:average_scaled_meter_Demand:"Average\: %2.2lf kW"

Expected behavior I would expect the left Y-Axis to be the same as the right Y-Axis

Screenshots meter_fast_IR_Demand_920

Further Information When I add the option --units=si then the left Y-Axis values are shown with a suffix, e.g. 500 m, but the right Y-Axis remains unaffected.

meter_fast_IR_Demand_920 si

I would be grateful for any hints as to why the Y-Axis formatting comes out in exponential notation.

Regards, Muiris.

inc90 commented 4 years ago

This is the associated RRD

meter_fast_IR.zip