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


Java TextTitle.setHorizontalAlignment方法代码示例

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


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

示例1: getChartPanel

import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
private ChartPanel getChartPanel() {

		if (chartPanel == null) {

			CombinedDomainXYPlot combinedDomainXYPlot = getCombinedDomainXYPlot();

			JFreeChart jFreeChart = new JFreeChart(filename, JFreeChart.DEFAULT_TITLE_FONT, combinedDomainXYPlot,
					false);

			ChartUtilities.applyCurrentTheme(jFreeChart);

			// customise the title position and font
			TextTitle t = jFreeChart.getTitle();
			t.setHorizontalAlignment(HorizontalAlignment.CENTER);
			t.setPaint(Color.DARK_GRAY);
			t.setFont(new Font("Arial", Font.BOLD, 12));
			t.setPadding(10, 10, 5, 10);

			chartPanel = new ChartPanel(jFreeChart);

			chartPanel.setMinimumDrawWidth(0);
			chartPanel.setMinimumDrawHeight(0);
			chartPanel.setMaximumDrawWidth(Integer.MAX_VALUE);
			chartPanel.setMaximumDrawHeight(Integer.MAX_VALUE);
			chartPanel.setMouseWheelEnabled(true);

			LogTableModel logTableModel = (LogTableModel) logTable.getModel();

			NavigationTableController<Integer> navigationTableController;
			navigationTableController = new NavigationTableController<Integer>(logTableModel);
			navigationTableController.addCustomJTable(logTable);

			chartPanel.addChartMouseListener(
					new CombinedDomainXYPlotMouseListener(chartPanel, logTableModel, navigationTableController));

			chartPanel.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 1));
		}

		return chartPanel;
	}
 
开发者ID:pegasystems,项目名称:pega-logviewer,代码行数:41,代码来源:ChartAndLegendPanel.java

示例2: erstelleDiagramm

import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
/**
 * Erstellt ein Stabdiagramm aus den Parametern.
 * 
 * @param dataset
 *            Datenset
 * @param titel
 *            Titel
 * @return {@link JFreeChart}
 */
protected JFreeChart erstelleDiagramm(CategoryDataset dataset,
		String titel, String reihenBeschriftung, String spaltenBeschriftung) {
	// create the chart...
	JFreeChart chart = ChartFactory.createBarChart3D(titel,
			reihenBeschriftung, spaltenBeschriftung, dataset,
			PlotOrientation.VERTICAL, true, true, false);

	TextTitle t = chart.getTitle();
	t.setHorizontalAlignment(HorizontalAlignment.CENTER);
	t.setFont(new Font("Arial", Font.CENTER_BASELINE, 26));

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

	NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
	rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

	BarRenderer renderer = (BarRenderer) plot.getRenderer();
	renderer.setDrawBarOutline(false);

	for (int i = 0; i < parteienListe.size(); i++) {
		if (parteienListe.get(i).getFarbe() != null) {
			GradientPaint gp = new GradientPaint(0.0f, 0.0f, parteienListe
					.get(i).getFarbe(), 0.0f, 0.0f, new Color(parteienListe
					.get(i).getFarbe().getRGB()));
			renderer.setSeriesPaint(i, gp);
		}
	}

	CategoryAxis domainAxis = plot.getDomainAxis();
	domainAxis.setCategoryLabelPositions(CategoryLabelPositions
			.createUpRotationLabelPositions(Math.PI / 6.0));

	return chart;
}
 
开发者ID:Bundeswahlrechner,项目名称:Bundeswahlrechner,代码行数:45,代码来源:EinWahlStabdiagrammAnsicht.java

示例3: erstelleKuchenDiagramm

import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
/**
 * Erstellt ein Kuchendiagramm aus den Parametern.
 * 
 * @param dataset
 *            Datenset
 * @param titel
 *            Titel
 * @return {@link JFreeChart}
 */
private JFreeChart erstelleKuchenDiagramm(PieDataset dataset, String titel) {
	JFreeChart chart = ChartFactory.createPieChart3D(titel, dataset, true,
			true, false);

	TextTitle t = chart.getTitle();
	t.setHorizontalAlignment(HorizontalAlignment.CENTER);
	t.setFont(new Font("Arial", Font.CENTER_BASELINE, 26));

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

	for (Partei partei : parteienListe) {
		if (partei.getFarbe() != null) {
			plot.setSectionPaint(
					partei.getName(),
					createGradientPaint(partei.getFarbe(),
							partei.getFarbe()));
		}
	}

	plot.setBaseSectionOutlinePaint(Color.GRAY);
	plot.setLabelFont(new Font("Arial", Font.BOLD, 15));
	plot.setLabelLinkPaint(Color.black);
	plot.setLabelPaint(Color.black);
	plot.setLabelBackgroundPaint(null);

	return chart;

}
 
