Example usage for org.jfree.chart.renderer.xy XYArrowRenderer setSeriesVisibleInLegend

List of usage examples for org.jfree.chart.renderer.xy XYArrowRenderer setSeriesVisibleInLegend

Introduction

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

Prototype

public void setSeriesVisibleInLegend(int series, Boolean visible) 

Source Link

Document

Sets the flag that controls whether a series is visible in the legend and sends a RendererChangeEvent to all registered listeners.

Usage

From source file:no.met.jtimeseries.chart.ChartPlotter.java

/**
 * Add arrow symobl to the chart. Specify height to follow value curve.
 * Plot in the middle of chart if height is null.
 * /*from  w w w  .ja v  a  2s  .  c om*/
 * @param direction
 *            The direction of arrow
 * @param height
 *            The followed height
 * @param offset
 *            The offset value to follow the height, value is between
 *            [-1,1]
 */
public void addArrowDirectionPlot(NumberPhenomenon direction, NumberPhenomenon height, double offset,
        PlotStyle plotStyle) {
    XYArrowRenderer arrowRender = new XYArrowRenderer();
    arrowRender.setSeriesVisibleInLegend(0, false);
    arrowRender.setSeriesPaint(0, plotStyle.getSeriesColor());

    ArrowDataset dataset = Utility.toChartArrowDataset(direction, height, offset);
    XYPlot arrowPlot = new XYPlot(dataset, plot.getDomainAxis(0), plotStyle.getNumberAxis(), arrowRender);
    arrowPlot.setRangeGridlinesVisible(false);
    arrowPlot.setOutlineVisible(false);

    plot.mapDatasetToRangeAxis(plotIndex, rangeAxisIndex);
    plot.setDataset(plotIndex, dataset);
    plot.setRenderer(plotIndex, arrowRender);

    plotIndex++;
    rangeAxisIndex++;
}