[Graph-dev] Re: Chart::Graph::Gnuplot help

Adam Pirkle adam at pirkle.org
Fri Jan 2 14:01:49 PST 2004


Seun,

Here's an example that will print date vs. columns 3 and 4
(bandwidth). You can change the hash at the top of the file to get it
to print other columns. Note that to print what you call columns 3 and
4 I had to tell gnuplot to use columns 5 and 6; this is because
gnuplot interprets a column as anything that is seperated by
whitespace.

Also, if you're not familiar with the perl map function, you may want to
read this:
http://www.perldoc.com/perl5.8.0/pod/func/map.html

Here's my code:

use Chart::Graph::Gnuplot qw(gnuplot);

my %cols = (
            5 => "Bandwidth Utilization In %",
            6 => "Bandwidth Utilization Out %"
            );

gnuplot({
         "title" => "Priory Hse birmingham-mort-direct 4MB PVC Util% In/Out 15pm-20pm",
         "x-axis label" => "Last 4 Weeks",
         "y-axis label" => "Utilization %",
         "output type" => "png",
         "output file" => "priory-Hse-birmingham-mort-direct-15pm-20pm.png",
         # Setting date/time specific options.
         "xdata" => "time",
         "timefmt" => "%d/%m/%Y\t%H:%M",
         "format" => ["x", "%d/%m/%Y"],
         # Set output range - note quoting of date string
#         "xrange" => "[\"3/10/2003\":\"10/12/2003\"]",
         "extra_opts" => join("\n", "set grid"),
        },


        map {  
            [{"title" => $cols{$_},
              "style" => "linespoints",
              "type" => "file",
              using => "1:$_" },
             "data-in"] } (sort keys %cols));


Regards,
Adam

On Fri, Jan 02, 2004 at 11:21:44AM -0800, seun ewulomi said the following:
> Hi Adam, 
> 
> My apologies on the email but I desperately need advice and help. I have posted on the graph-dev form but got no replies.
> 
> I am collecting time series data on our routers in the format below(ascii/text
>  file). I have als attached a  file for the time series data due to 
> formatting.
> 
> ************************
> col-1					col-2	col-3	col-4	col-5	col-6	col-7	col-8
> 23/10/2003 00:00	00:04:19	302	0.26	1.18	3617.13	657.42	2959.71	29
> 23/10/2003 00:00	00:09:17	298	0.92	1.92	7094.68	2291.25	4803.43	28
> 23/10/2003 00:00	00:14:28	311	2.12	1.23	8389.58	5312.24	3077.34	28
> 23/10/2003 00:00	00:24:30	315	0.67	0.86	3804.99	1665.32	2139.67	28
> 
> col-1 - Sample Time	
> col-2 -  "Delta Time"
> col-3 -  "Bandwidth Utilization In %"
> col-4 -  "Bandwidth Utilization Out %"
> col-5 -  "Bytes/sec Util" 
> col-6 -  "Bytes In" "/sec"
> col-7 -  "Bytes Out" "/sec"
> col-8 - latency	
> ***********************************
> 
> My main aim is to graph the outputs of certain columns and to have the 
> graph in png format. I have attached my chart graph script that I currently use.
> 
> 1)How would I use the Chart::Graph::Gnuplot to plot e.g col-1, col-3, 
> col-4 and have the graph in png format on the same graph. 
> 
> I have tried this according to the examples and it doesnt seem to work
> 
> e.g
>           Data for when Bytes out
>           [{"title" => "Bytes Out",
> 	  "style" => "lines",
>           "type" => "file"}, "test-data", "using" => "1:3 with lines"],
> 
> This part is currently commented out in the script because it doesnt work. Can you please view the script and edit where possible to show me where it is going wrong.
> 
> My apologies if this sounds trivial but your help will be greatly apprciated. I am quite desperate as I have been trying to figure this out for weeks.
> 
> My environment
> 
> linux redhat 7.3, 2.4.20 kernel
> gnuplot 3.7
> Chart-Graph-2.0.tar.gz 
> 
> Thanks again.
> 
> Regards,
> Seun
> 
> 
> 
> _____________________________________________________________
> Free, simple, fast, memorable email
> Become you at EmailAccount.com at http://www.emailaccount.com/




More information about the Graph-dev mailing list