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


Java PiePlot.setLabelFont方法代碼示例

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


在下文中一共展示了PiePlot.setLabelFont方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createChartCategory

import org.jfree.chart.plot.PiePlot; //導入方法依賴的package包/類
/**
 * Creates a sample chart for the given dataset.
 *
 * @param dataset
 *            the dataset.
 *
 * @return A sample chart.
 */
private JFreeChart createChartCategory(final CategoryDataset dataset) {
	final JFreeChart chart = ChartFactory.createMultiplePieChart3D("Multiple Pie Chart Demo 4", dataset,
			TableOrder.BY_COLUMN, false, true, false);
	chart.setBackgroundPaint(new Color(216, 255, 216));
	final MultiplePiePlot plot = (MultiplePiePlot) chart.getPlot();
	final JFreeChart subchart = plot.getPieChart();
	// final StandardLegend legend = new StandardLegend();
	// legend.setItemFont(new Font("SansSerif", Font.PLAIN, 8));
	// legend.setAnchor(Legend.SOUTH);
	// subchart.setLegend(legend);
	plot.setLimit(0.10);
	final PiePlot p = (PiePlot) subchart.getPlot();
	// p.setLabelGenerator(new StandardPieItemLabelGenerator("{0}"));
	p.setLabelFont(new Font("SansSerif", Font.PLAIN, 8));
	p.setInteriorGap(0.30);

	return chart;
}
 
開發者ID:rototor,項目名稱:pdfbox-graphics2d,代碼行數:27,代碼來源:MultiPageTest.java

示例2: PieChart

import org.jfree.chart.plot.PiePlot; //導入方法依賴的package包/類
public PieChart() {
    DefaultPieDataset data = getDataSet();
    JFreeChart chart = ChartFactory.createPieChart3D("水果產量", data, true, false, false);
    //設置百分比
    PiePlot pieplot = (PiePlot) chart.getPlot();
    DecimalFormat df = new DecimalFormat("0.00%");//獲得一個DecimalFormat對象,主要是設置小數問題
    NumberFormat nf = NumberFormat.getNumberInstance();//獲得一個NumberFormat對象
    StandardPieSectionLabelGenerator sp1 = new StandardPieSectionLabelGenerator("{0}  {2}", nf, df);//獲得StandardPieSectionLabelGenerator對象
    pieplot.setLabelGenerator(sp1);//設置餅圖顯示百分比

    //沒有數據的時候顯示的內容
    pieplot.setNoDataMessage("無數據顯示");
    pieplot.setCircular(false);
    pieplot.setLabelGap(0.02D);

    pieplot.setIgnoreNullValues(true);//設置不顯示空值
    pieplot.setIgnoreZeroValues(true);//設置不顯示負值
    frame1 = new ChartPanel(chart, true);
    chart.getTitle().setFont(new Font("宋體", Font.BOLD, 20));//設置標題字體
    PiePlot piePlot = (PiePlot) chart.getPlot();//獲取圖表區域對象
    piePlot.setLabelFont(new Font("宋體", Font.BOLD, 10));//解決亂碼
    chart.getLegend().setItemFont(new Font("黑體", Font.BOLD, 10));
}
 
開發者ID:leon66666,項目名稱:financehelper,代碼行數:24,代碼來源:PieChart.java

示例3: 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(
        "Pie Chart Demo 1",  // chart title
        dataset,             // data
        true,               // include legend
        true,
        false
    );

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setSectionOutlinesVisible(false);
    plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
    plot.setNoDataMessage("No data available");
    plot.setCircular(false);
    plot.setLabelGap(0.02);
    return chart;
    
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:27,代碼來源:SWTPieChartDemo1.java

示例4: applyToPiePlot

import org.jfree.chart.plot.PiePlot; //導入方法依賴的package包/類
/**
 * Applies the attributes of this theme to a {@link PiePlot} instance.
 * This method also clears any set values for the section paint, outline
 * etc, so that the theme's {@link DrawingSupplier} will be used.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 */
