rrdtool-1.x icon indicating copy to clipboard operation
rrdtool-1.x copied to clipboard

left-axis-format does not accept %s

Open dschultzca opened this issue 1 year ago • 1 comments

Describe the bug When trying to format the left axis with --left-axis-format="%8.2lf %s" an error is thrown.
ERROR: invalid format string '%8.2lf %s' (should match '^(?:[^%]+|%%)*%[-+ 0#]?[0-9]*(?:[.][0-9]+)?l[eEfFgG](?:[^%]+|%%)*$')

To Reproduce Steps to reproduce the behavior: Using the attached RRD (power.rrd) create graph with a command such as: rrdtool.exe graph - --imgformat=PNG --start="1679511902" --end="1679598034" --pango-markup --title="Current Power" --vertical-label="power level" --slope-mode --base=1000 --height=200 --width=700 --alt-autoscale --left-axis-format="%8.2lf %s" COMMENT:"From 2023-03-22 19\:05\:02 To 2023-03-23 19\:00\:34\c" COMMENT:" \n" --color BACK#F3F3F3 --color CANVAS#FDFDFD --color SHADEA#CBCBCB --color SHADEB#999999 --color FONT#000000 --color AXIS#2C4D43 --color ARROW#2C4D43 --color FRAME#2C4D43 --border 1 --font TITLE:11:"Arial" --font AXIS:8:"Arial" --font LEGEND:8:"Courier" --font UNIT:8:"Arial" --font WATERMARK:6:"Arial" --slope-mode DEF:a="power.rrd":"CurrPower":AVERAGE LINE1:a#00CF00FF:"power level" GPRINT:a:LAST:"Cur\:%8.2lf %s" GPRINT:a:AVERAGE:"Avg\:%8.2lf %s" GPRINT:a:MAX:"Max\:%8.2lf %s\n > power_graph.png"

Expected behavior I expect that the 'k' SI magnitude unit be printed after the numeric value of the axis with the format I specify. In this case 26.0 k, 26.2 k, 26.4 k, 26.6 k, 26.8 k, 27.0 k, etc.
If I use --left-axis-format="%8.2lf" the 'k' SI magnitude unit is left out completely.
Using the axis --units-exponent option does not help either.

Screenshots I am trying to correct this axis labelling behavior: image

Desktop (please complete the following information):

  • OS: Windows Server 2012
  • Browser: Chrome

power.rrd.zip

dschultzca avatar Mar 23 '23 19:03 dschultzca