/** * Renders a clickable map. */ public void doMap(StaplerRequest req, StaplerResponse rsp) throws IOException { if (req.checkIfModified(timestamp, rsp)) return; ChartRenderingInfo info = new ChartRenderingInfo(); render(req,info); rsp.setContentType("text/plain;charset=UTF-8"); rsp.getWriter().println(ChartUtilities.getImageMap( "map", info )); } }
public JFreeChartInstance(JFreeChart chart, File file, String mapId, String alt, int width, int height, String chartUrl) throws IOException { this.chart = chart; this.file = file; this.mapId = mapId; this.alt = alt; this.width = width; this.height = height; this.chartUrl = chartUrl; renderingInfo = new ChartRenderingInfo(); ChartUtilities.saveChartAsPNG(file, chart, width, height, renderingInfo); }
/** * Create an image file using dataset object. This method takes a dataset object, e.g. a DialWidgetDefinition, * creates a JFreeChart object from it, and then creates an image file. * * @param dataset * The * @param title * The title of the chart * @param units * The units of the chart value * @param fileName * The path and file of the image to create * @param width * The width of the image to create * @param height * The height of the image to create * @param outputType * The type of the image to create * @param writer * A writer to writer the image map into * @param logger * The logger to log any messages to */ public static void saveChart( final Dataset dataset, final String title, final String units, final String fileName, final int width, final int height, final int outputType, final PrintWriter writer, final ILogger logger ) { ChartRenderingInfo info = new ChartRenderingInfo(); JFreeChartEngine.saveChart( dataset, title, units, fileName, width, height, outputType, writer, info, logger ); }
public void generate(int width, int height) throws IOException, AlreadyGeneratedException { if (!generated) { renderingInfo = new ChartRenderingInfo(); // NOTE: the chart will be deleted directly after it is streamed once. location = ServletUtilities.saveChartAsPNG(chart, width, height, renderingInfo, null); generated = true; } else { throw new AlreadyGeneratedException(); } }
/** * Generates chart "into the memory" which can be later retrieved via {@link #getImage()} method. */ public void generateInline(int width, int height) throws IOException { if (log.isDebugEnabled()) { log.debug("ChartHelper.generate() Create a ChartRenderingInfo."); } renderingInfo = new ChartRenderingInfo(); // Profile the call to JFreeChart final String logLine = "ChartHelper calling JFreeChart: JFreeChart.createBufferedImage()"; UtilTimerStack.push(logLine); try { log.debug("ChartHelper.generateInline(): Use JFreeChart to create PNG file."); image = createChartImageInline(chart, width, height, renderingInfo); log.debug("ChartHelper.generateInline(): PNG file created ."); } finally { UtilTimerStack.pop(logLine); } }
/** * @deprecated JRA-21854 images should be rendered using data uri. * Please use {@link #generateInline(int, int)} * * @see #getImage() */ @Deprecated public void generate(int width, int height) throws IOException { if (log.isDebugEnabled()) { log.debug("ChartHelper.generate() Create a ChartRenderingInfo."); } renderingInfo = new ChartRenderingInfo(); // Profile the call to JFreeChart final String logLine = "ChartHelper calling JFreeChart: ServletUtilities.saveChartAsPNG()"; UtilTimerStack.push(logLine); try { log.debug("ChartHelper.generate(): Use JFreeChart to create PNG file."); location = createChartImage(chart, width, height, renderingInfo); // JRA-34911: this change is causing undesired side effects. disabling for now. // markAsTemporaryFile(location); log.debug("ChartHelper.generate(): PNG file created in '" + location + "'."); } finally { UtilTimerStack.pop(logLine); } }
JFreeChart chart = functionWhichRetrievesTheChart(); ChartRenderingInfo info = new ChartRenderingInfo(); // PLOT_SIZE is the size if the graph and has to be the same size as the original drawn chart.createBufferedImage(PLOT_SIZE, PLOT_SIZE, info); graph, otherwise the pixel position points to somewhere else PlotRenderingInfo plotInfo = info.getPlotInfo(); XYPlot plot = (XYPlot)chart.getPlot(); Point p = new Point(x,y); // x and y are the pixel positions // this is the domain value which belongs to the pixel position x double domain = plot.getDomainAxis().java2DToValue(p.getX(), plotInfo.getDataArea(), plot.getDomainAxisEdge()); // this is the range value which belongs to the pixel position y double range = plot.getRangeAxis().java2DToValue(p.getY(), plotInfo.getDataArea(), plot.getRangeAxisEdge());
final ChartRenderingInfo renderingInfo = new ChartRenderingInfo(); outputDevice.drawWithGraphics((float) x, (float) y, (float) width / dotsPerPixel, (float) height / dotsPerPixel, new OutputDeviceGraphicsDrawer() {
final ChartRenderingInfo renderingInfo = new ChartRenderingInfo(); outputDevice.drawWithGraphics((float) x, (float) y, (float) width / dotsPerPixel, (float) height / dotsPerPixel, new OutputDeviceGraphicsDrawer() {
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 InternalServiceException(); } }
/** * Renders a clickable map. */ public void doMap(StaplerRequest req, StaplerResponse rsp) throws IOException { if (req.checkIfModified(timestamp, rsp)) return; ChartRenderingInfo info = new ChartRenderingInfo(); render(req,info); rsp.setContentType("text/plain;charset=UTF-8"); rsp.getWriter().println(ChartUtilities.getImageMap( "map", info )); } }
public static String renderChart(JFreeChart chart, String fileName) { String imageFile = ""; try { final ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection()); TempDir tempDir = TempDirUtils.createTempDir(); File file1 = tempDir.createFile(fileName); imageFile = "<IMG SRC=\"file:" + file1.getAbsolutePath() + "\" " + "WIDTH=\"600\" HEIGHT=\"400\" BORDER=\"0\" USEMAP=\"#chart\"></IMG>"; ChartUtilities.saveChartAsPNG(file1, chart, 600, 400, info); } catch (IOException e) { } return imageFile; }
/** * Renders a clickable map. */ public void doMap(StaplerRequest req, StaplerResponse rsp) throws IOException { if (req.checkIfModified(timestamp, rsp)) return; String w = req.getParameter("width"); if(w==null) w=String.valueOf(defaultW); String h = req.getParameter("height"); if(h==null) h=String.valueOf(defaultH); ChartRenderingInfo info = new ChartRenderingInfo(); render(req,info); rsp.setContentType("text/plain;charset=UTF-8"); rsp.getWriter().println(ChartUtilities.getImageMap( "map", info )); } }
/** * Renders a clickable map. */ public void doMap(StaplerRequest req, StaplerResponse rsp) throws IOException { if (req.checkIfModified(timestamp, rsp)) return; String w = req.getParameter("width"); if(w==null) w=String.valueOf(defaultW); String h = req.getParameter("height"); if(h==null) h=String.valueOf(defaultH); ChartRenderingInfo info = new ChartRenderingInfo(); render(req,info); rsp.setContentType("text/plain;charset=UTF-8"); rsp.getWriter().println(ChartUtilities.getImageMap( "map", info )); } }
/** * Renders a clickable map. */ public void doMap(StaplerRequest req, StaplerResponse rsp) throws IOException { if (req.checkIfModified(timestamp, rsp)) return; String w = req.getParameter("width"); if(w==null) w=String.valueOf(defaultW); String h = req.getParameter("height"); if(h==null) h=String.valueOf(defaultH); ChartRenderingInfo info = new ChartRenderingInfo(); render(req,info); rsp.setContentType("text/plain;charset=UTF-8"); rsp.getWriter().println(ChartUtilities.getImageMap( "map", info )); } }
@Override public RepresentationResponse producePresentation(DesignOptions options) throws Exception { 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()); }
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 InternalServiceException(); } }
ChartRenderingInfo renderingInfo = new ChartRenderingInfo();
ChartRenderingInfo info = null; if(showToolTips() || showUrls()) { info = new ChartRenderingInfo(new StandardEntityCollection());
/** * Generates and writes the plot's clickable map to the response output * stream. * * @param req the incoming request * @param rsp the response stream * @throws IOException */ public void plotGraphMap(StaplerRequest req, StaplerResponse rsp) throws IOException { if (ChartUtil.awtProblemCause != null) { // not available. send out error message rsp.sendRedirect2(req.getContextPath() + "/images/headless.png"); return; } setWidth(req); setHeight(req); setNumBuilds(req); setRightBuildNum(req); setHasLegend(req); setTitle(req); setStyle(req); setUseDescr(req); generatePlot(false); ChartRenderingInfo info = new ChartRenderingInfo(); plot.createBufferedImage(getWidth(), getHeight(), info); rsp.setContentType("text/plain;charset=UTF-8"); rsp.getWriter().println(ChartUtilities.getImageMap(getCsvFileName(), info)); }