本文整理汇总了Java中org.jfree.chart.labels.PieSectionLabelGenerator类的典型用法代码示例。如果您正苦于以下问题:Java PieSectionLabelGenerator类的具体用法?Java PieSectionLabelGenerator怎么用?Java PieSectionLabelGenerator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PieSectionLabelGenerator类属于org.jfree.chart.labels包,在下文中一共展示了PieSectionLabelGenerator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createChart
import org.jfree.chart.labels.PieSectionLabelGenerator; //导入依赖的package包/类
private JFreeChart createChart(PieDataset dataset, String title) {
JFreeChart chart = ChartFactory.createPieChart3D(title, // chart title
dataset, // data
true, // include legend
true,
true);
PiePlot3D plot = (PiePlot3D) chart.getPlot();
plot.setStartAngle(290);
PieSectionLabelGenerator gen = new StandardPieSectionLabelGenerator(
"{0}: {1} ({2})", new DecimalFormat("0"), new DecimalFormat("0%"));
plot.setLabelGenerator(gen);
plot.setDirection(Rotation.CLOCKWISE);
plot.setForegroundAlpha(0.5f);
return chart;
}
示例2: customize
import org.jfree.chart.labels.PieSectionLabelGenerator; //导入依赖的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);
}
示例3: showVehicleInStore
import org.jfree.chart.labels.PieSectionLabelGenerator; //导入依赖的package包/类
private void showVehicleInStore() {
DefaultPieDataset dataset = new DefaultPieDataset();
List<Vehicle> vs = vehicleService.getAll();
for (Vehicle vehicle : vs) {
if (vehicle.getQuantity() > 0) {
dataset.setValue(vehicle.getModelNumber(), vehicle.getQuantity());
}
}
JFreeChart chart = ChartFactory.createPieChart3D("Vehicle In Store", // chart title
dataset, // data
true, // include legend
true,
false);
PiePlot3D plot = (PiePlot3D) chart.getPlot();
PieSectionLabelGenerator generator = new StandardPieSectionLabelGenerator(
"Model No {0} : {2}({1})", new DecimalFormat("0"), new DecimalFormat("0.00%"));
plot.setLabelGenerator(generator);
plot.setStartAngle(290);
plot.setDirection(Rotation.CLOCKWISE);
plot.setForegroundAlpha(0.5f);
// we put the chart into a panel
ChartPanel chartPanel = new ChartPanel(chart);
changePanelReport(chartPanel);
}
示例4: createChart
import org.jfree.chart.labels.PieSectionLabelGenerator; //导入依赖的package包/类
@Secured({"ROLE_ADMIN","ROLE_SURVEY_ADMIN"})
private JFreeChart createChart(PieDataset pieDataset, String title) {
try{
JFreeChart chart = ChartFactory.createPieChart(title, pieDataset, false,true,false);
chart.setBackgroundPaint(null);//this line necessary for transparency of background
final ChartPanel chartPanel = new ChartPanel(chart);
chartPanel.setOpaque(false); //this line necessary for transparency of background
chartPanel.setBackground(new Color(0, 0, 0, 0)); //this line necessary for transparency of background
PiePlot plot = (PiePlot) chart.getPlot();
//Color[] colors = {new Color(170, 195, 217, 255),new Color(246, 140, 31, 255),new Color(204, 204, 204, 255),new Color(231, 238, 144, 255),new Color(51, 51, 51, 255),new Color(101, 125, 151, 255),new Color(0, 102, 255, 255)};
//PieRenderer renderer = new PieRenderer(colors);
//renderer.setColor(plot, pieDataset);
PieSectionLabelGenerator generator = new StandardPieSectionLabelGenerator("{0}:{1}%");
plot.setLabelGenerator(generator);
plot.setStartAngle(270);
plot.setDirection(Rotation.CLOCKWISE);
return chart;
} catch (Exception e) {
log.error(e.getMessage(),e);
throw (new RuntimeException(e));
}
}
示例5: setLegendLabelGenerator
import org.jfree.chart.labels.PieSectionLabelGenerator; //导入依赖的package包/类
/**
* Sets the legend label generator and sends a {@link PlotChangeEvent} to
* all registered listeners.
*
* @param generator the generator (<code>null</code> not permitted).
*
* @see #getLegendLabelGenerator()
*/
public void setLegendLabelGenerator(PieSectionLabelGenerator generator) {
if (generator == null) {
throw new IllegalArgumentException("Null 'generator' argument.");
}
this.legendLabelGenerator = generator;
notifyListeners(new PlotChangeEvent(this));
}
示例6: setLegendLabelGenerator
import org.jfree.chart.labels.PieSectionLabelGenerator; //导入依赖的package包/类
/**
* Sets the legend label generator and sends a {@link PlotChangeEvent} to
* all registered listeners.
*
* @param generator the generator (<code>null</code> not permitted).
*
* @see #getLegendLabelGenerator()
*/
public void setLegendLabelGenerator(PieSectionLabelGenerator generator) {
if (generator == null) {
throw new IllegalArgumentException("Null 'generator' argument.");
}
this.legendLabelGenerator = generator;
fireChangeEvent();
}
示例7: getLabelGenerator
import org.jfree.chart.labels.PieSectionLabelGenerator; //导入依赖的package包/类
/**
* Returns the section label generator.
*
* @return The generator (possibly <code>null</code>).
*/
public PieSectionLabelGenerator getLabelGenerator() {
return this.labelGenerator;
}
示例8: setLabelGenerator
import org.jfree.chart.labels.PieSectionLabelGenerator; //导入依赖的package包/类
/**
* Sets the section label generator and sends a {@link PlotChangeEvent} to all registered
* listeners.
*
* @param generator the generator (<code>null</code> permitted).
*/
public void setLabelGenerator(PieSectionLabelGenerator generator) {
this.labelGenerator = generator;
notifyListeners(new PlotChangeEvent(this));
}
示例9: getLabelGenerator
import org.jfree.chart.labels.PieSectionLabelGenerator; //导入依赖的package包/类
/**
* Returns the section label generator.
*
* @return The generator (possibly <code>null</code>).
*
* @see #setLabelGenerator(PieSectionLabelGenerator)
*/
public PieSectionLabelGenerator getLabelGenerator() {
return this.labelGenerator;
}
示例10: setLabelGenerator
import org.jfree.chart.labels.PieSectionLabelGenerator; //导入依赖的package包/类
/**
* Sets the section label generator and sends a {@link PlotChangeEvent} to
* all registered listeners.
*
* @param generator the generator (<code>null</code> permitted).
*
* @see #getLabelGenerator()
*/
public void setLabelGenerator(PieSectionLabelGenerator generator) {
this.labelGenerator = generator;
notifyListeners(new PlotChangeEvent(this));
}
示例11: getLegendLabelGenerator
import org.jfree.chart.labels.PieSectionLabelGenerator; //导入依赖的package包/类
/**
* Returns the legend label generator.
*
* @return The legend label generator (never <code>null</code>).
*
* @see #setLegendLabelGenerator(PieSectionLabelGenerator)
*/
public PieSectionLabelGenerator getLegendLabelGenerator() {
return this.legendLabelGenerator;
}
示例12: getLegendLabelToolTipGenerator
import org.jfree.chart.labels.PieSectionLabelGenerator; //导入依赖的package包/类
/**
* Returns the legend label tool tip generator.
*
* @return The legend label tool tip generator (possibly <code>null</code>).
*
* @see #setLegendLabelToolTipGenerator(PieSectionLabelGenerator)
*/
public PieSectionLabelGenerator getLegendLabelToolTipGenerator() {
return this.legendLabelToolTipGenerator;
}
示例13: setLegendLabelToolTipGenerator
import org.jfree.chart.labels.PieSectionLabelGenerator; //导入依赖的package包/类
/**
* Sets the legend label tool tip generator and sends a
* {@link PlotChangeEvent} to all registered listeners.
*
* @param generator the generator (<code>null</code> permitted).
*
* @see #getLegendLabelToolTipGenerator()
*/
public void setLegendLabelToolTipGenerator(
PieSectionLabelGenerator generator) {
this.legendLabelToolTipGenerator = generator;
notifyListeners(new PlotChangeEvent(this));
}
示例14: getLabelGenerator
import org.jfree.chart.labels.PieSectionLabelGenerator; //导入依赖的package包/类
/**
* Returns the section label generator.
*
* @return The generator (possibly <code>null</code>).
*
* @see #setLabelGenerator(PieSectionLabelGenerator)
*/
public PieSectionLabelGenerator getLabelGenerator() {
return this.labelGenerator;
}
示例15: setLabelGenerator
import org.jfree.chart.labels.PieSectionLabelGenerator; //导入依赖的package包/类
/**
* Sets the section label generator and sends a {@link PlotChangeEvent} to
* all registered listeners.
*
* @param generator the generator (<code>null</code> permitted).
*
* @see #getLabelGenerator()
*/
public void setLabelGenerator(PieSectionLabelGenerator generator) {
this.labelGenerator = generator;
fireChangeEvent();
}