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


Java PiePlot.setBackgroundPaint方法代码示例

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


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

示例1: generatePieChart

import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
public static JFreeChart generatePieChart()
{
    DefaultPieDataset dataSet = new DefaultPieDataset();
    dataSet.setValue("China", 30);
    dataSet.setValue("India", 30);
    dataSet.setValue("United States", 40);

    JFreeChart chart = ChartFactory.createPieChart("", dataSet, false, true, false);
    PiePlot piePlot = (PiePlot) chart.getPlot();
    piePlot.setBackgroundPaint(Color.WHITE); // set background color white
    piePlot.setOutlineVisible(false); // remove background border
    piePlot.setLabelGenerator(null); // remove pie section labels
    piePlot.setSectionPaint("China", Color.GRAY);
    piePlot.setSectionPaint("India", Color.GREEN);
    piePlot.setSectionPaint("United States", Color.BLUE);
    piePlot.setShadowPaint(Color.WHITE);

    return chart;
}
 
开发者ID:mkl-public,项目名称:testarea-itext5,代码行数:20,代码来源:JFreeChartTest.java

示例2: createPieChart

import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
private static JFreeChart createPieChart(PieDataset piedataset, GraphDataItem item) {
	JFreeChart jfreechart = ChartFactory.createPieChart(item.getTitle(), piedataset, true, true, false);
	Font font = new Font("宋体", Font.PLAIN, 13);
	jfreechart.getTitle().setFont(font);
	jfreechart.getLegend().setItemFont(font);
	PiePlot pieplot = (PiePlot) jfreechart.getPlot();
	pieplot.setBackgroundPaint(ChartColor.WHITE);
	pieplot.setLabelFont(font);
	pieplot.setLabelGenerator(new StandardPieSectionLabelGenerator(("{0}: ({2})"),
			NumberFormat.getNumberInstance(), new DecimalFormat("0.00%")));
	pieplot.setLabelBackgroundPaint(new Color(220, 220, 220));
	pieplot.setSimpleLabels(true);
	pieplot.setInteriorGap(0.0D);

	int index = 0;
	for (Object name : item.getDatas().keySet()) {
		pieplot.setSectionPaint((String) name, COLORS[index % COLORS.length]);
		index++;

	}
	return jfreechart;
}
 
开发者ID:jdepend,项目名称:cooper,代码行数:23,代码来源:PieChartCreater.java

示例3: ChartWidget

import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
public ChartWidget() {		
	
	rightLabel = new JLabel();
	Font rightFont = new Font("Verdana", Font.PLAIN, 12);
	rightLabel.setHorizontalAlignment(JLabel.LEFT);
	rightLabel.setVerticalAlignment(JLabel.TOP);
	rightLabel.setFont(rightFont);
	this.add(rightLabel);		
	
	
	myColoredPieChart = new DefaultPieDataset();
	myColoredChart = ChartFactory.createPieChart3D("", myColoredPieChart,
			false, false, false);
	myColoredChart.setBorderVisible(false);
	myColoredChart.setBackgroundPaint(new Color(0, 0, 0, 0)); // transparent
																// black
	PiePlot configurator = (PiePlot) myColoredChart.getPlot();
	configurator.setBackgroundPaint(new Color(0, 0, 0, 0));
	configurator.setLabelGenerator(null);
	configurator.setOutlineVisible(false);
	ChartPanel chartPanel = new ChartPanel(myColoredChart, 150, 150, 150,
			150, 250, 250, true, false, false, false, false, false);
	this.add(chartPanel);
}
 
开发者ID:burningrain,项目名称:planetBot,代码行数:25,代码来源:ChartWidget.java

示例4: makePlot

import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
@Override
protected Plot makePlot(final JFreeChartBuilder.PlotParameters parameters) {

    final KeyedValuesDataset tmpDataset = this.getDataset();

    final PiePlot retVal = new PiePlot(tmpDataset);

    retVal.setShadowXOffset(0);
    retVal.setShadowYOffset(0);

    retVal.setBackgroundPaint(parameters.getBackground());
    retVal.setOutlinePaint(parameters.getOutline());

    retVal.setLabelGenerator(new StandardPieSectionLabelGenerator());

    if (this.isTooltips()) {
        retVal.setToolTipGenerator(new StandardPieToolTipGenerator());
    }
    if (this.isUrls()) {
        retVal.setURLGenerator(new StandardPieURLGenerator());
    }

    for (final Entry<Comparable<?>, Paint> tmpEntry : this.getColourSet()) {
        retVal.setSectionPaint(tmpEntry.getKey(), tmpEntry.getValue());
    }

    return retVal;
}
 
