本文整理汇总了Java中hudson.util.ShiftedCategoryAxis类的典型用法代码示例。如果您正苦于以下问题:Java ShiftedCategoryAxis类的具体用法?Java ShiftedCategoryAxis怎么用?Java ShiftedCategoryAxis使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ShiftedCategoryAxis类属于hudson.util包,在下文中一共展示了ShiftedCategoryAxis类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createGraph
import hudson.util.ShiftedCategoryAxis; //导入依赖的package包/类
/**
* 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;
}
示例2: createGraph
import hudson.util.ShiftedCategoryAxis; //导入依赖的package包/类
/**
* Create graph based on the given dataset and constraints.
* @return
*/
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;
}
示例3: createGraph
import hudson.util.ShiftedCategoryAxis; //导入依赖的package包/类
@Override
protected JFreeChart createGraph() {
int size = results.size();
final String[] rowKeys = {"Statement Coverage", "Branch Coverage"};
final String[] columnKeys = new String[size];
double[][] data = new double[2][size];
for (int i = 0; i < size; i++) {
columnKeys[size - i - 1] = "#" + results.get(i).getNum();
data[0][size - i - 1] = results.get(i).getStatement();
data[1][size - i - 1] = results.get(i).getCondition();
}
final CategoryDataset dataset = DatasetUtilities.createCategoryDataset(rowKeys, columnKeys, data);
final JFreeChart chart = ChartFactory.createLineChart(
null, // chart title
null, // unused
"%", // range axis label
dataset, // data
PlotOrientation.VERTICAL, // orientation
true, // include legend
true, // tooltips
false // urls
);
chart.setBackgroundPaint(Color.white);
final CategoryPlot plot = chart.getCategoryPlot();
plot.setBackgroundPaint(Color.WHITE);
plot.setOutlinePaint(null);
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();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
rangeAxis.setUpperBound(100);
rangeAxis.setLowerBound(0);
rangeAxis.setTickUnit(new NumberTickUnit(10));
final LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();
renderer.setBaseStroke(new BasicStroke(2.0f));
renderer.setSeriesPaint(0, Color.BLUE);
renderer.setSeriesPaint(1, Color.RED);
plot.setRenderer(renderer);
plot.setInsets(new RectangleInsets(5.0, 0, 0, 5.0));
return chart;
}
示例4: createGraph
import hudson.util.ShiftedCategoryAxis; //导入依赖的package包/类
@Override
protected JFreeChart createGraph()
{
DataSetBuilder<Row, NumberOnlyBuildLabel> dataSetBuilder = new DataSetBuilder<Row, NumberOnlyBuildLabel>();
for (GraphPoint point : points)
{
dataSetBuilder.add(point.getConcernDiagnosticsCount(), CONCERN_ROW, new NumberOnlyBuildLabel(point.getBuild()));
dataSetBuilder.add(point.getWarningDiagnosticsCount(), WARNING_ROW, new NumberOnlyBuildLabel(point.getBuild()));
dataSetBuilder.add(point.getErrorDiagnosticsCount(), ERROR_ROW, new NumberOnlyBuildLabel(point.getBuild()));
}
final JFreeChart chart = ChartFactory.createStackedAreaChart(
null, // chart title
null, // category axis label
"Diagnostics", // value axis label
dataSetBuilder.build(), // dataset
PlotOrientation.VERTICAL, // orientation
false, // include legend
true, // tooltips
true // urls
);
chart.setBackgroundPaint(Color.white);
final CategoryPlot plot = chart.getCategoryPlot();
plot.setBackgroundPaint(Color.WHITE);
plot.setOutlinePaint(null);
plot.setRangeGridlinesVisible(true);
plot.setRangeGridlinePaint(Color.black);
CategoryAxis domainAxis = new ShiftedCategoryAxis("Build Number");
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();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
StackedAreaRenderer renderer = new StackedAreaRenderer2();
plot.setRenderer(renderer);
renderer.setSeriesPaint(2, RED);
renderer.setSeriesPaint(1, YELLOW);
renderer.setSeriesPaint(0, CYAN);
// crop extra space around the graph
plot.setInsets(new RectangleInsets(5.0, 0, 0, 5.0));
return chart;
}
示例5: buildChart
import hudson.util.ShiftedCategoryAxis; //导入依赖的package包/类
public static JFreeChart buildChart(CodeDxBuildAction action,
int numBuildsInGraph, String statisticsName, Map<String,Color> colors){
CategoryDataset dataset = buildDataset(action, numBuildsInGraph, statisticsName);
JFreeChart chart = ChartFactory.createStackedAreaChart(null, null,
"Findings", dataset,
PlotOrientation.VERTICAL, true, false, true);
chart.setBackgroundPaint(Color.white);
CategoryPlot plot = chart.getCategoryPlot();
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);
NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
// crop extra space around the graph
plot.setInsets(new RectangleInsets(0, 0, 0, 5.0));
List rows = dataset.getRowKeys();
List<Color> colorList = new ArrayList<Color>();
if(colors != null){
for(Object row : rows){
if(colors.containsKey(row.toString())){
colorList.add(colors.get(row.toString()));
}
}
}
if(colorList.size() == rows.size()){
plot.setRenderer(new CodeDxAreaRenderer(colorList));
}
else{
plot.setRenderer(new CodeDxAreaRenderer(null));
}
ArrayList<LegendItem> legendItems = new ArrayList<LegendItem>();
Iterator<LegendItem> itr = plot.getLegendItems().iterator();
while (itr.hasNext()) {
legendItems.add(itr.next());
}
//Reverse the order
Collections.sort(legendItems, new Comparator<LegendItem>() {
public int compare(LegendItem lhs, LegendItem rhs) {
return rhs.getSeriesKey().compareTo(lhs.getSeriesKey());
}
});
LegendItemCollection newItems = new LegendItemCollection();
for (LegendItem item : legendItems) {
newItems.add(item);
}
plot.setFixedLegendItems(newItems);
return chart;
}
示例6: createGraph
import hudson.util.ShiftedCategoryAxis; //导入依赖的package包/类
@Override
protected JFreeChart createGraph() {
final JFreeChart chart = ChartFactory.createStackedAreaChart(
null, // chart
null, // unused
yLabel, // range axis label
categoryDataset, // data
PlotOrientation.VERTICAL, // orientation
true, // include legend
true, // tooltips
false // urls
);
final LegendTitle legend = chart.getLegend();
legend.setPosition(RectangleEdge.RIGHT);
chart.setBackgroundPaint(Color.white);
final CategoryPlot plot = chart.getCategoryPlot();
plot.setBackgroundPaint(Color.WHITE);
plot.setOutlinePaint(null);
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();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
rangeAxis.setLowerBound(0);
rangeAxis.setAutoRange(true);
final StackedAreaRenderer renderer = (StackedAreaRenderer) plot.getRenderer();
renderer.setBaseStroke(new BasicStroke(2.0f));
// crop extra space around the graph
plot.setInsets(new RectangleInsets(5.0, 0, 0, 5.0));
return chart;
}