use of hudson.util.ShiftedCategoryAxis in project jenkins by jenkinsci.
the class Job method getBuildTimeGraph.
public Graph getBuildTimeGraph() {
return new Graph(getLastBuildTime(), 500, 400) {
@Override
protected JFreeChart createGraph() {
DataSetBuilder<String, ChartLabel> data = new DataSetBuilder<>();
for (Run r : getNewBuilds()) {
if (r.isBuilding())
continue;
data.add(((double) r.getDuration()) / (1000 * 60), "min", new ChartLabel(r));
}
final CategoryDataset dataset = data.build();
final JFreeChart chart = // chart
ChartFactory.createStackedAreaChart(// chart
null, // unused
null, // range axis label
Messages.Job_minutes(), // data
dataset, // orientation
PlotOrientation.VERTICAL, // include legend
false, // tooltips
true, // urls
false);
chart.setBackgroundPaint(Color.white);
final CategoryPlot plot = chart.getCategoryPlot();
// plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0));
plot.setBackgroundPaint(Color.WHITE);
plot.setOutlinePaint(null);
plot.setForegroundAlpha(0.8f);
plot.setRangeGridlinesVisible(true);
plot.setRangeGridlinePaint(Color.black);
CategoryAxis domainAxis = new ShiftedCategoryAxis(null);
plot.setDomainAxis(domainAxis);
domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
domainAxis.setLowerMargin(0.0);
domainAxis.setUpperMargin(0.0);
domainAxis.setCategoryMargin(0.0);
final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
ChartUtil.adjustChebyshev(dataset, rangeAxis);
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
StackedAreaRenderer ar = new ChartLabelStackedAreaRenderer2(dataset);
plot.setRenderer(ar);
// crop extra space around the graph
plot.setInsets(new RectangleInsets(0, 0, 0, 5.0));
return chart;
}
};
}
use of hudson.util.ShiftedCategoryAxis in project memory-map-plugin by Praqma.
the class MemoryMapBuildAction method createPairedBarCharts.
protected JFreeChart createPairedBarCharts(String title, String yAxis, double max, double min, CategoryDataset dataSet, Collection<ValueMarker> markers) {
final CategoryAxis domainAxis = new ShiftedCategoryAxis(null);
final NumberAxis rangeAxis = new NumberAxis(yAxis);
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
rangeAxis.setUpperBound(max);
rangeAxis.setLowerBound(min);
BarRenderer renderer = new BarRenderer();
CategoryPlot plot = new CategoryPlot(dataSet, domainAxis, rangeAxis, renderer);
plot.setDomainAxis(domainAxis);
domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
plot.setOrientation(PlotOrientation.VERTICAL);
plot.setBackgroundPaint(Color.WHITE);
plot.setOutlinePaint(null);
plot.setRangeGridlinesVisible(true);
plot.setRangeGridlinePaint(Color.black);
for (ValueMarker mkr : markers) {
plot.addRangeMarker(mkr);
}
JFreeChart chart = new JFreeChart(plot);
chart.setTitle(title);
return chart;
}
Aggregations