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


Java StandardPieSectionLabelGenerator類代碼示例

本文整理匯總了Java中org.jfree.chart.labels.StandardPieSectionLabelGenerator的典型用法代碼示例。如果您正苦於以下問題:Java StandardPieSectionLabelGenerator類的具體用法?Java StandardPieSectionLabelGenerator怎麽用?Java StandardPieSectionLabelGenerator使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: createRingChart

import org.jfree.chart.labels.StandardPieSectionLabelGenerator; //導入依賴的package包/類
/**
 * Creates a ring chart with default settings.
 * <P>
 * The chart object returned by this method uses a {@link RingPlot} 
 * instance as the plot.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param dataset  the dataset for the chart (<code>null</code> permitted).
 * @param legend  a flag specifying whether or not a legend is required.
 * @param tooltips  configure chart to generate tool tips?
 * @param urls  configure chart to generate URLs?
 *
 * @return A pie chart.
 */
public static JFreeChart createRingChart(String title,
                                         PieDataset dataset,
                                         boolean legend,
                                         boolean tooltips,
                                         boolean urls) {

    RingPlot plot = new RingPlot(dataset);
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator());
    plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
    if (tooltips) {
        plot.setToolTipGenerator(new StandardPieToolTipGenerator(
                StandardPieToolTipGenerator.DEFAULT_SECTION_LABEL_FORMAT));
    }
    if (urls) {
        plot.setURLGenerator(new StandardPieURLGenerator());
    }
    return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, 
            legend);

}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:35,代碼來源:ChartFactory.java

示例2: setPieRender

import org.jfree.chart.labels.StandardPieSectionLabelGenerator; //導入依賴的package包/類
public static void setPieRender(Plot plot) {

        plot.setNoDataMessage(NO_DATA_MSG);
        plot.setInsets(new RectangleInsets(10, 10, 5, 10));
        PiePlot piePlot = (PiePlot) plot;
        piePlot.setInsets(new RectangleInsets(0, 0, 0, 0));
        piePlot.setCircular(true);

        piePlot.setLabelGap(0.01);
        piePlot.setInteriorGap(0.05D);
        piePlot.setLegendItemShape(new Rectangle(10, 10));
        piePlot.setIgnoreNullValues(true);
        piePlot.setLabelBackgroundPaint(null);
        piePlot.setLabelShadowPaint(null);
        piePlot.setLabelOutlinePaint(null);
        piePlot.setShadowPaint(null);
        // 0:category 1:value:2 :percentage
        piePlot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0}:{2}"));
    }
 
開發者ID:Fanping,項目名稱:iveely.ml,代碼行數:20,代碼來源:ChartUtils.java

示例3: PieChart

import org.jfree.chart.labels.StandardPieSectionLabelGenerator; //導入依賴的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

示例4: createPieChart

import org.jfree.chart.labels.StandardPieSectionLabelGenerator; //導入依賴的package包/類
/**
 * Creates a pie chart with default settings.
 * <P>
 * The chart object returned by this method uses a {@link PiePlot} instance 
 * as the plot.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param dataset  the dataset for the chart (<code>null</code> permitted).
 * @param legend  a flag specifying whether or not a legend is required.
 * @param tooltips  configure chart to generate tool tips?
 * @param urls  configure chart to generate URLs?
 *
 * @return A pie chart.
 */
public static JFreeChart createPieChart(String title,
                                        PieDataset dataset,
                                        boolean legend,
                                        boolean tooltips,
                                        boolean urls) {

    PiePlot plot = new PiePlot(dataset);
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator());
    plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
    if (tooltips) {
        plot.setToolTipGenerator(new StandardPieToolTipGenerator(
                StandardPieToolTipGenerator.DEFAULT_SECTION_LABEL_FORMAT));
    }
    if (urls) {
        plot.setURLGenerator(new StandardPieURLGenerator());
    }
    return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, 
            legend);

}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:35,代碼來源:ChartFactory.java

示例5: testCloning_LegendLabelGenerator

import org.jfree.chart.labels.StandardPieSectionLabelGenerator; //導入依賴的package包/類
/**
 * Check cloning of the legendLabelGenerator field.
 */
