本文整理汇总了Java中org.jfree.chart.plot.PiePlot.setOutlinePaint方法的典型用法代码示例。如果您正苦于以下问题:Java PiePlot.setOutlinePaint方法的具体用法?Java PiePlot.setOutlinePaint怎么用?Java PiePlot.setOutlinePaint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.plot.PiePlot
的用法示例。
在下文中一共展示了PiePlot.setOutlinePaint方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makePlot
import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
@Override
protected Plot makePlot(final JFreeChartBuilder.PlotParameters parameters) {
final KeyedValuesDataset tmpDataset = this.getDataset();
final PiePlot retVal = new PiePlot(tmpDataset);
retVal.setShadowXOffset(0);
retVal.setShadowYOffset(0);
retVal.setBackgroundPaint(parameters.getBackground());
retVal.setOutlinePaint(parameters.getOutline());
retVal.setLabelGenerator(new StandardPieSectionLabelGenerator());
if (this.isTooltips()) {
retVal.setToolTipGenerator(new StandardPieToolTipGenerator());
}
if (this.isUrls()) {
retVal.setURLGenerator(new StandardPieURLGenerator());
}
for (final Entry<Comparable<?>, Paint> tmpEntry : this.getColourSet()) {
retVal.setSectionPaint(tmpEntry.getKey(), tmpEntry.getValue());
}
return retVal;
}
示例2: getMultiplePieChart
import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
private JFreeChart getMultiplePieChart( BaseChart chart, CategoryDataset[] dataSets )
{
JFreeChart multiplePieChart = ChartFactory.createMultiplePieChart( chart.getName(), dataSets[0], TableOrder.BY_ROW,
!chart.isHideLegend(), false, false );
setBasicConfig( multiplePieChart, chart );
if ( multiplePieChart.getLegend() != null )
{
multiplePieChart.getLegend().setItemFont( SUB_TITLE_FONT );
}
MultiplePiePlot multiplePiePlot = (MultiplePiePlot) multiplePieChart.getPlot();
JFreeChart pieChart = multiplePiePlot.getPieChart();
pieChart.setBackgroundPaint( COLOR_TRANSPARENT );
pieChart.getTitle().setFont( SUB_TITLE_FONT );
PiePlot piePlot = (PiePlot) pieChart.getPlot();
piePlot.setBackgroundPaint( COLOR_TRANSPARENT );
piePlot.setOutlinePaint( COLOR_TRANSPARENT );
piePlot.setLabelFont( LABEL_FONT );
piePlot.setLabelGenerator( new StandardPieSectionLabelGenerator( "{2}" ) );
piePlot.setSimpleLabels( true );
piePlot.setIgnoreZeroValues( true );
piePlot.setIgnoreNullValues( true );
piePlot.setShadowXOffset( 0d );
piePlot.setShadowYOffset( 0d );
for ( int i = 0; i < dataSets[0].getColumnCount(); i++ )
{
piePlot.setSectionPaint( dataSets[0].getColumnKey( i ), COLORS[(i % COLORS.length)] );
}
return multiplePieChart;
}
示例3: generatePieChart
import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
private byte[] generatePieChart(
String siteId, PieDataset dataset, int width, int height,
boolean render3d, float transparency,
boolean smallFontInDomainAxis) {
JFreeChart chart = null;
if(render3d)
chart = ChartFactory.createPieChart3D(null, dataset, false, false, false);
else
chart = ChartFactory.createPieChart(null, dataset, false, false, false);
PiePlot plot = (PiePlot) chart.getPlot();
// set start angle (135 or 150 deg so minor data has more space on the left)
plot.setStartAngle(150D);
// set transparency
plot.setForegroundAlpha(transparency);
// set background
chart.setBackgroundPaint(parseColor(M_sm.getChartBackgroundColor()));
plot.setBackgroundPaint(parseColor(M_sm.getChartBackgroundColor()));
// fix border offset
chart.setPadding(new RectangleInsets(5,5,5,5));
plot.setInsets(new RectangleInsets(1,1,1,1));
// set chart border
plot.setOutlinePaint(null);
chart.setBorderVisible(true);
chart.setBorderPaint(parseColor("#cccccc"));
// set antialias
chart.setAntiAlias(true);
BufferedImage img = chart.createBufferedImage(width, height);
final ByteArrayOutputStream out = new ByteArrayOutputStream();
try{
ImageIO.write(img, "png", out);
}catch(IOException e){
log.warn("Error occurred while generating SiteStats chart image data", e);
}
return out.toByteArray();
}
示例4: getPieChart
import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
/**
* Creates a Pie Chart based on map.
*
* @return the Pie Chart generated.
*/
public JFreeChart getPieChart(Map<String, Double> pieValues) {
DefaultPieDataset dataset = new DefaultPieDataset();
for (String key : pieValues.keySet()) {
dataset.setValue(key, pieValues.get(key));
}
JFreeChart chart = ChartFactory.createPieChart3D(
null, // chart title
dataset, // data
true, // include legend
true,
false
);
chart.setBackgroundPaint(Color.white);
chart.setBorderVisible(false);
chart.setBorderPaint(null);
PiePlot plot = (PiePlot)chart.getPlot();
plot.setSectionOutlinesVisible(false);
plot.setLabelFont(new Font("SansSerif", Font.BOLD, 12));
plot.setNoDataMessage("No data available");
plot.setCircular(true);
plot.setLabelGap(0.02);
plot.setOutlinePaint(null);
plot.setLabelLinksVisible(false);
plot.setLabelGenerator(null);
plot.setLegendLabelGenerator(new StandardPieSectionLabelGenerator("{0}"));
plot.setStartAngle(270);
plot.setDirection(Rotation.ANTICLOCKWISE);
plot.setForegroundAlpha(0.60f);
plot.setInteriorGap(0.33);
return chart;
}
示例5: updatePlotter
import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
public void updatePlotter() {
int categoryCount = prepareData();
String maxClassesProperty = ParameterService.getParameterValue(MainFrame.PROPERTY_RAPIDMINER_GUI_PLOTTER_LEGEND_CLASSLIMIT);
int maxClasses = 20;
try {
if (maxClassesProperty != null)
maxClasses = Integer.parseInt(maxClassesProperty);
} catch (NumberFormatException e) {
//LogService.getGlobal().log("Pie Chart plotter: cannot parse property 'rapidminer.gui.plotter.colors.classlimit', using maximal 20 different classes.", LogService.WARNING);
LogService.getRoot().log(Level.WARNING, "com.rapidminer.gui.plotter.charts.AbstractPieChartPlotter.pie_chart_plotter_parsing_error");
}
boolean createLegend = categoryCount > 0 && categoryCount < maxClasses;
if (categoryCount <= MAX_CATEGORIES) {
JFreeChart chart = createChart(pieDataSet, createLegend);
// set the background color for the chart...
chart.setBackgroundPaint(Color.white);
PiePlot plot = (PiePlot) chart.getPlot();
plot.setBackgroundPaint(Color.WHITE);
plot.setSectionOutlinesVisible(true);
plot.setShadowPaint(new Color(104, 104, 104, 100));
int size = pieDataSet.getKeys().size();
for (int i = 0; i < size; i++) {
Comparable key = pieDataSet.getKey(i);
plot.setSectionPaint(key, getColorProvider().getPointColor(i / (double) (size - 1)));
boolean explode = false;
for (String explosionGroup : explodingGroups) {
if (key.toString().startsWith(explosionGroup) || explosionGroup.startsWith(key.toString())) {
explode = true;
break;
}
}
if (explode) {
plot.setExplodePercent(key, this.explodingAmount);
}
}
plot.setLabelFont(LABEL_FONT);
plot.setNoDataMessage("No data available");
plot.setCircular(false);
plot.setLabelGap(0.02);
plot.setOutlinePaint(Color.WHITE);
// legend settings
LegendTitle legend = chart.getLegend();
if (legend != null) {
legend.setPosition(RectangleEdge.TOP);
legend.setFrame(BlockBorder.NONE);
legend.setHorizontalAlignment(HorizontalAlignment.LEFT);
legend.setItemFont(LABEL_FONT);
}
if (panel instanceof AbstractChartPanel) {
panel.setChart(chart);
} else {
panel = new AbstractChartPanel(chart, getWidth(), getHeight() - MARGIN);
final ChartPanelShiftController controller = new ChartPanelShiftController(panel);
panel.addMouseListener(controller);
panel.addMouseMotionListener(controller);
}
// ATTENTION: WITHOUT THIS WE GET SEVERE MEMORY LEAKS!!!
panel.getChartRenderingInfo().setEntityCollection(null);
} else {
//LogService.getGlobal().logNote("Too many columns (" + categoryCount + "), this chart is only able to plot up to " + MAX_CATEGORIES + " different categories.");
LogService.getRoot().log(Level.INFO, "com.rapidminer.gui.plotter.charts.AbstractPieChartPlotter.too_many_columns",
new Object[] {categoryCount, MAX_CATEGORIES});
}
}