本文整理汇总了Java中org.jfree.chart.renderer.xy.XYItemRenderer.setDefaultToolTipGenerator方法的典型用法代码示例。如果您正苦于以下问题:Java XYItemRenderer.setDefaultToolTipGenerator方法的具体用法?Java XYItemRenderer.setDefaultToolTipGenerator怎么用?Java XYItemRenderer.setDefaultToolTipGenerator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.renderer.xy.XYItemRenderer
的用法示例。
在下文中一共展示了XYItemRenderer.setDefaultToolTipGenerator方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createXYLineChart
import org.jfree.chart.renderer.xy.XYItemRenderer; //导入方法依赖的package包/类
/**
* Creates a line chart (based on an {@link XYDataset}) with default
* settings.
*
* @param title the chart title ({@code null} permitted).
* @param xAxisLabel a label for the X-axis ({@code null} permitted).
* @param yAxisLabel a label for the Y-axis ({@code null} permitted).
* @param dataset the dataset for the chart ({@code null} permitted).
* @param orientation the plot orientation (horizontal or vertical)
* ({@code null} NOT 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 The chart.
*/
public static JFreeChart createXYLineChart(String title, String xAxisLabel,
String yAxisLabel, XYDataset dataset, PlotOrientation orientation,
boolean legend, boolean tooltips, boolean urls) {
Args.nullNotPermitted(orientation, "orientation");
NumberAxis xAxis = new NumberAxis(xAxisLabel);
xAxis.setAutoRangeIncludesZero(false);
NumberAxis yAxis = new NumberAxis(yAxisLabel);
XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false);
XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
plot.setOrientation(orientation);
if (tooltips) {
renderer.setDefaultToolTipGenerator(new StandardXYToolTipGenerator());
}
if (urls) {
renderer.setURLGenerator(new StandardXYURLGenerator());
}
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
currentTheme.apply(chart);
return chart;
}
示例2: createBubbleChart
import org.jfree.chart.renderer.xy.XYItemRenderer; //导入方法依赖的package包/类
/**
* Creates a bubble chart with default settings. The chart is composed of
* an {@link XYPlot}, with a {@link NumberAxis} for the domain axis,
* a {@link NumberAxis} for the range axis, and an {@link XYBubbleRenderer}
* to draw the data items.
*
* @param title the chart title ({@code null} permitted).
* @param xAxisLabel a label for the X-axis ({@code null} permitted).
* @param yAxisLabel a label for the Y-axis ({@code null} permitted).
* @param dataset the dataset for the chart ({@code null} permitted).
* @param orientation the orientation (horizontal or vertical)
* ({@code null} NOT 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 bubble chart.
*/
public static JFreeChart createBubbleChart(String title, String xAxisLabel,
String yAxisLabel, XYZDataset dataset, PlotOrientation orientation,
boolean legend, boolean tooltips, boolean urls) {
Args.nullNotPermitted(orientation, "orientation");
NumberAxis xAxis = new NumberAxis(xAxisLabel);
xAxis.setAutoRangeIncludesZero(false);
NumberAxis yAxis = new NumberAxis(yAxisLabel);
yAxis.setAutoRangeIncludesZero(false);
XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
XYItemRenderer renderer = new XYBubbleRenderer(
XYBubbleRenderer.SCALE_ON_RANGE_AXIS);
if (tooltips) {
renderer.setDefaultToolTipGenerator(new StandardXYZToolTipGenerator());
}
if (urls) {
renderer.setURLGenerator(new StandardXYZURLGenerator());
}
plot.setRenderer(renderer);
plot.setOrientation(orientation);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
currentTheme.apply(chart);
return chart;
}
示例3: createHistogram
import org.jfree.chart.renderer.xy.XYItemRenderer; //导入方法依赖的package包/类
/**
* Creates a histogram chart. This chart is constructed with an
* {@link XYPlot} using an {@link XYBarRenderer}. The domain and range
* axes are {@link NumberAxis} instances.
*
* @param title the chart title ({@code null} permitted).
* @param xAxisLabel the x axis label ({@code null} permitted).
* @param yAxisLabel the y axis label ({@code null} permitted).
* @param dataset the dataset ({@code null} permitted).
* @param orientation the orientation (horizontal or vertical)
* ({@code null} NOT permitted).
* @param legend create a legend?
* @param tooltips display tooltips?
* @param urls generate URLs?
*
* @return The chart.
*/
public static JFreeChart createHistogram(String title,
String xAxisLabel, String yAxisLabel, IntervalXYDataset dataset,
PlotOrientation orientation, boolean legend, boolean tooltips,
boolean urls) {
Args.nullNotPermitted(orientation, "orientation");
NumberAxis xAxis = new NumberAxis(xAxisLabel);
xAxis.setAutoRangeIncludesZero(false);
ValueAxis yAxis = new NumberAxis(yAxisLabel);
XYItemRenderer renderer = new XYBarRenderer();
if (tooltips) {
renderer.setDefaultToolTipGenerator(new StandardXYToolTipGenerator());
}
if (urls) {
renderer.setURLGenerator(new StandardXYURLGenerator());
}
XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
plot.setOrientation(orientation);
plot.setDomainZeroBaselineVisible(true);
plot.setRangeZeroBaselineVisible(true);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
currentTheme.apply(chart);
return chart;
}
示例4: testSerialization2
import org.jfree.chart.renderer.xy.XYItemRenderer; //导入方法依赖的package包/类
/**
* Serialize an instance, restore it, and check for equality. This test
* uses a {@link DateAxis} and a {@link StandardXYToolTipGenerator}.
*/
@Test
public void testSerialization2() {
IntervalXYDataset data1 = createDataset1();
XYItemRenderer renderer1 = new XYBarRenderer(0.20);
renderer1.setDefaultToolTipGenerator(
StandardXYToolTipGenerator.getTimeSeriesInstance());
XYPlot p1 = new XYPlot(data1, new DateAxis("Date"), null, renderer1);
XYPlot p2 = (XYPlot) TestUtils.serialised(p1);
assertEquals(p1, p2);
}