當前位置: 首頁>>代碼示例>>Java>>正文


Java LineAndShapeRenderer.setDefaultToolTipGenerator方法代碼示例

本文整理匯總了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;

}
 
開發者ID:jfree,項目名稱:jfreechart,代碼行數:48,代碼來源:ChartFactory.java

示例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;
}
 
開發者ID:jfree,項目名稱:jfreechart,代碼行數:32,代碼來源:CombinedRangeCategoryPlotTest.java

示例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;

}
 
開發者ID:jfree,項目名稱:jfreechart,代碼行數:40,代碼來源:CombinedDomainCategoryPlotTest.java


注:本文中的org.jfree.chart.renderer.category.LineAndShapeRenderer.setDefaultToolTipGenerator方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。