开发者ID:optimatika,项目名称:ojAlgo-extensions,代码行数:29,代码来源:PieChartBuilder.java

示例5: createChart

import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
protected JFreeChart createChart(PieDataset dataset) {
      // create the chart...
      JFreeChart chart = ChartFactory.createPieChart(
          chartTitle,  // chart title
          dataset,             // dataset
          !legendPanelOn,               // include legend
          true,
          false
      );

      // set the background color for the chart...
      chart.setBackgroundPaint(new Color(222, 222, 255));
      PiePlot plot = (PiePlot) chart.getPlot();
      plot.setBackgroundPaint(Color.white);
      plot.setCircular(true);
      for (int i=0; i<pulloutFlag.length; i++){
      	//System.out.println("\""+pulloutFlag[i]+"\"");
      	if (isPullout(i)){
      		Comparable key = dataset.getKey(i);
      		plot.setExplodePercent(key, 0.30);
      	}
      }
      plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} = {2}",
              NumberFormat.getNumberInstance(), 
              NumberFormat.getPercentInstance()));
      plot.setNoDataMessage("No data available");

      if(rotateOn){
      	Rotator rotator = new Rotator(plot);
      	rotator.start();
      }
setCategorySummary(dataset);
return chart;
  }
 
开发者ID:SOCR,项目名称:HTML5_WebSite,代码行数:35,代码来源:PieChartDemo4.java

示例6: getMultiplePieChart

import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
private JFreeChart getMultiplePieChart( BaseChart chart, CategoryDataset[] dataSets )
{
    JFreeChart multiplePieChart = ChartFactory.createMultiplePieChart( chart.getName(), dataSets[0], TableOrder.BY_ROW,
        !chart.isHideLegend(), false, false );

    setBasicConfig( multiplePieChart, chart );
    
    if ( multiplePieChart.getLegend() != null )
    {
        multiplePieChart.getLegend().setItemFont( SUB_TITLE_FONT );
    }
    
    MultiplePiePlot multiplePiePlot = (MultiplePiePlot) multiplePieChart.getPlot();
    JFreeChart pieChart = multiplePiePlot.getPieChart();
    pieChart.setBackgroundPaint( COLOR_TRANSPARENT );
    pieChart.getTitle().setFont( SUB_TITLE_FONT );

    PiePlot piePlot = (PiePlot) pieChart.getPlot();
    piePlot.setBackgroundPaint( COLOR_TRANSPARENT );
    piePlot.setOutlinePaint( COLOR_TRANSPARENT );
    piePlot.setLabelFont( LABEL_FONT );
    piePlot.setLabelGenerator( new StandardPieSectionLabelGenerator( "{2}" ) );
    piePlot.setSimpleLabels( true );
    piePlot.setIgnoreZeroValues( true );
    piePlot.setIgnoreNullValues( true );
    piePlot.setShadowXOffset( 0d );
    piePlot.setShadowYOffset( 0d );

    for ( int i = 0; i < dataSets[0].getColumnCount(); i++ )
    {
        piePlot.setSectionPaint( dataSets[0].getColumnKey( i ), COLORS[(i % COLORS.length)] );
    }

    return multiplePieChart;
}
 
开发者ID:ehatle,项目名称:AgileAlligators,代码行数:36,代码来源:DefaultChartService.java

示例7: stylePiePlot

import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
/**
 * Style the plot of a pie chart.
 */
public static void stylePiePlot(PiePlot plot) {
	plot.setLabelFont(EHtmlPresentationFont.SANS_CONDENSED.getFont());
	plot.setSectionOutlinesVisible(false);
	plot.setLabelGap(0.02);
	plot.setBackgroundPaint(Color.WHITE);
}
 
开发者ID:vimaier,项目名称:conqat,代码行数:10,代码来源:PieChartCreator.java

示例8: erstelleKuchenDiagramm

import org.jfree.chart.plot.PiePlot; //导入方法依赖的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

示例9: renderChartToFile

