Example usage for org.jfree.chart.block FlowArrangement FlowArrangement

List of usage examples for org.jfree.chart.block FlowArrangement FlowArrangement

Introduction

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

Prototype

public FlowArrangement(HorizontalAlignment hAlign, VerticalAlignment vAlign, double hGap, double vGap) 

Source Link

Document

Creates a new instance.

Usage

From source file:org.codehaus.mojo.dashboard.report.plugin.chart.time.MarkerTimeChartDecorator.java

/**
 * Creates a legend item block./*  w ww .j a  va 2  s  . c o  m*/
 * 
 * @param item
 *            the legend item.
 * 
 * @return The block.
 */
protected void createLegendBlock(BlockContainer blockcontainerLabel) {

    XYPlot xyplot = (XYPlot) report.getPlot();

    int nbRenderer = xyplot.getDatasetCount();
    BlockContainer blockcontainer = new BlockContainer(new BorderArrangement());
    if (nbRenderer > 1) {
        BlockContainer oldLegendBlockContainer = new BlockContainer(
                new FlowArrangement(HorizontalAlignment.LEFT, VerticalAlignment.TOP, 2.0D, 2.0D));
        for (int i = 0; i < nbRenderer; i++) {
            LegendTitle legendtitle = new LegendTitle(xyplot.getRenderer(i));
            legendtitle.setMargin(new RectangleInsets(1.0, 1.0, 1.0, 1.0));
            legendtitle.setFrame(new LineBorder());
            legendtitle.setBackgroundPaint(ChartColor.WHITE);
            oldLegendBlockContainer.add(legendtitle);
        }

        blockcontainer.add(oldLegendBlockContainer, RectangleEdge.LEFT);
    } else {
        LegendTitle legendtitle = new LegendTitle(xyplot.getRenderer(0));
        legendtitle.setMargin(new RectangleInsets(1.0, 1.0, 1.0, 1.0));
        legendtitle.setFrame(new LineBorder());
        legendtitle.setBackgroundPaint(ChartColor.WHITE);
        blockcontainer.add(legendtitle, RectangleEdge.LEFT);
    }

    LegendTitle legendtitle1 = new LegendTitle(xyplot.getRenderer());
    legendtitle1.setMargin(new RectangleInsets(1.0, 1.0, 1.0, 1.0));
    legendtitle1.setFrame(new LineBorder());
    legendtitle1.setBackgroundPaint(ChartColor.WHITE);
    legendtitle1.setWrapper(blockcontainerLabel);

    blockcontainer.add(legendtitle1, RectangleEdge.RIGHT);
    blockcontainer.add(new EmptyBlock(1000D, 0.0D));

    CompositeTitle compositetitle = new CompositeTitle(blockcontainer);
    compositetitle.setPosition(RectangleEdge.BOTTOM);
    report.clearSubtitles();
    report.addSubtitle(compositetitle);
}

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

/**
 * Creates {@link LegendTitle}s for all dimensions from the PlotConfiguration of this Plotter2D.
 * Expects that all {@link ValueSource} s in the provided PlotConfiguration use the same
 * {@link DimensionConfig} s./*  w w  w .  ja v  a2s . co  m*/
 */
private List<LegendTitle> createLegendTitles() {
    List<LegendTitle> legendTitles = new LinkedList<LegendTitle>();
    LegendConfiguration legendConfiguration = plotInstance.getCurrentPlotConfigurationClone()
            .getLegendConfiguration();

    LegendTitle legendTitle = new SmartLegendTitle(this,
            new FlowArrangement(HorizontalAlignment.CENTER, VerticalAlignment.CENTER, 30, 2),
            new ColumnArrangement(HorizontalAlignment.LEFT, VerticalAlignment.CENTER, 0, 2));
    legendTitle.setItemPaint(legendConfiguration.getLegendFontColor());

    RectangleEdge position = legendConfiguration.getLegendPosition().getPosition();
    if (position == null) {
        return legendTitles;
    }
    legendTitle.setPosition(position);

    if (legendConfiguration.isShowLegendFrame()) {
        legendTitle.setFrame(new BlockBorder(legendConfiguration.getLegendFrameColor()));
    }
    ColoredBlockContainer wrapper = new ColoredBlockContainer(legendConfiguration.getLegendBackgroundColor());
    wrapper.add(legendTitle.getItemContainer());
    wrapper.setPadding(3, 3, 3, 3);
    legendTitle.setWrapper(wrapper);

    legendTitles.add(legendTitle);
    return legendTitles;
}