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

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

Introduction

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

Prototype

public void setMargin(double top, double left, double bottom, double right) 

Source Link

Document

Sets the margin.

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);

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

    if (fillPaint != null) {
        g2.setPaint(fillPaint);/*from w ww  . j av a 2s .c  o m*/
        g2.fill(shape);
    }

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

    block.draw(g2, hotspot);
}