hudson.util.ShiftedCategoryAxis Java Examples
The following examples show how to use
hudson.util.ShiftedCategoryAxis.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AWSDeviceFarmGraph.java From aws-device-farm-jenkins-plugin with Apache License 2.0 | 5 votes |
/** * Create graph based on the given dataset and constraints. * * @return The JFreeChart graph. */ protected JFreeChart createGraph() { // Create chart. JFreeChart chart = ChartFactory.createStackedAreaChart(null, null, yLabel, dataset, PlotOrientation.VERTICAL, true, true, false); chart.setBackgroundPaint(Color.WHITE); // Create chart legend. LegendTitle legend = chart.getLegend(); legend.setPosition(RectangleEdge.RIGHT); // Create chart plot. CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setForegroundAlpha(0.7f); plot.setBackgroundPaint(Color.WHITE); plot.setRangeGridlinePaint(Color.darkGray); // Create domain (x) axis. CategoryAxis domain = new ShiftedCategoryAxis(xLabel); domain.setCategoryLabelPositions(CategoryLabelPositions.UP_45); domain.setLowerMargin(0.0); domain.setUpperMargin(0.0); domain.setCategoryMargin(0.0); plot.setDomainAxis(domain); // Create range (y) axis. NumberAxis range = (NumberAxis) plot.getRangeAxis(); range.setAutoRange(true); range.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // Create renderer and paint the chart. CategoryItemRenderer renderer = plot.getRenderer(); plot.setInsets(new RectangleInsets(5.0, 0, 0, 5.0)); // Set chart colors for sections. for (int i = 0; i < colors.length; i++) { renderer.setSeriesPaint(i, colors[i]); } return chart; }