protected void applyToPiePlot(PiePlot plot) {
    plot.setLabelLinkPaint(this.labelLinkPaint);
    plot.setLabelLinkStyle(this.labelLinkStyle);
    plot.setLabelFont(this.regularFont);
    plot.setShadowGenerator(this.shadowGenerator);

    // clear the section attributes so that the theme's DrawingSupplier
    // will be used
    if (plot.getAutoPopulateSectionPaint()) {
        plot.clearSectionPaints(false);
    }
    if (plot.getAutoPopulateSectionOutlinePaint()) {
        plot.clearSectionOutlinePaints(false);
    }
    if (plot.getAutoPopulateSectionOutlineStroke()) {
        plot.clearSectionOutlineStrokes(false);
    }
}
 
開發者ID:mdzio,項目名稱:ccu-historian,代碼行數:26,代碼來源:StandardChartTheme.java

示例5: applyToPiePlot

import org.jfree.chart.plot.PiePlot; //導入方法依賴的package包/類
/**
 * Applies the attributes of this theme to a {@link PiePlot} instance.
 * This method also clears any set values for the section paint, outline
 * etc, so that the theme's {@link DrawingSupplier} will be used.
 *
 * @param plot  the plot ({@code null} not permitted).
 */
protected void applyToPiePlot(PiePlot plot) {
    plot.setLabelLinkPaint(this.labelLinkPaint);
    plot.setLabelLinkStyle(this.labelLinkStyle);
    plot.setLabelFont(this.regularFont);
    plot.setShadowGenerator(this.shadowGenerator);

    // clear the section attributes so that the theme's DrawingSupplier
    // will be used
    if (plot.getAutoPopulateSectionPaint()) {
        plot.clearSectionPaints(false);
    }
    if (plot.getAutoPopulateSectionOutlinePaint()) {
        plot.clearSectionOutlinePaints(false);
    }
    if (plot.getAutoPopulateSectionOutlineStroke()) {
        plot.clearSectionOutlineStrokes(false);
    }
}
 
開發者ID:jfree,項目名稱:jfreechart,代碼行數:26,代碼來源:StandardChartTheme.java

示例6: PieChart

import org.jfree.chart.plot.PiePlot; //導入方法依賴的package包/類
public PieChart(DefaultPieDataset dataset, String title, String hostIP){
	Font titleFont = new Font("微軟雅黑", Font.BOLD, 14);
	Font legendFont = new Font("微軟雅黑", Font.PLAIN, 10);
	Font plotFont = new Font("微軟雅黑", Font.PLAIN, 12);
	
	this.dataset = dataset;
	this.title = title;
	this.hostIP = hostIP;
	// create a chart...
	chart = ChartFactory.createPieChart(this.title,dataset,true, // legend?
			true, // tooltips?
			false // URLs?
	);
	
	chart.getLegend().setItemFont(legendFont);//設置圖例字體
	chart.getTitle().setFont(titleFont);//設置標題字體
	
	PiePlot plot = (PiePlot)chart.getPlot();//設置字體
	plot.setLabelFont(plotFont);
}
 
開發者ID:uestc-lsu,項目名稱:LPCM,代碼行數:21,代碼來源:PieChart.java

示例7: createEmptyChart

import org.jfree.chart.plot.PiePlot; //導入方法依賴的package包/類
protected JFreeChart createEmptyChart(PieDataset dataset) {

 		JFreeChart chart = ChartFactory.createPieChart(
             "SOCR Chart",  // chart title
             null,             // data
             true,                // include legend
             true,
             false
         );

         PiePlot plot = (PiePlot) chart.getPlot();
         plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
         plot.setNoDataMessage("No data available");
         plot.setCircular(false);
         plot.setLabelGap(0.02);
         return chart;
 }
 
開發者ID:SOCR,項目名稱:HTML5_WebSite,代碼行數:18,代碼來源:StockApplication.java

示例8: createEmptyChart

import org.jfree.chart.plot.PiePlot; //導入方法依賴的package包/類
protected JFreeChart createEmptyChart(PieDataset dataset) {
        
		JFreeChart chart = ChartFactory.createPieChart(
            "SOCR Chart",  // chart title
            null,             // data
            true,                // include legend
            true,
            false
        );
        
        PiePlot plot = (PiePlot) chart.getPlot();
        plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
        plot.setNoDataMessage("No data available");
        plot.setCircular(false);
        plot.setLabelGap(0.02);
        return chart;
}
 
