Example usage for org.jfree.chart LegendItem getLabelFont

List of usage examples for org.jfree.chart LegendItem getLabelFont

Introduction

In this page you can find the example usage for org.jfree.chart LegendItem getLabelFont.

Prototype

public Font getLabelFont() 

Source Link

Document

Returns the label font.

Usage

From source file:com.rapidminer.gui.new_plotter.engine.jfreechart.PlotInstanceLegendCreator.java

/**
 * Creates a title item (i.e. bold font etc.) with the given string. Simply gets the default
 * font from the plotConfig and sets it style to bold.
 * /*from  w ww  . j  ava 2  s. c  o  m*/
 * @return The created legend item.
 */
private LegendItem createTitleLegendItem(String titleString, PlotConfiguration plotConfiguration) {
    LegendItem titleItem = new LegendItem(titleString, "", "", "", false, new Rectangle(), false, Color.WHITE,
            false, Color.WHITE, new BasicStroke(), false, new Rectangle(), new BasicStroke(), Color.WHITE);
    Font titleFont = titleItem.getLabelFont();

    if (titleFont == null) {
        titleFont = plotConfiguration.getLegendConfiguration().getLegendFont();
    }
    titleItem.setLabelFont(titleFont.deriveFont(Font.BOLD));
    return titleItem;
}

From source file:com.rapidminer.gui.new_plotter.engine.jfreechart.legend.SmartLegendTitle.java

private Block createDefaultLegendItem(LegendItem item) {
    BlockContainer result = null;/*ww  w . j a v a 2  s  .  co  m*/

    Shape shape = item.getShape();
    if (shape == null) {
        shape = new Rectangle();
    }
    LegendGraphic lg = new LegendGraphic(shape, item.getFillPaint());
    lg.setFillPaintTransformer(item.getFillPaintTransformer());
    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());

    LegendItemBlockContainer legendItem = new LegendItemBlockContainer(new BorderArrangement(),
            item.getDataset(), item.getSeriesKey());
    lg.setShapeAnchor(getLegendItemGraphicAnchor());
    lg.setShapeLocation(getLegendItemGraphicLocation());
    legendItem.add(lg, getLegendItemGraphicEdge());

    Font textFont = item.getLabelFont();
    if (textFont == null) {
        textFont = getItemFont();
    }
    Paint textPaint = item.getLabelPaint();
    if (textPaint == null) {
        textPaint = getItemPaint();
    }
    LabelBlock labelBlock = new LabelBlock(item.getLabel(), textFont, textPaint);
    labelBlock.setPadding(getItemLabelPadding());
    legendItem.add(labelBlock);
    legendItem.setToolTipText(item.getToolTipText());
    legendItem.setURLText(item.getURLText());

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

    return result;
}