perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sbek...@hyperreal.org
Subject cvs commit: modperl-site/netcraft graph.gif graph.pl input.data
Date Sat, 14 Aug 1999 11:42:39 GMT
sbekman     99/08/14 04:42:38

  Modified:    .        index.html
               netcraft graph.gif graph.pl input.data
  Log:
  graphs, graphs, graphs... updated the monthly graph, created a better
  smaller graph for the /index.html. Now graph.pl makes both graphs - the
  normal and small one.
  
  Revision  Changes    Path
  1.28      +9 -3      modperl-site/index.html
  
  Index: index.html
  ===================================================================
  RCS file: /export/home/cvs/modperl-site/index.html,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- index.html	1999/08/03 06:49:23	1.27
  +++ index.html	1999/08/14 11:42:37	1.28
  @@ -1,7 +1,7 @@
   <html>
   <head>
   <title>Apache/Perl Integration Project</title>
  -<!-- Last changed: $Id: index.html,v 1.27 1999/08/03 06:49:23 sbekman Exp $ -->
  +<!-- Last changed: $Id: index.html,v 1.28 1999/08/14 11:42:37 sbekman Exp $ -->
   <!-- Last changed: Gerald Richter: 31-Mar-1999 -->
   </head>
   <body bgcolor=#ffffff >
  @@ -148,8 +148,14 @@
   <p>
   <hr>
   <p>
  -And finally some numbers: (See <A HREF="/netcraft">for more information</A>
and bigger picture :)<BR>
  -<IMG SRC="/netcraft/graph.gif" HEIGHT=300 WIDTH=525 BORDER=0 ALT="mod_perl usage graph">
  +
  +And finally some numbers: A monthly growth of mod_perl deployment
  + (See <A HREF="/netcraft">for more information</A> and bigger and better
  +graphp:)<BR>
  +
  +<A HREF="/netcraft">
  +<IMG SRC="/netcraft/pseudo-graph.gif" HEIGHT=200 WIDTH=350 BORDER=0 ALT="mod_perl usage
