From 3c7c158f11c09bfdbc0996711d7c28d45e00a138 Mon Sep 17 00:00:00 2001 From: oetiker Date: Sat, 4 Oct 2008 14:09:24 +0000 Subject: [PATCH] added graditents git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk@1572 a5681a0c-68f1-0310-ab6d-d61299d08faa --- tutorial/lisa2008/rrd-by-example/body.tex | 16 ++++- .../rrd-by-example/ex/graph-examples.pl | 70 ++++++++++++------- 2 files changed, 58 insertions(+), 28 deletions(-) diff --git a/tutorial/lisa2008/rrd-by-example/body.tex b/tutorial/lisa2008/rrd-by-example/body.tex index 6e31c75e..6229a87d 100644 --- a/tutorial/lisa2008/rrd-by-example/body.tex +++ b/tutorial/lisa2008/rrd-by-example/body.tex @@ -407,6 +407,7 @@ $15\mathbf{+}23=38$ \end{alltt} \end{frame} +\newpage \begin{frame}{math in the graph (+)} \addgraph{RPN-simple} @@ -417,6 +418,10 @@ $15\mathbf{+}23=38$ expression. The input to a CDEF expression can come from another CDEF expression.} +\begin{frame}{simple gradient} +\addgraph{RPN-grad-a} +\end{frame} + \begin{frame}{the MAX function} \addgraph{RPN-max} \end{frame} @@ -452,8 +457,6 @@ $15\mathbf{+}23=38$ function with enough input, so that it can calculate the first few pixels as well.} -\mode
{\newpage} - \begin{frame}{the TREND and SHIFT} \addgraph{RPN-trend-shift} \end{frame} @@ -476,6 +479,11 @@ $15\mathbf{+}23=38$ less, \texttt{LE} - less or equal, \texttt{EQ} - equal, \texttt{NE} not equal, \texttt{GE} - greater or equal, \texttt{GT} - greater.} +\begin{frame}{horizontal gradient} +\addgraph{RPN-grad-b} +\end{frame} + + \begin{frame}{about invisibility} \addgraph{RPN-UNKN} \end{frame} @@ -483,6 +491,7 @@ $15\mathbf{+}23=38$ \mode
{Unknown values are not drawn on the graph. Here we use trick to only show the largest values.} + \begin{frame}{positional drawing count} \addgraph{RPN-count} \end{frame} @@ -500,6 +509,7 @@ $15\mathbf{+}23=38$ \addgraph{RPN-time} \end{frame} +\newpage \begin{frame}{positional drawing time-shifting} \addgraph{RPN-time-minus} \end{frame} @@ -628,7 +638,7 @@ A VDEF result has a value and a time assigned. \item Every data set is different, tweaking is required. \item Know which knobs to turn. \item Use real data when experimenting. -\item Use \texttt{rrdtool tune} to tweak settings. +\item Use \texttt{rrdtool tune} and \texttt{rrdtool resize} to tweak settings. \item The FAILURES RRA is short! \end{itemize} } diff --git a/tutorial/lisa2008/rrd-by-example/ex/graph-examples.pl b/tutorial/lisa2008/rrd-by-example/ex/graph-examples.pl index d2738ac5..a1eb7859 100755 --- a/tutorial/lisa2008/rrd-by-example/ex/graph-examples.pl +++ b/tutorial/lisa2008/rrd-by-example/ex/graph-examples.pl @@ -5,8 +5,8 @@ my $R=rrdtool; my $w=320 ; my $h=200 ; my $start = 1199999700; -if (not -f 'x.rrd'){ - system $R,'create','x.rrd', +if (not -f 'graph-examples.rrd'){ + system $R,'create','graph-examples.rrd', '--step' => 300, '--start' => ($start-1), 'DS:a:GAUGE:600:-40:2100', @@ -21,7 +21,7 @@ if (not -f 'x.rrd'){ for (my $i = 1; $i < 100;$i++){ push @updates, ($i*300+$start).':'.(sin($i/10)*40+sin($i/19)*10+50).':'.(cos($i/10)*40+cos($i/33)*15+70).':'.(cos($i/10)*10+sin($i/3)*35+70+rand(40)); } - system $R,'update','x.rrd',@updates; + system $R,'update','graph-examples.rrd',@updates; } sub rg { @@ -42,16 +42,16 @@ sub rg { '--pango-markup', '--height' => $h, '--width' => $w, '--imgformat' => 'PDF', - 'DEF:a=x.rrd:a:AVERAGE', - 'DEF:r=x.rrd:r:AVERAGE', - 'DEF:b=x.rrd:b:AVERAGE'); + 'DEF:a=graph-examples.rrd:a:AVERAGE', + 'DEF:r=graph-examples.rrd:r:AVERAGE', + 'DEF:b=graph-examples.rrd:b:AVERAGE'); system $R, 'graph', $file, @G, @_; } rg 'LINE.pdf', '--lower-limit' => 1000, - 'LINE:a#11a03b:DEF\:a=x.rrd\:a\:AVERAGE', - 'LINE:b#a1003b:DEF\:b=x.rrd\:b\:AVERAGE\l'; + 'LINE:a#11a03b:DEF\:a=graph-examples.rrd\:a\:AVERAGE', + 'LINE:b#a1003b:DEF\:b=graph-examples.rrd\:b\:AVERAGE\l'; rg 'LINE-lower.pdf', 'LINE:a#11a03b', @@ -94,22 +94,22 @@ rg "LINE-dash.pdf", rg "DEF-step.pdf", - 'DEF:c=x.rrd:a:AVERAGE:step=1800', - 'LINE3:a#ccc:DEF\:a=x.rrd\:a\:AVERAGE\n', - 'LINE1:c#f00:DEF\:b=x.rrd\:a\:AVERAGE\:step=1800'; + 'DEF:c=graph-examples.rrd:a:AVERAGE:step=1800', + 'LINE3:a#ccc:DEF\:a=graph-examples.rrd\:a\:AVERAGE\n', + 'LINE1:c#f00:DEF\:b=graph-examples.rrd\:a\:AVERAGE\:step=1800'; rg "DEF-reduce.pdf", - 'DEF:c=x.rrd:a:AVERAGE:step=1800:reduce=MIN', - "DEF:d=x.rrd:a:AVERAGE:step=1800:reduce=MAX", - 'LINE1:c#f00:DEF\:b=x.rrd\:a\:AVERAGE\:step=1800\:reduce=MIN\n', - 'LINE1:d#0a0:DEF\:c=x.rrd\:a\:AVERAGE\:step=1800\:reduce=MAX\n', - 'LINE1:a#888:DEF\:a=x.rrd\:a\:AVERAGE'; + 'DEF:c=graph-examples.rrd:a:AVERAGE:step=1800:reduce=MIN', + "DEF:d=graph-examples.rrd:a:AVERAGE:step=1800:reduce=MAX", + 'LINE1:c#f00:DEF\:b=graph-examples.rrd\:a\:AVERAGE\:step=1800\:reduce=MIN\n', + 'LINE1:d#0a0:DEF\:c=graph-examples.rrd\:a\:AVERAGE\:step=1800\:reduce=MAX\n', + 'LINE1:a#888:DEF\:a=graph-examples.rrd\:a\:AVERAGE'; my $newstart = $start + 40*300; rg "DEF-start.pdf", - 'DEF:c=x.rrd:a:AVERAGE:start='.$newstart, - 'LINE5:a#ccc:DEF\:a=x.rrd\:a\:AVERAGE\n', - 'LINE1:c#f00:DEF\:b=x.rrd\:a\:AVERAGE\:start='.$newstart.''; + 'DEF:c=graph-examples.rrd:a:AVERAGE:start='.$newstart, + 'LINE5:a#ccc:DEF\:a=graph-examples.rrd\:a\:AVERAGE\n', + 'LINE1:c#f00:DEF\:b=graph-examples.rrd\:a\:AVERAGE\:start='.$newstart.''; rg 'AREA-simple.pdf', 'AREA:a#f1805b:AREA\:a#a1003b', @@ -128,7 +128,7 @@ rg 'AREA-stack.pdf', 'AREA:b#21808b:AREA\:b#21808b\:...\:STACK\l:STACK'; rg 'SHIFT-simple.pdf', - 'DEF:c=x.rrd:a:AVERAGE', + 'DEF:c=graph-examples.rrd:a:AVERAGE', 'CDEF:d=c', 'SHIFT:d:3600', 'LINE:c#1f9', @@ -136,12 +136,12 @@ rg 'SHIFT-simple.pdf', rg 'SHIFT-startdef.pdf', - 'DEF:c=x.rrd:a:AVERAGE:start='.($start-3600), + 'DEF:c=graph-examples.rrd:a:AVERAGE:start='.($start-3600), 'CDEF:d=c', 'SHIFT:d:3600', 'LINE:c#1f9', 'LINE:d#417:CDEF\:b=a SHIFT\:b\:3600\l', - 'COMMENT:DEF\:a=x.rrd\:a\:AVERAGE\:start='.($start-3600).'\l'; + 'COMMENT:DEF\:a=graph-examples.rrd\:a\:AVERAGE\:start='.($start-3600).'\l'; rg 'RPN-simple.pdf', 'CDEF:c=a,20,+', @@ -168,15 +168,15 @@ rg 'RPN-trend.pdf', 'COMMENT:b=a,3600,TREND\l'; rg 'RPN-trend-start.pdf', - 'DEF:rr=x.rrd:r:AVERAGE:start='.($start-3600), + 'DEF:rr=graph-examples.rrd:r:AVERAGE:start='.($start-3600), 'CDEF:k=rr,3600,TREND', - 'COMMENT:DEF\:a=x.rrd\:a\:AVERAGE\:start='.($start-3600).'\l', + 'COMMENT:DEF\:a=graph-examples.rrd\:a\:AVERAGE\:start='.($start-3600).'\l', 'LINE1:r#3a1:a', 'LINE1:k#21f:b', 'COMMENT:b=a,3600,TREND\l'; rg 'RPN-trend-shift.pdf', - 'DEF:rr=x.rrd:r:AVERAGE:start='.($start-3600), + 'DEF:rr=graph-examples.rrd:r:AVERAGE:start='.($start-3600), 'CDEF:k=rr,3600,TREND', 'SHIFT:k:-1800', 'LINE1:r#3a1:a', @@ -237,6 +237,26 @@ rg 'RPN-prev.pdf', 'CDEF:d=COUNT,3,%,1,EQ,PREV,c,IF', 'COMMENT:CDEF\:c=COUNT,3,%,0,EQ,a,UNKN,IF', 'AREA:d#8a1:d=COUNT,3,%,1,EQ,PREV,c,IF'; + +rg 'RPN-grad-a.pdf', + 'CDEF:c=a,4,/', + 'COMMENT:CDEF\:c=a,4,/\l', + 'AREA:c#77b7ff:AREA\:c#77b7ff\l', + 'AREA:c#5aa8ff:AREA\:c#5aa8ff\:\:STACK\l:STACK', + 'AREA:c#2b8fff:AREA\:c#2b8fff\:\:STACK\l:STACK', + 'AREA:c#0078ff:AREA\:c#0078ff\:\:STACK\l:STACK'; + +rg 'RPN-grad-b.pdf', + 'AREA:a#0078ff:a\l', + 'CDEF:e=a,75,LE,a,75,IF', + 'AREA:e#2b8fff:b=a,75,LE,a,75,IF\l', + 'CDEF:d=a,50,LE,a,50,IF', + 'AREA:d#5aa8ff:c=a,50,LE,a,50,IF\l', + 'CDEF:c=a,25,LE,a,25,IF', + 'AREA:c#77b7ff:b=a,25,LE,a,25,IF\l'; + + + rg 'VDEF-average.pdf', 'VDEF:aavg=a,AVERAGE', -- 2.30.2