org.jfree.chart.JFreeChart.setAntiAlias()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(182)

本文整理了Java中org.jfree.chart.JFreeChart.setAntiAlias()方法的一些代码示例,展示了JFreeChart.setAntiAlias()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JFreeChart.setAntiAlias()方法的具体详情如下:
包路径:org.jfree.chart.JFreeChart
类名称:JFreeChart
方法名:setAntiAlias

JFreeChart.setAntiAlias介绍

[英]Sets a flag that indicates whether or not anti-aliasing is used when the chart is drawn.

Anti-aliasing usually improves the appearance of charts, but is slower.
[中]设置一个标志,指示绘制图表时是否使用抗锯齿。
抗锯齿通常会改善图表的外观,但速度较慢。

代码示例

代码示例来源:origin: stackoverflow.com

JFreeChart chart = ChartFactory.createCandlestickChart(...);
chart.setAntiAlias(false);

代码示例来源:origin: psi-probe/psi-probe

chart.setAntiAlias(true);
chart.setBackgroundPaint(new Color(backgroundColor));
for (int i = 0; i < seriesMaxCount; i++) {

代码示例来源:origin: com.anrisoftware.prefdialog/prefdialog-misc-swing

@OnAwt
@Override
public void setAntiAliasing(boolean antiAliasing) {
  chart.setAntiAlias(antiAliasing);
}

代码示例来源:origin: dhis2/dhis2-core

/**
 * 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;
}

代码示例来源:origin: com.sun.japex/japex

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);
  }
}

代码示例来源:origin: org.n52.series-api/io

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;
}

代码示例来源:origin: org.codehaus.sonar/sonar-deprecated

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();
}

代码示例来源:origin: org.n52.sensorweb/timeseries-io

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;
}

代码示例来源:origin: org.codehaus.jtstand/jtstand-chart

/**
 * 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());
}

代码示例来源:origin: com.sun.japex/japex

true, true, false);
configureLineChart(chart);
chart.setAntiAlias(true);

代码示例来源:origin: com.sun.japex/japex

true, true, false);
configureLineChart(chart);
chart.setAntiAlias(true);

代码示例来源:origin: jfree/jfreechart

/**
 * 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());
}

代码示例来源:origin: com.sun.japex/japex

chart.setAntiAlias(true);
ChartUtilities.saveChartAsJPEG(
  new File(baseName + Integer.toString(nOfFiles) + extension),

代码示例来源:origin: stackoverflow.com

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);

代码示例来源:origin: Baralga/baralga

/**
 * 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);
}

代码示例来源:origin: dhis2/dhis2-core

/**
 * 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 );
}

代码示例来源:origin: org.sakaiproject.sitestats/sitestats-impl

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();
}

代码示例来源:origin: org.sakaiproject.sitestats/sitestats-impl

chart.setAntiAlias(true);

代码示例来源:origin: org.sakaiproject.sitestats/sitestats-impl

chart.setAntiAlias (true);

代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core

jfchart.setAntiAlias(params.getBoolean(ChartParams.ANTI_ALIAS).booleanValue());

相关文章