[Orca-checkins] r366 - in trunk/orca: lib/Orca orca

Blair Zajac blair at orcaware.com
Sat Jul 3 23:17:26 PDT 2004


Author: blair
Date: Sat Jul  3 23:14:36 2004
New Revision: 366

Modified:
   trunk/orca/lib/Orca/Config.pm
   trunk/orca/lib/Orca/ImageFile.pm
   trunk/orca/orca/orca.pl.in
Log:
Add the ability to add a horizontal line (rule) using a new hrule
configuration parameter to a plot.  Patch by Jon Tankersley
<jon.tankersley at eds.com>.

* orca/orca.pl.in
  (pod):
    Add documentation for the new hrule plot parameter.

* lib/Orca/Config.pm:
  (%pcl_plot_elements),
  (%pcl_plot_append_elements),
    Add hrule to these hashes.
  (check_config):
    Initialize the hrule's array reference if it doesn't exist in the
    plot.

* lib/Orca/ImageFile.pm
  (_update_graph_options):
    Add all the hrule's to the RRDs::graph options.


Modified: trunk/orca/lib/Orca/Config.pm
==============================================================================
--- trunk/orca/lib/Orca/Config.pm	(original)
+++ trunk/orca/lib/Orca/Config.pm	Sat Jul  3 23:14:36 2004
@@ -102,6 +102,7 @@
                                     data_type           => 1,
                                     flush_regexps       => 1,
                                     href                => 1,
+                                    hrule               => 1,
                                     legend              => 1,
                                     line_type           => 1,
                                     logarithmic         => 1,
@@ -127,6 +128,7 @@
                                     data_min            => 1,
                                     data_max            => 1,
                                     data_type           => 1,
+                                    hrule               => 1,
                                     legend              => 1,
                                     line_type           => 1,
                                     summary_format      => 1);
@@ -830,7 +832,7 @@
       $plot->{y_legend} = $plot->{legend}[0];
     }
 
-    # Set the colors of any data not defined.
+    # Set the colors of any data's not defined.
     $plot->{color} = [] unless defined $plot->{color};
     for (my $k=@{$plot->{color}}; $k<$number_datas; ++$k) {
       $plot->{color}[$k] = data_index_to_color($k);
@@ -873,6 +875,9 @@
       }
       $plot->{title} = $title;
     }
+
+    # The hrule array reference must exist.
+    $plot->{hrule} = [] unless defined $plot->{hrule}
   }
 
   $number_errors;

Modified: trunk/orca/lib/Orca/ImageFile.pm
==============================================================================
--- trunk/orca/lib/Orca/ImageFile.pm	(original)
+++ trunk/orca/lib/Orca/ImageFile.pm	Sat Jul  3 23:14:36 2004
@@ -180,6 +180,13 @@
     my $rrd_version  = $rrd->version;
     push(@options, "DEF:average$i=$rrd_filename:Orca$rrd_version:AVERAGE");
   }
+
+  # Add any hrule's to the plot.
+  for (my $i=0; $i<@{$plot_ref->{hrule}}; ++$i) {
+    push(@options, "HRULE:$plot_ref->{hrule}[$i]");
+  }
+
+  # Put the legends on the plot.
   my @legends;
   my $max_legend_length = 0;
   for (my $i=0; $i<$data_sources; ++$i) {

Modified: trunk/orca/orca/orca.pl.in
==============================================================================
--- trunk/orca/orca/orca.pl.in	(original)
+++ trunk/orca/orca/orca.pl.in	Sat Jul  3 23:14:36 2004
@@ -2234,11 +2234,19 @@
 the exact text matched by the ()'s and %G is replaced with the same
 text, except the first character is capitalized.
 
-=item B<y_legend> <text>
+=item B<y_legend> I<text>
 
 Setting B<y_legend> sets the text to be displayed along the Y axis of
 the PNG plot.
 
+=item B<hrule> I<value>#I<rrggbb>[:I<legend>]
+
+Draw a horizontal line (rule) into the graph at the vertical Y
+I<value> with the specified color I<rrggbb> and optionally add a
+I<legend> for it.
+
+An arbitrary number of B<hrule>'s may be added to a plot.
+
 =back
 
 =head2 Multiple Plot Plotting Parameters



More information about the Orca-checkins mailing list