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

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

Introduction

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

Prototype

public Size2D arrange(Graphics2D g2) 

Source Link

Document

Arranges the contents of the block, with no constraints, and returns the block size.

Usage

From source file:ec.util.chart.swing.JTimeSeriesRendererSupport.java

static void drawToolTip(Graphics2D g2, double x, double y, double anchorOffset, String label, Font font,
        Paint paint, Paint fillPaint, Paint outlinePaint, Stroke outlineStroke) {
    LabelBlock block = new LabelBlock(label/*.replace("\n", "")*/, font, paint);
    block.setMargin(3, 3, 3, 3);/*from   w  w w . j  a v a  2s  . c  o m*/

    Rectangle2D hotspot = createHotspot(g2, x, y, anchorOffset + 10, block.arrange(g2));
    Shape shape = createShape(x, y, hotspot);

    if (fillPaint != null) {
        g2.setPaint(fillPaint);
        g2.fill(shape);
    }

    if (outlinePaint != null && outlineStroke != null) {
        g2.setStroke(outlineStroke);
        g2.setPaint(outlinePaint);
        g2.draw(shape);
    }

    block.draw(g2, hotspot);
}