import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
private Image renderChartToFile(TotalPaymentSummaryReportResponse response, File chartFile) throws IOException,
        BadElementException, MalformedURLException {
    // For generating pie chart for total payments(example for total deposits) perform following:
    // Create the dataset
    DefaultPieDataset dataset = new DefaultPieDataset();

    dataset.setValue("Pre 10/82 Deposit", response.getTotalDepositsPre1082());
    dataset.setValue("Pre 10/82 Redeposit", response.getTotalRedepositsPre1082());
    dataset.setValue("CSRS: Post 9/82 Deposit", response.getCsrsDepositsPost982());
    dataset.setValue("FERS Postal", response.getFersPostalDepositsPost982());
    dataset.setValue("FERS Non Postal", response.getFersNonPostalDepositsPost982());
    dataset.setValue("Post 9/82 Deposit", response.getTotalDepositsPost982());
    dataset.setValue("Post 9/82 Redeposit", response.getTotalRedepositsPost982());

    // Set following data
    // Create the chart
    JFreeChart chart = ChartFactory.createPieChart("Total Payments", dataset, true, true, false);

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setLabelFont(new Font("Helvetica", 0, 10));
    plot.setBackgroundPaint(Color.white);
    plot.setIgnoreZeroValues(false);
    plot.setOutlineVisible(false);

    chart.getTitle().setFont(new Font("Helvetica", 1, 14));

    LegendTitle legend = chart.getLegend();
    legend.setItemFont(new Font("Helvetica", 0, 10));
    legend.setPosition(RectangleEdge.RIGHT);

    ChartUtilities.saveChartAsPNG(chartFile, chart, chartWidth, chartHeight);
    Image image = Image.getInstance(chartFile.getAbsolutePath());
    return image;
}
 
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:35,代码来源:TotalPaymentSummaryReportService.java

示例10: createPieChart

import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
private JFreeChart createPieChart() throws QueryException {		
	pieDataset = new DefaultPieDataset();
	String chartTitle = replaceParameters(chart.getTitle().getTitle());
	chartTitle = StringUtil.getI18nString(chartTitle, I18nUtil.getLanguageByName(chart, language));
	JFreeChart jfreechart = ChartFactory.createPieChart(
			    chartTitle,
                pieDataset, 
                true, 
                true, 
                false);
	
	// hide border
	jfreechart.setBorderVisible(false);
	
	// title
	setTitle(jfreechart);
	
	PiePlot plot = (PiePlot)jfreechart.getPlot();
	plot.setForegroundAlpha(transparency);
	// a start angle used to create similarities between flash chart and this jfreechart
	plot.setStartAngle(330);	
	// legend label will contain the text and the value
	plot.setLegendLabelGenerator(new StandardPieSectionLabelGenerator("{0} = {1}"));
	
	// no shadow
	plot.setShadowXOffset(0);
	plot.setShadowYOffset(0);
	
	DecimalFormat decimalformat;
	DecimalFormat percentageFormat;
	if (chart.getYTooltipPattern() == null) {
       	decimalformat = new DecimalFormat("#");
       	percentageFormat = new DecimalFormat("0.00%");
	} else {
		decimalformat = new DecimalFormat(chart.getYTooltipPattern());
		percentageFormat = decimalformat;
	}
	boolean showValues = (chart.getShowYValuesOnChart() == null) ? false : chart.getShowYValuesOnChart();
	if (showValues) {
		// label will contain also the percentage formatted with two decimals
		plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} ({2})", decimalformat, percentageFormat));
	}
	
	// chart background
       plot.setBackgroundPaint(chart.getBackground());
                                                     
       createChart(null, new Object[1]);   
       
       // after chart creation we can set slices colors
       List <Comparable> keys = pieDataset.getKeys();
       List<Color> colors = chart.getForegrounds();
       for (int i = 0, size = colors.size(); i < keys.size(); i++) {            	
           plot.setSectionPaint(keys.get(i), colors.get(i % size));
           plot.setLabelFont(chart.getFont());
       }
	
	return jfreechart;
}
 
开发者ID:nextreports,项目名称:nextreports-engine,代码行数:59,代码来源:JFreeChartExporter.java

示例11: createChart

import org.jfree.chart.plot.PiePlot; //导入方法依赖的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

示例12: createChart

import org.jfree.chart.plot.PiePlot; //导入方法依赖的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

示例13: createChart

import org.jfree.chart.plot.PiePlot; //导入方法依赖的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

示例14: renderChartInfo