@Test
public void testCloning_LegendLabelGenerator() throws CloneNotSupportedException {
    StandardPieSectionLabelGenerator generator
            = new StandardPieSectionLabelGenerator();
    PiePlot p1 = new PiePlot();
    p1.setLegendLabelGenerator(generator);
    PiePlot p2 = (PiePlot) p1.clone();
    assertTrue(p1 != p2);
    assertTrue(p1.getClass() == p2.getClass());
    assertTrue(p1.equals(p2));

    // change the generator and make sure it only affects p1
    generator.getNumberFormat().setMinimumFractionDigits(2);
    assertFalse(p1.equals(p2));
}
 
開發者ID:mdzio,項目名稱:ccu-historian,代碼行數:19,代碼來源:PiePlotTest.java

示例6: testCloning_LegendLabelToolTipGenerator

import org.jfree.chart.labels.StandardPieSectionLabelGenerator; //導入依賴的package包/類
/**
 * Check cloning of the legendLabelToolTipGenerator field.
 */
@Test
public void testCloning_LegendLabelToolTipGenerator() throws CloneNotSupportedException {
    StandardPieSectionLabelGenerator generator
            = new StandardPieSectionLabelGenerator();
    PiePlot p1 = new PiePlot();
    p1.setLegendLabelToolTipGenerator(generator);
    PiePlot p2 = (PiePlot) p1.clone();
    assertTrue(p1 != p2);
    assertTrue(p1.getClass() == p2.getClass());
    assertTrue(p1.equals(p2));

    // change the generator and make sure it only affects p1
    generator.getNumberFormat().setMinimumFractionDigits(2);
    assertFalse(p1.equals(p2));
}
 
開發者ID:mdzio,項目名稱:ccu-historian,代碼行數:19,代碼來源:PiePlotTest.java

示例7: createPieChart

import org.jfree.chart.labels.StandardPieSectionLabelGenerator; //導入依賴的package包/類
/**
 * Creates a pie chart with default settings.
 * <P>
 * The chart object returned by this method uses a {@link PiePlot} instance
 * as the plot.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param dataset  the dataset for the chart (<code>null</code> permitted).
 * @param legend  a flag specifying whether or not a legend is required.
 * @param tooltips  configure chart to generate tool tips?
 * @param urls  configure chart to generate URLs?
 *
 * @return A pie chart.
 */
public static JFreeChart createPieChart(String title, PieDataset dataset,
        boolean legend, boolean tooltips, boolean urls) {

    PiePlot plot = new PiePlot(dataset);
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator());
    plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
    if (tooltips) {
        plot.setToolTipGenerator(new StandardPieToolTipGenerator());
    }
    if (urls) {
        plot.setURLGenerator(new StandardPieURLGenerator());
    }
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
            plot, legend);
    currentTheme.apply(chart);
    return chart;
}
 
開發者ID:mdzio,項目名稱:ccu-historian,代碼行數:32,代碼來源:ChartFactory.java

示例8: createRingChart

import org.jfree.chart.labels.StandardPieSectionLabelGenerator; //導入依賴的package包/類
/**
 * Creates a ring chart with default settings.
 * <P>
 * The chart object returned by this method uses a {@link RingPlot}
 * instance as the plot.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param dataset  the dataset for the chart (<code>null</code> permitted).
 * @param legend  a flag specifying whether or not a legend is required.
 * @param tooltips  configure chart to generate tool tips?
 * @param urls  configure chart to generate URLs?
 *
 * @return A ring chart.
 */
public static JFreeChart createRingChart(String title, PieDataset dataset,
        boolean legend, boolean tooltips, boolean urls) {

    RingPlot plot = new RingPlot(dataset);
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator());
    plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
    if (tooltips) {
        plot.setToolTipGenerator(new StandardPieToolTipGenerator());
    }
    if (urls) {
        plot.setURLGenerator(new StandardPieURLGenerator());
    }
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
            plot, legend);
    currentTheme.apply(chart);
    return chart;

}
 
開發者ID:mdzio,項目名稱:ccu-historian,代碼行數:33,代碼來源:ChartFactory.java

示例9: createPieChart

import org.jfree.chart.labels.StandardPieSectionLabelGenerator; //導入依賴的package包/類
/**
 * Creates a pie chart with default settings.
 * <P>
 * The chart object returned by this method uses a {@link PiePlot} instance
 * as the plot.
 *
 * @param title  the chart title ({@code null} permitted).
 * @param dataset  the dataset for the chart ({@code null} permitted).
 * @param legend  a flag specifying whether or not a legend is required.
 * @param tooltips  configure chart to generate tool tips?
 * @param urls  configure chart to generate URLs?
 *
 * @return A pie chart.
 */