開發者ID:SOCR,項目名稱:HTML5_WebSite,代碼行數:18,代碼來源:Chart.java

示例9: createEmptyChart

import org.jfree.chart.plot.PiePlot; //導入方法依賴的package包/類
protected JFreeChart createEmptyChart(PieDataset dataset) {
       
		JFreeChart chart = ChartFactory.createPieChart(
            "SOCR Chart",  // chart title
            null,             // data
            true,                // include legend
            true,
            false
        );
        
        PiePlot plot = (PiePlot) chart.getPlot();
        plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
        plot.setNoDataMessage("No data available");
        plot.setCircular(false);
        plot.setLabelGap(0.02);
        return chart;
}
 
開發者ID:SOCR,項目名稱:HTML5_WebSite,代碼行數:18,代碼來源:BinomialTradingApplication.java

示例10: createEmptyChart

import org.jfree.chart.plot.PiePlot; //導入方法依賴的package包/類
protected JFreeChart createEmptyChart(String chartTitle, PieDataset dataset) {

		JFreeChart chart = ChartFactory.createPieChart(
			chartTitle,  // chart title
            null,             // data
            true,                // include legend
            true,
            false
        );

        PiePlot plot = (PiePlot) chart.getPlot();
        plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
        plot.setNoDataMessage("No data available");
        plot.setCircular(false);
        plot.setLabelGap(0.02);
        return chart;
}
 
開發者ID:SOCR,項目名稱:HTML5_WebSite,代碼行數:18,代碼來源:PortfolioApplication2.java

示例11: applyToPiePlot

import org.jfree.chart.plot.PiePlot; //導入方法依賴的package包/類
/**
 * Applies the attributes of this theme to a {@link PiePlot} instance.
 * This method also clears any set values for the section paint, outline
 * etc, so that the theme's {@link DrawingSupplier} will be used.
 *
 * @param plot  the plot (<code>null</code> not permitted).
 */
protected void applyToPiePlot(PiePlot plot) {
    plot.setLabelLinkPaint(this.labelLinkPaint);
    plot.setLabelLinkStyle(this.labelLinkStyle);
    plot.setLabelFont(this.regularFont);

    // clear the section attributes so that the theme's DrawingSupplier
    // will be used
    if (plot.getAutoPopulateSectionPaint()) {
        plot.clearSectionPaints(false);
    }
    if (plot.getAutoPopulateSectionOutlinePaint()) {
        plot.clearSectionOutlinePaints(false);
    }
    if (plot.getAutoPopulateSectionOutlineStroke()) {
        plot.clearSectionOutlineStrokes(false);
    }
}
 
開發者ID:lulab,項目名稱:PI,代碼行數:25,代碼來源:StandardChartTheme.java

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

示例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(
        "Pie Chart Demo 1",  // chart title
        dataset,             // data
        true,               // include legend
        true,
        false
    );

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setSectionOutlinesVisible(false);
    plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
    plot.setNoDataMessage("No data available");
    plot.setCircular(false);
    plot.setLabelGap(0.02);
    return chart;
}
 
開發者ID:SpoonLabs,項目名稱:astor,代碼行數:26,代碼來源:SWTPieChartDemo1.java

示例14: createChart

import org.jfree.chart.plot.PiePlot; //導入方法依賴的package包/類
@Override
public JFreeChart createChart(PieDataset pieDataSet, boolean createLegend) {
	JFreeChart chart = ChartFactory.createRingChart(
			null,
			pieDataSet,
			createLegend, // legend
			true,
			false);
	
	PiePlot plot = (PiePlot) chart.getPlot();
	plot.setSectionOutlinesVisible(false);
	plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 11));
	plot.setNoDataMessage("No data available");
	plot.setCircular(false);
	plot.setLabelGap(0.02);

	return chart;
}
 
開發者ID:rapidminer,項目名稱:rapidminer-5,代碼行數:19,代碼來源:RingChartPlotter.java

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


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