Example usage for org.jfree.chart.title TextTitle setToolTipText

List of usage examples for org.jfree.chart.title TextTitle setToolTipText

Introduction

In this page you can find the example usage for org.jfree.chart.title TextTitle setToolTipText.

Prototype

public void setToolTipText(String text) 

Source Link

Document

Sets the tool tip text to the specified text and sends a TitleChangeEvent to all registered listeners.

Usage

From source file:edu.ucla.stat.SOCR.chart.demo.PieChartDemo1.java

/**
 * Creates a chart// www  . j  av  a2  s  . c  o  m
 * 
 * @param dataset  the dataset.
 * 
 * @return a chart.
 */
protected JFreeChart createChart(PieDataset dataset) {
    JFreeChart chart = ChartFactory.createPieChart(chartTitle, // chart title
            dataset, // data
            !legendPanelOn, // include legend
            true, false);
    TextTitle title = chart.getTitle();
    title.setToolTipText("A title tooltip!");

    PiePlot plot = (PiePlot) chart.getPlot();
    for (int i = 0; i < pulloutFlag.length; i++) {
        //System.out.println("\""+pulloutFlag[i]+"\"");
        if (isPullout(i)) {
            Comparable key = dataset.getKey(i);
            plot.setExplodePercent(key, 0.30);
        }
    }
    plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
    plot.setNoDataMessage("No data available");
    plot.setCircular(false);
    plot.setLabelGap(0.02);

    setCategorySummary(dataset);

    if (rotateOn) {
        Rotator rotator = new Rotator(plot);
        rotator.start();
    }
    return chart;
}

From source file:it.eng.spagobi.engines.chart.bo.charttypes.piecharts.SimplePie.java

public JFreeChart createChart(DatasetMap datasets) {

    Dataset dataset = (Dataset) datasets.getDatasets().get("1");

    JFreeChart chart = null;/*w w  w  .  j  ava 2s .  c om*/

    if (!threeD) {
        chart = ChartFactory.createPieChart(name, (PieDataset) dataset, // data
                legend, // include legend
                true, false);

        chart.setBackgroundPaint(color);

        TextTitle title = chart.getTitle();
        title.setToolTipText("A title tooltip!");

        PiePlot plot = (PiePlot) chart.getPlot();
        plot.setLabelFont(new Font(defaultLabelsStyle.getFontName(), Font.PLAIN, defaultLabelsStyle.getSize()));
        plot.setCircular(false);
        plot.setLabelGap(0.02);
        plot.setNoDataMessage("No data available");

        if (percentage == false) {
            plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} ({1})"));
        } else {
            plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} ({2})"));
        }

    } else {
        chart = ChartFactory.createPieChart3D(name, (PieDataset) dataset, // data
                true, // include legend
                true, false);

        chart.setBackgroundPaint(color);

        TextTitle title = chart.getTitle();
        title.setToolTipText("A title tooltip!");

        PiePlot3D plot = (PiePlot3D) chart.getPlot();

        plot.setDarkerSides(true);
        plot.setStartAngle(290);
        plot.setDirection(Rotation.CLOCKWISE);
        plot.setForegroundAlpha(1.0f);
        plot.setDepthFactor(0.2);

        plot.setLabelFont(new Font(defaultLabelsStyle.getFontName(), Font.PLAIN, defaultLabelsStyle.getSize()));
        // plot.setNoDataMessages("No data available");
        plot.setCircular(false);
        plot.setLabelGap(0.02);
        plot.setNoDataMessage("No data available");

        if (percentage == false) {
            plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} ({1})"));
        } else {
            plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} ({2})"));
        }
    }

    TextTitle title = setStyleTitle(name, styleTitle);
    chart.setTitle(title);
    if (subName != null && !subName.equals("")) {
        TextTitle subTitle = setStyleTitle(subName, styleSubTitle);
        chart.addSubtitle(subTitle);
    }

    return chart;

}

From source file:it.eng.spagobi.engines.chart.bo.charttypes.piecharts.LinkablePie.java

