Skip to content
This repository has been archived by the owner on Apr 6, 2022. It is now read-only.

Commit

Permalink
[JENKINS-31421] Make y-axis label configurable.
Browse files Browse the repository at this point in the history
  • Loading branch information
uhafner committed May 12, 2016
1 parent ea79d2b commit 0055ce3
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 4 deletions.
Expand Up @@ -38,7 +38,7 @@
import hudson.util.ChartUtil.NumberOnlyBuildLabel;
import hudson.util.DataSetBuilder;
import hudson.util.ShiftedCategoryAxis;

import hudson.plugins.analysis.Messages;
/**
* A build result graph using a {@link CategoryPlot}. Uses a template method to
* create a graph based on a series of build results.
Expand All @@ -47,6 +47,7 @@
*/
public abstract class CategoryBuildResultGraph extends BuildResultGraph {
private static final Font LEGEND_FONT = new Font("SansSerif", Font.PLAIN, 10); // NOCHECKSTYLE
private static final String Y_AXIS_LABEL = Messages.Trend_yAxisLabel();

/**
* Creates a PNG image trend graph with clickable map.
Expand Down Expand Up @@ -473,10 +474,23 @@ protected void setCategoryPlotProperties(final CategoryPlot plot) {
* @return the created graph
*/
public JFreeChart createAreaChart(final CategoryDataset dataset) {
return createAreaChart(dataset, "count");
}

/**
* Creates a stacked area graph from the specified data set.
*
* @param dataset
* the values to display
* @param yAxisLabel
* label of the range axis, i.e. y axis
* @return the created graph
*/
public JFreeChart createAreaChart(final CategoryDataset dataset, final String yAxisLabel) {
JFreeChart chart = ChartFactory.createStackedAreaChart(
null, // chart title
null, // unused
"count", // range axis label
yAxisLabel, // range axis label
dataset, // data
PlotOrientation.VERTICAL, // orientation
false, // include legend
Expand All @@ -498,10 +512,23 @@ public JFreeChart createAreaChart(final CategoryDataset dataset) {
* @return the created graph
*/
public JFreeChart createBlockChart(final CategoryDataset dataset) {
return createBlockChart(dataset, "count");
}

/**
* Creates a stacked block graph from the specified data set.
*
* @param dataset
* the values to display
* @param yAxisLabel
* label of the range axis, i.e. y axis
* @return the created graph
*/
public JFreeChart createBlockChart(final CategoryDataset dataset, final String yAxisLabel) {
JFreeChart chart = ChartFactory.createStackedBarChart(
null, // chart title
null, // unused
"count", // range axis label
yAxisLabel, // range axis label
dataset, // data
PlotOrientation.VERTICAL, // orientation
false, // include legend
Expand Down Expand Up @@ -536,7 +563,22 @@ protected CategoryItemRenderer createLineRenderer() {
* @return the graph
*/
protected JFreeChart createLineGraph(final CategoryDataset dataSet, final boolean hasLegend) {
NumberAxis numberAxis = new NumberAxis("count");
return createLineGraph(dataSet, hasLegend, Y_AXIS_LABEL);
}

/**
* Creates a line graph for the specified data set.
*
* @param dataSet
* the data to plot
* @param hasLegend
* determines whether to show a legend
* @param yAxisLabel
* label of the range axis, i.e. y axis
* @return the graph
*/
protected JFreeChart createLineGraph(final CategoryDataset dataSet, final boolean hasLegend, final String yAxisLabel) {
NumberAxis numberAxis = new NumberAxis(yAxisLabel);
numberAxis.setAutoRange(true);
numberAxis.setAutoRangeIncludesZero(false);

Expand Down
Expand Up @@ -10,6 +10,8 @@ Trend.PriorityLow=(low priority)
Trend.Fixed=(fixed)
Trend.New=(new)

Trend.yAxisLabel=count

Priority.High=High
Priority.Normal=Normal
Priority.Low=Low
Expand Down
Expand Up @@ -10,6 +10,8 @@ Trend.PriorityLow=(niedrige Priorit
Trend.Fixed=(behoben)
Trend.New=(neu)

Trend.yAxisLabel=Anzahl

Priority.High=Hoch
Priority.Normal=Normal
Priority.Low=Niedrig
Expand Down

0 comments on commit 0055ce3

Please sign in to comment.