开发者ID:Bundeswahlrechner,项目名称:Bundeswahlrechner,代码行数:41,代码来源:EinWahlKuchendiagrammAnsicht.java

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: createChart

import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
/**
   * Creates a sample chart.
   * 
   * @param dataset  a dataset.
   * 
   * @return The chart.
   */
  protected JFreeChart createChart(CategoryDataset dataset) {
  	 if(isDemo){
  		 chartTitle = "Java Standard Class Library";
  		 domainLabel = "Release";
  		 rangeLabel ="Class Count";
  	 }else chartTitle="Line Chart";
  	 
  	
      // create the chart...
      JFreeChart chart = ChartFactory.createLineChart(
          chartTitle,   // chart title
          domainLabel,                       // domain axis label
          rangeLabel,                   // range axis label
          dataset,                         // data
          PlotOrientation.VERTICAL,        // orientation
          !legendPanelOn,                           // include legend
          true,                            // tooltips
          false                            // urls
      );

      if(isDemo){
       chart.addSubtitle(new TextTitle("Number of Classes By Release"));
       TextTitle source = new TextTitle(
           "Source: Java In A Nutshell (4th Edition) " 
           + "by David Flanagan (O'Reilly)"
       );
       source.setFont(new Font("SansSerif", Font.PLAIN, 10));
       source.setPosition(RectangleEdge.BOTTOM);
       source.setHorizontalAlignment(HorizontalAlignment.RIGHT);
       chart.addSubtitle(source);
      }else{
      	chart.clearSubtitles();
      }
      
      chart.setBackgroundPaint(Color.white);

      CategoryPlot plot = (CategoryPlot) chart.getPlot();
      plot.setBackgroundPaint(Color.lightGray);
      plot.setRangeGridlinePaint(Color.white);

      // customise the range axis...
      NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
      rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

      // customise the renderer...
      LineAndShapeRenderer renderer 
          = (LineAndShapeRenderer) plot.getRenderer();
      renderer.setBaseShapesVisible(true);
      renderer.setDrawOutlines(true);
      renderer.setUseFillPaint(true);
      renderer.setBaseFillPaint(Color.white);
      renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());

setCategorySummary(dataset);
      return chart;
  }
 
开发者ID:SOCR,项目名称:HTML5_WebSite,代码行数:64,代码来源:LineChartDemo1.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(JFreeChart.getFont(), 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(JFreeChart.getFont(), 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(JFreeChart.getFont(),
			Font.PLAIN, 12));
	source.setPaint(Color.WHITE);
	source.setPosition(RectangleEdge.BOTTOM);
	source.setHorizontalAlignment(HorizontalAlignment.RIGHT);
	chart.addSubtitle(source);
	return chart;

}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:58,代码来源:PieChartDemo1.java

示例12: getChart

import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
private static JFreeChart getChart(String type,
        Map<Parameter, XYDataset> parameter2SeriesCollection, Collection<String> varList,
        HorizontalPosition hPos, String copyrightStatement, String domainLabel,
        PlotOrientation orientation, boolean invertDomainAxis) {

    String title = getTitle(type, varList, hPos);

    XYPlot plot = new XYPlot();

    NumberAxis domainAxis = new NumberAxis(domainLabel);
    domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    domainAxis.setAutoRangeIncludesZero(false);
    domainAxis.setInverted(invertDomainAxis);
    plot.setDomainAxis(domainAxis);

    int i = 0;
    boolean legendNeeded = false;
    for (Entry<Parameter, XYDataset> entry : parameter2SeriesCollection.entrySet()) {
        if (i > 0) {
            legendNeeded = true;
        }
        XYDataset coll = entry.getValue();

        if (coll.getSeriesCount() > 0) {
            NumberAxis valueAxis = new NumberAxis();
            valueAxis.setAutoRangeIncludesZero(false);
            valueAxis.setAutoRange(true);
            valueAxis.setNumberFormatOverride(NUMBER_FORMAT);
            Parameter parameter = entry.getKey();
            valueAxis.setLabel(parameter.getStandardName() + " (" + parameter.getUnits() + ")");
            plot.setDataset(i, coll);
            plot.setRangeAxis(i, valueAxis);
            XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
            for (int j = 0; j < coll.getSeriesCount(); j++) {
                renderer.setSeriesShape(j, new Ellipse2D.Double(-1.0, -1.0, 2.0, 2.0));
                renderer.setSeriesShapesVisible(j, true);
                if (j > 0) {
                    legendNeeded = true;
                }
            }
            plot.setRenderer(i, renderer);
            plot.mapDatasetToRangeAxis(i, i);
            i++;
        }
    }

    plot.setNoDataMessage("There is no data for your choice");
    plot.setNoDataMessageFont(new Font("sansserif", Font.BOLD, 20));
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinesVisible(false);
    plot.setRangeGridlinePaint(Color.white);
    plot.setOrientation(orientation);

    /*
     * Use default font and create a legend if there are multiple lines
     */
    JFreeChart chart = new JFreeChart(title.toString(), null, plot, legendNeeded);

    if (copyrightStatement != null) {
        final TextTitle textTitle = new TextTitle(copyrightStatement);
        textTitle.setFont(new Font("SansSerif", Font.PLAIN, 10));
        textTitle.setPosition(RectangleEdge.BOTTOM);
        textTitle.setHorizontalAlignment(HorizontalAlignment.RIGHT);
        chart.addSubtitle(textTitle);
    }

    return chart;
}
 
