Java源码示例:org.jfree.chart.entity.StandardEntityCollection
示例1
/**
* 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);
}
示例2
/**
* 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);
}
示例3
/**
* 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);
}
示例4
/**
* 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
/**
* 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
/**
* 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
/**
* 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));
}
示例8
/**
* 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);
}
示例9
/**
* 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);
}
示例10
@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());
}
示例11
private ImageDataResult performChartRendering(DesignOptions options) {
try {
EESGenerator chartGenerator = new EESGenerator();
ChartRenderingInfo renderingInfo = new ChartRenderingInfo(new StandardEntityCollection());
String chartUrl = chartGenerator.createChart(options, renderingInfo);
return new ImageDataResult(chartUrl);
}
catch (Exception e) {
LOGGER.error("Could not render time series chart.", e);
throw new InternalServerException("internal error!", e);
}
}
示例12
private void performChartRendering(DesignOptions options, OutputStream outputStream) {
try {
EESGenerator chartGenerator = new EESGenerator();
ChartRenderingInfo renderingInfo = new ChartRenderingInfo(new StandardEntityCollection());
chartGenerator.createChartToOutputStream(options, renderingInfo, outputStream);
}
catch (Exception e) {
LOGGER.error("Could not render timeseries chart.", e);
throw new InternalServerException("internal error!", e);
}
}
示例13
private void displayReportChartWithImageMap(
Map<String, Object> root,
int numberOfColumns,
int averageLengthPrLegend,
List<String> aggregation,
HttpSession session) {
StringWriter stringWriter = new StringWriter();
PrintWriter writer = new PrintWriter(stringWriter);
boolean shouldZoom = true;
switch (reportType) {
case JOB:
case UNIT:
shouldZoom = false;
break;
default:
break;
}
String clickablePointUrl = "";
if (shouldZoom || periodType.getSelected().isLongerThan(PeriodType.HOUR)) {
clickablePointUrl =
generateClickablePointUrl(
periodType.getSelected(),
reportType.getName(),
method.getSelected(),
optionalmethod.getSelected());
}
XYPlot plot = (XYPlot) chart.getPlot();
XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
XYURLGenerator urls = new ReportURLGenerator(clickablePointUrl, chart, aggregation);
renderer.setURLGenerator(urls);
XYSeriesLabelGenerator slg =
new CustomXYSeriesLabelGenerator("javascript:xAPS.report.updateReport(%d);");
renderer.setLegendItemURLGenerator(slg);
renderer.setDefaultShapesVisible(true);
renderer.setDrawOutlines(true);
renderer.setUseFillPaint(true);
renderer.setDefaultFillPaint(Color.white);
try {
ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
ByteArrayOutputStream image = new ByteArrayOutputStream();
int chartWidth = 700 + 10 * averageLengthPrLegend * numberOfColumns + 35 * numberOfColumns;
ChartUtils.writeChartAsPNG(image, chart, chartWidth, 400, info);
session.setAttribute("JFreeChartPNG" + reportType.getName(), image.toByteArray());
ImageMapUtils.writeImageMap(
writer,
"chart" + reportType.getName(),
info,
arg0 -> " title=\"" + arg0 + "\" alt=\"" + arg0 + "\"",
arg0 -> " href=\"" + arg0 + "\"");
writer.println(
"<img src=\""
+ Page.REPORT.getUrl()
+ "&type="
+ reportType.getName()
+ "&image=true&d="
+ new Date().getTime()
+ "\" border=\"0\" usemap=\"#chart"
+ reportType.getName()
+ "\" id=\"ImageMapImg\" alt=\"ReportImage\"/>");
writer.close();
root.put("imagemap", stringWriter.toString());
} catch (IOException e) {
e.printStackTrace();
}
}
示例14
private String createXYLineChart(HttpSession session, String title,
String xtitle, String ytitle, int width, int height, String useMap,
PrintWriter pw) {
XYDataset xydataset = getXYDataset();
String filename = "";
JFreeChart chart = ChartFactory.createXYLineChart(title, xtitle,
ytitle, xydataset, PlotOrientation.VERTICAL, true, true, true);
chart.setTitle(new TextTitle(title, new Font("Calibri",
Font.ITALIC, 12)));
chart.getTitle().setFont(new Font("Calibri", Font.PLAIN, 12));
chart.setBackgroundPaint(Color.white);
/*
final XYPlot xyplot = (XYPlot) jfreechart.getPlot();
xyplot.setBackgroundPaint(Color.lightGray);
xyplot.setDomainGridlinePaint(Color.white);
xyplot.setDomainGridlinesVisible(true);
xyplot.setRangeGridlinePaint(Color.white);
xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));
final ValueAxis categoryAxis = xyplot.getDomainAxis();
// categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
categoryAxis.setLabelFont(new Font("Calibri", Font.TYPE1_FONT, 12));
categoryAxis.setTickLabelFont(new Font("Calibri", Font.TYPE1_FONT, 12));
NumberAxis numberAxis = (NumberAxis) xyplot.getRangeAxis();
numberAxis.setLabelFont(new Font("Calibri", Font.TYPE1_FONT, 12));
numberAxis.setTickLabelFont(new Font("Calibri", Font.TYPE1_FONT, 12));
numberAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
numberAxis.setAutoRangeIncludesZero(true);
XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyplot
.getRenderer();
xylineandshaperenderer.setShapesVisible(true);
xylineandshaperenderer.setShapesFilled(true);
xylineandshaperenderer.setSeriesLinesVisible(0, false);
xylineandshaperenderer.setSeriesShapesVisible(1, false);
xyplot.setRenderer(xylineandshaperenderer);
xylineandshaperenderer.setSeriesStroke(0, new BasicStroke(2.0F, 1, 1,
1.0F, new float[] { 10F, 6F }, 0.0F));
xylineandshaperenderer.setSeriesStroke(1, new BasicStroke(2.0F, 1, 1,
1.0F, new float[] { 6F, 6F }, 0.0F));
xylineandshaperenderer.setSeriesStroke(2, new BasicStroke(2.0F, 1, 1,
1.0F, new float[] { 2.0F, 6F }, 0.0F));
xylineandshaperenderer
.setBaseItemLabelGenerator(new IntervalXYItemLabelGenerator(
"({1},{2})", NumberFormat.getNumberInstance(),
NumberFormat.getNumberInstance()));
xylineandshaperenderer.setURLGenerator(new StandardXYURLGenerator(
"/hrms/admin_charts", "seriesName", "itemName"));
xylineandshaperenderer.setLegendTextFont(0, new Font("Calibri",
Font.TYPE1_FONT, 12));
xylineandshaperenderer.setLegendTextFont(1, new Font("Calibri",
Font.TYPE1_FONT, 12));
xylineandshaperenderer.setLegendTextFont(2, new Font("Calibri",
Font.TYPE1_FONT, 12));
*/
final XYPlot plot = chart.getXYPlot( );
XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer( );
renderer.setSeriesPaint( 0 , Color.RED );
renderer.setSeriesPaint( 1 , Color.GREEN );
renderer.setSeriesPaint( 2 , Color.YELLOW );
renderer.setSeriesStroke( 0 , new BasicStroke( 4.0f ) );
renderer.setSeriesStroke( 1 , new BasicStroke( 3.0f ) );
renderer.setSeriesStroke( 2 , new BasicStroke( 2.0f ) );
plot.setRenderer( renderer );
ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
try {
filename = ServletUtilities.saveChartAsPNG(chart, width,
height, info, session);
ChartUtilities.writeImageMap(pw, useMap, info, false);
pw.flush();
} catch (IOException e) {
e.printStackTrace();
}
return filename;
}
示例15
/**
* Constructs a new ChartRenderingInfo structure that can be used to
* collect information about the dimensions of a rendered chart.
*/
public ChartRenderingInfo() {
this(new StandardEntityCollection());
}
示例16
/**
* Constructs a new ChartRenderingInfo structure that can be used to
* collect information about the dimensions of a rendered chart.
*/
public ChartRenderingInfo() {
this(new StandardEntityCollection());
}
示例17
/**
* Constructs a new ChartRenderingInfo structure that can be used to
* collect information about the dimensions of a rendered chart.
*/
public ChartRenderingInfo() {
this(new StandardEntityCollection());
}
示例18
/**
* Constructs a new ChartRenderingInfo structure that can be used to
* collect information about the dimensions of a rendered chart.
*/
public ChartRenderingInfo() {
this(new StandardEntityCollection());
}
示例19
/**
* Constructs a new ChartRenderingInfo structure that can be used to
* collect information about the dimensions of a rendered chart.
*/
public ChartRenderingInfo() {
this(new StandardEntityCollection());
}
示例20
/**
* Constructs a new ChartRenderingInfo structure that can be used to
* collect information about the dimensions of a rendered chart.
*/
public ChartRenderingInfo() {
this(new StandardEntityCollection());
}
示例21
/**
* Constructs a new ChartRenderingInfo structure that can be used to
* collect information about the dimensions of a rendered chart.
*/
public ChartRenderingInfo() {
this(new StandardEntityCollection());
}
示例22
/**
* Constructs a new ChartRenderingInfo structure that can be used to
* collect information about the dimensions of a rendered chart.
*/
public ChartRenderingInfo() {
this(new StandardEntityCollection());
}
示例23
/**
* Constructs a new ChartRenderingInfo structure that can be used to
* collect information about the dimensions of a rendered chart.
*/
public ChartRenderingInfo() {
this(new StandardEntityCollection());
}