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

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

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

JFreeChart.setTextAntiAlias介绍

[英]Sets the value in the rendering hints table for RenderingHints#KEY_TEXT_ANTIALIASING and sends a ChartChangeEvent to all registered listeners.
[中]在渲染提示表中设置渲染提示#键_文本)抗锯齿的值,并向所有注册的侦听器发送ChartChangeEvent。

代码示例

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

/**
 * Sets the value in the rendering hints table for
 * {@link RenderingHints#KEY_TEXT_ANTIALIASING} to either
 * {@link RenderingHints#VALUE_TEXT_ANTIALIAS_ON} or
 * {@link RenderingHints#VALUE_TEXT_ANTIALIAS_OFF}, then sends a
 * {@link ChartChangeEvent} to all registered listeners.
 *
 * @param flag  the new value of the flag.
 *
 * @since 1.0.5
 *
 * @see #getTextAntiAlias()
 * @see #setTextAntiAlias(Object)
 */
public void setTextAntiAlias(boolean flag) {
  if (flag) {
    setTextAntiAlias(RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
  }
  else {
    setTextAntiAlias(RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
  }
}

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

/**
 * Sets the value in the rendering hints table for
 * {@link RenderingHints#KEY_TEXT_ANTIALIASING} to either
 * {@link RenderingHints#VALUE_TEXT_ANTIALIAS_ON} or
 * {@link RenderingHints#VALUE_TEXT_ANTIALIAS_OFF}, then sends a
 * {@link ChartChangeEvent} to all registered listeners.
 *
 * @param flag  the new value of the flag.
 *
 * @since 1.0.5
 *
 * @see #getTextAntiAlias()
 * @see #setTextAntiAlias(Object)
 */
public void setTextAntiAlias(boolean flag) {
  if (flag) {
    setTextAntiAlias(RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
  }
  else {
    setTextAntiAlias(RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
  }
}

代码示例来源: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.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.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-ui

renderer6.setSeriesPaint(0, ChartCategories.getColor(0));
chart.setTextAntiAlias(false);
return chart;

代码示例来源: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: org.codehaus.jtstand/jtstand-ui

chart.setTextAntiAlias(false);
return chart;

代码示例来源:origin: org.renci/charts

public JFreeChart createStackedBarChart(String title, XYDataset dataset) {
  DateAxis domainAxis = new DateAxis("Date");
  domainAxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);
  domainAxis.setLowerMargin(0.01);
  domainAxis.setUpperMargin(0.01);
  NumberAxis rangeAxis = new NumberAxis("Hours");
  rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
  rangeAxis.setUpperMargin(0.10); // leave some space for item labels
  StackedXYBarRenderer renderer = new StackedXYBarRenderer(0.15);
  // StackedXYAreaRenderer2 renderer = new StackedXYAreaRenderer2();
  renderer.setDrawBarOutline(false);
  renderer.setBaseItemLabelsVisible(true);
  renderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
  renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12,
      TextAnchor.BOTTOM_CENTER));
  renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator("{0} : {1} = {2}",
      new SimpleDateFormat("yyyy"), new DecimalFormat("0")));
  XYPlot plot = new XYPlot(dataset, domainAxis, rangeAxis, renderer);
  JFreeChart chart = new JFreeChart(title, plot);
  chart.removeLegend();
  chart.setTextAntiAlias(RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT);
  LegendTitle legend = new LegendTitle(plot);
  legend.setBackgroundPaint(Color.white);
  legend.setFrame(new BlockBorder());
  legend.setPosition(RectangleEdge.BOTTOM);
  chart.addSubtitle(legend);
  return chart;
}

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

yAxis.setAutoRange(true);
xAxis.setRange(leftValue(0), rightValue(numberOfCategories - 1));
chart.setTextAntiAlias(false);
return chart;

代码示例来源:origin: org.renci/charts

public JFreeChart createStackedAreaChart(String title, TableXYDataset dataset) {
  DateAxis domainAxis = new DateAxis("Date");
  domainAxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);
  domainAxis.setLowerMargin(0.01);
  domainAxis.setUpperMargin(0.01);
  NumberAxis rangeAxis = new NumberAxis("Minutes");
  rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
  rangeAxis.setUpperMargin(0.10);
  StackedXYAreaRenderer2 renderer = new StackedXYAreaRenderer2();
  renderer.setBaseItemLabelsVisible(true);
  renderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
  renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12,
      TextAnchor.BOTTOM_CENTER));
  renderer.setSeriesPaint(0, Color.lightGray);
  XYPlot plot = new XYPlot(dataset, domainAxis, rangeAxis, renderer);
  plot.setRenderer(0, renderer);
  plot.setDomainCrosshairVisible(true);
  plot.setRangeCrosshairVisible(true);
  LegendTitle legend = new LegendTitle(plot);
  legend.setBackgroundPaint(Color.white);
  legend.setFrame(new BlockBorder());
  legend.setPosition(RectangleEdge.BOTTOM);
  JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, true);
  chart.removeLegend();
  chart.setTextAntiAlias(RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT);
  chart.addSubtitle(legend);
  return chart;
}

相关文章