/** * 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)); }
/** * 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)); }
/** * 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); }
/** * 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); }
@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()); }
/** * 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); }
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); }
/** * */ 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); }
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); }
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); }
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); }
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; }
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; } }
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); } }
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); } }
/** * Creates a distribution image for build results. * * @param stats SortedMap with dates as keys and * BuildStatistics as value. * @param categoryLabel - label to place on X axis. * @param out OutputStream to write image to. */ public static void createBuildResultsBarChart(final SortedMap stats, final String categoryLabel, final String dateFormat, 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 Date date = (Date) entry.getKey(); final BuildStatistics bst = (BuildStatistics) entry.getValue(); final String dateAsString = StringUtils.formatDate(date, dateFormat); dataset.addValue(new Integer(bst.getFailedBuilds()), "Failed builds", dateAsString); dataset.addValue(new Integer(bst.getSuccessfulBuilds()), "Successful builds", dateAsString); } // 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()); // rotate X dates final CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45); // 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 bar.setSeriesPaint(1, Color.GREEN); // second bar //plot.setRenderer(bar); // write to reposnce final ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection()); ChartUtilities.writeChartAsPNG(out, chart, IMG_WIDTH, IMG_HEIGHT, info); }
/** * Creates a distribution image for build results. * * @param stats SortedMap with dates as keys and * BuildStatistics as value. * @param categoryLabel - label to place on X axis. * @param out OutputStream to write image to. */ public static void createChangeListsBarChart(final SortedMap stats, final String categoryLabel, final String dateFormat, 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 Date date = (Date) entry.getKey(); final BuildStatistics bst = (BuildStatistics) entry.getValue(); final String dateAsString = StringUtils.formatDate(date, dateFormat); dataset.addValue(new Integer(bst.getChangeLists()), "Change lists", dateAsString); } // create the chart object // This generates a stacked bar - more suitable final JFreeChart chart = ChartFactory.createStackedBarChart(null, categoryLabel, "Change lists", 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 BarRenderer bar = (BarRenderer) plot.getRenderer(); bar.setItemMargin(0); // reduce the width between the bars. bar.setSeriesPaint(0, Color.BLUE); // first bar //bar.setSeriesPaint(1, Color.GREEN); // second bar // write to reposnce final ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection()); ChartUtilities.writeChartAsPNG(out, chart, IMG_WIDTH, IMG_HEIGHT, info); }
public ImmutableImage generate(final List samples) { try { final DefaultCategoryDataset dataset = new DefaultCategoryDataset(); for (int i = 0; i < samples.size(); i++) { final AgentStatusSample sample = (AgentStatusSample) samples.get(i); dataset.addValue(sample.getBusyCounter(), "Load", new ColumnKey(i)); } final JFreeChart chart = ChartFactory.createLineChart(null, "Last 24 Hours", "Builds", dataset, PlotOrientation.VERTICAL, false, 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.BLUE); line.setStroke(StatisticsUtils.DEFAULT_LINE_STROKE); // Write to byte array final ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection()); final ByteArrayOutputStream out = new ByteArrayOutputStream(1000); ChartUtilities.writeChartAsPNG(out, chart, width, height, info); out.flush(); out.close(); // Return result return new ImmutableImage(out.toByteArray(), width, height); } catch (IOException e) { final ErrorManager errorManager = ErrorManagerFactory.getErrorManager(); final Error error = new Error("Error generating agent status chart: " + StringUtils.toString(e), e); errorManager.reportSystemError(error); return ImmutableImage.ZERO_SIZE_IMAGE; } }
@GET @Path("/charts") @Produces("image/png") @ApiOperation(value = "", notes = "") @ApiResponses(value = { @ApiResponse(code = 500, message = "Internal Server Error") }) public Response doGetChart(@Context HttpSession session) throws IOException { DefaultPieDataset dataset = new DefaultPieDataset(); dataset.setValue("Linux", 29); dataset.setValue("Mac", 20); dataset.setValue("Windows", 51); JFreeChart chart = ChartFactory.createPieChart3D("hello world", // chart title dataset, // data true, // include legend true, false); PiePlot3D plot = (PiePlot3D) chart.getPlot(); plot.setStartAngle(290); plot.setDirection(Rotation.CLOCKWISE); plot.setForegroundAlpha(0.5f); // Write the chart image to the temporary directory ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection()); String filename = ServletUtilities.saveChartAsPNG(chart, 500, 300, info, session); byte[] imageData = FileUtils.readFileToByteArray(new File("/tmp/" + filename)); //BufferedImage image = ...; /*ByteArrayOutputStream baos = new ByteArrayOutputStream(); ImageIO.write(image, "png", baos); byte[] imageData = baos.toByteArray();*/ // uncomment line below to send non-streamed // return Response.ok(imageData).build(); // uncomment line below to send streamed return Response.ok(new ByteArrayInputStream(imageData)).build(); }
private ChartRenderingInfo createChart(int x, int y, XYSeriesCollection dataset, String metricName, String chartPath, ServletContext sc) { try { final String xAxisLabel = (USE_RELATIVE_COMMIT_DATE ? "Development Time (min)" : "Number of commit"); JFreeChart chart = ChartFactory.createXYLineChart(metricName, xAxisLabel, "Value", dataset, PlotOrientation.VERTICAL, false, true, false); XYPlot plot = chart.getXYPlot(); plot.getRenderer().setSeriesPaint(0, Color.BLUE); plot.getRenderer().setSeriesPaint(1, Color.GREEN); plot.getRenderer().setSeriesPaint(2, Color.YELLOW); plot.getRenderer().setSeriesPaint(3, Color.YELLOW); plot.getRenderer().setSeriesPaint(4, Color.RED); plot.getRenderer().setSeriesPaint(5, Color.RED); Double minY = null; Double maxY = null; // System.out.println("minY = " + minY); // System.out.println("maxY = " + maxY); for (Object object : dataset.getSeries()) { XYSeries series = (XYSeries) object; if (minY == null || series.getMinY() < minY) { minY = series.getMinY(); // System.out.println("minY = " + minY); } if (maxY == null || series.getMaxY() > maxY) { // System.out.println("maxY = " + maxY); maxY = series.getMaxY(); } } // System.out.println("minY = " + minY); // System.out.println("maxY = " + maxY); if (minY != null && maxY != null) { minY -= minY * 0.1; maxY += maxY * 0.1; plot.getRangeAxis().setRange(minY, maxY); } // System.out.println("sc.getRealPath() = " + sc.getRealPath("")); File chartFile = new File(sc.getRealPath(chartPath)); ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection()); ChartUtilities.saveChartAsPNG(chartFile, chart, x, y, info); //chartImage = new DefaultStreamedContent(new FileInputStream(chartFile), "image/png"); // System.out.println("chartFile.getAbsolutePath() = " + chartFile.getAbsolutePath()); return info; } catch (IOException ex) { ex.printStackTrace(); } return null; }
/** * Return rendering information for the chart. */ public static final ChartRenderingInfo getMetricRenderingInfo() { return new ChartRenderingInfo(new StandardEntityCollection()); }
/** * Return rendering information for the chart. */ public static final ChartRenderingInfo getAverageMetricRenderingInfo() { return new ChartRenderingInfo(new StandardEntityCollection()); }
/** * Return rendering information for the chart. */ public static final ChartRenderingInfo getTestCountRenderingInfo() { return new ChartRenderingInfo(new StandardEntityCollection()); }
/** * Return rendering information for the chart. */ public static final ChartRenderingInfo getAverageTestCountRenderingInfo() { return new ChartRenderingInfo(new StandardEntityCollection()); }
/** * Return rendering information for the chart. */ public static final ChartRenderingInfo getAreaTestCountRenderingInfo() { return new ChartRenderingInfo(new StandardEntityCollection()); }
/** * Return rendering information for the chart. */ public static final ChartRenderingInfo getAverageAreaTestCountRenderingInfo() { return new ChartRenderingInfo(new StandardEntityCollection()); }
/** * Return rendering information for the chart. */ public static final ChartRenderingInfo getAreaTestTimeRenderingInfo() { return new ChartRenderingInfo(new StandardEntityCollection()); }
/** * Return rendering information for the chart. */ public static final ChartRenderingInfo getAverageAreaTestTimeRenderingInfo() { return new ChartRenderingInfo(new StandardEntityCollection()); }