public static JFreeChart createPieChart(String title, PieDataset dataset,
        boolean legend, boolean tooltips, boolean urls) {

    PiePlot plot = new PiePlot(dataset);
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator());
    plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
    if (tooltips) {
        plot.setToolTipGenerator(new StandardPieToolTipGenerator());
    }
    if (urls) {
        plot.setURLGenerator(new StandardPieURLGenerator());
    }
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
            plot, legend);
    currentTheme.apply(chart);
    return chart;
}
 
開發者ID:jfree,項目名稱:jfreechart,代碼行數:32,代碼來源:ChartFactory.java

示例10: createRingChart

import org.jfree.chart.labels.StandardPieSectionLabelGenerator; //導入依賴的package包/類
/**
 * Creates a ring chart with default settings.
 * <P>
 * The chart object returned by this method uses a {@link RingPlot}
 * instance as the plot.
 *
 * @param title  the chart title ({@code null} permitted).
 * @param dataset  the dataset for the chart ({@code null} permitted).
 * @param legend  a flag specifying whether or not a legend is required.
 * @param tooltips  configure chart to generate tool tips?
 * @param urls  configure chart to generate URLs?
 *
 * @return A ring chart.
 */
public static JFreeChart createRingChart(String title, PieDataset dataset,
        boolean legend, boolean tooltips, boolean urls) {

    RingPlot plot = new RingPlot(dataset);
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator());
    plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
    if (tooltips) {
        plot.setToolTipGenerator(new StandardPieToolTipGenerator());
    }
    if (urls) {
        plot.setURLGenerator(new StandardPieURLGenerator());
    }
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
            plot, legend);
    currentTheme.apply(chart);
    return chart;

}
 
開發者ID:jfree,項目名稱:jfreechart,代碼行數:33,代碼來源:ChartFactory.java

示例11: createPieChart

import org.jfree.chart.labels.StandardPieSectionLabelGenerator; //導入依賴的package包/類
/**
 * Creates a pie chart with default settings.
 * <P>
 * The chart object returned by this method uses a {@link PiePlot} instance
 * as the plot.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param dataset  the dataset for the chart (<code>null</code> permitted).
 * @param legend  a flag specifying whether or not a legend is required.
 * @param tooltips  configure chart to generate tool tips?
 * @param urls  configure chart to generate URLs?
 *
 * @return A pie chart.
 */
public static JFreeChart createPieChart(String title,
                                        PieDataset dataset,
                                        boolean legend,
                                        boolean tooltips,
                                        boolean urls) {

    PiePlot plot = new PiePlot(dataset);
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator());
    plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
    if (tooltips) {
        plot.setToolTipGenerator(new StandardPieToolTipGenerator());
    }
    if (urls) {
        plot.setURLGenerator(new StandardPieURLGenerator());
    }
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
            plot, legend);
    currentTheme.apply(chart);
    return chart;
}
 
開發者ID:SOCR,項目名稱:HTML5_WebSite,代碼行數:35,代碼來源:ChartFactory.java

示例12: createRingChart

import org.jfree.chart.labels.StandardPieSectionLabelGenerator; //導入依賴的package包/類
/**
 * Creates a ring chart with default settings.
 * <P>
 * The chart object returned by this method uses a {@link RingPlot}
 * instance as the plot.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param dataset  the dataset for the chart (<code>null</code> permitted).
 * @param legend  a flag specifying whether or not a legend is required.
 * @param tooltips  configure chart to generate tool tips?
 * @param urls  configure chart to generate URLs?
 *
 * @return A ring chart.
 */
public static JFreeChart createRingChart(String title,
                                         PieDataset dataset,
                                         boolean legend,
                                         boolean tooltips,
                                         boolean urls) {

    RingPlot plot = new RingPlot(dataset);
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator());
    plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
    if (tooltips) {
        plot.setToolTipGenerator(new StandardPieToolTipGenerator());
    }
    if (urls) {
        plot.setURLGenerator(new StandardPieURLGenerator());
    }
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
            plot, legend);
    currentTheme.apply(chart);
    return chart;

}
 
開發者ID:SOCR,項目名稱:HTML5_WebSite,代碼行數:36,代碼來源:ChartFactory.java

