当前位置: 首页>>代码示例>>Java>>正文


Java TextTitle.setPosition方法代码示例

本文整理汇总了Java中org.jfree.chart.title.TextTitle.setPosition方法的典型用法代码示例。如果您正苦于以下问题:Java TextTitle.setPosition方法的具体用法?Java TextTitle.setPosition怎么用?Java TextTitle.setPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jfree.chart.title.TextTitle的用法示例。


在下文中一共展示了TextTitle.setPosition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: MultiplePiePlot

import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
/**
 * Creates a new plot.
 * 
 * @param dataset  the dataset (<code>null</code> permitted).
 */
public MultiplePiePlot(CategoryDataset dataset) {
    super();
    this.dataset = dataset;
    PiePlot piePlot = new PiePlot(null);
    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();
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:22,代码来源:MultiplePiePlot.java

示例2: MultiplePiePlot

import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:24,代码来源:MultiplePiePlot.java

示例3: MultiplePiePlot

import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:24,代码来源:MultiplePiePlot.java

示例4: MultiplePiePlot

import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
/**
 * Creates a new plot.
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 */
public MultiplePiePlot(CategoryDataset dataset) {
    super();
    setDataset(dataset);
    PiePlot piePlot = new PiePlot(null);
    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();
}
 
开发者ID:SOCR,项目名称:HTML5_WebSite,代码行数:22,代码来源:MultiplePiePlot.java

示例5: MultiplePiePlot

import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
/**
 * 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("Tahoma", 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);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:24,代码来源:MultiplePiePlot.java

示例6: MultiplePiePlot

import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
/**
 * 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(JFreeChart.getFont(), 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);
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:24,代码来源:MultiplePiePlot.java

示例7: MultiplePiePlot

import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
/**
 * Creates a new plot.
 * 
 * @param dataset  the dataset (<code>null</code> permitted).
 */
public MultiplePiePlot(CategoryDataset dataset) {
    super();
    this.dataset = dataset;
    PiePlot piePlot = new PiePlot(null);
    this.pieChart = new JFreeChart(piePlot);
    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);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:17,代码来源:MultiplePiePlot.java

示例8: createMultiplePieChart3D

import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
/**
 * Creates a chart that displays multiple pie plots.  The chart object
 * returned by this method uses a {@link MultiplePiePlot} instance as the
 * plot.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param dataset  the dataset (<code>null</code> permitted).
 * @param order  the order that the data is extracted (by row or by column)
 *               (<code>null</code> not permitted).
 * @param legend  include a legend?
 *
 * @return A chart.
 */
public static JFreeChart createMultiplePieChart3D(String title,
        CategoryDataset dataset, TableOrder order, boolean legend) {

    if (order == null) {
        throw new IllegalArgumentException("Null 'order' argument.");
    }
    MultiplePiePlot plot = new MultiplePiePlot(dataset);
    plot.setDataExtractOrder(order);
    plot.setBackgroundPaint(null);
    plot.setOutlineStroke(null);

    JFreeChart pieChart = new JFreeChart(new PiePlot3D(null));
    TextTitle seriesTitle = new TextTitle("Series Title",
            new Font("Tahoma", Font.BOLD, 12));
    seriesTitle.setPosition(RectangleEdge.BOTTOM);
    pieChart.setTitle(seriesTitle);
    pieChart.removeLegend();
    pieChart.setBackgroundPaint(null);
    plot.setPieChart(pieChart);

    PieToolTipGenerator tooltipGenerator
            = new StandardPieToolTipGenerator();
    PiePlot pp = (PiePlot) plot.getPieChart().getPlot();
    pp.setToolTipGenerator(tooltipGenerator);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
            plot, legend);
    currentTheme.apply(chart);
    return chart;

}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:44,代码来源:ChartFactory.java

示例9: setPlotMessage

import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
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);
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:12,代码来源:SpectrumTopComponent.java

示例10: createChart

import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
/**
 * Creates a chart.
 *
 * @param dataset  the dataset.
 *
 * @return A chart.
 */
