简体   繁体   English

php rrd_graphs评论位置几乎每次更改

[英]php rrd_graphs comments position change almost every time

I have a problem with rrd graps - they look different every time. 我对rrd grap有问题-每次看起来都不同。

For example: these are 2 graphs generated one by one using the same function. 例如:这些是使用相同功能一张一张地生成的2张图。

第一

第二名

My rrd_graph options looks like this: 我的rrd_graph选项如下所示:

"--slope-mode",
        "--start", $start,

        "--font=DEFAULT:9:Cantarell",
        "--font=TITLE:12:Roboto Condensed",
        "--font=AXIS:8:Roboto Condensed",
        "--font=LEGEND:9:Cantarell",
        "--font=WATERMARK:6:Cantarell",

        "--title=$title",
        "-W General",
        "--vertical-label=Tx[dBm] / Rx[dBm] / SNR[dB]",
        "--lower=0",
        "-w 550",
        "-h 300",
        "-P",
        "--border=0",
        "--color=BACK#ffffff",
        "DEF:Tx=$RRD_CM_PATH$cm_mac_mod.rrd:US_Tx:AVERAGE",
        "DEF:SNR=$RRD_CM_PATH$cm_mac_mod.rrd:US_SNR:AVERAGE",
        "DEF:Rx=$RRD_CM_PATH$cm_mac_mod.rrd:US_Rx:AVERAGE",
        "COMMENT:\\n",
        "COMMENT:\\t\\t\\t\\t\\t\\t\\t\\t    Current\\t\\t  Average\\t\\tMinimum\\t      Maximum",
        "COMMENT:\\n",
        "COMMENT:\\t\\t\\t",
        "LINE3:Tx#055499:US Tx\\t\\t\\t",
        "GPRINT:Tx:LAST:%2.1lfdBm \\t",
        "GPRINT:Tx:AVERAGE:%2.1lfdBm \\t",
        "GPRINT:Tx:MAX:%2.1lfdBm \\t",
        "GPRINT:Tx:MIN:%2.1lfdBm \\t",
        "COMMENT:\\n",
        "COMMENT:\\t\\t\\t",
        "LINE3:SNR#ff5a00:US SNR\\t\\t",
        "GPRINT:SNR:LAST:%2.1lfdBm\\t",
        "GPRINT:SNR:AVERAGE:%2.1lfdBm\\t",
        "GPRINT:SNR:MAX:%2.1lfdBm\\t",
        "GPRINT:SNR:MIN:%2.1lfdBm\\t",
        "COMMENT:\\n",
        "COMMENT:\\t\\t\\t",
        "LINE3:Rx#4be117:US_Rx\\t",
        "GPRINT:Rx:LAST:%2.1lfdBm\\t",
        "GPRINT:Rx:AVERAGE:%2.1lfdBm\\t",
        "GPRINT:Rx:MAX:%2.1lfdBm\\t",
        "GPRINT:Rx:MIN:%2.1lfdBm\\t",
        "COMMENT:\\n",

I forgot to share the solution... I fixed a problem using 2 things: 我忘了分享解决方案...我用2件东西解决了一个问题:

  1. Monospaced font. 等宽字体。
  2. sprintf with fixed width strings: 带有固定宽度字符串的sprintf:

      sprintf('COMMENT:%25s%13s%13s%14s%13s', "", "Current", " Average", "Maximum", "Minimum"), "COMMENT:\\\\n", "COMMENT: \\\\n", "COMMENT:\\\\t", sprintf("LINE3:Rx#055499:%-9s%-10s", "DS Rx", "[dBm]"), sprintf("GPRINT:Rx:LAST:%-13s", "%4.1lf"), sprintf("GPRINT:Rx:AVERAGE:%-13s", "%4.1lf"), sprintf("GPRINT:Rx:MAX:%-13s", "%4.1lf"), sprintf("GPRINT:Rx:MIN:%-13s", "%4.1lf"), "COMMENT:\\\\n", "COMMENT:\\\\t", sprintf("LINE3:SNR#ff5a00:%-9s%-10s", "DS SNR", "[dB]"), sprintf("GPRINT:SNR:LAST:%-13s", "%4.1lf"), sprintf("GPRINT:SNR:AVERAGE:%-13s", "%4.1lf"), sprintf("GPRINT:SNR:MAX:%-13s", "%4.1lf"), sprintf("GPRINT:SNR:MIN:%-13s", "%4.1lf"), "COMMENT:\\\\n", "COMMENT:\\\\t", sprintf("LINE3:MR#4be117:%-9s%-10s", "MicroRef", "[-dBc]"), sprintf("GPRINT:MR:LAST:%-13s", "%4.1lf"), sprintf("GPRINT:MR:AVERAGE:%-13s", "%4.1lf"), sprintf("GPRINT:MR:MAX:%-13s", "%4.1lf"), sprintf("GPRINT:MR:MIN:%-13s", "%4.1lf"), "COMMENT:\\\\n", 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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