public JFreeChart createChart(DatasetMap datasets) {
    Dataset dataset = (Dataset) datasets.getDatasets().get("1");

    boolean document_composition = false;
    if (mode.equalsIgnoreCase(SpagoBIConstants.DOCUMENT_COMPOSITION))
        document_composition = true;/*from  w ww .  j a v  a2s.c  o m*/

    JFreeChart chart = null;

    if (!threeD) {
        chart = ChartFactory.createPieChart(name, (PieDataset) dataset, // data
                legend, // include legend
                true, false);

        chart.setBackgroundPaint(color);

        TextTitle title = chart.getTitle();
        title.setToolTipText("A title tooltip!");

        PiePlot plot = (PiePlot) chart.getPlot();
        plot.setLabelFont(new Font(defaultLabelsStyle.getFontName(), Font.PLAIN, defaultLabelsStyle.getSize()));
        plot.setCircular(false);
        plot.setLabelGap(0.02);
        plot.setNoDataMessage("No data available");

        if (percentage == false) {
            plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} ({1})"));
        } else {
            plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} ({2})"));
        }

        MyPieUrlGenerator pieUrl = new MyPieUrlGenerator(rootUrl);
        pieUrl.setDocument_composition(document_composition);
        pieUrl.setCategoryUrlLabel(categoryUrlName);
        pieUrl.setDrillDocTitle(drillDocTitle);
        pieUrl.setTarget(target);

        plot.setURLGenerator(pieUrl);

    } else {
        chart = ChartFactory.createPieChart3D(name, (PieDataset) dataset, // data
                true, // include legend
                true, false);

        chart.setBackgroundPaint(color);

        TextTitle title = chart.getTitle();
        title.setToolTipText("A title tooltip!");

        PiePlot3D plot = (PiePlot3D) chart.getPlot();

        plot.setDarkerSides(true);
        plot.setStartAngle(290);
        plot.setDirection(Rotation.CLOCKWISE);
        plot.setForegroundAlpha(1.0f);
        plot.setDepthFactor(0.2);

        plot.setLabelFont(new Font(defaultLabelsStyle.getFontName(), Font.PLAIN, defaultLabelsStyle.getSize()));
        plot.setCircular(false);
        plot.setLabelGap(0.02);
        plot.setNoDataMessage("No data available");

        //org.jfree.chart.renderer.category.BarRenderer renderer = new org.jfree.chart.renderer.category.AreaRenderer);

        MyPieUrlGenerator pieUrl = new MyPieUrlGenerator(rootUrl);
        pieUrl.setDocument_composition(document_composition);
        pieUrl.setCategoryUrlLabel(categoryUrlName);
        pieUrl.setDrillDocTitle(drillDocTitle);
        pieUrl.setTarget(target);

        plot.setURLGenerator(pieUrl);

        if (percentage == false) {
            plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} ({1})"));
        } else {
            plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} ({2})"));
        }
    }

    TextTitle title = setStyleTitle(name, styleTitle);
    chart.setTitle(title);
    if (subName != null && !subName.equals("")) {
        TextTitle subTitle = setStyleTitle(subName, styleSubTitle);
        chart.addSubtitle(subTitle);
    }

    return chart;

}

From source file:edu.ucla.stat.SOCR.chart.SuperPieChart.java

/**
 * Creates a chart.//w ww .  j a va  2  s  .  c  o m
 * 
 * @param dataset  the dataset.
 * 
 * @return a chart.
 */
protected JFreeChart createChart(PieDataset dataset) {

    JFreeChart chart = ChartFactory.createPieChart(chartTitle, // chart title
            dataset, // data
            !legendPanelOn, // include legend
            true, false);
    TextTitle title = chart.getTitle();
    title.setToolTipText("A title tooltip!");

    PiePlot plot = (PiePlot) chart.getPlot();
    if (!ThreeDPie) {
        for (int i = 0; i < pulloutFlag.length; i++) {
            //System.out.println("SuperPieChart\""+pulloutFlag[i]+"\"");
            if (pulloutFlag[i].equals("1")) {
                Comparable key = dataset.getKey(i);
                plot.setExplodePercent(key, 0.30);
            }
        }
    }
    plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
    plot.setNoDataMessage("No data available");
    plot.setCircular(false);
    plot.setLabelGap(0.02);

    return chart;
}

From source file:edu.ucla.stat.SOCR.chart.ChartGenerator_JTable.java

private JFreeChart createPieChart(String titleLabel, PieDataset dataset) {
    // System.out.println("rotation="+rotation);
    if (dimension.equalsIgnoreCase("3D")) {
        JFreeChart chart = ChartFactory.createPieChart3D(titleLabel, // chart title
                dataset, // data
                true, // include legend
                true, false);/*from  w  w w  .ja va2s . c om*/

        PiePlot3D plot = (PiePlot3D) chart.getPlot();
        if (rotation.equalsIgnoreCase("clockwise")) {
            plot.setStartAngle(290);
            plot.setDirection(Rotation.CLOCKWISE);
            Rotator rotator = new Rotator(plot);
            rotator.start();
        } else if (rotation.equalsIgnoreCase("counter_clockwise")) {
            plot.setStartAngle(290);
            plot.setDirection(Rotation.ANTICLOCKWISE);
            Rotator rotator = new Rotator(plot);
            rotator.start();
        }
        plot.setForegroundAlpha(0.5f);
        plot.setNoDataMessage("No data to display");
        return chart;
    } //end of 3D

    //2D ring
    if (rotation.equalsIgnoreCase("ring")) {
        JFreeChart chart = ChartFactory.createRingChart(titleLabel, // chart title
                dataset, // data
                false, // include legend
                true, false);

        RingPlot plot = (RingPlot) chart.getPlot();
        plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
        plot.setNoDataMessage("No data available");
        plot.setCircular(false);
        plot.setLabelGap(0.02);
        return chart;
    }

    //2D
    JFreeChart chart = ChartFactory.createPieChart(titleLabel, // chart title
            dataset, // data
            true, // include legend
            true, false);
    TextTitle title = chart.getTitle();
    title.setToolTipText("A title tooltip!");

    PiePlot plot = (PiePlot) chart.getPlot();
    if (rotation.equalsIgnoreCase("clockwise")) {
        plot.setStartAngle(290);
        plot.setDirection(Rotation.CLOCKWISE);
        Rotator rotator = new Rotator(plot);
        rotator.start();
    } else if (rotation.equalsIgnoreCase("counter_clockwise")) {
        plot.setStartAngle(290);
        plot.setDirection(Rotation.ANTICLOCKWISE);
        Rotator rotator = new Rotator(plot);
        rotator.start();
    }

    plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
    plot.setNoDataMessage("No data available");
    plot.setCircular(false);
    plot.setLabelGap(0.02);

    return chart;
}