本文整理匯總了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);
}