hudson.util
Class ChartUtil

java.lang.Object
  extended by hudson.util.ChartUtil

public class ChartUtil
extends Object

Chart generation utility code around JFreeChart.

Author:
Kohsuke Kawaguchi
See Also:
StackedAreaRenderer2, DataSetBuilder, ShiftedCategoryAxis

Nested Class Summary
static class ChartUtil.NumberOnlyBuildLabel
          Can be used as a graph label.
 
Field Summary
static boolean awtProblem
          Deprecated. Use awtProblemCause!=null instead. As of 1.267.
static Throwable awtProblemCause
          See issue 93.
static double CHEBYSHEV_N
           
 
Constructor Summary
ChartUtil()
           
 
Method Summary
static void adjustChebyshev(org.jfree.data.category.CategoryDataset dataset, org.jfree.chart.axis.NumberAxis yAxis)
          Adjusts the Y-axis so that abnormally large value won't spoil the whole chart by making everything look virtually 0.
static void generateClickableMap(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, org.jfree.chart.JFreeChart chart, Area defaultSize)
          Deprecated. as of 1.320 Bind Graph to the URL space. See History as an example (note that doing so involves a bit of URL structure change.)
static void generateClickableMap(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, org.jfree.chart.JFreeChart chart, int defaultW, int defaultH)
          Deprecated. as of 1.320 Bind Graph to the URL space. See History as an example (note that doing so involves a bit of URL structure change.)
static void generateGraph(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, org.jfree.chart.JFreeChart chart, Area defaultSize)
          Deprecated. as of 1.320 Bind Graph to the URL space. See History as an example (note that doing so involves a bit of URL structure change.)
static void generateGraph(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, org.jfree.chart.JFreeChart chart, int defaultW, int defaultH)
          Deprecated. as of 1.320 Bind Graph to the URL space. See History as an example (note that doing so involves a bit of URL structure change.)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

awtProblem

public static boolean awtProblem
Deprecated. Use awtProblemCause!=null instead. As of 1.267.

awtProblemCause

public static Throwable awtProblemCause
See issue 93. Detect an error in X11 and handle it gracefully.


CHEBYSHEV_N

public static double CHEBYSHEV_N
Constructor Detail

ChartUtil

public ChartUtil()
Method Detail

generateGraph

public static void generateGraph(org.kohsuke.stapler.StaplerRequest req,
                                 org.kohsuke.stapler.StaplerResponse rsp,
                                 org.jfree.chart.JFreeChart chart,
                                 Area defaultSize)
                          throws IOException
Deprecated. as of 1.320 Bind Graph to the URL space. See History as an example (note that doing so involves a bit of URL structure change.)

Generates the graph in PNG format and sends that to the response.

Parameters:
defaultSize - The size of the picture to be generated. These values can be overridden by the query paramter 'width' and 'height' in the request.
Throws:
IOException

generateGraph

public static void generateGraph(org.kohsuke.stapler.StaplerRequest req,
                                 org.kohsuke.stapler.StaplerResponse rsp,
                                 org.jfree.chart.JFreeChart chart,
                                 int defaultW,
                                 int defaultH)
                          throws IOException
Deprecated. as of 1.320 Bind Graph to the URL space. See History as an example (note that doing so involves a bit of URL structure change.)

Generates the graph in PNG format and sends that to the response.

Parameters:
defaultW -
defaultH - The size of the picture to be generated. These values can be overridden by the query paramter 'width' and 'height' in the request.
Throws:
IOException

generateClickableMap

public static void generateClickableMap(org.kohsuke.stapler.StaplerRequest req,
                                        org.kohsuke.stapler.StaplerResponse rsp,
                                        org.jfree.chart.JFreeChart chart,
                                        Area defaultSize)
                                 throws IOException
Deprecated. as of 1.320 Bind Graph to the URL space. See History as an example (note that doing so involves a bit of URL structure change.)

Generates the clickable map info and sends that to the response.

Throws:
IOException

generateClickableMap

public static void generateClickableMap(org.kohsuke.stapler.StaplerRequest req,
                                        org.kohsuke.stapler.StaplerResponse rsp,
                                        org.jfree.chart.JFreeChart chart,
                                        int defaultW,
                                        int defaultH)
                                 throws IOException
Deprecated. as of 1.320 Bind Graph to the URL space. See History as an example (note that doing so involves a bit of URL structure change.)

Generates the clickable map info and sends that to the response.

Throws:
IOException

adjustChebyshev

public static void adjustChebyshev(org.jfree.data.category.CategoryDataset dataset,
                                   org.jfree.chart.axis.NumberAxis yAxis)
Adjusts the Y-axis so that abnormally large value won't spoil the whole chart by making everything look virtually 0.

The algorithm is based on Chebyshev's inequality, which states that given any number sequence, nore more than 1/(N^2) values are more than N x stddev away from the average.

So the algorithm is to set Y-axis range so that we can see all data points that are within N x stddev of the average. Most of the time, Cebyshev's inequality is very conservative, so it shouldn't do much harm.

When the algorithm does kick in, however, we can kick out at most 1 in N^2 data points. (So for example if N=3 then we can "fix" the graph as long as we only have less than 1/(3*3)=11.111...% bad data.

Also see issue #1246.



Copyright © 2004-2013. All Rights Reserved.