本文整理汇总了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;
}
示例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));
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}