org.jfree.chart.title.TextTitle.<init>()方法的使用及代码示例

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

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

TextTitle.<init>介绍

[英]Creates a new title, using default attributes where necessary.
[中]创建新标题,必要时使用默认属性。

代码示例

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

false ); // urls       
chart.setBackgroundPaint( Color.white );
TextTitle title = new TextTitle( chartTitle );

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

/**
 * Adds a subtitle to the chart.
 *
 * @param subtitle  the subtitle.
 */
public void addSubtitle(String subtitle) {
  this.chart.addSubtitle(new TextTitle(subtitle));
}

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

/**
 * Adds a subtitle to the chart.
 *
 * @param subtitle  the subtitle.
 * @param font  the subtitle font.
 */
public void addSubtitle(String subtitle, Font font) {
  this.chart.addSubtitle(new TextTitle(subtitle, font));
}

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

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

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

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

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

private void createChart(XYPlot plot, String fileName, String caption) throws IOException {
  JFreeChart chart = new JFreeChart(caption, plot);
  chart.addSubtitle(this.subtitle);
  if (plot.getRangeAxis() instanceof LogarithmicAxis) {
    chart.addSubtitle(1, new TextTitle("(logarithmische Skala)"));
  }
  File file = new File(fileName);
  file.delete();
  ChartUtilities.saveChartAsPNG(file, chart, CHART_WIDTH, CHART_HEIGHT);
 }

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

public MemoryRelativeBarPlot( String title ) {
  chart = ChartFactory.createBarChart(
      title,       // chart title
      "Operation",               // domain axis label
      "Relative Memory",                  // range axis label
      dataset,                  // data
      PlotOrientation.VERTICAL, // orientation
      true,                     // include legend
      true,                     // tooltips?
      false                     // URLs?
  );
  chart.addSubtitle(new TextTitle("(Smaller is Better)",new Font("SansSerif", Font.ITALIC, 12)));
  plot();
}

代码示例来源:origin: OpenNMS/opennms

/**
 * @param chartConfig
 * @param barChart
 */
private static void addSubTitles(BarChart chartConfig, JFreeChart barChart) {
  Iterator<SubTitle> it;
  /*
   * Add subtitles.
   */
  for (it = chartConfig.getSubTitleCollection().iterator(); it.hasNext();) {
    SubTitle subTitle = (SubTitle) it.next();
    Title title = subTitle.getTitle();
    String value = title.getValue();
    barChart.addSubtitle(new TextTitle(value));
  }
}

代码示例来源:origin: org.opennms/opennms-web-api

/**
 * @param chartConfig
 * @param barChart
 */
private static void addSubTitles(BarChart chartConfig, JFreeChart barChart) {
  Iterator<SubTitle> it;
  /*
   * Add subtitles.
   */
  for (it = chartConfig.getSubTitleCollection().iterator(); it.hasNext();) {
    SubTitle subTitle = (SubTitle) it.next();
    Title title = subTitle.getTitle();
    String value = title.getValue();
    barChart.addSubtitle(new TextTitle(value));
  }
}

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

/**
 * Sets the chart title and sends a {@link ChartChangeEvent} to all
 * registered listeners.  This is a convenience method that ends up calling
 * the {@link #setTitle(TextTitle)} method.  If there is an existing title,
 * its text is updated, otherwise a new title using the default font is
 * added to the chart.  If {@code text} is {@code null} the chart
 * title is set to {@code null}.
 *
 * @param text  the title text ({@code null} permitted).
 *
 * @see #getTitle()
 */
public void setTitle(String text) {
  if (text != null) {
    if (this.title == null) {
      setTitle(new TextTitle(text, JFreeChart.DEFAULT_TITLE_FONT));
    } else {
      this.title.setText(text);
    }
  }
  else {
    setTitle((TextTitle) null);
  }
}

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

/**
 * Creates a new plot.
 *
 * @param dataset  the dataset (<code>null</code> 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: 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: dhis2/dhis2-core

private TextTitle getSubTitle( BaseChart chart )
{
  TextTitle textTitle = new TextTitle();
  String title = chart.hasTitle() ? chart.getTitle() : chart.generateTitle();
  textTitle.setFont( SUB_TITLE_FONT );
  textTitle.setText( title );
  return textTitle;
}

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

private void addNotice(JFreeChart chart) {
  TextTitle notice = new TextTitle();
  String msg = i18n.get("msg.io.chart.notice");
  if (msg != null && !msg.isEmpty()) {
    notice.setText(msg);
    notice.setPaint(Color.BLACK);
    notice.setFont(LabelConstants.FONT_LABEL_SMALL);
    notice.setPosition(RectangleEdge.BOTTOM);
    notice.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    notice.setVerticalAlignment(VerticalAlignment.BOTTOM);
    notice.setPadding(new RectangleInsets(0, 0, 20, 20));
    chart.addSubtitle(notice);
  }
}

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

private void addNotice(JFreeChart chart) {
  TextTitle notice = new TextTitle();
  String msg = i18n.get("notice");
  if (msg != null && !msg.isEmpty()) {
    notice.setText(msg);
    notice.setPaint(BLACK);
    notice.setFont(FONT_LABEL_SMALL);
    notice.setPosition(RectangleEdge.BOTTOM);
    notice.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    notice.setVerticalAlignment(VerticalAlignment.BOTTOM);
    notice.setPadding(new RectangleInsets(0, 0, 20, 20));
    chart.addSubtitle(notice);
  }
}

代码示例来源: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: senbox-org/snap-desktop

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: jfree/jfreechart

/**
 * Sets the properties of the specified title to match the properties
 * defined on this panel.
 *
 * @param chart  the chart whose title is to be modified.
 */
public void setTitleProperties(JFreeChart chart) {
  if (this.showTitle) {
    TextTitle title = chart.getTitle();
    if (title == null) {
      title = new TextTitle();
      chart.setTitle(title);
    }
    title.setText(getTitleText());
    title.setFont(getTitleFont());
    title.setPaint(getTitlePaint());
  }
  else {
    chart.setTitle((TextTitle) null);
  }
}

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

/**
 * Sets the properties of the specified title to match the properties
 * defined on this panel.
 *
 * @param chart  the chart whose title is to be modified.
 */
public void setTitleProperties(JFreeChart chart) {
  if (this.showTitle) {
    TextTitle title = chart.getTitle();
    if (title == null) {
      title = new TextTitle();
      chart.setTitle(title);
    }
    title.setText(getTitleText());
    title.setFont(getTitleFont());
    title.setPaint(getTitlePaint());
  }
  else {
    chart.setTitle((TextTitle) null);
  }
}

相关文章