This repository has been archived by the owner on Apr 6, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIXED JENKINS-9745] Added new graphs that shows the totals (scaled).
- Loading branch information
Showing
5 changed files
with
95 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
src/main/java/hudson/plugins/analysis/graph/TotalsGraph.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package hudson.plugins.analysis.graph; | ||
|
||
import java.awt.Color; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.jfree.chart.JFreeChart; | ||
import org.jfree.chart.axis.CategoryAxis; | ||
import org.jfree.chart.axis.NumberAxis; | ||
import org.jfree.chart.plot.CategoryPlot; | ||
import org.jfree.chart.plot.PlotOrientation; | ||
import org.jfree.chart.renderer.category.CategoryItemRenderer; | ||
import org.jfree.chart.renderer.category.LineAndShapeRenderer; | ||
import org.jfree.data.category.CategoryDataset; | ||
|
||
import hudson.plugins.analysis.Messages; | ||
import hudson.plugins.analysis.core.BuildResult; | ||
import hudson.plugins.analysis.util.ToolTipProvider; | ||
|
||
import hudson.util.ColorPalette; | ||
|
||
/** | ||
* Builds a graph showing the total of warnings in a scaled line graph. | ||
* | ||
* @author Ulli Hafner | ||
* @since 1.23 | ||
*/ | ||
public class TotalsGraph extends CategoryBuildResultGraph { | ||
@Override | ||
public String getId() { | ||
return "TOTALS"; | ||
} | ||
|
||
@Override | ||
public String getLabel() { | ||
return Messages.Trend_type_totals(); | ||
} | ||
|
||
@Override | ||
protected List<Integer> computeSeries(final BuildResult current) { | ||
List<Integer> series = new ArrayList<Integer>(); | ||
series.add(current.getNumberOfWarnings()); | ||
return series; | ||
} | ||
|
||
@Override | ||
protected JFreeChart createChart(final CategoryDataset dataSet) { | ||
NumberAxis numberAxis = new NumberAxis("count"); | ||
numberAxis.setAutoRange(true); | ||
numberAxis.setAutoRangeIncludesZero(false); | ||
|
||
CategoryAxis domainAxis = new CategoryAxis(); | ||
domainAxis.setCategoryMargin(0.0); | ||
|
||
CategoryPlot plot = new CategoryPlot(dataSet, domainAxis, numberAxis, new LineAndShapeRenderer(true, false)); | ||
plot.setOrientation(PlotOrientation.VERTICAL); | ||
|
||
JFreeChart chart = new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, plot, false); | ||
chart.setBackgroundPaint(Color.white); | ||
|
||
setCategoryPlotProperties(plot); | ||
|
||
return chart; | ||
} | ||
|
||
@Override | ||
protected Color[] getColors() { | ||
return new Color[] {ColorPalette.BLUE}; | ||
} | ||
|
||
@Override | ||
protected CategoryItemRenderer createRenderer(final GraphConfiguration configuration, final String pluginName, final ToolTipProvider toolTipProvider) { | ||
return createLineRenderer(); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters