Java Code Examples for org.jfree.chart.LegendItem#setToolTipText()

The following examples show how to use org.jfree.chart.LegendItem#setToolTipText() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractXYItemRenderer.java    From openstock with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Returns a default legend item for the specified series.  Subclasses
 * should override this method to generate customised items.
 *
 * @param datasetIndex  the dataset index (zero-based).
 * @param series  the series index (zero-based).
 *
 * @return A legend item for the series.
 */
@Override
public LegendItem getLegendItem(int datasetIndex, int series) {
    XYPlot xyplot = getPlot();
    if (xyplot == null) {
        return null;
    }
    XYDataset dataset = xyplot.getDataset(datasetIndex);
    if (dataset == null) {
        return null;
    }
    String label = this.legendItemLabelGenerator.generateLabel(dataset,
            series);
    String description = label;
    String toolTipText = null;
    if (getLegendItemToolTipGenerator() != null) {
        toolTipText = getLegendItemToolTipGenerator().generateLabel(
                dataset, series);
    }
    String urlText = null;
    if (getLegendItemURLGenerator() != null) {
        urlText = getLegendItemURLGenerator().generateLabel(dataset,
                series);
    }
    Shape shape = lookupLegendShape(series);
    Paint paint = lookupSeriesPaint(series);
    LegendItem item = new LegendItem(label, paint);
    item.setToolTipText(toolTipText);
    item.setURLText(urlText);
    item.setLabelFont(lookupLegendTextFont(series));
    Paint labelPaint = lookupLegendTextPaint(series);
    if (labelPaint != null) {
        item.setLabelPaint(labelPaint);
    }
    item.setSeriesKey(dataset.getSeriesKey(series));
    item.setSeriesIndex(series);
    item.setDataset(dataset);
    item.setDatasetIndex(datasetIndex);

    if (getTreatLegendShapeAsLine()) {
        item.setLineVisible(true);
        item.setLine(shape);
        item.setLinePaint(paint);
        item.setShapeVisible(false);
    }
    else {
        Paint outlinePaint = lookupSeriesOutlinePaint(series);
        Stroke outlineStroke = lookupSeriesOutlineStroke(series);
        item.setOutlinePaint(outlinePaint);
        item.setOutlineStroke(outlineStroke);
    }
    return item;
}
 
Example 2
Source File: AbstractXYItemRenderer.java    From ccu-historian with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Returns a default legend item for the specified series.  Subclasses
 * should override this method to generate customised items.
 *
 * @param datasetIndex  the dataset index (zero-based).
 * @param series  the series index (zero-based).
 *
 * @return A legend item for the series.
 */
@Override
public LegendItem getLegendItem(int datasetIndex, int series) {
    XYPlot xyplot = getPlot();
    if (xyplot == null) {
        return null;
    }
    XYDataset dataset = xyplot.getDataset(datasetIndex);
    if (dataset == null) {
        return null;
    }
    String label = this.legendItemLabelGenerator.generateLabel(dataset,
            series);
    String description = label;
    String toolTipText = null;
    if (getLegendItemToolTipGenerator() != null) {
        toolTipText = getLegendItemToolTipGenerator().generateLabel(
                dataset, series);
    }
    String urlText = null;
    if (getLegendItemURLGenerator() != null) {
        urlText = getLegendItemURLGenerator().generateLabel(dataset,
                series);
    }
    Shape shape = lookupLegendShape(series);
    Paint paint = lookupSeriesPaint(series);
    LegendItem item = new LegendItem(label, paint);
    item.setToolTipText(toolTipText);
    item.setURLText(urlText);
    item.setLabelFont(lookupLegendTextFont(series));
    Paint labelPaint = lookupLegendTextPaint(series);
    if (labelPaint != null) {
        item.setLabelPaint(labelPaint);
    }
    item.setSeriesKey(dataset.getSeriesKey(series));
    item.setSeriesIndex(series);
    item.setDataset(dataset);
    item.setDatasetIndex(datasetIndex);

    if (getTreatLegendShapeAsLine()) {
        item.setLineVisible(true);
        item.setLine(shape);
        item.setLinePaint(paint);
        item.setShapeVisible(false);
    }
    else {
        Paint outlinePaint = lookupSeriesOutlinePaint(series);
        Stroke outlineStroke = lookupSeriesOutlineStroke(series);
        item.setOutlinePaint(outlinePaint);
        item.setOutlineStroke(outlineStroke);
    }
    return item;
}
 
Example 3
Source File: AbstractXYItemRenderer.java    From SIMVA-SoS with Apache License 2.0 4 votes vote down vote up
/**
 * Returns a default legend item for the specified series.  Subclasses
 * should override this method to generate customised items.
 *
 * @param datasetIndex  the dataset index (zero-based).
 * @param series  the series index (zero-based).
 *
 * @return A legend item for the series.
 */
@Override
public LegendItem getLegendItem(int datasetIndex, int series) {
    XYPlot xyplot = getPlot();
    if (xyplot == null) {
        return null;
    }
    XYDataset dataset = xyplot.getDataset(datasetIndex);
    if (dataset == null) {
        return null;
    }
    String label = this.legendItemLabelGenerator.generateLabel(dataset,
            series);
    String description = label;
    String toolTipText = null;
    if (getLegendItemToolTipGenerator() != null) {
        toolTipText = getLegendItemToolTipGenerator().generateLabel(
                dataset, series);
    }
    String urlText = null;
    if (getLegendItemURLGenerator() != null) {
        urlText = getLegendItemURLGenerator().generateLabel(dataset,
                series);
    }
    Shape shape = lookupLegendShape(series);
    Paint paint = lookupSeriesPaint(series);
    LegendItem item = new LegendItem(label, paint);
    item.setToolTipText(toolTipText);
    item.setURLText(urlText);
    item.setLabelFont(lookupLegendTextFont(series));
    Paint labelPaint = lookupLegendTextPaint(series);
    if (labelPaint != null) {
        item.setLabelPaint(labelPaint);
    }
    item.setSeriesKey(dataset.getSeriesKey(series));
    item.setSeriesIndex(series);
    item.setDataset(dataset);
    item.setDatasetIndex(datasetIndex);

    if (getTreatLegendShapeAsLine()) {
        item.setLineVisible(true);
        item.setLine(shape);
        item.setLinePaint(paint);
        item.setShapeVisible(false);
    }
    else {
        Paint outlinePaint = lookupSeriesOutlinePaint(series);
        Stroke outlineStroke = lookupSeriesOutlineStroke(series);
        item.setOutlinePaint(outlinePaint);
        item.setOutlineStroke(outlineStroke);
    }
    return item;
}
 
Example 4
Source File: AbstractXYItemRenderer.java    From ECG-Viewer with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns a default legend item for the specified series.  Subclasses
 * should override this method to generate customised items.
 *
 * @param datasetIndex  the dataset index (zero-based).
 * @param series  the series index (zero-based).
 *
 * @return A legend item for the series.
 */
@Override
public LegendItem getLegendItem(int datasetIndex, int series) {
    XYPlot xyplot = getPlot();
    if (xyplot == null) {
        return null;
    }
    XYDataset dataset = xyplot.getDataset(datasetIndex);
    if (dataset == null) {
        return null;
    }
    String label = this.legendItemLabelGenerator.generateLabel(dataset,
            series);
    String description = label;
    String toolTipText = null;
    if (getLegendItemToolTipGenerator() != null) {
        toolTipText = getLegendItemToolTipGenerator().generateLabel(
                dataset, series);
    }
    String urlText = null;
    if (getLegendItemURLGenerator() != null) {
        urlText = getLegendItemURLGenerator().generateLabel(dataset,
                series);
    }
    Shape shape = lookupLegendShape(series);
    Paint paint = lookupSeriesPaint(series);
    LegendItem item = new LegendItem(label, paint);
    item.setToolTipText(toolTipText);
    item.setURLText(urlText);
    item.setLabelFont(lookupLegendTextFont(series));
    Paint labelPaint = lookupLegendTextPaint(series);
    if (labelPaint != null) {
        item.setLabelPaint(labelPaint);
    }
    item.setSeriesKey(dataset.getSeriesKey(series));
    item.setSeriesIndex(series);
    item.setDataset(dataset);
    item.setDatasetIndex(datasetIndex);

    if (getTreatLegendShapeAsLine()) {
        item.setLineVisible(true);
        item.setLine(shape);
        item.setLinePaint(paint);
        item.setShapeVisible(false);
    }
    else {
        Paint outlinePaint = lookupSeriesOutlinePaint(series);
        Stroke outlineStroke = lookupSeriesOutlineStroke(series);
        item.setOutlinePaint(outlinePaint);
        item.setOutlineStroke(outlineStroke);
    }
    return item;
}
 
Example 5
Source File: AbstractXYItemRenderer.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns a default legend item for the specified series.  Subclasses
 * should override this method to generate customised items.
 *
 * @param datasetIndex  the dataset index (zero-based).
 * @param series  the series index (zero-based).
 *
 * @return A legend item for the series.
 */
public LegendItem getLegendItem(int datasetIndex, int series) {
    XYPlot xyplot = getPlot();
    if (xyplot == null) {
        return null;
    }
    XYDataset dataset = xyplot.getDataset(datasetIndex);
    if (dataset == null) {
        return null;
    }
    String label = this.legendItemLabelGenerator.generateLabel(dataset,
            series);
    String description = label;
    String toolTipText = null;
    if (getLegendItemToolTipGenerator() != null) {
        toolTipText = getLegendItemToolTipGenerator().generateLabel(
                dataset, series);
    }
    String urlText = null;
    if (getLegendItemURLGenerator() != null) {
        urlText = getLegendItemURLGenerator().generateLabel(dataset,
                series);
    }
    Shape shape = lookupLegendShape(series);
    Paint paint = lookupSeriesPaint(series);
    LegendItem item = new LegendItem(label, paint);
    item.setToolTipText(toolTipText);
    item.setURLText(urlText);
    item.setLabelFont(lookupLegendTextFont(series));
    Paint labelPaint = lookupLegendTextPaint(series);
    if (labelPaint != null) {
        item.setLabelPaint(labelPaint);
    }
    item.setSeriesKey(dataset.getSeriesKey(series));
    item.setSeriesIndex(series);
    item.setDataset(dataset);
    item.setDatasetIndex(datasetIndex);

    if (getTreatLegendShapeAsLine()) {
        item.setLineVisible(true);
        item.setLine(shape);
        item.setLinePaint(paint);
        item.setShapeVisible(false);
    }
    else {
        Paint outlinePaint = lookupSeriesOutlinePaint(series);
        Stroke outlineStroke = lookupSeriesOutlineStroke(series);
        item.setOutlinePaint(outlinePaint);
        item.setOutlineStroke(outlineStroke);
    }
    return item;
}
 
Example 6
Source File: AbstractXYItemRenderer.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Returns a default legend item for the specified series.  Subclasses
 * should override this method to generate customised items.
 *
 * @param datasetIndex  the dataset index (zero-based).
 * @param series  the series index (zero-based).
 *
 * @return A legend item for the series.
 */
@Override
public LegendItem getLegendItem(int datasetIndex, int series) {
    XYPlot xyplot = getPlot();
    if (xyplot == null) {
        return null;
    }
    XYDataset dataset = xyplot.getDataset(datasetIndex);
    if (dataset == null) {
        return null;
    }
    String label = this.legendItemLabelGenerator.generateLabel(dataset,
            series);
    String description = label;
    String toolTipText = null;
    if (getLegendItemToolTipGenerator() != null) {
        toolTipText = getLegendItemToolTipGenerator().generateLabel(
                dataset, series);
    }
    String urlText = null;
    if (getLegendItemURLGenerator() != null) {
        urlText = getLegendItemURLGenerator().generateLabel(dataset,
                series);
    }
    Shape shape = lookupLegendShape(series);
    Paint paint = lookupSeriesPaint(series);
    LegendItem item = new LegendItem(label, paint);
    item.setToolTipText(toolTipText);
    item.setURLText(urlText);
    item.setLabelFont(lookupLegendTextFont(series));
    Paint labelPaint = lookupLegendTextPaint(series);
    if (labelPaint != null) {
        item.setLabelPaint(labelPaint);
    }
    item.setSeriesKey(dataset.getSeriesKey(series));
    item.setSeriesIndex(series);
    item.setDataset(dataset);
    item.setDatasetIndex(datasetIndex);

    if (getTreatLegendShapeAsLine()) {
        item.setLineVisible(true);
        item.setLine(shape);
        item.setLinePaint(paint);
        item.setShapeVisible(false);
    }
    else {
        Paint outlinePaint = lookupSeriesOutlinePaint(series);
        Stroke outlineStroke = lookupSeriesOutlineStroke(series);
        item.setOutlinePaint(outlinePaint);
        item.setOutlineStroke(outlineStroke);
    }
    return item;
}
 
Example 7
Source File: AbstractXYItemRenderer.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Returns a default legend item for the specified series.  Subclasses
 * should override this method to generate customised items.
 *
 * @param datasetIndex  the dataset index (zero-based).
 * @param series  the series index (zero-based).
 *
 * @return A legend item for the series.
 */
@Override
public LegendItem getLegendItem(int datasetIndex, int series) {
    XYPlot xyplot = getPlot();
    if (xyplot == null) {
        return null;
    }
    XYDataset dataset = xyplot.getDataset(datasetIndex);
    if (dataset == null) {
        return null;
    }
    String label = this.legendItemLabelGenerator.generateLabel(dataset,
            series);
    String description = label;
    String toolTipText = null;
    if (getLegendItemToolTipGenerator() != null) {
        toolTipText = getLegendItemToolTipGenerator().generateLabel(
                dataset, series);
    }
    String urlText = null;
    if (getLegendItemURLGenerator() != null) {
        urlText = getLegendItemURLGenerator().generateLabel(dataset,
                series);
    }
    Shape shape = lookupLegendShape(series);
    Paint paint = lookupSeriesPaint(series);
    LegendItem item = new LegendItem(label, paint);
    item.setToolTipText(toolTipText);
    item.setURLText(urlText);
    item.setLabelFont(lookupLegendTextFont(series));
    Paint labelPaint = lookupLegendTextPaint(series);
    if (labelPaint != null) {
        item.setLabelPaint(labelPaint);
    }
    item.setSeriesKey(dataset.getSeriesKey(series));
    item.setSeriesIndex(series);
    item.setDataset(dataset);
    item.setDatasetIndex(datasetIndex);

    if (getTreatLegendShapeAsLine()) {
        item.setLineVisible(true);
        item.setLine(shape);
        item.setLinePaint(paint);
        item.setShapeVisible(false);
    }
    else {
        Paint outlinePaint = lookupSeriesOutlinePaint(series);
        Stroke outlineStroke = lookupSeriesOutlineStroke(series);
        item.setOutlinePaint(outlinePaint);
        item.setOutlineStroke(outlineStroke);
    }
    return item;
}