Example usage for org.jfree.chart.block LabelBlock setToolTipText

List of usage examples for org.jfree.chart.block LabelBlock setToolTipText

Introduction

In this page you can find the example usage for org.jfree.chart.block LabelBlock setToolTipText.

Prototype

public void setToolTipText(String text) 

Source Link

Document

Sets the tool tip text.

Usage

From source file:gda.plots.SimpleLegendTitle.java

/**
 * Overrides the super class method to create a SimpleLegendGraphic instead of a LegendGraphic and a
 * SimpleLegendLabelBlock instead of a LabelBlock (otherwise identical except private field names replaced with
 * method calls). Assumes it will be passed a SimpleLegendItem and uses it to get the SimpleXYSeries to pass on to
 * the SimpleLegendGraphic and SimpleLegendLabelBlock.
 * /*from w w w  .  j a  v  a  2s .  co m*/
 * @param item
 *            the LegendItem for which the LegendItemBlock is to be created
 * @return the LegendItemBlock created
 */
@Override
protected Block createLegendItemBlock(LegendItem item) {
    BlockContainer result = null;
    if (item instanceof SimpleLegendItem) {
        LegendGraphic lg = new SimpleLegendGraphic(item.getShape(), item.getFillPaint(),
                ((SimpleLegendItem) item).getSeries());
        lg.setShapeFilled(item.isShapeFilled());
        lg.setLine(item.getLine());
        lg.setLineStroke(item.getLineStroke());
        lg.setLinePaint(item.getLinePaint());
        lg.setLineVisible(item.isLineVisible());
        lg.setShapeVisible(item.isShapeVisible());
        lg.setShapeOutlineVisible(item.isShapeOutlineVisible());
        lg.setOutlinePaint(item.getOutlinePaint());
        lg.setOutlineStroke(item.getOutlineStroke());
        lg.setPadding(getLegendItemGraphicPadding());

        BlockContainer legendItem = new BlockContainer(new BorderArrangement());
        lg.setShapeAnchor(getLegendItemGraphicAnchor());
        lg.setShapeLocation(getLegendItemGraphicLocation());
        legendItem.add(lg, getLegendItemGraphicEdge());
        LabelBlock labelBlock = new SimpleLegendLabelBlock(item.getLabel(), getItemFont(), getItemPaint(),
                ((SimpleLegendItem) item).getSeries());
        labelBlock.setPadding(getItemLabelPadding());
        labelBlock.setToolTipText(item.getLabel());
        // labelBlock.setToolTipText("click");
        legendItem.add(labelBlock);

        result = new BlockContainer(new CenterArrangement());
        result.add(legendItem);
    }

    return result;
}