Example usage for org.jfree.chart.renderer XYItemRenderer setToolTipGenerator

List of usage examples for org.jfree.chart.renderer XYItemRenderer setToolTipGenerator

Introduction

In this page you can find the example usage for org.jfree.chart.renderer XYItemRenderer setToolTipGenerator.

Prototype

public void setToolTipGenerator(XYToolTipGenerator generator);

Source Link

Document

Sets the tool tip generator for ALL series and sends a RendererChangeEvent to all registered listeners.

Usage

From source file:com.sixrr.metrics.ui.charts.HistogramDialog.java

private JFreeChart createChart(IntervalXYDataset dataset, boolean isIntegral) {
    final String title = getTitle();
    final NumberAxis xAxis = new NumberAxis();
    if (isIntegral) {
        xAxis.setTickUnit(new NumberTickUnit(1.0));
    }//  w ww  . ja v a 2 s  .c  o  m
    if (metricType == MetricType.Ratio || metricType == MetricType.RecursiveRatio) {
        xAxis.setNumberFormatOverride(new PercentFormatter());
    }

    final XYToolTipGenerator tooltipGenerator = new StandardXYToolTipGenerator();

    final XYItemRenderer renderer = new XYBarRenderer();
    renderer.setToolTipGenerator(tooltipGenerator);
    renderer.setURLGenerator(null);

    final ValueAxis yAxis = new NumberAxis();
    final XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
    plot.setRenderer(renderer);
    plot.setOrientation(PlotOrientation.VERTICAL);

    return new JFreeChart(title, JFreeChartConstants.DEFAULT_TITLE_FONT, plot, true);
}

From source file:com.sixrr.metrics.ui.charts.DiffHistogramDialog.java

private JFreeChart createChart(IntervalXYDataset dataset, boolean isIntegral) {
    final String title = getTitle();
    final NumberAxis xAxis = new NumberAxis();
    if (metricType.equals(MetricType.Ratio) || metricType.equals(MetricType.RecursiveRatio)) {
        xAxis.setNumberFormatOverride(new PercentFormatter());
    }//w  ww  .  j a  v a  2 s  .c om
    if (isIntegral) {
        xAxis.setTickUnit(new NumberTickUnit(1.0));
    }

    final XYToolTipGenerator tooltipGenerator = new StandardXYToolTipGenerator();

    final XYItemRenderer renderer = new XYBarRenderer();
    renderer.setToolTipGenerator(tooltipGenerator);
    renderer.setURLGenerator(null);

    final ValueAxis yAxis = new NumberAxis();
    final XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
    plot.setRenderer(renderer);
    plot.setOrientation(PlotOrientation.VERTICAL);

    return new JFreeChart(title, JFreeChartConstants.DEFAULT_TITLE_FONT, plot, true);
}

From source file:com.sixrr.metrics.ui.charts.DistributionDialog.java

private JFreeChart createChart(XYDataset dataset) {
    final String title = getTitle();

    final NumberAxis xAxis = new NumberAxis(metricName);
    xAxis.setAutoRangeIncludesZero(false);
    if (metricType == MetricType.Ratio || metricType == MetricType.RecursiveRatio) {
        xAxis.setNumberFormatOverride(new PercentFormatter());
    }//from w ww  .j  a  v a 2 s.  c  o  m
    final NumberAxis yAxis = new NumberAxis("%");
    final XYItemRenderer renderer = new StandardXYItemRenderer(StandardXYItemRenderer.LINES);
    final XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    plot.setOrientation(PlotOrientation.VERTICAL);
    renderer.setToolTipGenerator(new StandardXYToolTipGenerator());
    return new JFreeChart(title, JFreeChartConstants.DEFAULT_TITLE_FONT, plot, true);
}

From source file:com.sixrr.metrics.ui.charts.DiffDistributionDialog.java

private JFreeChart createChart(XYDataset dataset) {
    final String title = getTitle();

    final NumberAxis xAxis = new NumberAxis(metricName);
    xAxis.setAutoRangeIncludesZero(false);
    if (metricType.equals(MetricType.Ratio) || metricType.equals(MetricType.RecursiveRatio)) {
        xAxis.setNumberFormatOverride(new PercentFormatter());
    }/*ww  w  .  j  a v  a 2 s . c  o  m*/
    final NumberAxis yAxis = new NumberAxis("%");
    final XYItemRenderer renderer = new StandardXYItemRenderer(StandardXYItemRenderer.LINES);
    final XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    plot.setOrientation(PlotOrientation.VERTICAL);
    renderer.setToolTipGenerator(new StandardXYToolTipGenerator());
    return new JFreeChart(title, JFreeChartConstants.DEFAULT_TITLE_FONT, plot, true);
}