org.jfree.chart.title.TextTitle类的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(9.9k)|赞(0)|评价(0)|浏览(175)

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

TextTitle介绍

[英]A chart title that displays a text string with automatic wrapping as required.
[中]显示文本字符串并根据需要自动换行的图表标题。

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

true, // tooltips
  false ); // urls       
chart.setBackgroundPaint( Color.white );
TextTitle title = new TextTitle( chartTitle );
title.setFont( new java.awt.Font( "SansSerif", java.awt.Font.BOLD, 12 ) );
chart.setTitle( title );
CategoryPlot plot = (CategoryPlot) chart.getPlot();
plot.setBackgroundPaint( Color.white );
plot.setForegroundAlpha( 0.5f );

代码示例来源:origin: afranken/jmeter-analysis-maven-plugin

public static JFreeChart createJFreeChart(String title, XYPlot result, int imageHeight) {
    JFreeChart chart = new JFreeChart(title, result);
    chart.getLegend().setPosition(RectangleEdge.TOP);
    chart.getLegend().setHorizontalAlignment(HorizontalAlignment.LEFT);
    chart.getLegend().setFrame(BlockBorder.NONE);
    chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, imageHeight, new Color(229, 236, 246)));
    chart.getTitle().setFont(new Font("SansSerif", Font.PLAIN | Font.BOLD, 16));
    chart.getTitle().setPaint(Color.GRAY);
    return chart;
  }
}

代码示例来源:origin: bcdev/beam

private void setPlotMessage(String messageText) {
  chart.getXYPlot().clearAnnotations();
  TextTitle tt = new TextTitle(messageText);
  tt.setTextAlignment(HorizontalAlignment.RIGHT);
  tt.setFont(chart.getLegend().getItemFont());
  tt.setBackgroundPaint(new Color(200, 200, 255, 50));
  tt.setFrame(new BlockBorder(Color.white));
  tt.setPosition(RectangleEdge.BOTTOM);
  XYTitleAnnotation message = new XYTitleAnnotation(0.5, 0.5, tt, RectangleAnchor.CENTER);
  chart.getXYPlot().addAnnotation(message);
}

代码示例来源:origin: com.atlassian.jira/jira-api

public static void setupTextTitle(TextTitle title)
{
  if (title != null)
  {
    title.setFont(ChartDefaults.titleFont);
    title.setTextAlignment(HorizontalAlignment.LEFT);
    title.setPaint(ChartDefaults.titleTextColor);
    title.setBackgroundPaint(ChartDefaults.transparent);
  }
}

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

TextTitle legendText = new TextTitle("This is LEGEND: ");
legendText.setPosition(RectangleEdge.BOTTOM);
chart.addSubtitle(legendText);

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

/**
 * Creates a new plot.
 *
 * @param dataset  the dataset ({@code null} permitted).
 */
public MultiplePiePlot(CategoryDataset dataset) {
  super();
  setDataset(dataset);
  PiePlot piePlot = new PiePlot(null);
  piePlot.setIgnoreNullValues(true);
  this.pieChart = new JFreeChart(piePlot);
  this.pieChart.removeLegend();
  this.dataExtractOrder = TableOrder.BY_COLUMN;
  this.pieChart.setBackgroundPaint(null);
  TextTitle seriesTitle = new TextTitle("Series Title",
      new Font("SansSerif", Font.BOLD, 12));
  seriesTitle.setPosition(RectangleEdge.BOTTOM);
  this.pieChart.setTitle(seriesTitle);
  this.aggregatedItemsKey = "Other";
  this.aggregatedItemsPaint = Color.lightGray;
  this.sectionPaints = new HashMap();
  this.legendItemShape = new Ellipse2D.Double(-4.0, -4.0, 8.0, 8.0);
}

代码示例来源:origin: us.ihmc/Plotting

public static void increaseFontSize(JFreeChart chart, int amount)
 XYPlot plot = chart.getXYPlot();
 int size = font.getSize();
 size += amount;
 Font bigger = new Font(font.getName(), font.getStyle(), size);
 ValueAxis valueAxis = plot.getDomainAxis();
 valueAxis.setTickLabelFont(bigger);
 font = chart.getTitle().getFont();
 size = font.getSize();
 size += amount;
 bigger = new Font(font.getName(), font.getStyle(), size);
 chart.getTitle().setFont(bigger);
  if ( chart.getLegend() != null )
    font = chart.getLegend().getItemFont();
    size = font.getSize();
    size += amount;
    bigger = new Font(font.getName(), font.getStyle(), size);
    chart.getLegend().setItemFont(bigger);

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

