本文整理汇总了Java中org.jfree.chart.renderer.category.LineAndShapeRenderer.setDefaultToolTipGenerator方法的典型用法代码示例。如果您正苦于以下问题:Java LineAndShapeRenderer.setDefaultToolTipGenerator方法的具体用法?Java LineAndShapeRenderer.setDefaultToolTipGenerator怎么用?Java LineAndShapeRenderer.setDefaultToolTipGenerator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.renderer.category.LineAndShapeRenderer
的用法示例。
在下文中一共展示了LineAndShapeRenderer.setDefaultToolTipGenerator方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createLineChart
import org.jfree.chart.renderer.category.LineAndShapeRenderer; //导入方法依赖的package包/类
/**
* Creates a line chart with default settings. The chart object returned
* by this method uses a {@link CategoryPlot} instance as the plot, with a
* {@link CategoryAxis} for the domain axis, a {@link NumberAxis} as the
* range axis, and a {@link LineAndShapeRenderer} as the renderer.
*
* @param title the chart title ({@code null} permitted).
* @param categoryAxisLabel the label for the category axis
* ({@code null} permitted).
* @param valueAxisLabel the label for the value axis ({@code null}
* permitted).
* @param dataset the dataset for the chart ({@code null} permitted).
* @param orientation the chart 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 line chart.
*/
public static JFreeChart createLineChart(String title,
String categoryAxisLabel, String valueAxisLabel,
CategoryDataset dataset, PlotOrientation orientation,
boolean legend, boolean tooltips, boolean urls) {
Args.nullNotPermitted(orientation, "orientation");
CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
ValueAxis valueAxis = new NumberAxis(valueAxisLabel);
LineAndShapeRenderer renderer = new LineAndShapeRenderer(true, false);
if (tooltips) {
renderer.setDefaultToolTipGenerator(
new StandardCategoryToolTipGenerator());
}
if (urls) {
renderer.setDefaultItemURLGenerator(
new StandardCategoryURLGenerator());
}
CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis,
renderer);
plot.setOrientation(orientation);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
currentTheme.apply(chart);
return chart;
}
示例2: createPlot
import org.jfree.chart.renderer.category.LineAndShapeRenderer; //导入方法依赖的package包/类
/**
* Creates a sample plot.
*
* @return A plot.
*/
private CombinedRangeCategoryPlot createPlot() {
CategoryDataset dataset1 = createDataset1();
CategoryAxis catAxis1 = new CategoryAxis("Category");
LineAndShapeRenderer renderer1 = new LineAndShapeRenderer();
renderer1.setDefaultToolTipGenerator(
new StandardCategoryToolTipGenerator());
CategoryPlot subplot1 = new CategoryPlot(dataset1, catAxis1, null,
renderer1);
subplot1.setDomainGridlinesVisible(true);
CategoryDataset dataset2 = createDataset2();
CategoryAxis catAxis2 = new CategoryAxis("Category");
BarRenderer renderer2 = new BarRenderer();
renderer2.setDefaultToolTipGenerator(
new StandardCategoryToolTipGenerator());
CategoryPlot subplot2 = new CategoryPlot(dataset2, catAxis2, null,
renderer2);
subplot2.setDomainGridlinesVisible(true);
NumberAxis rangeAxis = new NumberAxis("Value");
CombinedRangeCategoryPlot plot = new CombinedRangeCategoryPlot(
rangeAxis);
plot.add(subplot1, 2);
plot.add(subplot2, 1);
return plot;
}
示例3: createPlot
import org.jfree.chart.renderer.category.LineAndShapeRenderer; //导入方法依赖的package包/类
/**
* Creates a sample plot.
*
* @return A sample plot.
*/
private CombinedDomainCategoryPlot createPlot() {
CategoryDataset dataset1 = createDataset1();
NumberAxis rangeAxis1 = new NumberAxis("Value");
rangeAxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
LineAndShapeRenderer renderer1 = new LineAndShapeRenderer();
renderer1.setDefaultToolTipGenerator(
new StandardCategoryToolTipGenerator()
);
CategoryPlot subplot1 = new CategoryPlot(
dataset1, null, rangeAxis1, renderer1
);
subplot1.setDomainGridlinesVisible(true);
CategoryDataset dataset2 = createDataset2();
NumberAxis rangeAxis2 = new NumberAxis("Value");
rangeAxis2.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
BarRenderer renderer2 = new BarRenderer();
renderer2.setDefaultToolTipGenerator(
new StandardCategoryToolTipGenerator()
);
CategoryPlot subplot2 = new CategoryPlot(
dataset2, null, rangeAxis2, renderer2
);
subplot2.setDomainGridlinesVisible(true);
CategoryAxis domainAxis = new CategoryAxis("Category");
CombinedDomainCategoryPlot plot
= new CombinedDomainCategoryPlot(domainAxis);
plot.add(subplot1, 2);
plot.add(subplot2, 1);
return plot;
}