import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
private void renderChartInfo() {
    Hashtable<Object, Marker> marks = new Hashtable<>();
    DefaultPieDataset dataset = buildDataset(marks);

    JFreeChart chart = ChartFactory.createPieChart(
            null, // chart title
            dataset, // data
            true, // include legend
            true,
            false);
    chart.setBackgroundPaint(null);
    //chart.setBorderStroke(null);
    chart.setBorderVisible(false);
    final PiePlot plot = (PiePlot) chart.getPlot();
    // plot.setBackgroundPaint(null);
    //  plot.setShadowPaint(null);

    Enumeration<Object> markKeys = marks.keys();


    while (markKeys.hasMoreElements()) {
        if (iCurrentView == ID_ALLY_CHART) {
            Ally a = (Ally) markKeys.nextElement();
            plot.setSectionPaint(a.getTag(), marks.get(a).getMarkerColor());
        } else {
            Tribe t = (Tribe) markKeys.nextElement();
            plot.setSectionPaint(t.getName(), marks.get(t).getMarkerColor());
        }
    }
    //plot.setCircular(true);
    //  plot.setMaximumLabelWidth(30.0);
 /*
     * plot.setLabelGenerator(new StandardPieSectionLabelGenerator( "{0} = {2}", NumberFormat.getNumberInstance(),
     * NumberFormat.getPercentInstance()));
     */
    //   chart.getLegend().setVerticalAlignment(VerticalAlignment.CENTER);
    //  chart.getLegend().setPosition(RectangleEdge.RIGHT);
    // plot.setMaximumLabelWidth(20.0);
    plot.setLabelGenerator(null);
    plot.setBackgroundPaint(Constants.DS_BACK);
    /*
     * plot.setInteriorGap(0.0); plot.setLabelGap(0.0);
     */
    plot.setLegendLabelGenerator(new StandardPieSectionLabelGenerator(
            "{0} = {2}", NumberFormat.getNumberInstance(), NumberFormat.getPercentInstance()));

    /*
     * plot.getL plot.setLabelFont(g2d.getFont().deriveFont(10.0f));
     */


    //plot.setLabelGenerator(null);

    //plot.setMaximumLabelWidth(30.0);
    //plot.getLabelDistributor().distributeLabels(10.0, 20.0);
    //chart.draw(g2d, new Rectangle2D.Float(20, 20, 100, 100));

    //  g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha));
    plot.setOutlineVisible(false);
    mChartImage = chart.createBufferedImage(getWidth(), getHeight());
    //chart.draw(g2d, new Rectangle2D.Float(50, 50, 400, 400));
    //g2d.drawImage(bi, 30, 30, null);

    //  g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha));

    //bi = chart.createBufferedImage(240, 240);
    // g2d.drawImage(bi, 30, 30, null);
}
 
开发者ID:Torridity,项目名称:dsworkbench,代码行数:69,代码来源:MinimapPanel.java

示例15: generatePieChart

import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
private byte[] generatePieChart(
		String siteId, PieDataset dataset, int width, int height,
		boolean render3d, float transparency,
		boolean smallFontInDomainAxis) {
	JFreeChart chart = null;
	if(render3d)
		chart = ChartFactory.createPieChart3D(null, dataset, false, false, false);
	else
		chart = ChartFactory.createPieChart(null, dataset, false, false, false);
	PiePlot plot = (PiePlot) chart.getPlot();
	
	// set start angle (135 or 150 deg so minor data has more space on the left)
	plot.setStartAngle(150D);
	
	// set transparency
	plot.setForegroundAlpha(transparency);
	
	// set background
	chart.setBackgroundPaint(parseColor(M_sm.getChartBackgroundColor()));
	plot.setBackgroundPaint(parseColor(M_sm.getChartBackgroundColor()));
	
	// fix border offset		
	chart.setPadding(new RectangleInsets(5,5,5,5));
	plot.setInsets(new RectangleInsets(1,1,1,1));
	// set chart border
	plot.setOutlinePaint(null);
	chart.setBorderVisible(true);
	chart.setBorderPaint(parseColor("#cccccc"));
	
	// set antialias
	chart.setAntiAlias(true);
	
	BufferedImage img = chart.createBufferedImage(width, height);
	final ByteArrayOutputStream out = new ByteArrayOutputStream();
	try{
		ImageIO.write(img, "png", out);
	}catch(IOException e){
		log.warn("Error occurred while generating SiteStats chart image data", e);
	}
	return out.toByteArray();
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:42,代码来源:ChartServiceImpl.java


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