private static JFreeChart createChart(PieDataset dataset) {

    JFreeChart chart = ChartFactory.createPieChart(
        "Smart Phones Manufactured / Q3 2011", dataset);

    // set a custom background for the chart
    chart.setBackgroundPaint(new GradientPaint(new Point(0, 0), 
            new Color(20, 20, 20), new Point(400, 200), Color.DARK_GRAY));

    // customise the title position and font
    TextTitle t = chart.getTitle();
    t.setHorizontalAlignment(HorizontalAlignment.LEFT);
    t.setPaint(new Color(240, 240, 240));
    t.setFont(new Font("Arial", Font.BOLD, 26));

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setBackgroundPaint(null);
    plot.setInteriorGap(0.04);
    plot.setOutlineVisible(false);

    // use gradients and white borders for the section colours
    plot.setSectionPaint("Others", createGradientPaint(new Color(200, 200, 255), Color.BLUE));
    plot.setSectionPaint("Samsung", createGradientPaint(new Color(255, 200, 200), Color.RED));
    plot.setSectionPaint("Apple", createGradientPaint(new Color(200, 255, 200), Color.GREEN));
    plot.setSectionPaint("Nokia", createGradientPaint(new Color(200, 255, 200), Color.YELLOW));
    plot.setDefaultSectionOutlinePaint(Color.WHITE);
    plot.setSectionOutlinesVisible(true);
    plot.setDefaultSectionOutlineStroke(new BasicStroke(2.0f));

    // customise the section label appearance
    plot.setLabelFont(new Font("Courier New", Font.BOLD, 20));
    plot.setLabelLinkPaint(Color.WHITE);
    plot.setLabelLinkStroke(new BasicStroke(2.0f));
    plot.setLabelOutlineStroke(null);
    plot.setLabelPaint(Color.WHITE);
    plot.setLabelBackgroundPaint(null);
    
    // add a subtitle giving the data source
    TextTitle source = new TextTitle("Source: http://www.bbc.co.uk/news/business-15489523", 
            new Font("Courier New", Font.PLAIN, 12));
    source.setPaint(Color.WHITE);
    source.setPosition(RectangleEdge.BOTTOM);
    source.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    chart.addSubtitle(source);
    return chart;

}
 
开发者ID:jfree,项目名称:jfree-fxdemos,代码行数:55,代码来源:PieChartFXDemo1.java

示例11: createChart

import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
/**
     * Creates a chart.
     *
     * @param dataset  the dataset.
     *
     * @return A chart.
     */
    private static JFreeChart createChart(PieDataset dataset) {

        JFreeChart chart = ChartFactory.createPieChart(
            "Smart Phones Manufactured / Q3 2011",  // chart title
            dataset,            // data
            false,              // no legend
            true,               // tooltips
            false               // no URL generation
        );

        // set a custom background for the chart
        chart.setBackgroundPaint(new GradientPaint(new Point(0, 0), 
                new Color(20, 20, 20), new Point(400, 200), Color.DARK_GRAY));

        // customise the title position and font
        TextTitle t = chart.getTitle();
        t.setHorizontalAlignment(HorizontalAlignment.LEFT);
        t.setPaint(new Color(240, 240, 240));
        t.setFont(new Font("Arial", Font.BOLD, 26));

        PiePlot plot = (PiePlot) chart.getPlot();
        plot.setBackgroundPaint(null);
        plot.setInteriorGap(0.04);
//        plot.setOutlineVisible(false);

        // use gradients and white borders for the section colours
        plot.setSectionPaint("Others", createGradientPaint(new Color(200, 200, 255), Color.BLUE));
        plot.setSectionPaint("Samsung", createGradientPaint(new Color(255, 200, 200), Color.RED));
        plot.setSectionPaint("Apple", createGradientPaint(new Color(200, 255, 200), Color.GREEN));
        plot.setSectionPaint("Nokia", createGradientPaint(new Color(200, 255, 200), Color.YELLOW));
        plot.setBaseSectionOutlinePaint(Color.WHITE);
        plot.setSectionOutlinesVisible(true);
        plot.setBaseSectionOutlineStroke(new BasicStroke(2.0f));

        // customise the section label appearance
        plot.setLabelFont(new Font("Courier New", Font.BOLD, 20));
        plot.setLabelLinkPaint(Color.WHITE);
        plot.setLabelLinkStroke(new BasicStroke(2.0f));
        plot.setLabelOutlineStroke(null);
        plot.setLabelPaint(Color.WHITE);
        plot.setLabelBackgroundPaint(null);
        
        // add a subtitle giving the data source
        TextTitle source = new TextTitle("Source: http://www.bbc.co.uk/news/business-15489523", 
                new Font("Courier New", Font.PLAIN, 12));
        source.setPaint(Color.WHITE);
        source.setPosition(RectangleEdge.BOTTOM);
        source.setHorizontalAlignment(HorizontalAlignment.RIGHT);
        chart.addSubtitle(source);
        return chart;

    }
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:60,代码来源:PieChartDemo1.java

示例12: createChart

import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
/**
 * Creates a chart.
 *
 * @param dataset  the dataset.
 *
 * @return A chart.
 */
