Example usage for org.jfree.chart.renderer.xy XYBlockRenderer setToolTipGenerator

List of usage examples for org.jfree.chart.renderer.xy XYBlockRenderer setToolTipGenerator

Introduction

In this page you can find the example usage for org.jfree.chart.renderer.xy XYBlockRenderer setToolTipGenerator.

Prototype

@Override
public void setToolTipGenerator(XYToolTipGenerator generator) 

Source Link

Document

Sets the tool tip generator for ALL series and sends a RendererChangeEvent to all registered listeners.

Usage

From source file:net.sf.maltcms.chromaui.chromatogram1Dviewer.ui.Chromatogram1DHeatmapViewTopComponent.java

private XYPlot createPlot(ADataset2D<IChromatogram1D, IScan> ds) {
    XYBlockRenderer xybr = new XYBlockRenderer();
    IPaintScaleProvider ips = Lookup.getDefault().lookup(IPaintScaleProvider.class);
    ips.setMin(ds.getMinZ());//from  ww  w  .  j av a  2 s  .co  m
    ips.setMax(ds.getMaxZ());
    PaintScale ps = ips.getPaintScales().get(0);
    xybr.setPaintScale(ps);
    xybr.setDefaultEntityRadius(5);
    xybr.setBlockWidth(0.1);
    xybr.setBlockAnchor(RectangleAnchor.CENTER);
    xybr.setBlockHeight(1.0);
    RTUnit rtUnit = RTUnit.SECONDS;
    xybr.setToolTipGenerator(
            new StandardXYZToolTipGenerator("{0}: @({1}, {2}) = {3}", DecimalFormat.getNumberInstance(),
                    DecimalFormat.getNumberInstance(), DecimalFormat.getNumberInstance()));
    NumberAxis rt1 = new NumberAxis("Retention Time [" + rtUnit.name().toLowerCase() + "]");
    NumberAxis rt2 = new NumberAxis("M/Z");
    rt1.setAutoRange(false);
    rt1.setLowerBound(ds.getMinX());
    rt1.setUpperBound(ds.getMaxX());
    rt1.setRangeWithMargins(ds.getMinX(), ds.getMaxX());
    rt2.setFixedAutoRange(ds.getMaxX() - ds.getMinX());
    rt2.setAutoRange(false);
    rt2.setLowerBound(ds.getMinY());
    rt2.setUpperBound(ds.getMaxY());
    rt2.setFixedAutoRange(ds.getMaxY() - ds.getMinY());
    rt2.setRangeWithMargins(ds.getMinY(), ds.getMaxY());
    XYPlot heatmapPlot = new XYPlot(ds, rt1, rt2, xybr);
    heatmapPlot.setDomainPannable(true);
    heatmapPlot.setRangePannable(true);
    return heatmapPlot;
}