org.jfree.chart.labels.XYToolTipGenerator Java Examples

The following examples show how to use org.jfree.chart.labels.XYToolTipGenerator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XYAreaRenderer2.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Constructs a new renderer.
 *
 * @param labelGenerator  the tool tip generator to use.  <code>null</code>
 *                        is none.
 * @param urlGenerator  the URL generator (null permitted).
 */
public XYAreaRenderer2(XYToolTipGenerator labelGenerator,
                       XYURLGenerator urlGenerator) {
    super();
    this.showOutline = false;
    setBaseToolTipGenerator(labelGenerator);
    setURLGenerator(urlGenerator);
    GeneralPath area = new GeneralPath();
    area.moveTo(0.0f, -4.0f);
    area.lineTo(3.0f, -2.0f);
    area.lineTo(4.0f, 4.0f);
    area.lineTo(-4.0f, 4.0f);
    area.lineTo(-3.0f, -2.0f);
    area.closePath();
    this.legendArea = area;
}
 
Example #2
Source File: ChartFactory.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates and returns a time series chart.  A time series chart is an
 * {@link XYPlot} with a {@link DateAxis} for the x-axis and a
 * {@link NumberAxis} for the y-axis.  The default renderer is an
 * {@link XYLineAndShapeRenderer}. A convenient dataset to use with this
 * chart is a {@link TimeSeriesCollection}.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param timeAxisLabel  a label for the time axis (<code>null</code>
 *                       permitted).
 * @param valueAxisLabel  a label for the value axis (<code>null</code>
 *                        permitted).
 * @param dataset  the dataset for the chart (<code>null</code> permitted).
 * @param legend  a flag specifying whether or not a legend is required.
 *
 * @return A time series chart.
 */
public static JFreeChart createTimeSeriesChart(String title,
        String timeAxisLabel, String valueAxisLabel, XYDataset dataset,
        boolean legend) {

    ValueAxis timeAxis = new DateAxis(timeAxisLabel);
    timeAxis.setLowerMargin(0.02);  // reduce the default margins
    timeAxis.setUpperMargin(0.02);
    NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
    valueAxis.setAutoRangeIncludesZero(false);  // override default
    XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, null);
    XYToolTipGenerator toolTipGenerator = null;
    toolTipGenerator = StandardXYToolTipGenerator.getTimeSeriesInstance();
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true,
            false);
    renderer.setBaseToolTipGenerator(toolTipGenerator);
    plot.setRenderer(renderer);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
            plot, legend);
    currentTheme.apply(chart);
    return chart;

}
 
Example #3
Source File: AbstractXYItemRenderer.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns the tool tip generator for a data item.  If, for some reason,
 * you want a different generator for individual items, you can override
 * this method.
 *
 * @param series  the series index (zero based).
 * @param item  the item index (zero based).
 *
 * @return The generator (possibly <code>null</code>).
 */
@Override
public XYToolTipGenerator getToolTipGenerator(int series, int item) {
    // return the generator for ALL series, if there is one...
    if (this.toolTipGenerator != null) {
        return this.toolTipGenerator;
    }

    // otherwise look up the generator table
    XYToolTipGenerator generator
            = (XYToolTipGenerator) this.toolTipGeneratorMap.get(series);
    if (generator == null) {
        generator = this.baseToolTipGenerator;
    }
    return generator;
}
 
Example #4
Source File: AbstractXYItemRenderer.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the tool tip generator for a data item.  If, for some reason,
 * you want a different generator for individual items, you can override
 * this method.
 *
 * @param series  the series index (zero based).
 * @param item  the item index (zero based).
 *
 * @return The generator (possibly <code>null</code>).
 */
@Override
public XYToolTipGenerator getToolTipGenerator(int series, int item) {
    // return the generator for ALL series, if there is one...
    if (this.toolTipGenerator != null) {
        return this.toolTipGenerator;
    }

    // otherwise look up the generator table
    XYToolTipGenerator generator
            = (XYToolTipGenerator) this.toolTipGeneratorMap.get(series);
    if (generator == null) {
        generator = this.baseToolTipGenerator;
    }
    return generator;
}
 