graph">
  +</A>
   <hr>
   <p>
   <font size=-2>
  
  
  
  1.3       +66 -73    modperl-site/netcraft/graph.gif
  
  	<<Binary file>>
  
  
  1.2       +106 -47   modperl-site/netcraft/graph.pl
  
  Index: graph.pl
  ===================================================================
  RCS file: /export/home/cvs/modperl-site/netcraft/graph.pl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- graph.pl	1999/05/13 19:44:47	1.1
  +++ graph.pl	1999/08/14 11:42:38	1.2
  @@ -1,72 +1,131 @@
   #!/usr/bin/perl
   
  -# this script build a graph from 2 data sets, expects to find a file 
  +# this script builds 2 graphs from 2 data sets, expects to find a file 
   # with data of name "input.data" in the script's directory, data should be
   # separated with tabs, e.g:
   #May 1999        156458  36976
   #April 1999      134255  32570
   #March 1999      112399  28482
  +#
  +# first set describes a number Hostnames, 2nd - Unique IP numbers
  +#
  +# first graph (graph.gif) is a normal one
  +#
  +# second graph (pseudo-graph.gif) is much smaller and includes points,
  +# with no other labels, but y axis. This graph should be linked to a
  +# bigger one (graph.gif)
  +#
  +# Note: you need GIFgraph package to be installed in order to use this
  +# script.
  +
  +# Copyrighted under GPL license
  +# by Stas Bekman <sbekman@iname.com>
  +# Aug, 14 1999
   
  -# Note: you need GIFgraph to be installed in order to use this script.
  -
  -# Copyleft by Stas Bekman <sbekman@iname.com> 
  -# May, 13 1999
  -
   use GIFgraph::linespoints;
  +use strict;
   
   print STDERR "Processing data\n";
   
  -@data =  read_data_from_csv("input.data")
  +my @data =  read_data_from_csv("input.data")
           or die "Cannot read data from input.data";
   
  -$my_graph = new GIFgraph::linespoints(700,400);
  -
   # make the Y axis to be optimally used
  -$max_y = 0;
  -foreach $val (@{$data[1]},@{$data[2]}){
  -  $max_y = $val if $val >  $max_y ;
  +my $max_y = 0;
  +foreach (@{$data[1]},@{$data[2]}) {
  +  $max_y = $_ if $_ >  $max_y ;
   }
   # normalize it
   $max_y  = ( int $max_y / 1000 + 1 ) * 1000; 
  +
  +normal_graph();
  +
  +pseudo_graph();
  +
  +# plot a normal graph of points with all the info as possible
  +sub normal_graph{
  +  my $my_graph = new GIFgraph::linespoints(700,400);
  +
  +  $my_graph->set( 
  +		 x_label => 'Months',
  +		 y_label => 'Counts',
  +		 title => "mod_perl usage survey (numbers are by courtesy of netcraft.com).",
  +		 y_max_value => $max_y,
  +		 y_label_skip => 1,
  +		 x_label_skip => 1,
  +		 x_labels_vertical => 1,
  +		 x_label_position => 1/2,
  +		 markers => [ 1, 7 ],
  +		 marker_size => 2,
  +		 transparent => 1,
  +		 t_margin => 10, 
  +		 b_margin => 10, 
  +		 l_margin => 10, 
  +		 r_margin => 10,
  +
  +		 two_axes => 1,
  +		 logo => 'logo.gif',
  +		 logo_position => 'LL',
  +		);
  +
  +  #$my_graph->set( dclrs => [ qw(green pink blue cyan) ] );
  +
  +  $my_graph->set_x_label_font(GD::gdMediumBoldFont);
  +  $my_graph->set_y_label_font(GD::gdMediumBoldFont);
  +  $my_graph->set_x_axis_font(GD::gdMediumBoldFont);
  +  $my_graph->set_y_axis_font(GD::gdMediumBoldFont);
  +  $my_graph->set_title_font(GD::gdGiantFont);
   
  -$my_graph->set( 
  -        x_label => 'Months',
  -        y_label => 'Counts',
  -        title => "mod_perl usage survey (numbers are by courtesy of netcraft.com).",
  -        y_max_value => $max_y,
  -        y_label_skip => 1,
  -        x_label_skip => 1,
  -        x_labels_vertical => 1,
  -      	x_label_position => 1/2,
  -        markers => [ 1, 7 ],
  -	marker_size => 2,
  -	transparent => 1,
  -	t_margin => 10, 
  -	b_margin => 10, 
  -	l_margin => 10, 
  -	r_margin => 10,
  -
  -        two_axes => 1,
  -        logo => 'logo.gif',
  -        logo_position => 'LL',
  -
  -
  -);
  -
  -#$my_graph->set( dclrs => [ qw(green pink blue cyan) ] );
  -
  -$my_graph->set_x_label_font(GD::gdMediumBoldFont);
  -$my_graph->set_y_label_font(GD::gdMediumBoldFont);
  -$my_graph->set_x_axis_font(GD::gdMediumBoldFont);
  -$my_graph->set_y_axis_font(GD::gdMediumBoldFont);
  -$my_graph->set_title_font(GD::gdGiantFont);
  +  $my_graph->set_legend('Hostnames','Unique IP numbers' );
  +  $my_graph->set_legend_font(GD::gdMediumBoldFont);
   
  -$my_graph->set_legend('Hostnames','Unique IP numbers' );
  -$my_graph->set_legend_font(GD::gdMediumBoldFont);
  +  $my_graph->plot_to_gif( "graph.gif", \@data );
   
  -$my_graph->plot_to_gif( "graph.gif", \@data );
  +}
  +
  +# plot a small graph of points with as least info as possible
  +sub pseudo_graph{
  +  my $my_graph = new GIFgraph::linespoints(350,200);
  +
  +    # in this graph we don't want X labels to be printed
  +  for (0..$#{$data[0]}) {
  +    $data[0]->[$_] = "";
  +  }
  +
  +  $my_graph->set( 
  +		 y_max_value => $max_y,
  +		 y_label_skip => 0,
  +		 x_label_skip => 1,
  +		 x_labels_vertical => 1,
  +		 x_label_position => 1/2,
  +		 markers => [ 1, 7 ],
  +		 marker_size => 2,
  +		 transparent => 1,
  +		 t_margin => 10, 
  +		 b_margin => 10, 
  +		 l_margin => 10, 
  +		 r_margin => 10,
  +		 two_axes => 0,
  +
  +		 logo => 'logo-middle.gif',
  +		 logo_position => 'UL',
  +		);
  +
  +  #$my_graph->set( dclrs => [ qw(green pink blue cyan) ] );
  +
  +  $my_graph->set_x_label_font(GD::gdMediumBoldFont);
  +  $my_graph->set_y_label_font(GD::gdSmallFont);
  +  $my_graph->set_x_axis_font(GD::gdMediumBoldFont);
  +  $my_graph->set_y_axis_font(GD::gdSmallFont);
  +  $my_graph->set_title_font(GD::gdGiantFont);
  +
  +  $my_graph->set_legend('Hostnames','Unique IP numbers' );
  +  $my_graph->set_legend_font(GD::gdSmallFont);
   
  -exit;
  +  $my_graph->plot_to_gif( "pseudo-graph.gif", \@data );
  +
  +
  +}
   
   sub read_data_from_csv
   {
  
  
  
  1.3       +2 -2      modperl-site/netcraft/input.data
  
  Index: input.data
  ===================================================================
  RCS file: /export/home/cvs/modperl-site/netcraft/input.data,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- input.data	1999/07/14 20:07:13	1.2
  +++ input.data	1999/08/14 11:42:38	1.3
  @@ -1,5 +1,6 @@
  +August 1999 	248925 	51413
   July 1999	202081	42183
  -June 1999	183793	40484
  +June 1999	183793	40484 
   May 1999	156458	36976
   April 1999	134255	32570
   March 1999	112399	28482
  @@ -24,5 +25,4 @@
   August 1997	1501	1228
   July 1997	1138	580
   June 1997	312	239
  -
   
  
  
  

Mime
View raw message