JFreeChart chart =  new JFreeChart(title,
    JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
  TextTitle subtitle = new TextTitle("Bright " + (greenForIncrease 
      ? "red" : "green") + "=change >=-" + percentDiffForMaxScale
      + "%, Bright " + (!greenForIncrease ? "red" : "green")
      + "=change >=+" + percentDiffForMaxScale + "%",
      new Font("SansSerif", Font.PLAIN, 10));
  chart.addSubtitle(subtitle);

代码示例来源:origin: nz.ac.waikato.cms.weka/distributedWekaBase

PlotOrientation.VERTICAL, false, false, false);
chart.setBackgroundPaint(java.awt.Color.white);
chart.setTitle(new TextTitle(plotTitle,
 new Font("SansSerif", Font.BOLD, 12)));

代码示例来源:origin: lessthanoptimal/Java-Matrix-Benchmark

public void setSubTitle( String title ) {
  chart.addSubtitle(new TextTitle(title,new Font("SansSerif", Font.ITALIC, 12)));
}

代码示例来源:origin: fossasia/neurolab-desktop

lineChart.getTitle().setFont(new Font("Ubuntu", Font.PLAIN, 20));
lineChart.getPlot().setOutlineStroke(new BasicStroke(3));
lineChart.getCategoryPlot().getRenderer().setSeriesStroke(0, new BasicStroke(3));
lineChart.getCategoryPlot().getRenderer().setSeriesStroke(1, new BasicStroke(3));

代码示例来源:origin: net.objectlab/qalab

final TextTitle copyright = new TextTitle("QALab 2004+,ObjectLab.co.uk Generated "
    + QALabTags.DEFAULT_DATETIME_FORMAT.format(new Date()), new Font("SansSerif", Font.PLAIN, DEFAULT_FONT_SIZE));
copyright.setPosition(RectangleEdge.BOTTOM);
copyright.setHorizontalAlignment(HorizontalAlignment.RIGHT);
chart.addSubtitle(copyright);
chart.setBackgroundImage(getLogo());
chart.setBackgroundImageAlpha(ALPHA);
chart.setBackgroundImageAlignment(Align.BOTTOM_LEFT);
chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, MAX_WIDTH, Color.blue));

代码示例来源:origin: org.n52.sensorweb/sensorwebclient-api

chart.setBackgroundPaint(Color.white);
  chart.addSubtitle(new TextTitle(ConfigurationContext.COPYRIGHT, new Font(LABEL_FONT, Font.PLAIN, 9),
      Color.black, RectangleEdge.BOTTOM, HorizontalAlignment.RIGHT, VerticalAlignment.BOTTOM,
      new RectangleInsets(0, 0, 20, 20)));
XYPlot plot = (XYPlot) chart.getPlot();
plot.setBackgroundPaint(Color.white);
plot.setDomainGridlinePaint(Color.lightGray);

代码示例来源:origin: us.ihmc/simulation-construction-set-tools

private void setUpVisuals()
 graph.getXYPlot().setDomainGridlinePaint(Color.BLACK);
 graph.getXYPlot().setDomainGridlinesVisible(false);
 graph.getXYPlot().setDomainGridlineStroke(new BasicStroke(3f));
 graph.getXYPlot().setRangeGridlinePaint(Color.BLACK);
 graph.getTitle().setFont(new Font("SansSerif", Font.BOLD, 26));
 graph.getXYPlot().getDomainAxis().setTickLabelFont(new Font("SansSerif", Font.PLAIN, 20));
 graph.getXYPlot().getRangeAxis().setTickLabelFont(new Font("SansSerif", Font.PLAIN, 20));
 graph.getXYPlot().getDomainAxis().setLabelFont(new Font("SansSerif", Font.BOLD, 22));
 graph.getXYPlot().getRangeAxis().setLabelFont(new Font("SansSerif", Font.BOLD, 22));

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

chart.setTitle(new TextTitle("XY Chart Sample, non default font",
    new java.awt.Font("Serif", Font.BOLD, 12)));
