本文整理汇总了Java中org.jfree.chart.plot.PiePlot.setCircular方法的典型用法代码示例。如果您正苦于以下问题:Java PiePlot.setCircular方法的具体用法?Java PiePlot.setCircular怎么用?Java PiePlot.setCircular使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.plot.PiePlot
的用法示例。
在下文中一共展示了PiePlot.setCircular方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setPieRender
import org.jfree.chart.plot.PiePlot; //导入方法依赖的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}"));
}
示例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: fillChart
import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
private void fillChart(String title, List<String> names,
List<String> colors, List<Float> values) throws Exception {
DefaultPieDataset data=new DefaultPieDataset();
for (int ix=0; ix<names.size(); ix++) {
data.setValue( names.get(ix), values.get(ix) );
}
this.chart=ChartFactory.createPieChart3D(
title,
data,
true,
true,
false);
LegendTitle legend=this.chart.getLegend();
legend.setItemFont(new Font("", Font.TRUETYPE_FONT, 9) );
PiePlot plot=(PiePlot)this.chart.getPlot();
plot.setCircular(true);
plot.setBackgroundAlpha(0.9f);
plot.setForegroundAlpha(0.5f);
plot.setLabelFont(new Font("", Font.TRUETYPE_FONT, 9) );
this.setPlotColor( plot, names, colors );
this.chart.setTitle(new TextTitle(title, new Font("", Font.TRUETYPE_FONT, 9) ) );
}
示例5: 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;
}
示例6: 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;
}
示例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: 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;
}
示例10: 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;
}
示例11: 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;
}
示例12: getCharts
import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
@Override
public JFreeChart[] getCharts() {
// set the plots circular before returning them if we have a pie chart
if (chartType == ChartType.PIE) {
for (JFreeChart chart : charts) {
PiePlot plot = (PiePlot) chart.getPlot();
plot.setCircular(true);
}
}
return charts;
}
示例13: getCharts
import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
@Override
public JFreeChart[] getCharts() {
// set the plots circular before returning them if we have a pie chart
if (chartType == ChartType.PIE) {
for (JFreeChart chart : charts) {
PiePlot plot = (PiePlot) chart.getPlot();
plot.setCircular(true);
}
}
return charts;
}
示例14: createPieChart
import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
@Override
protected JFreeChart createPieChart() throws JRException
{
JFreeChart jfreeChart = super.createPieChart();
PiePlot piePlot = (PiePlot)jfreeChart.getPlot();
JRPiePlot jrPiePlot = (JRPiePlot)getPlot();
boolean isShowLabels = jrPiePlot.getShowLabels() == null ? true : jrPiePlot.getShowLabels().booleanValue();
if (isShowLabels && piePlot.getLabelGenerator() != null)
{
piePlot.setLabelBackgroundPaint(ChartThemesConstants.TRANSPARENT_PAINT);
piePlot.setLabelShadowPaint(ChartThemesConstants.TRANSPARENT_PAINT);
piePlot.setLabelOutlinePaint(ChartThemesConstants.TRANSPARENT_PAINT);
}
piePlot.setShadowXOffset(5);
piePlot.setShadowYOffset(10);
piePlot.setShadowPaint(new GradientPaint(0, getChart().getHeight() / 2, new Color(41, 120, 162), 0, getChart().getHeight(), Color.white));
PieDataset pieDataset = piePlot.getDataset();
if (pieDataset != null)
{
for (int i = 0; i < pieDataset.getItemCount(); i++)
{
piePlot.setSectionOutlinePaint(pieDataset.getKey(i), ChartThemesConstants.TRANSPARENT_PAINT);
//makes pie colors darker
//piePlot.setSectionPaint(pieDataset.getKey(i), GRADIENT_PAINTS[i]);
}
}
piePlot.setCircular(true);
return jfreeChart;
}
示例15: createPieChart
import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
@Override
protected JFreeChart createPieChart() throws JRException
{
JFreeChart jfreeChart = super.createPieChart();
PiePlot piePlot = (PiePlot)jfreeChart.getPlot();
JRPiePlot jrPiePlot = (JRPiePlot)getPlot();
boolean isShowLabels = jrPiePlot.getShowLabels() == null ? true : jrPiePlot.getShowLabels().booleanValue();
if(isShowLabels && piePlot.getLabelGenerator() != null)
{
piePlot.setLabelBackgroundPaint(ChartThemesConstants.TRANSPARENT_PAINT);
piePlot.setLabelShadowPaint(ChartThemesConstants.TRANSPARENT_PAINT);
piePlot.setLabelOutlinePaint(ChartThemesConstants.TRANSPARENT_PAINT);
}
piePlot.setShadowXOffset(0);
piePlot.setShadowYOffset(0);
PieDataset pieDataset = piePlot.getDataset();
if(pieDataset != null)
{
for(int i = 0; i < pieDataset.getItemCount(); i++)
{
piePlot.setSectionOutlinePaint(pieDataset.getKey(i), ChartThemesConstants.TRANSPARENT_PAINT);
//makes pie colors darker
//piePlot.setSectionPaint(pieDataset.getKey(i), GRADIENT_PAINTS[i]);
}
}
piePlot.setCircular(true);
return jfreeChart;
}