當前位置: 首頁>>代碼示例>>Java>>正文


Java PiePlot.setSectionPaint方法代碼示例

本文整理匯總了Java中org.jfree.chart.plot.PiePlot.setSectionPaint方法的典型用法代碼示例。如果您正苦於以下問題:Java PiePlot.setSectionPaint方法的具體用法?Java PiePlot.setSectionPaint怎麽用?Java PiePlot.setSectionPaint使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jfree.chart.plot.PiePlot的用法示例。


在下文中一共展示了PiePlot.setSectionPaint方法的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: customize

import org.jfree.chart.plot.PiePlot; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
@Override
public void customize(JFreeChart chart, JRChart jasperChart) {
	
	PiePlot plot = (PiePlot) chart.getPlot();
	plot.setSectionPaint(4, new Color(0, 70, 120));
	plot.setSectionPaint(3, new Color(0, 70, 120));
	plot.setSectionPaint(2, new Color(189, 216, 77));
	plot.setSectionPaint(1, new Color(253, 224, 94));
	plot.setSectionPaint(0, new Color(219, 109, 29));
	
	PieSectionLabelGenerator generator = new StandardPieSectionLabelGenerator("{0}: {1} ({2})");
	plot.setLabelGenerator(generator);
	
	plot.setLabelBackgroundPaint(new Color(255,255,255));
	
	Font font = new Font(Font.SANS_SERIF, Font.PLAIN, 12);
	plot.setLabelFont(font);
}
 
開發者ID:jqxin2006,項目名稱:threadfixRack,代碼行數:20,代碼來源:PointInTimeChartCustomizer.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: setPiePlotColours

import org.jfree.chart.plot.PiePlot; //導入方法依賴的package包/類
public static void setPiePlotColours(JFreeChart chart, int numberOfSections, Color baseColor) {
    Color color = baseColor;
    PiePlot plot = (PiePlot) chart.getPlot();
    for (int i = 0; i < numberOfSections; i++) {
        try {
            plot.setSectionOutlinePaint(plot.getDataset().getKey(i), baseColor.darker().darker().darker());
            color = darken(color);
            plot.setSectionPaint(plot.getDataset().getKey(i), color);
        } catch (java.lang.IndexOutOfBoundsException ex) {
            // not data for all the categories - that is fine
            Logger.getLogger(TopNChartTableBuilder.class.getName()).log(Level.INFO, null, ex);
        }
    }
}
 
開發者ID:IARC-CSU,項目名稱:CanReg5,代碼行數:15,代碼來源:Tools.java

示例6: applyTo

import org.jfree.chart.plot.PiePlot; //導入方法依賴的package包/類
/**
 * Applied the chart style to the chart passed as parameter.
 *
 * @param chart the chart to apply the style to
 * @param dataset the dataset associated with the chart
 */
public void applyTo(JFreeChart chart, final PieDataset dataset) {
    PiePlot plot = (PiePlot) chart.getPlot();
    List<String> keys = dataset.getKeys();
    int coloursSize = colours.size();
    int colourMod;
    for (int i = 0; i < keys.size(); i++) {
        colourMod = i % coloursSize;
        plot.setSectionPaint(keys.get(i), this.colours.get(colourMod));
    }

}
 
開發者ID:c2mon,項目名稱:c2mon-web-ui,代碼行數:18,代碼來源:PieChartStyle.java

示例7: addDiskUsageObservation

import org.jfree.chart.plot.PiePlot; //導入方法依賴的package包/類
private void addDiskUsageObservation(long usedSize, long availableSize) {
	String usedLabel = "已使用"+usedSize/(1024*1024)+"GB";
	String avaiLabel = "未使用"+availableSize/(1024*1024)+"GB";
	dataset.clear();
	dataset.setValue(avaiLabel, availableSize);
	dataset.setValue(usedLabel, usedSize);

	PiePlot plot = (PiePlot)chart.getPlot();
	plot.setExplodePercent(avaiLabel, 0.05);
	plot.setExplodePercent(usedLabel, 0.05);
	plot.setSectionPaint(avaiLabel, Color.BLUE);
	plot.setSectionPaint(usedLabel, Color.RED);
}
 