chart.setBackgroundPaint(Color.white);
chart.setBorderPaint(Color.black);
chart.setBorderStroke(new BasicStroke(1));
chart.setBorderVisible(true);

代码示例来源:origin: lessthanoptimal/Java-Matrix-Benchmark

public JFreeChart createChart() {
  JFreeChart chart = ChartFactory.createBoxAndWhiskerChart(
      title, "Matrix Libraries", "Relative Performance", dataSet,
      true);
  CategoryPlot plot = chart.getCategoryPlot();
  plot.setDomainGridlinesVisible(true);
  plot.setBackgroundPaint(new Color(230,230,230));
  plot.setDomainGridlinePaint(new Color(50,50,50,50));
  plot.setDomainGridlineStroke(new BasicStroke(78f));
  chart.getTitle().setFont(new Font("Times New Roman", Font.BOLD, 24));
  String foo = "( Higher is Better )";
  if( subtitle != null )
    foo += "      ( "+subtitle+" )";
  chart.addSubtitle(new TextTitle(foo,new Font("SansSerif", Font.ITALIC, 12)));
  NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
  rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
  return chart;
}

代码示例来源:origin: lessthanoptimal/Java-Matrix-Benchmark

public OverallRelativeAreaPlot(String title , int sizes[] ) {
  // createAreaChart
  chart = ChartFactory.createStackedAreaChart(
      title,      // chart title
      "Size",                // domain axis label
      "Relative Average Speed",                   // range axis label
      dataset,                   // data
      PlotOrientation.VERTICAL,  // orientation
      true,                      // include legend
      true,
      false
  );
  chart.addSubtitle(new TextTitle("Weighted by Operation Speed. Larger is Better.",new Font("SansSerif", Font.ITALIC, 12)));
  plot = chart.getCategoryPlot();
  sizeNames = new String[sizes.length];
  for( int i = 0; i < sizes.length; i++ ) {
    sizeNames[i] = Integer.toString(sizes[i]);
  }
  plot.setRangeGridlinePaint(Color.WHITE);
  plot.setBackgroundPaint(Color.WHITE);
  plot.setDomainGridlinesVisible(true);
}

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

chart.getPlot().setOutlineVisible(false);
if (chart.getPlot() instanceof XYPlot) {
  XYPlot plot = (XYPlot) chart.getPlot();
  plot.getDomainAxis().setLabelFont(font);
  plot.getDomainAxis().setTickLabelFont(font);
        Font newFont = oldFont.deriveFont((float) fontSize);
        axis.setTickLabelFont(newFont);
    TextTitle t = new TextTitle(s[i].replace('+', ' '));
    t.setPaint(Color.gray);
    t.setFont(font.deriveFont(font.getSize2D() * 14f / 12f));
    chart.addSubtitle(t);
      if (t instanceof TextTitle) {
        TextTitle tt = (TextTitle) t;
        tt.setPaint(color);
        tt.setFont(font.deriveFont((float) size));
      LegendTitle legend = new LegendTitle(chart.getPlot());
      RectangleEdge pos = RectangleEdge.RIGHT;
      String[] chdlp = (String[]) params.get("chdlp");

代码示例来源:origin: sc.fiji/TrackMate_

chart.getTitle().setFont(FONT);
chart.getLegend().setItemFont(SMALL_FONT);
XYPlot plot = chart.getXYPlot();

代码示例来源:origin: jasperreports/jasperreports

jfreeChart.setBackgroundPaint(getChart().getBackcolor());
  jfreeChart.setBackgroundPaint(TRANSPARENT_PAINT);
if (jfreeChart.getTitle() != null)
  TextTitle title = jfreeChart.getTitle();
  title.setPaint(getChart().getTitleColor());
  title.setFont(JRFontUtil.getAwtFont(getChart().getTitleFont(), getLocale()));
  title.setPosition(titleEdge);
if (subtitleText != null)
  TextTitle subtitle = new TextTitle(subtitleText);
  subtitle.setPaint(getChart().getSubtitleColor());
  subtitle.setFont(JRFontUtil.getAwtFont(getChart().getSubtitleFont(), getLocale()));
  subtitle.setPosition(titleEdge);
  jfreeChart.addSubtitle(subtitle);
if (legend != null)
  legend.setItemPaint(getChart().getLegendColor());
    legend.setBackgroundPaint(TRANSPARENT_PAINT);

相关文章