Example #5
Source File: AbstractXYItemRenderer.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the tool tip generator for a data item.  If, for some reason,
 * you want a different generator for individual items, you can override
 * this method.
 *
 * @param series  the series index (zero based).
 * @param item  the item index (zero based).
 *
 * @return The generator (possibly <code>null</code>).
 */
@Override
public XYToolTipGenerator getToolTipGenerator(int series, int item) {
    // return the generator for ALL series, if there is one...
    if (this.toolTipGenerator != null) {
        return this.toolTipGenerator;
    }

    // otherwise look up the generator table
    XYToolTipGenerator generator
            = (XYToolTipGenerator) this.toolTipGeneratorMap.get(series);
    if (generator == null) {
        generator = this.baseToolTipGenerator;
    }
    return generator;
}
 
Example #6
Source File: CandlestickRenderer.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a new renderer for candlestick charts.
 * <P>
 * Use -1 for the candle width if you prefer the width to be calculated
 * automatically.
 *
 * @param candleWidth  the candle width.
 * @param drawVolume  a flag indicating whether or not volume bars should
 *                    be drawn.
 * @param toolTipGenerator  the tool tip generator. <code>null</code> is
 *                          none.
 */
public CandlestickRenderer(double candleWidth, boolean drawVolume,
                           XYToolTipGenerator toolTipGenerator) {
    super();
    setBaseToolTipGenerator(toolTipGenerator);
    this.candleWidth = candleWidth;
    this.drawVolume = drawVolume;
    this.volumePaint = Color.gray;
    this.upPaint = Color.green;
    this.downPaint = Color.red;
    this.useOutlinePaint = false;  // false preserves the old behaviour
                                   // prior to introducing this flag
}
 
Example #7
Source File: AbstractXYItemRenderer.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Adds an entity to the collection.
 *
 * @param entities  the entity collection being populated.
 * @param area  the entity area (if <code>null</code> a default will be
 *              used).
 * @param dataset  the dataset.
 * @param series  the series.
 * @param item  the item.
 * @param entityX  the entity's center x-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 * @param entityY  the entity's center y-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 */
protected void addEntity(EntityCollection entities, Shape area,
                         XYDataset dataset, int series, int item,
                         double entityX, double entityY) {
    if (!getItemCreateEntity(series, item)) {
        return;
    }
    Shape hotspot = area;
    if (hotspot == null) {
        double r = getDefaultEntityRadius();
        double w = r * 2;
        if (getPlot().getOrientation() == PlotOrientation.VERTICAL) {
            hotspot = new Ellipse2D.Double(entityX - r, entityY - r, w, w);
        }
        else {
            hotspot = new Ellipse2D.Double(entityY - r, entityX - r, w, w);
        }
    }
    String tip = null;
    XYToolTipGenerator generator = getToolTipGenerator(series, item);
    if (generator != null) {
        tip = generator.generateToolTip(dataset, series, item);
    }
    String url = null;
    if (getURLGenerator() != null) {
        url = getURLGenerator().generateURL(dataset, series, item);
    }
    XYItemEntity entity = new XYItemEntity(hotspot, dataset, series, item,
            tip, url);
    entities.add(entity);
}
 
