本文整理汇总了Java中org.jfree.chart.entity.StandardEntityCollection类的典型用法代码示例。如果您正苦于以下问题:Java StandardEntityCollection类的具体用法?Java StandardEntityCollection怎么用?Java StandardEntityCollection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StandardEntityCollection类属于org.jfree.chart.entity包,在下文中一共展示了StandardEntityCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testEquals
import org.jfree.chart.entity.StandardEntityCollection; //导入依赖的package包/类
/**
* Confirm that the equals method can distinguish all the required fields.
*/
public void testEquals() {
PieSectionEntity e1 = new PieSectionEntity(
new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0), new DefaultPieDataset(),
0, 1, "Key", "ToolTip", "URL"
);
StandardEntityCollection c1 = new StandardEntityCollection();
c1.addEntity(e1);
PieSectionEntity e2 = new PieSectionEntity(
new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0), new DefaultPieDataset(),
0, 1, "Key", "ToolTip", "URL"
);
StandardEntityCollection c2 = new StandardEntityCollection();
c2.addEntity(e2);
assertTrue(c1.equals(c2));
}
示例2: testEquals
import org.jfree.chart.entity.StandardEntityCollection; //导入依赖的package包/类
/**
* Confirm that the equals method can distinguish all the required fields.
*/
public void testEquals() {
StandardEntityCollection c1 = new StandardEntityCollection();
StandardEntityCollection c2 = new StandardEntityCollection();
assertTrue(c1.equals(c2));
PieSectionEntity e1 = new PieSectionEntity(new Rectangle2D.Double(1.0,
2.0, 3.0, 4.0), new DefaultPieDataset(), 0, 1, "Key",
"ToolTip", "URL");
c1.add(e1);
assertFalse(c1.equals(c2));
PieSectionEntity e2 = new PieSectionEntity(new Rectangle2D.Double(1.0,
2.0, 3.0, 4.0), new DefaultPieDataset(), 0, 1, "Key",
"ToolTip", "URL");
c2.add(e2);
assertTrue(c1.equals(c2));
}
示例3: testEquals
import org.jfree.chart.entity.StandardEntityCollection; //导入依赖的package包/类
/**
* Confirm that the equals method can distinguish all the required fields.
*/
public void testEquals() {
ChartRenderingInfo i1 = new ChartRenderingInfo();
ChartRenderingInfo i2 = new ChartRenderingInfo();
assertTrue(i1.equals(i2));
i1.setChartArea(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0));
assertFalse(i1.equals(i2));
i2.setChartArea(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0));
assertTrue(i1.equals(i2));
i1.getPlotInfo().setDataArea(new Rectangle(1, 2, 3, 4));
assertFalse(i1.equals(i2));
i2.getPlotInfo().setDataArea(new Rectangle(1, 2, 3, 4));
assertTrue(i1.equals(i2));
StandardEntityCollection e1 = new StandardEntityCollection();
e1.add(new ChartEntity(new Rectangle(1, 2, 3, 4)));
i1.setEntityCollection(e1);
assertFalse(i1.equals(i2));
StandardEntityCollection e2 = new StandardEntityCollection();
e2.add(new ChartEntity(new Rectangle(1, 2, 3, 4)));
i2.setEntityCollection(e2);
}
示例4: testEquals
import org.jfree.chart.entity.StandardEntityCollection; //导入依赖的package包/类
/**
* Confirm that the equals method can distinguish all the required fields.
*/
@Test
public void testEquals() {
ChartRenderingInfo i1 = new ChartRenderingInfo();
ChartRenderingInfo i2 = new ChartRenderingInfo();
assertEquals(i1, i2);
i1.setChartArea(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0));
assertFalse(i1.equals(i2));
i2.setChartArea(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0));
assertEquals(i1, i2);
i1.getPlotInfo().setDataArea(new Rectangle(1, 2, 3, 4));
assertFalse(i1.equals(i2));
i2.getPlotInfo().setDataArea(new Rectangle(1, 2, 3, 4));
assertEquals(i1, i2);
StandardEntityCollection e1 = new StandardEntityCollection();
e1.add(new ChartEntity(new Rectangle(1, 2, 3, 4)));
i1.setEntityCollection(e1);
assertFalse(i1.equals(i2));
StandardEntityCollection e2 = new StandardEntityCollection();
e2.add(new ChartEntity(new Rectangle(1, 2, 3, 4)));
i2.setEntityCollection(e2);
}
示例5: testEquals
import org.jfree.chart.entity.StandardEntityCollection; //导入依赖的package包/类
/**
* Confirm that the equals method can distinguish all the required fields.
*/
public void testEquals() {
StandardEntityCollection c1 = new StandardEntityCollection();
StandardEntityCollection c2 = new StandardEntityCollection();
assertTrue(c1.equals(c2));
PieSectionEntity e1 = new PieSectionEntity(new Rectangle2D.Double(1.0,
2.0, 3.0, 4.0), new DefaultPieDataset(), 0, 1, "Key",
"ToolTip", "URL");
c1.add(e1);
assertFalse(c1.equals(c2));
PieSectionEntity e2 = new PieSectionEntity(new Rectangle2D.Double(1.0,
2.0, 3.0, 4.0), new DefaultPieDataset(), 0, 1, "Key",
"ToolTip", "URL");
c2.add(e2);
assertTrue(c1.equals(c2));
}
示例6: testEquals
import org.jfree.chart.entity.StandardEntityCollection; //导入依赖的package包/类
/**
* Confirm that the equals method can distinguish all the required fields.
*/
public void testEquals() {
ChartRenderingInfo i1 = new ChartRenderingInfo();
ChartRenderingInfo i2 = new ChartRenderingInfo();
assertTrue(i1.equals(i2));
i1.setChartArea(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0));
assertFalse(i1.equals(i2));
i2.setChartArea(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0));
assertTrue(i1.equals(i2));
i1.getPlotInfo().setDataArea(new Rectangle(1, 2, 3, 4));
assertFalse(i1.equals(i2));
i2.getPlotInfo().setDataArea(new Rectangle(1, 2, 3, 4));
assertTrue(i1.equals(i2));
StandardEntityCollection e1 = new StandardEntityCollection();
e1.add(new ChartEntity(new Rectangle(1, 2, 3, 4)));
i1.setEntityCollection(e1);
assertFalse(i1.equals(i2));
StandardEntityCollection e2 = new StandardEntityCollection();
e2.add(new ChartEntity(new Rectangle(1, 2, 3, 4)));
i2.setEntityCollection(e2);
}
示例7: producePresentation
import org.jfree.chart.entity.StandardEntityCollection; //导入依赖的package包/类
@Override
public RepresentationResponse producePresentation(DesignOptions options) throws GeneratorException {
ChartRenderingInfo renderingInfo = new ChartRenderingInfo(new StandardEntityCollection());
String chartUrl = createChart(options, renderingInfo);
Rectangle2D plotArea = renderingInfo.getPlotInfo().getDataArea();
for (Axis axis : renderer.getAxisMapping().values()) {
axis.setMaxY(plotArea.getMaxY());
axis.setMinY(plotArea.getMinY());
}
ImageEntity[] entities = {};
if (!this.isOverview) {
LOGGER.debug("Produced EES diagram " + chartUrl);
entities = createImageEntities(renderingInfo.getEntityCollection());
} else {
LOGGER.debug("Produced EES Overview diagram " + chartUrl);
}
Bounds chartArea = new Bounds(plotArea.getMinX(), plotArea.getMaxX(), plotArea.getMinY(), plotArea.getMaxY());
return new EESDataResponse(chartUrl, options, chartArea, entities, renderer.getAxisMapping());
}
示例8: createChart
import org.jfree.chart.entity.StandardEntityCollection; //导入依赖的package包/类
/**
* Creates a chart for recent time to fix.
*
*/
public void createChart(final SortedMap time, final String valueKey, final Color lineColor, final OutputStream out) throws IOException {
final DefaultCategoryDataset dataset = new DefaultCategoryDataset();
addTimeToDataSet(dataset, time, valueKey);
// create the chart object
// This generates a stacked bar - more suitable
final JFreeChart chart = ChartFactory.createLineChart(null,
"Recent builds", "Time", dataset,
PlotOrientation.VERTICAL,
true, false, false);
chart.setBackgroundPaint(Color.white);
// change the auto tick unit selection to integer units only
final CategoryPlot plot = chart.getCategoryPlot();
final NumberAxis rangeAxis = (NumberAxis)plot.getRangeAxis();
rangeAxis.setStandardTickUnits(StatisticsUtils.createWordedTimeTickUnits());
// rotate X dates
final CategoryAxis domainAxis = plot.getDomainAxis();
domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
// set bar colors
final LineAndShapeRenderer line = (LineAndShapeRenderer)plot.getRenderer();
line.setSeriesPaint(0, lineColor);
line.setStroke(StatisticsUtils.DEFAULT_LINE_STROKE);
// write to reposnce
final ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
ChartUtilities.writeChartAsPNG(out, chart, StatisticsUtils.IMG_WIDTH, StatisticsUtils.IMG_HEIGHT, info);
}
示例9: createChart
import org.jfree.chart.entity.StandardEntityCollection; //导入依赖的package包/类
public void createChart(final SortedMap stats, final OutputStream out) throws IOException {
final DefaultCategoryDataset dataset = new DefaultCategoryDataset();
for (final Iterator iter = stats.entrySet().iterator(); iter.hasNext();) {
final Map.Entry entry = (Map.Entry)iter.next();
final Integer buildNumber = (Integer)entry.getKey();
final Integer violations = (Integer)entry.getValue();
dataset.addValue(violations, categoryDescription, buildNumber);
}
// create the chart object
// This generates a stacked bar - more suitable
final JFreeChart chart = ChartFactory.createLineChart(null,
"Recent builds", valueAxisLabel, dataset,
PlotOrientation.VERTICAL,
true, false, false);
chart.setBackgroundPaint(Color.white);
// change the auto tick unit selection to integer units only
final CategoryPlot plot = chart.getCategoryPlot();
final NumberAxis rangeAxis = (NumberAxis)plot.getRangeAxis();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
// rotate X dates
final CategoryAxis domainAxis = plot.getDomainAxis();
domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
// set bar colors
final LineAndShapeRenderer line = (LineAndShapeRenderer)plot.getRenderer();
line.setSeriesPaint(0, Color.RED);
line.setStroke(StatisticsUtils.DEFAULT_LINE_STROKE);
// write to reposnce
final ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
ChartUtilities.writeChartAsPNG(out, chart, StatisticsUtils.IMG_WIDTH, StatisticsUtils.IMG_HEIGHT, info);
}
示例10: createTestsResultsChartHelper
import org.jfree.chart.entity.StandardEntityCollection; //导入依赖的package包/类
/**
*
*/
private static void createTestsResultsChartHelper(final String categoryLabel, final DefaultCategoryDataset dataset, final OutputStream out, final CategoryLabelPositions categoryLabelPosition) throws IOException {
final JFreeChart chart = ChartFactory.createStackedAreaChart(null,
categoryLabel, "Tests", dataset,
PlotOrientation.VERTICAL,
true, false, false);
chart.setBackgroundPaint(Color.white);
// change the auto tick unit selection to integer units only
final CategoryPlot plot = chart.getCategoryPlot();
final LogarithmicAxis logarithmicAxis = new LogarithmicAxis("Tests");
logarithmicAxis.setStrictValuesFlag(false);
logarithmicAxis.setAutoRangeIncludesZero(true);
logarithmicAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
plot.setRangeAxis(logarithmicAxis);
// final NumberAxis rangeAxis = (NumberAxis)plot.getRangeAxis();
// rotate X dates
final CategoryAxis domainAxis = plot.getDomainAxis();
domainAxis.setCategoryLabelPositions(categoryLabelPosition);
// set area colors
final StackedAreaRenderer area = (StackedAreaRenderer) plot.getRenderer();
area.setSeriesPaint(0, Color.RED); // first area
area.setSeriesPaint(1, Color.PINK); // second area
area.setSeriesPaint(2, Color.GREEN); // thirs area
//plot.setRenderer(area);
// write to reposnce
final ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
ChartUtilities.writeChartAsPNG(out, chart, IMG_WIDTH, IMG_HEIGHT, info);
}
示例11: createHourlyBreakageDistributionChart
import org.jfree.chart.entity.StandardEntityCollection; //导入依赖的package包/类
public static void createHourlyBreakageDistributionChart(final SortedMap stats, final String categoryLabel, final OutputStream out) throws IOException {
final DefaultCategoryDataset dataset = new DefaultCategoryDataset();
for (final Iterator iter = stats.entrySet().iterator(); iter.hasNext();) {
final Map.Entry entry = (Map.Entry) iter.next();
final Integer hour = (Integer) entry.getKey();
final BuildStatistics bst = (BuildStatistics) entry.getValue();
dataset.addValue(new Integer(bst.getFailedBuilds()), "Failed builds", hour);
}
// create the chart object
// This generates a stacked bar - more suitable
final JFreeChart chart = ChartFactory.createStackedBarChart(null,
categoryLabel, "Builds", dataset,
PlotOrientation.VERTICAL,
true, false, false);
chart.setBackgroundPaint(Color.white);
// change the auto tick unit selection to integer units only
final CategoryPlot plot = chart.getCategoryPlot();
final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
// set bar colors
final BarRenderer bar = (BarRenderer) plot.getRenderer();
bar.setItemMargin(0); // reduce the width between the bars.
bar.setSeriesPaint(0, Color.RED); // first bar
// write to reposnce
final ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
ChartUtilities.writeChartAsPNG(out, chart, IMG_WIDTH, IMG_HEIGHT, info);
}
示例12: createRecentBuildTimesChart
import org.jfree.chart.entity.StandardEntityCollection; //导入依赖的package包/类
public static void createRecentBuildTimesChart(final SortedMap stats, final String categoryLabel, final OutputStream out) throws IOException {
final DefaultCategoryDataset dataset = new DefaultCategoryDataset();
for (final Iterator iter = stats.entrySet().iterator(); iter.hasNext();) {
final Map.Entry entry = (Map.Entry) iter.next();
final Integer buildNumber = (Integer) entry.getKey();
final Integer timeInSeconds = (Integer) entry.getValue();
dataset.addValue(timeInSeconds, "Build time", buildNumber);
}
// create the chart object
// This generates a stacked bar - more suitable
final JFreeChart chart = ChartFactory.createLineChart(null,
categoryLabel, "Build time", dataset,
PlotOrientation.VERTICAL,
true, false, false);
chart.setBackgroundPaint(Color.white);
// change the auto tick unit selection to integer units only
final CategoryPlot plot = chart.getCategoryPlot();
final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
rangeAxis.setStandardTickUnits(createWordedTimeTickUnits());
// rotate X dates
final CategoryAxis domainAxis = plot.getDomainAxis();
domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
// set bar colors
final LineAndShapeRenderer line = (LineAndShapeRenderer) plot.getRenderer();
line.setSeriesPaint(0, Color.BLUE);
line.setStroke(DEFAULT_LINE_STROKE);
// write to reposnce
final ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
ChartUtilities.writeChartAsPNG(out, chart, IMG_WIDTH, IMG_HEIGHT, info);
}
示例13: createDayOfWeekBreakageDistributionChart
import org.jfree.chart.entity.StandardEntityCollection; //导入依赖的package包/类
public static void createDayOfWeekBreakageDistributionChart(final SortedMap stats, final String categoryLabel, final OutputStream out) throws IOException {
final DefaultCategoryDataset dataset = new DefaultCategoryDataset();
for (final Iterator iter = stats.entrySet().iterator(); iter.hasNext();) {
final Map.Entry entry = (Map.Entry) iter.next();
final Integer dayOfWeek = (Integer) entry.getKey();
final BuildStatistics bst = (BuildStatistics) entry.getValue();
dataset.addValue(new Integer(bst.getFailedBuilds()), "Failed builds", new ComparableDayOfWeek(dayOfWeek));
}
// create the chart object
// This generates a stacked bar - more suitable
final JFreeChart chart = ChartFactory.createStackedBarChart(null,
categoryLabel, "Builds", dataset,
PlotOrientation.VERTICAL,
true, false, false);
chart.setBackgroundPaint(Color.white);
// change the auto tick unit selection to integer units only
final CategoryPlot plot = chart.getCategoryPlot();
final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
// set bar colors
final BarRenderer bar = (BarRenderer) plot.getRenderer();
bar.setItemMargin(0); // reduce the width between the bars.
bar.setSeriesPaint(0, Color.RED); // first bar
// write to reposnce
final ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
ChartUtilities.writeChartAsPNG(out, chart, IMG_WIDTH, IMG_HEIGHT, info);
}
示例14: createChartOutput
import org.jfree.chart.entity.StandardEntityCollection; //导入依赖的package包/类
private ChartEngineOutput createChartOutput(ReportChart reportChart, ChartValue[] values, boolean displayInline, Map parameters)
{
JFreeChart chart = null;
if (reportChart.getOverlayChart() != null)
{
chart = createOverlayChart(reportChart, values, displayInline, parameters);
}
else
{
chart = createChart(reportChart, values, displayInline);
}
if (chart == null) return null;
chart.setBackgroundPaint(Color.WHITE);
ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
BufferedImage bufferedImage = chart.createBufferedImage(reportChart.getWidth(), reportChart.getHeight(),info);
byte[] image = null;
try
{
image = EncoderUtil.encode(bufferedImage, ImageFormat.PNG);
}
catch(IOException ioe)
{
log.warn(ioe);
}
ChartEngineOutput chartOutput = new ChartEngineOutput();
chartOutput.setContent(image);
chartOutput.setContentType(ReportEngineOutput.CONTENT_TYPE_JPEG);
chartOutput.setChartRenderingInfo(info);
chartOutput.setChartValues(values);
return chartOutput;
}
示例15: createHistogram
import org.jfree.chart.entity.StandardEntityCollection; //导入依赖的package包/类
private ChartRenderingInfo createHistogram(int x, int y, XIntervalSeriesCollection dataset, String metricName, String chartPath, ServletContext sc) {
try {
JFreeChart chart = ChartFactory.createXYBarChart(metricName + " Histogram", "Value", false, "Number", dataset, PlotOrientation.VERTICAL, false, true, false);
File chartFile = new File(sc.getRealPath(chartPath));
ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
ChartUtilities.saveChartAsPNG(chartFile, chart, x, y, info);
return info;
} catch (Exception e) {
return null;
}
}