private static JFreeChart createChart(PieDataset dataset) {

    JFreeChart chart = ChartFactory.createPieChart(
        "Smart Phones Manufactured / Q3 2011",  // chart title
        dataset,            // data
        false,              // no legend
        true,               // tooltips
        false               // no URL generation
    );

    // set a custom background for the chart
    chart.setBackgroundPaint(new GradientPaint(new Point(0, 0), 
            new Color(20, 20, 20), new Point(400, 200), Color.DARK_GRAY));

    // customise the title position and font
    TextTitle t = chart.getTitle();
    t.setHorizontalAlignment(HorizontalAlignment.LEFT);
    t.setPaint(new Color(240, 240, 240));
    t.setFont(new Font("Arial", Font.BOLD, 26));

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setBackgroundPaint(null);
    plot.setInteriorGap(0.04);
    plot.setOutlineVisible(false);

    // use gradients and white borders for the section colours
    plot.setSectionPaint("Others", createGradientPaint(new Color(200, 200, 255), Color.BLUE));
    plot.setSectionPaint("Samsung", createGradientPaint(new Color(255, 200, 200), Color.RED));
    plot.setSectionPaint("Apple", createGradientPaint(new Color(200, 255, 200), Color.GREEN));
    plot.setSectionPaint("Nokia", createGradientPaint(new Color(200, 255, 200), Color.YELLOW));
    plot.setBaseSectionOutlinePaint(Color.WHITE);
    plot.setSectionOutlinesVisible(true);
    plot.setBaseSectionOutlineStroke(new BasicStroke(2.0f));

    // customise the section label appearance
    plot.setLabelFont(new Font("Courier New", Font.BOLD, 20));
    plot.setLabelLinkPaint(Color.WHITE);
    plot.setLabelLinkStroke(new BasicStroke(2.0f));
    plot.setLabelOutlineStroke(null);
    plot.setLabelPaint(Color.WHITE);
    plot.setLabelBackgroundPaint(null);
    
    // add a subtitle giving the data source
    TextTitle source = new TextTitle("Source: http://www.bbc.co.uk/news/business-15489523", 
            new Font("Courier New", Font.PLAIN, 12));
    source.setPaint(Color.WHITE);
    source.setPosition(RectangleEdge.BOTTOM);
    source.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    chart.addSubtitle(source);
    return chart;

}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:60,代码来源:PieChartFXDemo1.java

示例13: createEnergyPerSecondChart

import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
private JFreeChart createEnergyPerSecondChart(){
    
    _energyPerSecondDataSet.setValue(ENERGY_PER_SECOND_GRAPH_RANGE, PER_SECOND_ENERGY_ROW_KEY, 
            PER_SECOND_ENERGY_COLUMN_KEY);
    
    JFreeChart chart = ChartFactory.createBarChart(null, null, NuclearPhysicsStrings.POWER_GRAPH_UNITS, 
            _energyPerSecondDataSet, PlotOrientation.VERTICAL, false, false, false);
    chart.setBackgroundPaint( NuclearPhysicsConstants.NUCLEAR_FISSION_CONTROL_PANEL_COLOR );
    CategoryPlot plot = (CategoryPlot)chart.getPlot();
    plot.setBackgroundPaint( Color.darkGray );
    plot.setRangeGridlinePaint(Color.white);
    
    // Set up the title.
    TextTitle title = new TextTitle(NuclearPhysicsStrings.POWER_GRAPH_LABEL);
    title.setHorizontalAlignment( HorizontalAlignment.CENTER );
    title.setFont( TITLE_FONT );
    title.setPosition( RectangleEdge.BOTTOM );
    chart.setTitle( title );
    
    // Set the range for the Y axis.
    ValueAxis rangeAxis = plot.getRangeAxis();
    rangeAxis.setRange( 0, ENERGY_PER_SECOND_GRAPH_RANGE );
    rangeAxis.setTickLabelsVisible( false );
    rangeAxis.setLabelFont( LABEL_FONT );
    
    // Hide the X axis label, since we're using the title here (simply
    // because it looks better).
    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setTickLabelsVisible( false );
    
    // Disable bar outlines.
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);
    renderer.setItemMargin(0.01);
    
    // Set up gradient paint.
    GradientPaint gp0 = new GradientPaint(
        0.0f, 0.0f, Color.orange, 
        0.0f, 0.0f, Color.lightGray
    );

    renderer.setSeriesPaint(0, gp0);
    
    return chart;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:46,代码来源:NuclearReactorEnergyGraphPanel.java

示例14: createTotalEnergyChart