示例13: createChart

import org.jfree.chart.labels.StandardPieSectionLabelGenerator; //導入依賴的package包/類
private JFreeChart createChart(PieDataset dataset, String title) {
    
    JFreeChart chart = ChartFactory.createPieChart3D(title,          // chart title
        dataset,                // data
        true,                   // include legend
        true,
        true);

    PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setStartAngle(290);
    
    PieSectionLabelGenerator gen = new StandardPieSectionLabelGenerator(
            "{0}: {1} ({2})", new DecimalFormat("0"), new DecimalFormat("0%"));
        plot.setLabelGenerator(gen);
  
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);
    return chart;
    
}
 
開發者ID:ltrr-arizona-edu,項目名稱:tellervo,代碼行數:21,代碼來源:DatabaseSummaryDialog.java

示例14: PieChart

import org.jfree.chart.labels.StandardPieSectionLabelGenerator; //導入依賴的package包/類
public String PieChart() {
	DefaultPieDataset dataset = new DefaultPieDataset();
	List<Datas> list = new IncomeDao().getDatas2(park.getParkid());
	for (Datas datas : list) {
		dataset.setValue(datas.getYear() + "年" + datas.getMonth() + "月",
				datas.getMoney());
	}
	ChartFactory.setChartTheme(getStandardChartTheme());
	chart = ChartFactory.createPieChart3D("停車場餅圖", dataset, true, true,
			false);
	PiePlot3D plot = (PiePlot3D) chart.getPlot();
	plot.setBaseSectionOutlinePaint(Color.RED);// 設置圖形邊框顏色
	plot.setBaseSectionOutlineStroke(new BasicStroke(1.0f));// 設置圖形邊框粗細
	plot.setForegroundAlpha(0.5f);// 數據區的前景透明度(0.0~1.0)
	plot.setCircular(true);// 餅圖是否一定是正圓
	plot.setStartAngle(360);// 餅圖的初始角度
	plot.setToolTipGenerator(new StandardPieToolTipGenerator());// 設置鼠標懸停提示
	plot.setLabelFont(new Font("微軟雅黑", Font.PLAIN, 14));
	StandardPieSectionLabelGenerator standarPieIG = new StandardPieSectionLabelGenerator(
			"{0}:({1},{2})", NumberFormat.getNumberInstance(),
			NumberFormat.getPercentInstance());
	plot.setLabelGenerator(standarPieIG);
	chart.setTitle(getTitle());
	return SUCCESS;
}
 
開發者ID:foryuki,項目名稱:viewpark,代碼行數:26,代碼來源:ImageAction.java

示例15: makeChartByMap

import org.jfree.chart.labels.StandardPieSectionLabelGenerator; //導入依賴的package包/類
public void makeChartByMap(Map<String, Object> map,String title) {
    DefaultPieDataset dpd = new DefaultPieDataset(); //建立一個默認的餅圖
    System.out.println(map);

    dpd.setValue("優", Integer.parseInt(map.get("優").toString()));
    dpd.setValue("良", Integer.parseInt(map.get("良").toString()));
    dpd.setValue("中", Integer.parseInt(map.get("中").toString()));
    dpd.setValue("差", Integer.parseInt(map.get("差").toString()));
    dpd.setValue("不及格", Integer.parseInt(map.get("不及格").toString()));

    JFreeChart chart = ChartFactory.createPieChart(title, dpd, true, true, false);
    PiePlot piePlot = (PiePlot) chart.getPlot();
    piePlot.setLabelGenerator(new StandardPieSectionLabelGenerator(("{0}:({2})"), NumberFormat.getNumberInstance(), new DecimalFormat("0.00%")));
    //可以查具體的API文檔,第一個參數是標題,第二個參數是一個數據集,第三個參數表示是否顯示Legend,第四個參數表示是否顯示提示,第五個參數表示圖中是否存在URL
    ChartFrame chartFrame = new ChartFrame(title, chart);
    //chart要放在Java容器組件中,ChartFrame繼承自java的Jframe類。該第一個參數的數據是放在窗口左上角的,不是正中間的標題。
    chartFrame.pack(); //以合適的大小展現圖形
    chartFrame.setVisible(true);//圖形是否可見
}
 
開發者ID:leftjs,項目名稱:StudentGradesManageSystem,代碼行數:20,代碼來源:HomeAdmin.java


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