hudson.plugins.plot
Class Plot

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

public class Plot
extends Object
implements Comparable<Plot>

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 always 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
 String csvFileName
          The name of the CSV file that persists the plots data.
 String group
          Group name that this plot belongs to.
 String numBuilds
          Number of builds back to show on this plot.
 List<Series> series
          List of data series.
 String style
          Optional style of plot: line, line3d, stackedArea, stackedBar, etc.
 String title
          Title of plot.
 String urlNumBuilds
          Number of builds back to show on this plot from url.
 String urlStyle
          Style of plot from url.
 String urlTitle
          Title of plot from url.
 Boolean urlUseDescr
          Use description flag from url.
 boolean useDescr
          Whether or not to use build descriptions as X-axis labels.
 String yaxis
          Y-axis label.
 
Constructor Summary
Plot()
           
Plot(String title, String yaxis, String group, String numBuilds, String csvFileName, String style, boolean useDescr)
          Creates a new plot with the given paramenters.
 
Method Summary
 void addBuild(hudson.model.AbstractBuild<?,?> build, PrintStream logger)
          Called when a build completes.
 int compareTo(Plot o)
           
 String getCsvFileName()
           
 String getGroup()
           
 String getNumBuilds()
           
 hudson.model.AbstractProject<?,?> getProject()
           
 List<Series> getSeries()
           
 String getTitle()
           
 String getURLNumBuilds()
           
 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.AbstractProject<?,?> project)
          A reference to the project is needed to retrieve the project's root directory where the CSV file is located.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

urlNumBuilds

public transient String urlNumBuilds
Number of builds back to show on this plot from url.


urlTitle

public transient String urlTitle
Title of plot from url.


urlStyle

public transient String urlStyle
Style of plot from url.


urlUseDescr

public transient Boolean urlUseDescr
Use description flag from url.


title

public String title
Title of plot. Mandatory.


yaxis

public String yaxis
Y-axis label. Optional.


series

public List<Series> series
List of data series.


group

public String group
Group name that this plot belongs to.


numBuilds

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


csvFileName

public String csvFileName
The name of the CSV file that persists the plots data. The CSV file is stored in the projects root directory. This is different from the source csv file that can be used as a source for the plot.


style

public String style
Optional style of plot: line, line3d, stackedArea, stackedBar, etc.


useDescr

public boolean useDescr
Whether or not to use build descriptions as X-axis labels. Optional.

Constructor Detail

Plot

@DataBoundConstructor
public Plot(String title,
                                 String yaxis,
                                 String group,
                                 String numBuilds,
                                 String csvFileName,
                                 String style,
                                 boolean useDescr)
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(Plot o)
Specified by:
compareTo in interface Comparable<Plot>

toString

public String toString()
Overrides:
toString in class Object

getYaxis

public String getYaxis()

getSeries

public List<Series> getSeries()

getGroup

public String getGroup()

getCsvFileName

public String getCsvFileName()

getTitle

public String getTitle()

hasLegend

public boolean hasLegend()

getURLNumBuilds

public String getURLNumBuilds()

getNumBuilds

public String getNumBuilds()

getProject

public hudson.model.AbstractProject<?,?> getProject()

setProject

public void setProject(hudson.model.AbstractProject<?,?> 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 IOException
Generates and writes the plot to the response output stream.

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

plotGraphMap

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

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

addBuild

public void addBuild(hudson.model.AbstractBuild<?,?> build,
                     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 © 2004-2014. All Rights Reserved.