import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
private JFreeChart createTotalEnergyChart(){
    
    _totalEnergyDataSet.setValue(TOTAL_ENERGY_GRAPH_RANGE, TOTAL_ENERGY_ROW_KEY, TOTAL_ENERGY_COLUMN_KEY);
    
    JFreeChart chart = ChartFactory.createBarChart(NuclearPhysicsStrings.ENERGY_GRAPH_LABEL, null, 
            NuclearPhysicsStrings.ENERGY_GRAPH_UNITS, _totalEnergyDataSet, PlotOrientation.VERTICAL, false, false,
            false);
    chart.setBackgroundPaint( NuclearPhysicsConstants.NUCLEAR_FISSION_CONTROL_PANEL_COLOR );
    CategoryPlot plot = (CategoryPlot)chart.getPlot();
    plot.setBackgroundPaint( Color.DARK_GRAY );
    plot.setRangeGridlinePaint(Color.white);
    
    // Set up the title.
    TextTitle title = new TextTitle(NuclearPhysicsStrings.ENERGY_GRAPH_LABEL);
    title.setHorizontalAlignment( HorizontalAlignment.CENTER );
    title.setFont( TITLE_FONT );
    title.setPosition( RectangleEdge.BOTTOM );
    chart.setTitle( title );
    
    // Set the range for the Y axis.
    ValueAxis rangeAxis = plot.getRangeAxis();
    rangeAxis.setRange( 0, TOTAL_ENERGY_GRAPH_RANGE );
    rangeAxis.setTickLabelsVisible( false );
    rangeAxis.setLabelFont( LABEL_FONT );
    
    // Hide the X axis label, since we're using the title here (simply
    // because it looks better).
    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setTickLabelsVisible( false );
    
    // Disable bar outlines.
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);
    renderer.setItemMargin(0.01);
    
    // Set up gradient paint.
    GradientPaint gp0 = new GradientPaint(
        0.0f, 0.0f, Color.green, 
        0.0f, 0.0f, Color.lightGray
    );

    renderer.setSeriesPaint(0, gp0);
    
    return chart;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:46,代码来源:NuclearReactorEnergyGraphPanel.java

示例15: setChartSubtitles

import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
protected void setChartSubtitles(JFreeChart jfreeChart, Integer baseFontSize) throws JRException
{			
	Boolean subtitleVisibility = (Boolean)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_VISIBLE);

	if (subtitleVisibility != null && subtitleVisibility.booleanValue())
	{
		String subtitleText = evaluateTextExpression(getChart().getSubtitleExpression());
		if (subtitleText != null)
		{
			TextTitle subtitle = new TextTitle(subtitleText);
			
			Font themeSubtitleFont = getFont((JRFont)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_FONT), getChart().getSubtitleFont(), baseFontSize);
			subtitle.setFont(themeSubtitleFont);
			
			HorizontalAlignment defaultSubtitleHAlignment = (HorizontalAlignment)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_HORIZONTAL_ALIGNMENT);
			if (defaultSubtitleHAlignment != null)
				subtitle.setHorizontalAlignment(defaultSubtitleHAlignment);

			VerticalAlignment defaultSubtitleVAlignment = (VerticalAlignment)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_VERTICAL_ALIGNMENT);
			if (defaultSubtitleVAlignment != null)
				subtitle.setVerticalAlignment(defaultSubtitleVAlignment);
			
			RectangleInsets defaultSubtitlePadding = (RectangleInsets)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_PADDING);
			RectangleInsets subtitlePadding = subtitle.getPadding() != null ? subtitle.getPadding() : defaultSubtitlePadding;
			if (subtitlePadding != null)
				subtitle.setPadding(subtitlePadding);

			Color subtitleForecolor = getChart().getOwnSubtitleColor() != null ? 
					getChart().getOwnSubtitleColor() :
					(getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_FORECOLOR) != null ? 
							(Color)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_FORECOLOR) :
							getChart().getSubtitleColor());
			if (subtitleForecolor != null)
				subtitle.setPaint(subtitleForecolor);

			Color subtitleBackcolor = getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_BACKCOLOR) != null ? 
					(Color)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_BACKCOLOR) :
					null;
			if (subtitleBackcolor != null)
				subtitle.setBackgroundPaint(subtitleBackcolor);

			RectangleEdge defaultSubtitlePosition = (RectangleEdge)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_POSITION);
			//Subtitle has not its own position set, and by default this will be set the same as title position
			RectangleEdge subtitleEdge = null;
			if (defaultSubtitlePosition == null)
			{	
				subtitleEdge = jfreeChart.getTitle().getPosition();
			}
			else
			{
				subtitleEdge = defaultSubtitlePosition;
			}
			if (subtitleEdge != null)
				subtitle.setPosition(subtitleEdge);
			
			jfreeChart.addSubtitle(subtitle);
		}
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:60,代码来源:GenericChartTheme.java


注:本文中的org.jfree.chart.title.TextTitle.setPosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。