本文整理汇总了Java中org.jfree.chart.plot.PiePlot.setLegendItemShape方法的典型用法代码示例。如果您正苦于以下问题:Java PiePlot.setLegendItemShape方法的具体用法?Java PiePlot.setLegendItemShape怎么用?Java PiePlot.setLegendItemShape使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.plot.PiePlot
的用法示例。
在下文中一共展示了PiePlot.setLegendItemShape方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: chartPie
import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
private void chartPie() throws PageException, IOException {
// do dataset
DefaultPieDataset dataset = new DefaultPieDataset();
ChartSeriesBean csb = _series.get(0);
ChartDataBean cdb;
List datas=csb.getDatas();
if(sortxaxis)Collections.sort(datas);
Iterator itt = datas.iterator();
while(itt.hasNext()) {
cdb=(ChartDataBean) itt.next();
dataset.setValue(cdb.getItemAsString(), cdb.getValue());
}
JFreeChart chart = show3d?
ChartFactory.createPieChart3D (title, dataset, false, true, true):
ChartFactory.createPieChart (title, dataset, false, true, true);
Plot p = chart.getPlot();
PiePlot pp = (PiePlot)p;
Font _font = getFont();
pp.setLegendLabelGenerator(new PieSectionLegendLabelGeneratorImpl(_font,chartwidth));
pp.setBaseSectionOutlinePaint(Color.GRAY); // border
pp.setLegendItemShape(new Rectangle(7,7));
pp.setLabelFont(new Font(font,0,11));
pp.setLabelLinkPaint(COLOR_333333);
pp.setLabelLinkMargin(-0.05);
pp.setInteriorGap(0.123);
pp.setLabelGenerator(new PieSectionLabelGeneratorImpl(labelFormat));
databackgroundcolor=backgroundcolor;
setBackground(chart,p);
setBorder(chart,p);
setLegend(chart,p,_font);
set3d(p);
setFont(chart, _font);
setTooltip(chart);
setScale(chart);
// Slice Type and colors
boolean doSclice=pieslicestyle==PIE_SLICE_STYLE_SLICED;
Color[] colors = csb.getColorlist();
Iterator it = csb.getDatas().iterator();
int count=0;
while(it.hasNext()) {
cdb=(ChartDataBean) it.next();
if(doSclice)pp.setExplodePercent(cdb.getItemAsString(), 0.13);
if(count<colors.length){
pp.setSectionPaint(cdb.getItemAsString(), colors[count]);
}
count++;
}
writeOut(chart);
}