Package hudson.util
Class ChartUtil
- java.lang.Object
-
- 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
Nested Classes Modifier and Type Class Description static classChartUtil.NumberOnlyBuildLabelCan be used as a graph label.
-
Field Summary
Fields Modifier and Type Field Description static booleanawtProblemDeprecated.UseawtProblemCause!=nullinstead.static ThrowableawtProblemCauseSee issue 93.static doubleCHEBYSHEV_N
-
Constructor Summary
Constructors Constructor Description ChartUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static voidadjustChebyshev(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 voidgenerateClickableMap(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, org.jfree.chart.JFreeChart chart, int defaultW, int defaultH)Deprecated.as of 1.320 BindGraphto the URL space.static voidgenerateClickableMap(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, org.jfree.chart.JFreeChart chart, Area defaultSize)Deprecated.as of 1.320 BindGraphto the URL space.static voidgenerateGraph(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, org.jfree.chart.JFreeChart chart, int defaultW, int defaultH)Deprecated.as of 1.320 BindGraphto the URL space.static voidgenerateGraph(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, org.jfree.chart.JFreeChart chart, Area defaultSize)Deprecated.as of 1.320 BindGraphto the URL space.
-
-
-
Field Detail
-
awtProblem
@Deprecated public static boolean awtProblem
Deprecated.UseawtProblemCause!=nullinstead. As of 1.267.
-
awtProblemCause
public static Throwable awtProblemCause
See issue 93. Detect an error in X11 and handle it gracefully.
-
CHEBYSHEV_N
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @RestrictedSince("2.301") public static final double CHEBYSHEV_N
- See Also:
- Constant Field Values
-
-
Method Detail
-
generateGraph
@Deprecated 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 BindGraphto the URL space. Seehudson.tasks.junit.Historyas 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 parameter 'width' and 'height' in the request.- Throws:
IOException
-
generateGraph
@Deprecated 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 BindGraphto the URL space. Seehudson.tasks.junit.Historyas 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- The size of the picture to be generated. These values can be overridden by the query parameter 'width' in the request.defaultH- The size of the picture to be generated. These values can be overridden by the query parameter 'height' in the request.- Throws:
IOException
-
generateClickableMap
@Deprecated 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 BindGraphto the URL space. Seehudson.tasks.junit.Historyas 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
@Deprecated 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 BindGraphto the URL space. Seehudson.tasks.junit.Historyas 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 JENKINS-1246.
-
-