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

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

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

JFreeChart.setTitle介绍

[英]Sets the chart title and sends a ChartChangeEvent to all registered listeners. This is a convenience method that ends up calling the #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 text is null the chart title is set to null.
[中]设置图表标题并向所有注册的侦听器发送ChartChangeEvent。这是一个方便的方法,最终调用了#setTitle(TextTitle)方法。如果存在现有标题,则会更新其文本,否则会将使用默认字体的新标题添加到图表中。如果文本为空,则图表标题设置为空。

代码示例

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

chart.setTitle( title );
CategoryPlot plot = (CategoryPlot) chart.getPlot();
plot.setBackgroundPaint( Color.white );

代码示例来源:origin: Audiveris/audiveris

/**
   * Assign a new title for the chart.
   *
   * @param chartTitle new chart title
   */
  public void setChartTitle (String chartTitle)
  {
    chart.setTitle(chartTitle);
  }
}

代码示例来源:origin: ca.umontreal.iro/ssj

/**
* Sets a title to this chart. This title will appear on the chart displayed
*  by method {@link #view view}.
* 
* @param title chart title.
* 
* 
*/
public void setTitle (String title)  {
 chart.setTitle(title);
}

代码示例来源:origin: ca.umontreal.iro/ssj

/**
* Sets a title to this chart. This title will appear on the chart displayed
*  by method {@link #view view}.
* 
* @param title chart title.
* 
* 
*/
public void setTitle (String title)  {
 chart.setTitle(title);
}

代码示例来源:origin: ca.umontreal.iro/ssj

/**
* Sets a title to the chart. This title will appear on the chart displayed by method {@link #view view}.
* 
* @param title chart title.
* 
* 
*/
public void setTitle (String title)  {
 chart.setTitle(title);
}

代码示例来源:origin: tflobbe/solrmeter

/**
 * Changes the title of the chart
 * @param key is the last part of the i18n key
 */
private void changeChartTitle(String key) {
  char[] collectionName = activeCollection.toCharArray();
  collectionName[0] = Character.toUpperCase(collectionName[0]);
  
  chart.setTitle(String.valueOf(collectionName) + " " + I18n.get(PREFIX + key));
}

代码示例来源:origin: ExpediaDotCom/adaptive-alerting

@Override
public void next(ModelEvaluation evaluation) {
  notNull(evaluation, "evaluation can't be null");
  
  final String title = new StringBuilder(baseTitle)
      .append(" (")
      .append(evaluation.getEvaluatorMethod())
      .append("=")
      .append(format.format(evaluation.getEvaluatorScore()))
      .append(")")
      .toString();
  chart.setTitle(title);
}

代码示例来源: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: org.jwall/streams-plotter

public void setTitle(String title) {
  chart.setTitle(title);
  chart.getTitle().setPaint(Color.DARK_GRAY);
}

代码示例来源:origin: matsim-org/matsim

private static JDialog newChartDialog(JFreeChart chart, String title, boolean modal) {
    chart.setTitle(title);
    JDialog dialog = new JDialog();
    dialog.setTitle(title);
    dialog.setContentPane(new ChartPanel(chart));
    dialog.setModal(modal);
    dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    return dialog;
  }
}

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

@Override
public JFreeChart getJFreeChart( String name, PlotOrientation orientation, CategoryLabelPositions labelPositions,
  Map<String, Double> categoryValues )
{
  DefaultCategoryDataset dataSet = new DefaultCategoryDataset();
  for ( Entry<String, Double> entry : categoryValues.entrySet() )
  {
    dataSet.addValue( entry.getValue(), name, entry.getKey() );
  }
  CategoryPlot plot = getCategoryPlot( dataSet, getBarRenderer(), orientation, labelPositions );
  JFreeChart jFreeChart = getBasicJFreeChart( plot );
  jFreeChart.setTitle( name );
  return jFreeChart;
}

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

private void configureTitle(JFreeChart chart) {
  IoParameters parameters = getParameters();
  if (parameters.containsParameter(PARAMETER_PRERENDERING_TITLE)) {
    String title = parameters.getAsString(PARAMETER_PRERENDERING_TITLE);
    if (parameters.containsParameter(Parameters.RENDERING_TRIGGER)) {
      String trigger = parameters.getAsString(Parameters.RENDERING_TRIGGER);
      title = RENDERING_TRIGGER_PRERENDERING.equalsIgnoreCase(trigger)
        ? getTitleForSingle(parameters, title)
        : title;
    }
    chart.setTitle(title);
  }
}

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

private void configureTitle(JFreeChart chart) {
  DesignedParameterSet config = getChartStyleDefinitions();
  if (config.containsParameter("title")) {
    String title = config.getAsString("title");
    if (config.containsParameter("rendering_trigger")) {
      String trigger = config.getAsString("rendering_trigger");
      title = "prerendering".equalsIgnoreCase(trigger)
          ? getTitleForSingle(config, title)
          : title;
    }
    chart.setTitle(title);
  }
}

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

/**
 * 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: 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: senbox-org/snap-desktop

@Override
protected void updateComponents() {
  if (!isInitialized || !isVisible()) {
    return;
  }
  final RasterDataNode raster = getRaster();
  if (raster != null) {
    chart.setTitle(CHART_TITLE + " for " + raster.getName());
  } else {
    chart.setTitle(CHART_TITLE);
  }
  correlativeFieldSelector.updatePointDataSource(getProduct());
  updateDataSource();
  updateDataSet();
  updateUIState();
  super.updateComponents();
}

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

@Override
protected void updateComponents() {
  if (!isInitialized || !isVisible()) {
    return;
  }
  final RasterDataNode raster = getRaster();
  if (raster != null) {
    chart.setTitle(CHART_TITLE + " for " + raster.getName());
  } else {
    chart.setTitle(CHART_TITLE);
  }
  correlativeFieldSelector.updatePointDataSource(getProduct());
  updateDataSource();
  updateDataSet();
  updateUIState();
  super.updateComponents();
}

代码示例来源:origin: senbox-org/snap-desktop

@Override
protected void updateComponents() {
  if (!isInitialized || !isVisible()) {
    return;
  }
  super.updateComponents();
  chart.setTitle(getRaster() != null ? CHART_TITLE + " for " + getRaster().getName() : CHART_TITLE);
  updateXAxis();
  if (xAxisRangeControl.isAutoMinMax()) {
    xAxisRangeControl.getBindingContext().getPropertySet().getDescriptor("min").setDefaultValue(
        HISTO_MIN_DEFAULT);
    xAxisRangeControl.getBindingContext().getPropertySet().getDescriptor("max").setDefaultValue(
        HISTO_MAX_DEFAULT);
  }
  dataset = null;
  handleStxChange();
  updateRefreshButton();
}

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

@Override
protected void updateComponents() {
  if (!isInitialized || !isVisible()) {
    return;
  }
  super.updateComponents();
  chart.setTitle(getRaster() != null ? CHART_TITLE + " for " + getRaster().getName() : CHART_TITLE);
  updateXAxis();
  if (xAxisRangeControl.isAutoMinMax()) {
    xAxisRangeControl.getBindingContext().getPropertySet().getDescriptor("min").setDefaultValue(
        HISTO_MIN_DEFAULT);
    xAxisRangeControl.getBindingContext().getPropertySet().getDescriptor("max").setDefaultValue(
        HISTO_MAX_DEFAULT);
  }
  dataset = null;
  handleStxChange();
  updateRefreshButton();
}

相关文章