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

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

Introduction

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

Prototype

@Override
public void draw(Graphics2D g2, Rectangle2D area) 

Source Link

Document

Draws the block.

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);//  w  ww .  java 2  s.co  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);
}