本文整理汇总了Java中org.jfree.chart.plot.PiePlot.setToolTipGenerator方法的典型用法代码示例。如果您正苦于以下问题:Java PiePlot.setToolTipGenerator方法的具体用法?Java PiePlot.setToolTipGenerator怎么用?Java PiePlot.setToolTipGenerator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.plot.PiePlot
的用法示例。
在下文中一共展示了PiePlot.setToolTipGenerator方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPieChart
import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
/**
* Creates a pie chart with default settings.
* <P>
* The chart object returned by this method uses a {@link PiePlot} instance as the
* plot.
* @param title the chart title (<code>null</code> permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param legend a flag specifying whether or not a legend is required.
* @param tooltips configure chart to generate tool tips?
* @param urls configure chart to generate URLs?
*
* @return A pie chart.
*/
public static JFreeChart createPieChart(String title,
PieDataset dataset,
boolean legend,
boolean tooltips,
boolean urls) {
PiePlot plot = new PiePlot(dataset);
plot.setLabelGenerator(new StandardPieItemLabelGenerator());
plot.setInsets(new Insets(0, 5, 5, 5));
if (tooltips) {
plot.setToolTipGenerator(
new StandardPieItemLabelGenerator(
StandardPieItemLabelGenerator.DEFAULT_SECTION_LABEL_FORMAT
)
);
}
if (urls) {
plot.setURLGenerator(new StandardPieURLGenerator());
}
return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
}
示例2: createPieChart
import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
/**
* Creates a pie chart with default settings.
* <P>
* The chart object returned by this method uses a {@link PiePlot} instance
* as the plot.
*
* @param title the chart title (<code>null</code> permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param legend a flag specifying whether or not a legend is required.
* @param tooltips configure chart to generate tool tips?
* @param urls configure chart to generate URLs?
*
* @return A pie chart.
*/
public static JFreeChart createPieChart(String title,
PieDataset dataset,
boolean legend,
boolean tooltips,
boolean urls) {
PiePlot plot = new PiePlot(dataset);
plot.setLabelGenerator(new StandardPieSectionLabelGenerator());
plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
if (tooltips) {
plot.setToolTipGenerator(new StandardPieToolTipGenerator(
StandardPieToolTipGenerator.DEFAULT_SECTION_LABEL_FORMAT));
}
if (urls) {
plot.setURLGenerator(new StandardPieURLGenerator());
}
return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot,
legend);
}
示例3: createPieChart
import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
/**
* Creates a pie chart with default settings.
* <P>
* The chart object returned by this method uses a {@link PiePlot} instance
* as the plot.
*
* @param title the chart title (<code>null</code> permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param legend a flag specifying whether or not a legend is required.
* @param tooltips configure chart to generate tool tips?
* @param urls configure chart to generate URLs?
*
* @return A pie chart.
*/
public static JFreeChart createPieChart(String title, PieDataset dataset,
boolean legend, boolean tooltips, boolean urls) {
PiePlot plot = new PiePlot(dataset);
plot.setLabelGenerator(new StandardPieSectionLabelGenerator());
plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
if (tooltips) {
plot.setToolTipGenerator(new StandardPieToolTipGenerator());
}
if (urls) {
plot.setURLGenerator(new StandardPieURLGenerator());
}
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
currentTheme.apply(chart);
return chart;
}
示例4: createPieChart
import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
/**
* Creates a pie chart with default settings.
* <P>
* The chart object returned by this method uses a {@link PiePlot} instance
* as the plot.
*
* @param title the chart title ({@code null} permitted).
* @param dataset the dataset for the chart ({@code null} permitted).
* @param legend a flag specifying whether or not a legend is required.
* @param tooltips configure chart to generate tool tips?
* @param urls configure chart to generate URLs?
*
* @return A pie chart.
*/
public static JFreeChart createPieChart(String title, PieDataset dataset,
boolean legend, boolean tooltips, boolean urls) {
PiePlot plot = new PiePlot(dataset);
plot.setLabelGenerator(new StandardPieSectionLabelGenerator());
plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
if (tooltips) {
plot.setToolTipGenerator(new StandardPieToolTipGenerator());
}
if (urls) {
plot.setURLGenerator(new StandardPieURLGenerator());
}
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
currentTheme.apply(chart);
return chart;
}
示例5: createPieChart
import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
/**
* Creates a pie chart with default settings.
* <P>
* The chart object returned by this method uses a {@link PiePlot} instance
* as the plot.
*
* @param title the chart title (<code>null</code> permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param legend a flag specifying whether or not a legend is required.
* @param tooltips configure chart to generate tool tips?
* @param urls configure chart to generate URLs?
*
* @return A pie chart.
*/
public static JFreeChart createPieChart(String title,
PieDataset dataset,
boolean legend,
boolean tooltips,
boolean urls) {
PiePlot plot = new PiePlot(dataset);
plot.setLabelGenerator(new StandardPieSectionLabelGenerator());
plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
if (tooltips) {
plot.setToolTipGenerator(new StandardPieToolTipGenerator());
}
if (urls) {
plot.setURLGenerator(new StandardPieURLGenerator());
}
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
currentTheme.apply(chart);
return chart;
}
示例6: setTooltip
import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
private void setTooltip(JFreeChart chart) {
Plot plot = chart.getPlot();
if(plot instanceof PiePlot) {
PiePlot pp = (PiePlot)plot;
pp.setToolTipGenerator(new PieToolTipGeneratorImpl(labelFormat));
}
else if(plot instanceof CategoryPlot) {
CategoryPlot cp=(CategoryPlot) plot;
CategoryItemRenderer renderer = cp.getRenderer();
renderer.setBaseToolTipGenerator(new CategoryToolTipGeneratorImpl(labelFormat));
}
/*else if(plot instanceof XYPlot) {
XYPlot cp=(XYPlot) plot;
XYItemRenderer renderer = cp.getRenderer();
renderer.setBaseToolTipGenerator(new XYToolTipGeneratorImpl(labelFormat));
}*/
}
示例7: createMultiplePieChart
import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
/**
* Creates a chart that displays multiple pie plots. The chart object
* returned by this method uses a {@link MultiplePiePlot} instance as the
* plot.
*
* @param title the chart title (<code>null</code> permitted).
* @param dataset the dataset (<code>null</code> permitted).
* @param order the order that the data is extracted (by row or by column)
* (<code>null</code> not permitted).
* @param legend include a legend?
*
* @return A chart.
*/
public static JFreeChart createMultiplePieChart(String title,
CategoryDataset dataset, TableOrder order, boolean legend) {
if (order == null) {
throw new IllegalArgumentException("Null 'order' argument.");
}
MultiplePiePlot plot = new MultiplePiePlot(dataset);
plot.setDataExtractOrder(order);
plot.setBackgroundPaint(null);
plot.setOutlineStroke(null);
PieToolTipGenerator tooltipGenerator
= new StandardPieToolTipGenerator();
PiePlot pp = (PiePlot) plot.getPieChart().getPlot();
pp.setToolTipGenerator(tooltipGenerator);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
currentTheme.apply(chart);
return chart;
}
示例8: addChart
import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
/**
* It creates a chart for the given dataset and adds the chart to the panel.
*
* @param dataset The dataset that will provide the values for the chart.
*/
private void addChart() {
JFreeChart chart = ChartFactory.createPieChart(
getTitle(), dataset, false, true, false);
chart.addProgressListener(locker);
PiePlot plot = (PiePlot) chart.getPlot();
plot.setToolTipGenerator(dataset);
mainPanel().add(BorderLayout.CENTER, new ChartPanel(chart));
}
示例9: 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;
}
示例10: createMultiplePieChart3D
import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
/**
* Creates a chart that displays multiple pie plots. The chart object
* returned by this method uses a {@link MultiplePiePlot} instance as the
* plot.
*
* @param title the chart title (<code>null</code> permitted).
* @param dataset the dataset (<code>null</code> permitted).
* @param order the order that the data is extracted (by row or by column)
* (<code>null</code> not permitted).
* @param legend include a legend?
*
* @return A chart.
*/
public static JFreeChart createMultiplePieChart3D(String title,
CategoryDataset dataset, TableOrder order, boolean legend) {
if (order == null) {
throw new IllegalArgumentException("Null 'order' argument.");
}
MultiplePiePlot plot = new MultiplePiePlot(dataset);
plot.setDataExtractOrder(order);
plot.setBackgroundPaint(null);
plot.setOutlineStroke(null);
JFreeChart pieChart = new JFreeChart(new PiePlot3D(null));
TextTitle seriesTitle = new TextTitle("Series Title",
new Font("Tahoma", Font.BOLD, 12));
seriesTitle.setPosition(RectangleEdge.BOTTOM);
pieChart.setTitle(seriesTitle);
pieChart.removeLegend();
pieChart.setBackgroundPaint(null);
plot.setPieChart(pieChart);
PieToolTipGenerator tooltipGenerator
= new StandardPieToolTipGenerator();
PiePlot pp = (PiePlot) plot.getPieChart().getPlot();
pp.setToolTipGenerator(tooltipGenerator);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
currentTheme.apply(chart);
return chart;
}
示例11: createPieChart
import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
public static JFreeChart createPieChart(DefaultPieDataset dataset, String title, boolean is3D) {
JFreeChart chart = null;
if (is3D) {
chart = ChartFactory.createPieChart3D(title, // 图表标题
dataset, // 数据集
true, // 是否显示图例
true, // 是否显示工具提示
true // 是否生成URL
);
} else {
chart = ChartFactory.createPieChart(title, // 图表标题
dataset, // 数据集
true, // 是否显示图例
true, // 是否显示工具提示
true // 是否生成URL
);
}
// 设置标题字体==为了防止中文乱码:必须设置字体
chart.setTitle(new TextTitle(title, new Font("黑体", Font.ITALIC, 22)));
// 设置图例的字体==为了防止中文乱码:必须设置字体
chart.getLegend().setItemFont(new Font("黑体", Font.BOLD, 12));
// 获取饼图的Plot对象(实际图表)
PiePlot plot = (PiePlot) chart.getPlot();
// 图形边框颜色
plot.setBaseSectionOutlinePaint(Color.GRAY);
// 图形边框粗细
plot.setBaseSectionOutlineStroke(new BasicStroke(0.0f));
// 设置饼状图的绘制方向,可以按顺时针方向绘制,也可以按逆时针方向绘制
plot.setDirection(Rotation.ANTICLOCKWISE);
// 设置绘制角度(图形旋转角度)
plot.setStartAngle(70);
// 设置突出显示的数据块
// plot.setExplodePercent("One", 0.1D);
// 设置背景色透明度
plot.setBackgroundAlpha(0.7F);
// 设置前景色透明度
plot.setForegroundAlpha(0.65F);
// 设置区块标签的字体==为了防止中文乱码:必须设置字体
plot.setLabelFont(new Font("宋体", Font.PLAIN, 12));
// 扇区分离显示,对3D图不起效
if (is3D)
plot.setExplodePercent(dataset.getKey(3), 0.1D);
// 图例显示百分比:自定义方式,{0} 表示选项, {1} 表示数值, {2} 表示所占比例 ,小数点后两位
plot.setLabelGenerator(new StandardPieSectionLabelGenerator(
"{0}:{1}\r\n({2})", NumberFormat.getNumberInstance(),
new DecimalFormat("0.00%")));
// 图例显示百分比
// plot.setLegendLabelGenerator(new
// StandardPieSectionLabelGenerator("{0}={1}({2})"));
// 指定显示的饼图为:圆形(true) 还是椭圆形(false)
plot.setCircular(true);
// 没有数据的时候显示的内容
plot.setNoDataMessage("找不到可用数据...");
// 设置鼠标悬停提示
plot.setToolTipGenerator(new StandardPieToolTipGenerator());
// 设置热点链接
// plot.setURLGenerator(new StandardPieURLGenerator("detail.jsp"));
return chart;
}
示例12: createPieChart
import org.jfree.chart.plot.PiePlot; //导入方法依赖的package包/类
/**
* Creates a pie chart with default settings.
* <P>
* The chart object returned by this method uses a {@link PiePlot} instance
* as the plot.
*
* @param title the chart title (<code>null</code> permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param legend a flag specifying whether or not a legend is required.
* @param locale the locale (<code>null</code> not permitted).
*
* @return A pie chart.
*
* @since 1.0.7
*/
public static JFreeChart createPieChart(String title, PieDataset dataset,
boolean legend, Locale locale) {
PiePlot plot = new PiePlot(dataset);
plot.setLabelGenerator(new StandardPieSectionLabelGenerator(locale));
plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
plot.setToolTipGenerator(new StandardPieToolTipGenerator(locale));
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
currentTheme.apply(chart);
return chart;
}