简体   繁体   中英

How to make RRDtool use commas instead of dots as decimal separators in graphs

I'm using RRDtool through a Perl script (RRDs) to visualize temperature readings. As I want everything in the graph to be shown in Swedish (weekdays etc), I set the locale to in my Perl script with: ,方法是:

use POSIX qw(locale_h);
setlocale(LC_ALL, "sv_SE.UTF-8");

RRDtool gets this, and prints weekday names in Swedish. However, numerical values that are written under the RRDtool graph with GPRINT use dots instead of commas as decimal separators (XX xx), and I'm not sure why. 的数值,我不知道为什么。 In Swedish, commas should be used (XX xx). xx)。 I use GPRINT like this:

GPRINT:temp_out:MIN: Min\\: %6.1lf

I've tried setting LC_NUMERIC and LC_CTYPE to as well, but without result. ,但是没有结果。 I've tried using , but no go. ,但没有成功。 I've also read various printf documentation, but have yet to come up with a solution.

Has anyone managed to make RRDtool use commas instead of dots as decimal separators? Thanks!

If I create the graph using rrdtool graph at the command line and have set LC_NUMERIC=sv_SE , I get commas as decimal separators. This leads me to believe that my Perl script doesn't pick up on my setlocale . Still investigating...

rrdtool is actually forcing LC_NUMERIC in multiple places to 'C' in order to prevent stray commas from showing up in odd places ...

to see commas in generated charts, one would have to enhance this logic a bit further in rrd_graph.c to explicitly re-enable the users original LC_NUMERIC setting prior to rendering GPRINT statements.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM