当前位置: 首页>>代码示例>>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;未经允许,请勿转载。