Example #8
Source File: StandardXYItemRenderer.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Constructs a new renderer.  To specify the type of renderer, use one of
 * the constants: {@link #SHAPES}, {@link #LINES} or
 * {@link #SHAPES_AND_LINES}.
 *
 * @param type  the type of renderer.
 * @param toolTipGenerator  the item label generator (<code>null</code>
 *                          permitted).
 * @param urlGenerator  the URL generator.
 */
public StandardXYItemRenderer(int type,
                              XYToolTipGenerator toolTipGenerator,
                              XYURLGenerator urlGenerator) {

    super();
    setBaseToolTipGenerator(toolTipGenerator);
    setURLGenerator(urlGenerator);
    if ((type & SHAPES) != 0) {
        this.baseShapesVisible = true;
    }
    if ((type & LINES) != 0) {
        this.plotLines = true;
    }
    if ((type & IMAGES) != 0) {
        this.plotImages = true;
    }
    if ((type & DISCONTINUOUS) != 0) {
        this.plotDiscontinuous = true;
    }

    this.shapesFilled = null;
    this.seriesShapesFilled = new BooleanList();
    this.baseShapesFilled = true;
    this.legendLine = new Line2D.Double(-7.0, 0.0, 7.0, 0.0);
    this.drawSeriesLineAsPath = false;
}
 
Example #9
Source File: XYAreaChartTest.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Check that setting a tool tip generator for a series does override the
 * default generator.
 */
@Test
public void testSetSeriesToolTipGenerator() {
    XYPlot plot = (XYPlot) this.chart.getPlot();
    XYItemRenderer renderer = plot.getRenderer();
    StandardXYToolTipGenerator tt = new StandardXYToolTipGenerator();
    renderer.setSeriesToolTipGenerator(0, tt);
    XYToolTipGenerator tt2 = renderer.getToolTipGenerator(0, 0);
    assertTrue(tt2 == tt);
}
 
Example #10
Source File: AbstractXYItemRenderer.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a renderer where the tooltip generator and the URL generator are
 * both <code>null</code>.
 */
protected AbstractXYItemRenderer() {
    super();
    this.itemLabelGenerator = null;
    this.itemLabelGeneratorMap 
            = new HashMap<Integer, XYItemLabelGenerator>();
    this.toolTipGenerator = null;
    this.toolTipGeneratorMap = new HashMap<Integer, XYToolTipGenerator>();
    this.urlGenerator = null;
    this.backgroundAnnotations = new java.util.ArrayList();
    this.foregroundAnnotations = new java.util.ArrayList();
    this.legendItemLabelGenerator = new StandardXYSeriesLabelGenerator(
            "{0}");
}
 
Example #11
Source File: XYStepChartTest.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Check that setting a tool tip generator for a series does override the
 * default generator.
 */
@Test
public void testSetSeriesToolTipGenerator() {
    XYPlot plot = (XYPlot) this.chart.getPlot();
    XYItemRenderer renderer = plot.getRenderer();
    StandardXYToolTipGenerator tt = new StandardXYToolTipGenerator();
    renderer.setSeriesToolTipGenerator(0, tt);
    XYToolTipGenerator tt2 = renderer.getToolTipGenerator(0, 0);
    assertTrue(tt2 == tt);
}
 
Example #12
Source File: XYBarChartTest.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Check that setting a tool tip generator for a series does override the
 * default generator.
 */
@Test
public void testSetSeriesToolTipGenerator() {
    XYPlot plot = (XYPlot) this.chart.getPlot();
    XYItemRenderer renderer = plot.getRenderer();
    StandardXYToolTipGenerator tt = new StandardXYToolTipGenerator();
    renderer.setSeriesToolTipGenerator(0, tt);
    XYToolTipGenerator tt2 = renderer.getToolTipGenerator(0, 0);
    assertTrue(tt2 == tt);
}
 
Example #13
Source File: XYAreaChartTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Check that setting a tool tip generator for a series does override the
 * default generator.
 */
public void testSetSeriesToolTipGenerator() {
    XYPlot plot = (XYPlot) this.chart.getPlot();
    XYItemRenderer renderer = plot.getRenderer();
    StandardXYToolTipGenerator tt = new StandardXYToolTipGenerator();
    renderer.setSeriesToolTipGenerator(0, tt);
    XYToolTipGenerator tt2 = renderer.getToolTipGenerator(0, 0,
            false);
    assertTrue(tt2 == tt);
}
 
Example #14
Source File: AbstractXYItemRenderer.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Adds an entity to the collection.
 *
 * @param entities  the entity collection being populated.
 * @param area  the entity area (if <code>null</code> a default will be
 *              used).
 * @param dataset  the dataset.
 * @param series  the series.
 * @param item  the item.
 * @param selected  is the item selected?
 * @param entityX  the entity's center x-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 * @param entityY  the entity's center y-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 *
 * @since 1.2.0
 */
protected void addEntity(EntityCollection entities, Shape area,
        XYDataset dataset, int series, int item, boolean selected,
        double entityX, double entityY) {
    
    if (!getItemCreateEntity(series, item, selected)) {
        return;
    }
    Shape hotspot = area;
    if (hotspot == null) {
        double r = getDefaultEntityRadius();
        double w = r * 2;
        if (getPlot().getOrientation() == PlotOrientation.VERTICAL) {
            hotspot = new Ellipse2D.Double(entityX - r, entityY - r, w, w);
        }
        else {
            hotspot = new Ellipse2D.Double(entityY - r, entityX - r, w, w);
        }
    }
    String tip = null;
    XYToolTipGenerator generator = getToolTipGenerator(series, item,
            selected);
    if (generator != null) {
        tip = generator.generateToolTip(dataset, series, item);
    }
    String url = null;
    XYURLGenerator urlster = getURLGenerator(series, item, selected);
    if (urlster != null) {
        url = urlster.generateURL(dataset, series, item);
    }
    XYItemEntity entity = new XYItemEntity(hotspot, dataset, series, item,
            tip, url);
    entities.add(entity);
}
 
Example #15
Source File: AbstractXYItemRenderer.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a renderer where the tooltip generator and the URL generator are
 * both <code>null</code>.
 */
protected AbstractXYItemRenderer() {
    super();
    this.itemLabelGenerator = null;
    this.itemLabelGeneratorMap 
            = new HashMap<Integer, XYItemLabelGenerator>();
    this.toolTipGenerator = null;
    this.toolTipGeneratorMap = new HashMap<Integer, XYToolTipGenerator>();
    this.urlGenerator = null;
    this.backgroundAnnotations = new java.util.ArrayList();
    this.foregroundAnnotations = new java.util.ArrayList();
    this.legendItemLabelGenerator = new StandardXYSeriesLabelGenerator(
            "{0}");
}
 
Example #16
Source File: AbstractXYItemRenderer.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a renderer where the tooltip generator and the URL generator are
 * both <code>null</code>.
 */
protected AbstractXYItemRenderer() {
    super();
    this.itemLabelGenerator = null;
    this.itemLabelGeneratorMap 
            = new HashMap<Integer, XYItemLabelGenerator>();
    this.toolTipGenerator = null;
    this.toolTipGeneratorMap = new HashMap<Integer, XYToolTipGenerator>();
    this.urlGenerator = null;
    this.backgroundAnnotations = new java.util.ArrayList();
    this.foregroundAnnotations = new java.util.ArrayList();
    this.legendItemLabelGenerator = new StandardXYSeriesLabelGenerator(
            "{0}");
}
 
Example #17
Source File: CandlestickRenderer.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new renderer for candlestick charts.
 * <P>
 * Use -1 for the candle width if you prefer the width to be calculated
 * automatically.
 *
 * @param candleWidth  the candle width.
 * @param drawVolume  a flag indicating whether or not volume bars should
 *                    be drawn.
 * @param toolTipGenerator  the tool tip generator. <code>null</code> is
 *                          none.
 */
public CandlestickRenderer(double candleWidth, boolean drawVolume,
                           XYToolTipGenerator toolTipGenerator) {
    super();
    setBaseToolTipGenerator(toolTipGenerator);
    this.candleWidth = candleWidth;
    this.drawVolume = drawVolume;
    this.volumePaint = Color.gray;
    this.upPaint = Color.green;
    this.downPaint = Color.red;
    this.useOutlinePaint = false;  // false preserves the old behaviour
                                   // prior to introducing this flag
}
 
Example #18
Source File: CandlestickRenderer.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new renderer for candlestick charts.
 * <P>
 * Use -1 for the candle width if you prefer the width to be calculated
 * automatically.
 *
 * @param candleWidth  the candle width.
 * @param drawVolume  a flag indicating whether or not volume bars should
 *                    be drawn.
 * @param toolTipGenerator  the tool tip generator. <code>null</code> is
 *                          none.
 */
public CandlestickRenderer(double candleWidth, boolean drawVolume,
                           XYToolTipGenerator toolTipGenerator) {
    super();
    setBaseToolTipGenerator(toolTipGenerator);
    this.candleWidth = candleWidth;
    this.drawVolume = drawVolume;
    this.volumePaint = Color.gray;
    this.upPaint = Color.green;
    this.downPaint = Color.red;
    this.useOutlinePaint = false;  // false preserves the old behaviour
                                   // prior to introducing this flag
}
 
Example #19
Source File: AbstractXYItemRenderer.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Adds an entity to the collection.
 *
 * @param entities  the entity collection being populated.
 * @param area  the entity area (if <code>null</code> a default will be
 *              used).
 * @param dataset  the dataset.
 * @param series  the series.
 * @param item  the item.
 * @param entityX  the entity's center x-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 * @param entityY  the entity's center y-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 */
protected void addEntity(EntityCollection entities, Shape area,
                         XYDataset dataset, int series, int item,
                         double entityX, double entityY) {
    if (!getItemCreateEntity(series, item)) {
        return;
    }
    Shape hotspot = area;
    if (hotspot == null) {
        double r = getDefaultEntityRadius();
        double w = r * 2;
        if (getPlot().getOrientation() == PlotOrientation.VERTICAL) {
            hotspot = new Ellipse2D.Double(entityX - r, entityY - r, w, w);
        }
        else {
            hotspot = new Ellipse2D.Double(entityY - r, entityX - r, w, w);
        }
    }
    String tip = null;
    XYToolTipGenerator generator = getToolTipGenerator(series, item);
    if (generator != null) {
        tip = generator.generateToolTip(dataset, series, item);
    }
    String url = null;
    if (getURLGenerator() != null) {
        url = getURLGenerator().generateURL(dataset, series, item);
    }
    XYItemEntity entity = new XYItemEntity(hotspot, dataset, series, item,
            tip, url);
    entities.add(entity);
}
 
Example #20
Source File: ScatterPlotTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Check that setting a tool tip generator for a series does override the
 * default generator.
 */
public void testSetSeriesToolTipGenerator() {
    XYPlot plot = (XYPlot) this.chart.getPlot();
    XYItemRenderer renderer = plot.getRenderer();
    StandardXYToolTipGenerator tt = new StandardXYToolTipGenerator();
    renderer.setSeriesToolTipGenerator(0, tt);
    XYToolTipGenerator tt2 = renderer.getToolTipGenerator(0, 0);
    assertTrue(tt2 == tt);
}
 
Example #21
Source File: FormattedXYAreaRenderer2.java    From rapidminer-studio with GNU Affero General Public License v3.0 4 votes vote down vote up
public FormattedXYAreaRenderer2(XYToolTipGenerator labelGenerator, XYURLGenerator urlGenerator) {
	super(labelGenerator, urlGenerator);
}
 
Example #22
Source File: BubbleRenderer.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Draws the visual representation of a single data item.
 *
 * @param g2             the graphics device.
 * @param state          the renderer state.
 * @param dataArea       the area within which the data is being drawn.
 * @param info           collects information about the drawing.
 * @param plot           the plot (can be used to obtain standard color information etc).
 * @param domainAxis     the domain (horizontal) axis.
 * @param rangeAxis      the range (vertical) axis.
 * @param dataset        the dataset (an {@link XYZDataset} is expected).
 * @param series         the series index (zero-based).
 * @param item           the item index (zero-based).
 * @param crosshairState crosshair information for the plot (<code>null</code> permitted).
 * @param pass           the pass index.
 */
public void drawItem( final Graphics2D g2,
                      final XYItemRendererState state,
                      final Rectangle2D dataArea,
                      final PlotRenderingInfo info,
                      final XYPlot plot,
                      final ValueAxis domainAxis,
                      final ValueAxis rangeAxis,
                      final XYDataset dataset,
                      final int series,
                      final int item,
                      final CrosshairState crosshairState,
                      final int pass ) {

  final PlotOrientation orientation = plot.getOrientation();

  // get the data point...
  final double x = dataset.getXValue( series, item );
  final double y = dataset.getYValue( series, item );
  double z = Double.NaN;
  if ( dataset instanceof XYZDataset ) {
    final XYZDataset xyzData = (XYZDataset) dataset;
    z = xyzData.getZValue( series, item );
  }
  if ( !Double.isNaN( z ) ) {
    final RectangleEdge domainAxisLocation = plot.getDomainAxisEdge();
    final RectangleEdge rangeAxisLocation = plot.getRangeAxisEdge();
    final double transX = domainAxis.valueToJava2D( x, dataArea, domainAxisLocation );
    final double transY = rangeAxis.valueToJava2D( y, dataArea, rangeAxisLocation );

    double circleSize;

    circleSize = maxSize * ( z / maxZ );

    circleSize = Math.abs( circleSize );

    Ellipse2D circle = null;
    if ( orientation == PlotOrientation.VERTICAL ) {
      circle = new Ellipse2D.Double( transX - circleSize / 2.0, transY - circleSize / 2.0, circleSize, circleSize );
    } else if ( orientation == PlotOrientation.HORIZONTAL ) {
      circle = new Ellipse2D.Double( transY - circleSize / 2.0, transX - circleSize / 2.0, circleSize, circleSize );
    }
    g2.setPaint( getItemPaint( series, item ) );
    g2.fill( circle );
    g2.setStroke( getItemOutlineStroke( series, item ) );
    g2.setPaint( getItemOutlinePaint( series, item ) );
    g2.draw( circle );

    if ( isItemLabelVisible( series, item ) ) {
      if ( orientation == PlotOrientation.VERTICAL ) {
        drawItemLabel( g2, orientation, dataset, series, item, transX, transY, false );
      } else if ( orientation == PlotOrientation.HORIZONTAL ) {
        drawItemLabel( g2, orientation, dataset, series, item, transY, transX, false );
      }
    }

    // setup for collecting optional entity info...
    EntityCollection entities = null;
    if ( info != null ) {
      entities = info.getOwner().getEntityCollection();
    }

    // add an entity for the item...
    if ( entities != null ) {
      String tip = null;
      final XYToolTipGenerator generator = getToolTipGenerator( series, item );
      if ( generator != null ) {
        tip = generator.generateToolTip( dataset, series, item );
      }
      String url = null;
      if ( getURLGenerator() != null ) {
        url = getURLGenerator().generateURL( dataset, series, item );
      }
      final XYItemEntity entity = new XYItemEntity( circle, dataset, series, item, tip, url );
      entities.add( entity );
    }

    final int domainAxisIndex = plot.getDomainAxisIndex( domainAxis );
    final int rangeAxisIndex = plot.getRangeAxisIndex( rangeAxis );
    updateCrosshairValues( crosshairState, x, y, domainAxisIndex, rangeAxisIndex, transX, transY, orientation );
  }

}
 
Example #23
Source File: DefaultPolarItemRenderer.java    From ECG-Viewer with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Sets the tooltip generator for the specified series.
 * 
 * @param series  the series index.
 * @param generator  the tool tip generator (<code>null</code> permitted).
 * 
 * @since 1.0.14
 */
@Override
public void setSeriesToolTipGenerator(int series,
        XYToolTipGenerator generator) {
    this.toolTipGeneratorList.set(series, generator);
    fireChangeEvent();
}
 
Example #24
Source File: StackedXYAreaRenderer.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Constructs a new renderer.  To specify the type of renderer, use one of 
 * the constants: <code>SHAPES</code>, <code>LINES</code>, 
 * <code>SHAPES_AND_LINES</code>, <code>AREA</code> or 
 * <code>AREA_AND_SHAPES</code>.
 *
 * @param type  the type of renderer.
 * @param labelGenerator  the tool tip generator to use (<code>null</code> 
 *                        is none).
 * @param urlGenerator  the URL generator (<code>null</code> permitted).
 */
public StackedXYAreaRenderer(int type,
                             XYToolTipGenerator labelGenerator, 
                             XYURLGenerator urlGenerator) {

    super(type, labelGenerator, urlGenerator);
}
 
Example #25
Source File: CandlestickRenderer.java    From opensim-gui with Apache License 2.0 3 votes vote down vote up
/**
 * Creates a new renderer for candlestick charts.
 * <P>
 * Use -1 for the candle width if you prefer the width to be calculated 
 * automatically.
 *
 * @param candleWidth  the candle width.
 * @param drawVolume  a flag indicating whether or not volume bars should 
 *                    be drawn.
 * @param toolTipGenerator  the tool tip generator. <code>null</code> is 
 *                          none.
 */
public CandlestickRenderer(double candleWidth, boolean drawVolume,
                           XYToolTipGenerator toolTipGenerator) {

    super();
    setToolTipGenerator(toolTipGenerator);
    this.candleWidth = candleWidth;
    this.drawVolume = drawVolume;
    this.upPaint = Color.green;
    this.downPaint = Color.red;

}
 
Example #26
Source File: XYStepRenderer.java    From ccu-historian with GNU General Public License v3.0 3 votes vote down vote up
/**
 * Constructs a new renderer with the specified tool tip and URL
 * generators.
 *
 * @param toolTipGenerator  the item label generator (<code>null</code>
 *     permitted).
 * @param urlGenerator  the URL generator (<code>null</code> permitted).
 */
public XYStepRenderer(XYToolTipGenerator toolTipGenerator,
                      XYURLGenerator urlGenerator) {
    super();
    setBaseToolTipGenerator(toolTipGenerator);
    setURLGenerator(urlGenerator);
    setBaseShapesVisible(false);
}
 
Example #27
Source File: XYStepRenderer.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Constructs a new renderer with the specified tool tip and URL
 * generators.
 *
 * @param toolTipGenerator  the item label generator (<code>null</code>
 *     permitted).
 * @param urlGenerator  the URL generator (<code>null</code> permitted).
 */
public XYStepRenderer(XYToolTipGenerator toolTipGenerator,
                      XYURLGenerator urlGenerator) {
    super();
    setBaseToolTipGenerator(toolTipGenerator);
    setBaseURLGenerator(urlGenerator);
    setBaseShapesVisible(false);
}
 
Example #28
Source File: DefaultPolarItemRenderer.java    From SIMVA-SoS with Apache License 2.0 3 votes vote down vote up
/**
 * Returns the tooltip generator for the specified series and item.
 * 
 * @param series  the series index.
 * @param item  the item index.
 * 
 * @return The tooltip generator (possibly <code>null</code>).
 * 
 * @since 1.0.14
 */
@Override
public XYToolTipGenerator getToolTipGenerator(int series, int item) {
    XYToolTipGenerator generator
        = (XYToolTipGenerator) this.toolTipGeneratorList.get(series);
    if (generator == null) {
        generator = this.baseToolTipGenerator;
    }
    return generator;
}
 
Example #29
Source File: AbstractXYItemRenderer.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Sets the tool tip generator for a series and sends a
 * {@link RendererChangeEvent} to all registered listeners.
 *
 * @param series  the series index (zero based).
 * @param generator  the generator (<code>null</code> permitted).
 * @param notify  notify listeners?
 * 
 * @since 1.2.0
 */
public void setSeriesToolTipGenerator(int series,
        XYToolTipGenerator generator, boolean notify) {
    this.toolTipGeneratorList.set(series, generator);
    if (notify) {
        fireChangeEvent();
    }
}
 
Example #30
Source File: DefaultPolarItemRenderer.java    From buffer_bci with GNU General Public License v3.0 3 votes vote down vote up
/**
 * Sets the tooltip generator for the specified series.
 * 
 * @param series  the series index.
 * @param generator  the tool tip generator (<code>null</code> permitted).
 * 
 * @since 1.0.14
 */
@Override
public void setSeriesToolTipGenerator(int series,
        XYToolTipGenerator generator) {
    this.toolTipGeneratorList.set(series, generator);
    fireChangeEvent();
}