Class Plot

java.lang.Object
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 title (mandatory)
  • y-axis label (defaults to no label)
  • one or more data series
  • plot group (defaults to no group)
  • number of builds to show on the plot (defaults to all)

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 Details

    • 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.
    • description

      public String description
      Description of plot. Optional.
    • 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.
    • exclZero

      public boolean exclZero
      Whether or not to exclude zero as default Y-axis value. Optional.
    • logarithmic

      public boolean logarithmic
      Use a logarithmic Y-axis.
    • yaxisMinimum

      public String yaxisMinimum
      Min/max yaxis values, string used so if no value defaults used
    • yaxisMaximum

      public String yaxisMaximum
  • Constructor Details

    • Plot

      @DataBoundConstructor public Plot(String title, String yaxis, String group, String numBuilds, String csvFileName, String style, boolean useDescr, boolean keepRecords, boolean exclZero, boolean logarithmic, String yaxisMinimum, String yaxisMaximum, String description)
      Creates a new plot with the given parameters. If numBuilds is the empty string, then all builds will be included. Must not be zero.
    • Plot

      @Deprecated public Plot(String title, String yaxis, String group, String numBuilds, String csvFileName, String style, boolean useDescr)
      Deprecated.
      Kept for backward compatibility.
    • Plot

      public Plot()
  • Method Details

    • getKeepRecords

      public boolean getKeepRecords()
    • getExclZero

      public boolean getExclZero()
    • isLogarithmic

      public boolean isLogarithmic()
    • hasYaxisMinimum

      public boolean hasYaxisMinimum()
    • getYaxisMinimum

      public Double getYaxisMinimum()
    • hasYaxisMaximum

      public boolean hasYaxisMaximum()
    • getYaxisMaximum

      public Double getYaxisMaximum()
    • getDoubleFromString

      public Double getDoubleFromString(String input)
    • compareTo

      public int compareTo(Plot o)
      Specified by:
      compareTo in interface Comparable<Plot>
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • 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()
    • getDescription

      public String getDescription()
    • getJob

      public Job<?,?> getJob()
    • setJob

      public void setJob(Job<?,?> job)
    • getProject

      @Deprecated public AbstractProject<?,?> getProject()
      Deprecated.
    • setProject

      public void setProject(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.
    • plotGraph

      public void plotGraph(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 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.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 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(AbstractBuild<?,?> build, PrintStream logger)
      See Also:
    • addBuild

      public void addBuild(Run<?,?> run, PrintStream logger, FilePath workspace)
      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.