JFreeChart chart = ChartFactory.createCandlestickChart(...); chart.setAntiAlias(false);
chart.setAntiAlias(true); chart.setBackgroundPaint(new Color(backgroundColor)); for (int i = 0; i < seriesMaxCount; i++) {
@OnAwt @Override public void setAntiAliasing(boolean antiAliasing) { chart.setAntiAlias(antiAliasing); }
/** * Returns a basic JFreeChart. */ private JFreeChart getBasicJFreeChart( CategoryPlot plot ) { JFreeChart jFreeChart = new JFreeChart( null, TITLE_FONT, plot, false ); jFreeChart.setBackgroundPaint( Color.WHITE ); jFreeChart.setAntiAlias( true ); return jFreeChart; }
public void generateDriverChart(String fileName) { try { JFreeChart chart = null; String chartType = _testSuite.getParam(Constants.CHART_TYPE); if (chartType.equalsIgnoreCase("barchart")) { chart = generateDriverBarChart(); } else if (chartType.equalsIgnoreCase("scatterchart")) { chart = generateDriverScatterChart(); } else if (chartType.equalsIgnoreCase("linechart")) { chart = generateDriverLineChart(); } else { assert false; } chart.setAntiAlias(true); ChartUtilities.saveChartAsJPEG(new File(fileName), chart, _chartWidth, _chartHeight); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } }
private BufferedImage createImage() { IoParameters parameters = getParameters(); int width = parameters.getWidth(); int height = parameters.getHeight(); BufferedImage chartImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); Graphics2D chartGraphics = chartImage.createGraphics(); chartGraphics.fillRect(0, 0, width, height); chartGraphics.setColor(Color.WHITE); jFreeChart.setTextAntiAlias(true); jFreeChart.setAntiAlias(true); if (jFreeChart.getLegend() != null) { jFreeChart.getLegend() .setFrame(BlockBorder.NONE); } jFreeChart.draw(chartGraphics, new Rectangle2D.Float(0, 0, width, height)); return chartImage; }
private void improveChart(JFreeChart jfrechart, ChartParameters params) { Color background = Color.decode("#" + params.getValue(ChartParameters.PARAM_BACKGROUND_COLOR, "FFFFFF", false)); jfrechart.setBackgroundPaint(background); jfrechart.setBorderVisible(false); jfrechart.setAntiAlias(true); jfrechart.setTextAntiAlias(true); jfrechart.removeLegend(); }
private BufferedImage drawChartToImage() { int width = getChartStyleDefinitions().getWidth(); int height = getChartStyleDefinitions().getHeight(); BufferedImage chartImage = new BufferedImage(width, height, TYPE_INT_RGB); Graphics2D chartGraphics = chartImage.createGraphics(); chartGraphics.fillRect(0, 0, width, height); chartGraphics.setColor(WHITE); chart.setTextAntiAlias(true); chart.setAntiAlias(true); if (chart.getLegend() != null) { chart.getLegend() .setFrame(BlockBorder.NONE); } chart.draw(chartGraphics, new Rectangle2D.Float(0, 0, width, height)); return chartImage; }
/** * Updates the properties of a chart to match the properties defined on the * panel. * * @param chart the chart. */ public void updateChart(JFreeChart chart) { this.titleEditor.setTitleProperties(chart); this.plotEditor.updatePlotProperties(chart.getPlot()); chart.setAntiAlias(getAntiAlias()); chart.setBackgroundPaint(getBackgroundPaint()); }
true, true, false); configureLineChart(chart); chart.setAntiAlias(true);
true, true, false); configureLineChart(chart); chart.setAntiAlias(true);
/** * Updates the properties of a chart to match the properties defined on the * panel. * * @param chart the chart. */ @Override public void updateChart(JFreeChart chart) { this.titleEditor.setTitleProperties(chart); this.plotEditor.updatePlotProperties(chart.getPlot()); chart.setAntiAlias(getAntiAlias()); chart.setBackgroundPaint(getBackgroundPaint()); }
chart.setAntiAlias(true); ChartUtilities.saveChartAsJPEG( new File(baseName + Integer.toString(nOfFiles) + extension),
String fontName = "Lucida Sans"; JFreeChart chart = ChartFactory.createBarChart(null, "", "", dataset, PlotOrientation.VERTICAL, false, true, false ); StandardChartTheme theme = (StandardChartTheme)org.jfree.chart.StandardChartTheme.createJFreeTheme(); theme.setTitlePaint( Color.decode( "#4572a7" ) ); theme.setExtraLargeFont( new Font(fontName,Font.PLAIN, 16) ); //title theme.setLargeFont( new Font(fontName,Font.BOLD, 15)); //axis-title theme.setRegularFont( new Font(fontName,Font.PLAIN, 11)); theme.setRangeGridlinePaint( Color.decode("#C0C0C0")); theme.setPlotBackgroundPaint( Color.white ); theme.setChartBackgroundPaint( Color.white ); theme.setGridBandPaint( Color.red ); theme.setAxisOffset( new RectangleInsets(0,0,0,0) ); theme.setBarPainter(new StandardBarPainter()); theme.setAxisLabelPaint( Color.decode("#666666") ); theme.apply( chart ); chart.getCategoryPlot().setOutlineVisible( false ); chart.getCategoryPlot().getRangeAxis().setAxisLineVisible( false ); chart.getCategoryPlot().getRangeAxis().setTickMarksVisible( false ); chart.getCategoryPlot().setRangeGridlineStroke( new BasicStroke() ); chart.getCategoryPlot().getRangeAxis().setTickLabelPaint( Color.decode("#666666") ); chart.getCategoryPlot().getDomainAxis().setTickLabelPaint( Color.decode("#666666") ); chart.setTextAntiAlias( true ); chart.setAntiAlias( true ); chart.getCategoryPlot().getRenderer().setSeriesPaint( 0, Color.decode( "#4572a7" )); BarRenderer rend = (BarRenderer) chart.getCategoryPlot().getRenderer(); rend.setShadowVisible( true ); rend.setShadowXOffset( 2 ); rend.setShadowYOffset( 0 ); rend.setShadowPaint( Color.decode( "#C0C0C0")); rend.setMaximumBarWidth( 0.1);
/** * Set up GUI components. */ private void initialize() { hoursByProjectDataset = new DefaultPieDataset(); initChartData(); final JFreeChart chart = ChartFactory.createPieChart3D(null, hoursByProjectDataset, false, true, false); chart.setBorderVisible(false); chart.setAntiAlias(true); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setMouseZoomable(false); chartPanel.setEnabled(false); chartPanel.setPopupMenu(null); this.add(chartPanel, BorderLayout.CENTER); }
/** * Sets basic configuration including title font, subtitle, background paint and * anti-alias on the given JFreeChart. */ private void setBasicConfig( JFreeChart jFreeChart, BaseChart chart) { jFreeChart.getTitle().setFont( TITLE_FONT ); jFreeChart.setBackgroundPaint( DEFAULT_BACKGROUND_COLOR ); jFreeChart.setAntiAlias( true ); if ( !chart.isHideTitle() ) { jFreeChart.addSubtitle( getSubTitle( chart ) ); } Plot plot = jFreeChart.getPlot(); plot.setBackgroundPaint( DEFAULT_BACKGROUND_COLOR ); plot.setOutlinePaint( DEFAULT_BACKGROUND_COLOR ); }
private byte[] generateBoxAndWhiskerChart (BoxAndWhiskerCategoryDataset dataset, int width, int height) { JFreeChart chart = ChartFactory.createBoxAndWhiskerChart (null, null, null, dataset, false); // set background chart.setBackgroundPaint (parseColor (statsManager.getChartBackgroundColor ())); // set chart border chart.setPadding (new RectangleInsets (10, 5, 5, 5)); chart.setBorderVisible (true); chart.setBorderPaint (parseColor ("#cccccc")); // set anti alias chart.setAntiAlias (true); CategoryPlot plot = (CategoryPlot) chart.getPlot (); plot.setDomainGridlinePaint (Color.white); plot.setDomainGridlinesVisible (true); plot.setRangeGridlinePaint (Color.white); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis (); rangeAxis.setStandardTickUnits (NumberAxis.createIntegerTickUnits ()); CategoryAxis domainAxis = (CategoryAxis) plot.getDomainAxis (); domainAxis.setLowerMargin (0.0); domainAxis.setUpperMargin (0.0); BufferedImage img = chart.createBufferedImage (width, height); final ByteArrayOutputStream out = new ByteArrayOutputStream(); try{ ImageIO.write(img, "png", out); }catch(IOException e){ log.warn("Error occurred while generating SiteStats chart image data", e); } return out.toByteArray(); }
jfchart.setAntiAlias(params.getBoolean(ChartParams.ANTI_ALIAS).booleanValue());