hudson.plugins.plot
Class Plot

java.lang.Object
  extended by hudson.plugins.plot.Plot
All Implemented Interfaces:
java.lang.Comparable

public class Plot
extends java.lang.Object
implements java.lang.Comparable

Represents the configuration for a single plot. A plot can have one or more data series (lines). Each data series has one data point per build. The x-axis is alway the build number. A plot has the following characteristics:

A plots group effects the way in which plots are displayed. Group names are listed as links on the top-level plot page. The user then clicks on a group and sees the plots that belong to that group.

Author:
Nigel Daley

Field Summary
 java.lang.String csvFileName
          The name of the CSV file that persists the plots data.
 java.lang.String group
          Group name that this plot belongs to.
 java.lang.String numBuilds
          Number of builds back to show on this plot.
 Series[] series
          Array of data series.
 java.lang.String title
          Title of plot.
 java.lang.String yaxis
          Y-axis label.
 
Constructor Summary
Plot()
           
Plot(java.lang.String title, java.lang.String yaxis, Series[] series, java.lang.String group, java.lang.String numBuilds, java.lang.String csvFileName)
          Creates a new plot with the given paramenters.
 
Method Summary
 void addBuild(hudson.model.Build build, java.io.PrintStream logger)
          Called when a build completes.
 int compareTo(java.lang.Object o)
           
 java.lang.String getCsvFileName()
           
 java.lang.String getGroup()
           
 java.lang.String getNumBuilds()
           
 Series[] getSeries()
           
 java.lang.String getTitle()
           
 java.lang.String getYaxis()
           
 boolean hasLegend()
           
 void plotGraph(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Generates and writes the plot to the response output stream.
 void plotGraphMap(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Generates and writes the plot's clickable map to the response output stream.
 void setProject(hudson.model.Project project)
          A reference to the project is needed to retrieve the project's root directory where the CSV file is located.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

title

public java.lang.String title
Title of plot. Mandatory.


yaxis

public java.lang.String yaxis
Y-axis label. Optional.


series

public Series[] series
Array of data series.


group

public java.lang.String group
Group name that this plot belongs to.


numBuilds

public java.lang.String numBuilds
Number of builds back to show on this plot. Empty string means all builds. Must not be "0".


csvFileName

public java.lang.String csvFileName
The name of the CSV file that persists the plots data. The CSV file is stored in the projects root directory.

Constructor Detail

Plot

public Plot(java.lang.String title,
            java.lang.String yaxis,
            Series[] series,
            java.lang.String group,
            java.lang.String numBuilds,
            java.lang.String csvFileName)
Creates a new plot with the given paramenters. If numBuilds is the empty string, then all builds will be included. Must not be zero.


Plot

public Plot()
Method Detail

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getTitle

public java.lang.String getTitle()

getYaxis

public java.lang.String getYaxis()

getSeries

public Series[] getSeries()

getGroup

public java.lang.String getGroup()

getNumBuilds

public java.lang.String getNumBuilds()

hasLegend

public boolean hasLegend()

getCsvFileName

public java.lang.String getCsvFileName()

setProject

public void setProject(hudson.model.Project project)
A reference to the project is needed to retrieve the project's root directory where the CSV file is located. Unfortunately, a reference to the project is not available when this object is created.

Parameters:
project - the project

plotGraph

public void plotGraph(org.kohsuke.stapler.StaplerRequest req,
                      org.kohsuke.stapler.StaplerResponse rsp)
               throws java.io.IOException
Generates and writes the plot to the response output stream.

Parameters:
req - the incoming request
rsp - the response stream
Throws:
java.io.IOException

plotGraphMap

public void plotGraphMap(org.kohsuke.stapler.StaplerRequest req,
                         org.kohsuke.stapler.StaplerResponse rsp)
                  throws java.io.IOException
Generates and writes the plot's clickable map to the response output stream.

Parameters:
req - the incoming request
rsp - the response stream
Throws:
java.io.IOException

addBuild

public void addBuild(hudson.model.Build build,
                     java.io.PrintStream logger)
Called when a build completes. Adds the finished build to this plot. This method extracts the data for each data series from the build and saves it in the plot's CSV file.

Parameters:
build -
logger -


Copyright © 2007. All Rights Reserved.