简体   繁体   中英

Rrdtool line graph style

I'm learning this linux package, I can't find style information, is it possible to create graphs similar in appearance like this: https://canvasjs.com/php-charts/json-data-api-ajax-chart/

rrdtool graph graph.png \
    --start -10m \
    --title "CPU Temperature Log" \
    --vertical-label "Temperature ºC" \
    --width 600 \
    --height 200 \
    --color CANVAS#000000 \
    --color BACK#000000 \
    --color FONT#FFFFFF \
    --dynamic-labels \
    --grid-dash 1:1 \
    --font TITLE:10 \
    --font UNIT:9 \
    --font LEGEND:8 \
    --font AXIS:8 \
    --font WATERMARK:8 \
    --lazy \
    --watermark "$(date -R)" \
    DEF:cpu_temp=cputemp.rrd:cpu_temp:AVERAGE \
    AREA:cpu_temp#FF0000AA:"RPi CPU" \
    LINE2:cpu_temp#FF0000

Current guidebook comes out with something like this: image

You can always specify to use a line rather than an area; so just have:

LINE2:cpu_temp#FF0000:"RPi CPU"

... instead of the AREA and LINE2 directives.

You can also make the line sloped rather than staircase (as in your example) by adding --slope-mode as an option.

rrdtool graph graph.png \
    --start -10m \
    --title "CPU Temperature Log" \
    --vertical-label "Temperature ºC" \
    --width 600 \
    --height 200 \
    --color CANVAS#000000 \
    --color BACK#000000 \
    --color FONT#FFFFFF \
    --dynamic-labels \
    --grid-dash 1:1 \
    --font TITLE:10 \
    --font UNIT:9 \
    --font LEGEND:8 \
    --font AXIS:8 \
    --font WATERMARK:8 \
    --lazy \
    --watermark "$(date -R)" \
    --slope-mode \
    DEF:cpu_temp=cputemp.rrd:cpu_temp:AVERAGE \
    LINE1:cpu_temp#FF0000:"RPi CPU"

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