開發者ID:uestc-lsu,項目名稱:LPCM,代碼行數:14,代碼來源:PieChart.java

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

示例9: setColor

import org.jfree.chart.plot.PiePlot; //導入方法依賴的package包/類
public void setColor(PiePlot plot, PieDataset dataset) 
{ 
    List <Comparable> keys = dataset.getKeys(); 
    int aInt; 

    for (int i = 0; i < keys.size(); i++) 
    { 
        aInt = i % this.color.length; 
        plot.setSectionPaint(keys.get(i), this.color[aInt]); 
    } 
}
 
開發者ID:JD-Software,項目名稱:JDeSurvey,代碼行數:12,代碼來源:StatisticsController.java

示例10: configurationChanged

import org.jfree.chart.plot.PiePlot; //導入方法依賴的package包/類
public void configurationChanged() {
    // change all the colors
    PiePlot plot = (PiePlot)dataChart.getPlot(); 
    for(int i = 0; i < NABFlow.NUM_TYPES; i++){
        plot.setSectionPaint(i, gSet.getTypeColor(i));
    }
}
 
開發者ID:nologic,項目名稱:nabs,代碼行數:8,代碼來源:Main.java

示例11: configurationChanged

import org.jfree.chart.plot.PiePlot; //導入方法依賴的package包/類
public void configurationChanged() {
    // change all the colors
    PiePlot plot = (PiePlot)dataChart.getPlot(); 
    for(int i = 0; i < NABFlow.NUM_TYPES; i++){
        plot.setSectionPaint(i, Settings.getTypeColor(i));
    }
}
 
開發者ID:nologic,項目名稱:nabs,代碼行數:8,代碼來源:Main.java

示例12: setColor

import org.jfree.chart.plot.PiePlot; //導入方法依賴的package包/類
/**
 * Iterates through the Pie dataset keys and assigns proper colors to their
 * segments.
 *
 * @param plot PiePlot object.
 * @param dataset DefaultPieDataset that the charts is drawn from.
 */
public void setColor(PiePlot plot, DefaultPieDataset dataset) {
    List<Comparable> keys = dataset.getKeys();
    int colorIndex;
    for (int i = 0; i < keys.size(); i++) {
        colorIndex = i % this.colors.length;
        plot.setSectionPaint(keys.get(i), this.colors[colorIndex]);
    }
}
 
開發者ID:datapoet,項目名稱:hubminer,代碼行數:16,代碼來源:PieRenderer.java

示例13: setColors

import org.jfree.chart.plot.PiePlot; //導入方法依賴的package包/類
/** Set colors for traffic light colors properly. */
@SuppressWarnings("unchecked")
private void setColors(PiePlot plot, PieDataset dataSet) {
	List<Comparable<?>> keys = dataSet.getKeys();

	for (Comparable<?> key : keys) {
		if (key instanceof ETrafficLightColor) {
			plot.setSectionPaint(key, AssessmentColorizer
					.determineColor((ETrafficLightColor) key));
		}
	}
}
 
開發者ID:vimaier,項目名稱:conqat,代碼行數:13,代碼來源:PieChartCreator.java

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

示例15: formatChart

import org.jfree.chart.plot.PiePlot; //導入方法依賴的package包/類
private void formatChart(PiePlot plot, Hashtable colormap, String label) {
    // Set the chart colors
    Enumeration keys = colormap.keys();
    while (keys.hasMoreElements()) {
        String name = (String) keys.nextElement();
        Color color = (Color) colormap.get(name);
        if (color == null) {
            color = DEFAULT_COLOR;
        }
        plot.setSectionPaint(name, color);
    }

    // Set the chart label format
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{1} " + label + " ({2})"));
}
 
開發者ID:ModelN,項目名稱:build-management,代碼行數:16,代碼來源:CMnChartFormatter.java


注:本文中的org.jfree.chart.plot.PiePlot.setSectionPaint方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。