开发者ID:Reading-eScience-Centre,项目名称:edal-java,代码行数:69,代码来源:Charting.java

示例13: addVerticalSectionChart

import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
public static JFreeChart addVerticalSectionChart(JFreeChart transectChart,
        JFreeChart verticalSectionChart) {
    /*
     * Create the combined chart with both the transect and the vertical
     * section
     */
    CombinedDomainXYPlot plot = new CombinedDomainXYPlot(
            new NumberAxis("Distance along path (km)"));
    plot.setGap(20.0);
    plot.add(transectChart.getXYPlot(), 1);
    plot.add(verticalSectionChart.getXYPlot(), 1);
    plot.setOrientation(PlotOrientation.VERTICAL);
    String title = transectChart.getTitle().getText();
    String copyright = null;
    for (int i = 0; i < transectChart.getSubtitleCount(); i++) {
        Title subtitle = transectChart.getSubtitle(i);
        if (subtitle instanceof TextTitle) {
            copyright = ((TextTitle) transectChart.getSubtitle(0)).getText();
            break;
        }
    }

    JFreeChart combinedChart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot,
            false);

    /* Set left margin to 10 to avoid number wrap at color bar */
    RectangleInsets r = new RectangleInsets(0, 10, 0, 0);
    transectChart.setPadding(r);

    /*
     * This is not ideal. We have already added the copyright label to the
     * first chart, but then we extract the actual plot, so we need to add
     * it again here
     */
    if (copyright != null) {
        final TextTitle textTitle = new TextTitle(copyright);
        textTitle.setFont(new Font("SansSerif", Font.PLAIN, 10));
        textTitle.setPosition(RectangleEdge.BOTTOM);
        textTitle.setHorizontalAlignment(HorizontalAlignment.RIGHT);
        combinedChart.addSubtitle(textTitle);
    }

    /* Use the legend from the vertical section chart */
    combinedChart.addSubtitle(verticalSectionChart.getSubtitle(0));

    return combinedChart;
}
 
开发者ID:Reading-eScience-Centre,项目名称:edal-java,代码行数:48,代码来源:Charting.java

示例14: getBoxAndWiskerPanel

import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
/**
 * @return the boxAndWiskerPanel
 */
private ChartPanel getBoxAndWiskerPanel() {

	if (boxAndWiskerPanel == null) {

		CombinedDomainCategoryPlot combinedBoxAndWiskerCategoryPlot = getCombinedBoxAndWiskerCategoryPlot();

		JFreeChart jFreeChart = new JFreeChart("  ", JFreeChart.DEFAULT_TITLE_FONT,
				combinedBoxAndWiskerCategoryPlot, false);

		ChartUtilities.applyCurrentTheme(jFreeChart);

		TextTitle t = jFreeChart.getTitle();
		t.setHorizontalAlignment(HorizontalAlignment.CENTER);
		t.setPaint(Color.DARK_GRAY);
		t.setFont(new Font("Arial", Font.BOLD, 12));
		t.setPadding(10, 10, 5, 10);

		boxAndWiskerPanel = new ChartPanel(jFreeChart);

		Dimension preferredSize = new Dimension(140, 200);

		boxAndWiskerPanel.setMinimumSize(preferredSize);
		boxAndWiskerPanel.setPreferredSize(preferredSize);

		boxAndWiskerPanel.setMinimumDrawWidth(0);
		boxAndWiskerPanel.setMinimumDrawHeight(0);
		boxAndWiskerPanel.setMaximumDrawWidth(Integer.MAX_VALUE);
		boxAndWiskerPanel.setMaximumDrawHeight(Integer.MAX_VALUE);
		boxAndWiskerPanel.setMouseWheelEnabled(true);

		boxAndWiskerPanel.addChartMouseListener(new CombinedDomainCategoryPlotMouseListener(chartPanel, logTable));

		boxAndWiskerPanel.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 1));

		// TODO revert when functionality done
		boxAndWiskerPanel.setVisible(true);

	}

	return boxAndWiskerPanel;
}
 
开发者ID:pegasystems,项目名称:pega-logviewer,代码行数:45,代码来源:ChartAndLegendPanel.java


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