Java Code Examples for org.jfree.chart.LegendItem#setLabelFont()

The following examples show how to use org.jfree.chart.LegendItem#setLabelFont() . 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: Cardumen_000_s.java    From coming with MIT License 4 votes vote down vote up
/**
 * Returns a legend item for a series.  This default implementation will
 * return <code>null</code> if {@link #isSeriesVisible(int)} or
 * {@link #isSeriesVisibleInLegend(int)} returns <code>false</code>.
 *
 * @param datasetIndex  the dataset index (zero-based).
 * @param series  the series index (zero-based).
 *
 * @return The legend item (possibly <code>null</code>).
 *
 * @see #getLegendItems()
 */
public LegendItem getLegendItem(int datasetIndex, int series) {

    CategoryPlot p = getPlot();
    if (p == null) {
        return null;
    }

    // check that a legend item needs to be displayed...
    if (!isSeriesVisible(series) || !isSeriesVisibleInLegend(series)) {
        return null;
    }

    CategoryDataset dataset = p.getDataset(datasetIndex);
    String label = this.legendItemLabelGenerator.generateLabel(dataset,
            series);
    String description = label;
    String toolTipText = null;
    if (this.legendItemToolTipGenerator != null) {
        toolTipText = this.legendItemToolTipGenerator.generateLabel(
                dataset, series);
    }
    String urlText = null;
    if (this.legendItemURLGenerator != null) {
        urlText = this.legendItemURLGenerator.generateLabel(dataset,
                series);
    }
    Shape shape = lookupLegendShape(series);
    Paint paint = lookupSeriesPaint(series);
    Paint outlinePaint = lookupSeriesOutlinePaint(series);
    Stroke outlineStroke = lookupSeriesOutlineStroke(series);

    LegendItem item = new LegendItem(label, description, toolTipText,
            urlText, shape, paint, outlineStroke, outlinePaint);
    item.setLabelFont(lookupLegendTextFont(series));
    Paint labelPaint = lookupLegendTextPaint(series);
    if (labelPaint != null) {
        item.setLabelPaint(labelPaint);
    }
    item.setSeriesKey(dataset.getRowKey(series));
    item.setSeriesIndex(series);
    item.setDataset(dataset);
    item.setDatasetIndex(datasetIndex);
    return item;
}
 
Example 2
Source File: BarRenderer.java    From ccu-historian with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Returns a legend item for a series.
 *
 * @param datasetIndex  the dataset index (zero-based).
 * @param series  the series index (zero-based).
 *
 * @return The legend item (possibly <code>null</code>).
 */
@Override
public LegendItem getLegendItem(int datasetIndex, int series) {

    CategoryPlot cp = getPlot();
    if (cp == null) {
        return null;
    }

    // check that a legend item needs to be displayed...
    if (!isSeriesVisible(series) || !isSeriesVisibleInLegend(series)) {
        return null;
    }

    CategoryDataset dataset = cp.getDataset(datasetIndex);
    String label = getLegendItemLabelGenerator().generateLabel(dataset,
            series);
    String description = label;
    String toolTipText = null;
    if (getLegendItemToolTipGenerator() != null) {
        toolTipText = getLegendItemToolTipGenerator().generateLabel(
                dataset, series);
    }
    String urlText = null;
    if (getLegendItemURLGenerator() != null) {
        urlText = getLegendItemURLGenerator().generateLabel(dataset,
                series);
    }
    Shape shape = lookupLegendShape(series);
    Paint paint = lookupSeriesPaint(series);
    Paint outlinePaint = lookupSeriesOutlinePaint(series);
    Stroke outlineStroke = lookupSeriesOutlineStroke(series);

    LegendItem result = new LegendItem(label, description, toolTipText,
            urlText, true, shape, true, paint, isDrawBarOutline(),
            outlinePaint, outlineStroke, false, new Line2D.Float(),
            new BasicStroke(1.0f), Color.black);
    result.setLabelFont(lookupLegendTextFont(series));
    Paint labelPaint = lookupLegendTextPaint(series);
    if (labelPaint != null) {
        result.setLabelPaint(labelPaint);
    }
    result.setDataset(dataset);
    result.setDatasetIndex(datasetIndex);
    result.setSeriesKey(dataset.getRowKey(series));
    result.setSeriesIndex(series);
    if (this.gradientPaintTransformer != null) {
        result.setFillPaintTransformer(this.gradientPaintTransformer);
    }
    return result;
}
 
Example 3
Source File: AbstractCategoryItemRenderer.java    From SIMVA-SoS with Apache License 2.0 4 votes vote down vote up
/**
 * Returns a legend item for a series.  This default implementation will
 * return <code>null</code> if {@link #isSeriesVisible(int)} or
 * {@link #isSeriesVisibleInLegend(int)} returns <code>false</code>.
 *
 * @param datasetIndex  the dataset index (zero-based).
 * @param series  the series index (zero-based).
 *
 * @return The legend item (possibly <code>null</code>).
 *
 * @see #getLegendItems()
 */
@Override
public LegendItem getLegendItem(int datasetIndex, int series) {

    CategoryPlot p = getPlot();
    if (p == null) {
        return null;
    }

    // check that a legend item needs to be displayed...
    if (!isSeriesVisible(series) || !isSeriesVisibleInLegend(series)) {
        return null;
    }

    CategoryDataset dataset = p.getDataset(datasetIndex);
    String label = this.legendItemLabelGenerator.generateLabel(dataset,
            series);
    String description = label;
    String toolTipText = null;
    if (this.legendItemToolTipGenerator != null) {
        toolTipText = this.legendItemToolTipGenerator.generateLabel(
                dataset, series);
    }
    String urlText = null;
    if (this.legendItemURLGenerator != null) {
        urlText = this.legendItemURLGenerator.generateLabel(dataset,
                series);
    }
    Shape shape = lookupLegendShape(series);
    Paint paint = lookupSeriesPaint(series);
    Paint outlinePaint = lookupSeriesOutlinePaint(series);
    Stroke outlineStroke = lookupSeriesOutlineStroke(series);

    LegendItem item = new LegendItem(label, description, toolTipText,
            urlText, shape, paint, outlineStroke, outlinePaint);
    item.setLabelFont(lookupLegendTextFont(series));
    Paint labelPaint = lookupLegendTextPaint(series);
    if (labelPaint != null) {
        item.setLabelPaint(labelPaint);
    }
    item.setSeriesKey(dataset.getRowKey(series));
    item.setSeriesIndex(series);
    item.setDataset(dataset);
    item.setDatasetIndex(datasetIndex);
    return item;
}
 
Example 4
Source File: XYLineAndShapeRenderer.java    From SIMVA-SoS with Apache License 2.0 4 votes vote down vote up
/**
 * Returns a legend item for the specified series.
 *
 * @param datasetIndex  the dataset index (zero-based).
 * @param series  the series index (zero-based).
 *
 * @return A legend item for the series (possibly {@code null}).
 */
@Override
public LegendItem getLegendItem(int datasetIndex, int series) {
    XYPlot plot = getPlot();
    if (plot == null) {
        return null;
    }

    XYDataset dataset = plot.getDataset(datasetIndex);
    if (dataset == null) {
        return null;
    }

    if (!getItemVisible(series, 0)) {
        return null;
    }
    String label = getLegendItemLabelGenerator().generateLabel(dataset,
            series);
    String description = label;
    String toolTipText = null;
    if (getLegendItemToolTipGenerator() != null) {
        toolTipText = getLegendItemToolTipGenerator().generateLabel(
                dataset, series);
    }
    String urlText = null;
    if (getLegendItemURLGenerator() != null) {
        urlText = getLegendItemURLGenerator().generateLabel(dataset,
                series);
    }
    boolean shapeIsVisible = getItemShapeVisible(series, 0);
    Shape shape = lookupLegendShape(series);
    boolean shapeIsFilled = getItemShapeFilled(series, 0);
    Paint fillPaint = (this.useFillPaint ? lookupSeriesFillPaint(series)
            : lookupSeriesPaint(series));
    boolean shapeOutlineVisible = this.drawOutlines;
    Paint outlinePaint = (this.useOutlinePaint ? lookupSeriesOutlinePaint(
            series) : lookupSeriesPaint(series));
    Stroke outlineStroke = lookupSeriesOutlineStroke(series);
    boolean lineVisible = getItemLineVisible(series, 0);
    Stroke lineStroke = lookupSeriesStroke(series);
    Paint linePaint = lookupSeriesPaint(series);
    LegendItem result = new LegendItem(label, description, toolTipText,
            urlText, shapeIsVisible, shape, shapeIsFilled, fillPaint,
            shapeOutlineVisible, outlinePaint, outlineStroke, lineVisible,
            this.legendLine, lineStroke, linePaint);
    result.setLabelFont(lookupLegendTextFont(series));
    Paint labelPaint = lookupLegendTextPaint(series);
    if (labelPaint != null) {
        result.setLabelPaint(labelPaint);
    }
    result.setSeriesKey(dataset.getSeriesKey(series));
    result.setSeriesIndex(series);
    result.setDataset(dataset);
    result.setDatasetIndex(datasetIndex);

    return result;
}
 
Example 5
Source File: ScatterRenderer.java    From ccu-historian with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Returns a legend item for a series.
 *
 * @param datasetIndex  the dataset index (zero-based).
 * @param series  the series index (zero-based).
 *
 * @return The legend item.
 */
@Override
public LegendItem getLegendItem(int datasetIndex, int series) {

    CategoryPlot cp = getPlot();
    if (cp == null) {
        return null;
    }

    if (isSeriesVisible(series) && isSeriesVisibleInLegend(series)) {
        CategoryDataset dataset = cp.getDataset(datasetIndex);
        String label = getLegendItemLabelGenerator().generateLabel(
                dataset, series);
        String description = label;
        String toolTipText = null;
        if (getLegendItemToolTipGenerator() != null) {
            toolTipText = getLegendItemToolTipGenerator().generateLabel(
                    dataset, series);
        }
        String urlText = null;
        if (getLegendItemURLGenerator() != null) {
            urlText = getLegendItemURLGenerator().generateLabel(
                    dataset, series);
        }
        Shape shape = lookupLegendShape(series);
        Paint paint = lookupSeriesPaint(series);
        Paint fillPaint = (this.useFillPaint
                ? getItemFillPaint(series, 0) : paint);
        boolean shapeOutlineVisible = this.drawOutlines;
        Paint outlinePaint = (this.useOutlinePaint
                ? getItemOutlinePaint(series, 0) : paint);
        Stroke outlineStroke = lookupSeriesOutlineStroke(series);
        LegendItem result = new LegendItem(label, description, toolTipText,
                urlText, true, shape, getItemShapeFilled(series, 0),
                fillPaint, shapeOutlineVisible, outlinePaint, outlineStroke,
                false, new Line2D.Double(-7.0, 0.0, 7.0, 0.0),
                getItemStroke(series, 0), getItemPaint(series, 0));
        result.setLabelFont(lookupLegendTextFont(series));
        Paint labelPaint = lookupLegendTextPaint(series);
        if (labelPaint != null) {
            result.setLabelPaint(labelPaint);
        }
        result.setDataset(dataset);
        result.setDatasetIndex(datasetIndex);
        result.setSeriesKey(dataset.getRowKey(series));
        result.setSeriesIndex(series);
        return result;
    }
    return null;

}
 
Example 6
Source File: BoxAndWhiskerRenderer.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns a legend item for a series.
 *
 * @param datasetIndex  the dataset index (zero-based).
 * @param series  the series index (zero-based).
 *
 * @return The legend item (possibly <code>null</code>).
 */
public LegendItem getLegendItem(int datasetIndex, int series) {

    CategoryPlot cp = getPlot();
    if (cp == null) {
        return null;
    }

    // check that a legend item needs to be displayed...
    if (!isSeriesVisible(series) || !isSeriesVisibleInLegend(series)) {
        return null;
    }

    CategoryDataset dataset = cp.getDataset(datasetIndex);
    String label = getLegendItemLabelGenerator().generateLabel(dataset,
            series);
    String description = label;
    String toolTipText = null;
    if (getLegendItemToolTipGenerator() != null) {
        toolTipText = getLegendItemToolTipGenerator().generateLabel(
                dataset, series);
    }
    String urlText = null;
    if (getLegendItemURLGenerator() != null) {
        urlText = getLegendItemURLGenerator().generateLabel(dataset,
                series);
    }
    Shape shape = lookupLegendShape(series);
    Paint paint = lookupSeriesPaint(series);
    Paint outlinePaint = lookupSeriesOutlinePaint(series);
    Stroke outlineStroke = lookupSeriesOutlineStroke(series);
    LegendItem result = new LegendItem(label, description, toolTipText,
            urlText, shape, paint, outlineStroke, outlinePaint);
    result.setLabelFont(lookupLegendTextFont(series));
    Paint labelPaint = lookupLegendTextPaint(series);
    if (labelPaint != null) {
        result.setLabelPaint(labelPaint);
    }
    result.setDataset(dataset);
    result.setDatasetIndex(datasetIndex);
    result.setSeriesKey(dataset.getRowKey(series));
    result.setSeriesIndex(series);
    return result;

}
 
Example 7
Source File: ScatterRenderer.java    From ECG-Viewer with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns a legend item for a series.
 *
 * @param datasetIndex  the dataset index (zero-based).
 * @param series  the series index (zero-based).
 *
 * @return The legend item.
 */
@Override
public LegendItem getLegendItem(int datasetIndex, int series) {

    CategoryPlot cp = getPlot();
    if (cp == null) {
        return null;
    }

    if (isSeriesVisible(series) && isSeriesVisibleInLegend(series)) {
        CategoryDataset dataset = cp.getDataset(datasetIndex);
        String label = getLegendItemLabelGenerator().generateLabel(
                dataset, series);
        String description = label;
        String toolTipText = null;
        if (getLegendItemToolTipGenerator() != null) {
            toolTipText = getLegendItemToolTipGenerator().generateLabel(
                    dataset, series);
        }
        String urlText = null;
        if (getLegendItemURLGenerator() != null) {
            urlText = getLegendItemURLGenerator().generateLabel(
                    dataset, series);
        }
        Shape shape = lookupLegendShape(series);
        Paint paint = lookupSeriesPaint(series);
        Paint fillPaint = (this.useFillPaint
                ? getItemFillPaint(series, 0) : paint);
        boolean shapeOutlineVisible = this.drawOutlines;
        Paint outlinePaint = (this.useOutlinePaint
                ? getItemOutlinePaint(series, 0) : paint);
        Stroke outlineStroke = lookupSeriesOutlineStroke(series);
        LegendItem result = new LegendItem(label, description, toolTipText,
                urlText, true, shape, getItemShapeFilled(series, 0),
                fillPaint, shapeOutlineVisible, outlinePaint, outlineStroke,
                false, new Line2D.Double(-7.0, 0.0, 7.0, 0.0),
                getItemStroke(series, 0), getItemPaint(series, 0));
        result.setLabelFont(lookupLegendTextFont(series));
        Paint labelPaint = lookupLegendTextPaint(series);
        if (labelPaint != null) {
            result.setLabelPaint(labelPaint);
        }
        result.setDataset(dataset);
        result.setDatasetIndex(datasetIndex);
        result.setSeriesKey(dataset.getRowKey(series));
        result.setSeriesIndex(series);
        return result;
    }
    return null;

}
 
Example 8
Source File: patch1-Chart-1-jMutRepair_patch1-Chart-1-jMutRepair_s.java    From coming with MIT License 4 votes vote down vote up
/**
 * Returns a legend item for a series.  This default implementation will
 * return <code>null</code> if {@link #isSeriesVisible(int)} or
 * {@link #isSeriesVisibleInLegend(int)} returns <code>false</code>.
 *
 * @param datasetIndex  the dataset index (zero-based).
 * @param series  the series index (zero-based).
 *
 * @return The legend item (possibly <code>null</code>).
 *
 * @see #getLegendItems()
 */
public LegendItem getLegendItem(int datasetIndex, int series) {

    CategoryPlot p = getPlot();
    if (p == null) {
        return null;
    }

    // check that a legend item needs to be displayed...
    if (!isSeriesVisible(series) || !isSeriesVisibleInLegend(series)) {
        return null;
    }

    CategoryDataset dataset = p.getDataset(datasetIndex);
    String label = this.legendItemLabelGenerator.generateLabel(dataset,
            series);
    String description = label;
    String toolTipText = null;
    if (this.legendItemToolTipGenerator != null) {
        toolTipText = this.legendItemToolTipGenerator.generateLabel(
                dataset, series);
    }
    String urlText = null;
    if (this.legendItemURLGenerator != null) {
        urlText = this.legendItemURLGenerator.generateLabel(dataset,
                series);
    }
    Shape shape = lookupLegendShape(series);
    Paint paint = lookupSeriesPaint(series);
    Paint outlinePaint = lookupSeriesOutlinePaint(series);
    Stroke outlineStroke = lookupSeriesOutlineStroke(series);

    LegendItem item = new LegendItem(label, description, toolTipText,
            urlText, shape, paint, outlineStroke, outlinePaint);
    item.setLabelFont(lookupLegendTextFont(series));
    Paint labelPaint = lookupLegendTextPaint(series);
    if (labelPaint != null) {
        item.setLabelPaint(labelPaint);
    }
    item.setSeriesKey(dataset.getRowKey(series));
    item.setSeriesIndex(series);
    item.setDataset(dataset);
    item.setDatasetIndex(datasetIndex);
    return item;
}
 
Example 9
Source File: Cardumen_00191_t.java    From coming with MIT License 4 votes vote down vote up
/**
 * Returns a legend item for a series.  This default implementation will
 * return <code>null</code> if {@link #isSeriesVisible(int)} or
 * {@link #isSeriesVisibleInLegend(int)} returns <code>false</code>.
 *
 * @param datasetIndex  the dataset index (zero-based).
 * @param series  the series index (zero-based).
 *
 * @return The legend item (possibly <code>null</code>).
 *
 * @see #getLegendItems()
 */
public LegendItem getLegendItem(int datasetIndex, int series) {

    CategoryPlot p = getPlot();
    if (p == null) {
        return null;
    }

    // check that a legend item needs to be displayed...
    if (!isSeriesVisible(series) || !isSeriesVisibleInLegend(series)) {
        return null;
    }

    CategoryDataset dataset = p.getDataset(datasetIndex);
    String label = this.legendItemLabelGenerator.generateLabel(dataset,
            series);
    String description = label;
    String toolTipText = null;
    if (this.legendItemToolTipGenerator != null) {
        toolTipText = this.legendItemToolTipGenerator.generateLabel(
                dataset, series);
    }
    String urlText = null;
    if (this.legendItemURLGenerator != null) {
        urlText = this.legendItemURLGenerator.generateLabel(dataset,
                series);
    }
    Shape shape = lookupLegendShape(series);
    Paint paint = lookupSeriesPaint(series);
    Paint outlinePaint = lookupSeriesOutlinePaint(series);
    Stroke outlineStroke = lookupSeriesOutlineStroke(series);

    LegendItem item = new LegendItem(label, description, toolTipText,
            urlText, shape, paint, outlineStroke, outlinePaint);
    item.setLabelFont(lookupLegendTextFont(series));
    Paint labelPaint = lookupLegendTextPaint(series);
    if (labelPaint != null) {
        item.setLabelPaint(labelPaint);
    }
    item.setSeriesKey(dataset.getRowKey(series));
    item.setSeriesIndex(series);
    item.setDataset(dataset);
    item.setDatasetIndex(datasetIndex);
    return item;
}
 
Example 10
Source File: AreaRenderer.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns a legend item for a series.
 *
 * @param datasetIndex  the dataset index (zero-based).
 * @param series  the series index (zero-based).
 *
 * @return The legend item.
 */
public LegendItem getLegendItem(int datasetIndex, int series) {

    // if there is no plot, there is no dataset to access...
    CategoryPlot cp = getPlot();
    if (cp == null) {
        return null;
    }

    // check that a legend item needs to be displayed...
    if (!isSeriesVisible(series) || !isSeriesVisibleInLegend(series)) {
        return null;
    }

    CategoryDataset dataset = cp.getDataset(datasetIndex);
    String label = getLegendItemLabelGenerator().generateLabel(dataset,
            series);
    String description = label;
    String toolTipText = null;
    if (getLegendItemToolTipGenerator() != null) {
        toolTipText = getLegendItemToolTipGenerator().generateLabel(
                dataset, series);
    }
    String urlText = null;
    if (getLegendItemURLGenerator() != null) {
        urlText = getLegendItemURLGenerator().generateLabel(dataset,
                series);
    }
    Shape shape = lookupLegendShape(series);
    Paint paint = lookupSeriesPaint(series);
    Paint outlinePaint = lookupSeriesOutlinePaint(series);
    Stroke outlineStroke = lookupSeriesOutlineStroke(series);

    LegendItem result = new LegendItem(label, description, toolTipText,
            urlText, shape, paint, outlineStroke, outlinePaint);
    result.setLabelFont(lookupLegendTextFont(series));
    Paint labelPaint = lookupLegendTextPaint(series);
    if (labelPaint != null) {
        result.setLabelPaint(labelPaint);
    }
    result.setDataset(dataset);
    result.setDatasetIndex(datasetIndex);
    result.setSeriesKey(dataset.getRowKey(series));
    result.setSeriesIndex(series);
    return result;

}
 
Example 11
Source File: ScatterRenderer.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns a legend item for a series.
 *
 * @param datasetIndex  the dataset index (zero-based).
 * @param series  the series index (zero-based).
 *
 * @return The legend item.
 */
public LegendItem getLegendItem(int datasetIndex, int series) {

    CategoryPlot cp = getPlot();
    if (cp == null) {
        return null;
    }

    if (isSeriesVisible(series) && isSeriesVisibleInLegend(series)) {
        CategoryDataset dataset = cp.getDataset(datasetIndex);
        String label = getLegendItemLabelGenerator().generateLabel(
                dataset, series);
        String description = label;
        String toolTipText = null;
        if (getLegendItemToolTipGenerator() != null) {
            toolTipText = getLegendItemToolTipGenerator().generateLabel(
                    dataset, series);
        }
        String urlText = null;
        if (getLegendItemURLGenerator() != null) {
            urlText = getLegendItemURLGenerator().generateLabel(
                    dataset, series);
        }
        Shape shape = lookupLegendShape(series);
        Paint paint = lookupSeriesPaint(series);
        Paint fillPaint = (this.useFillPaint
                ? getItemFillPaint(series, 0, false) : paint);
        boolean shapeOutlineVisible = this.drawOutlines;
        Paint outlinePaint = (this.useOutlinePaint
                ? getItemOutlinePaint(series, 0, false) : paint);
        Stroke outlineStroke = lookupSeriesOutlineStroke(series);
        LegendItem result = new LegendItem(label, description, toolTipText,
                urlText, true, shape, getItemShapeFilled(series, 0),
                fillPaint, shapeOutlineVisible, outlinePaint, outlineStroke,
                false, new Line2D.Double(-7.0, 0.0, 7.0, 0.0),
                getItemStroke(series, 0, false), getItemPaint(series, 0,
                false));
        result.setLabelFont(lookupLegendTextFont(series));
        Paint labelPaint = lookupLegendTextPaint(series);
        if (labelPaint != null) {
            result.setLabelPaint(labelPaint);
        }
        result.setDataset(dataset);
        result.setDatasetIndex(datasetIndex);
        result.setSeriesKey(dataset.getRowKey(series));
        result.setSeriesIndex(series);
        return result;
    }
    return null;

}
 
Example 12
Source File: 1_AbstractCategoryItemRenderer.java    From SimFix with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns a legend item for a series.  This default implementation will
 * return <code>null</code> if {@link #isSeriesVisible(int)} or
 * {@link #isSeriesVisibleInLegend(int)} returns <code>false</code>.
 *
 * @param datasetIndex  the dataset index (zero-based).
 * @param series  the series index (zero-based).
 *
 * @return The legend item (possibly <code>null</code>).
 *
 * @see #getLegendItems()
 */
public LegendItem getLegendItem(int datasetIndex, int series) {

    CategoryPlot p = getPlot();
    if (p == null) {
        return null;
    }

    // check that a legend item needs to be displayed...
    if (!isSeriesVisible(series) || !isSeriesVisibleInLegend(series)) {
        return null;
    }

    CategoryDataset dataset = p.getDataset(datasetIndex);
    String label = this.legendItemLabelGenerator.generateLabel(dataset,
            series);
    String description = label;
    String toolTipText = null;
    if (this.legendItemToolTipGenerator != null) {
        toolTipText = this.legendItemToolTipGenerator.generateLabel(
                dataset, series);
    }
    String urlText = null;
    if (this.legendItemURLGenerator != null) {
        urlText = this.legendItemURLGenerator.generateLabel(dataset,
                series);
    }
    Shape shape = lookupLegendShape(series);
    Paint paint = lookupSeriesPaint(series);
    Paint outlinePaint = lookupSeriesOutlinePaint(series);
    Stroke outlineStroke = lookupSeriesOutlineStroke(series);

    LegendItem item = new LegendItem(label, description, toolTipText,
            urlText, shape, paint, outlineStroke, outlinePaint);
    item.setLabelFont(lookupLegendTextFont(series));
    Paint labelPaint = lookupLegendTextPaint(series);
    if (labelPaint != null) {
        item.setLabelPaint(labelPaint);
    }
    item.setSeriesKey(dataset.getRowKey(series));
    item.setSeriesIndex(series);
    item.setDataset(dataset);
    item.setDatasetIndex(datasetIndex);
    return item;
}
 
Example 13
Source File: AbstractCategoryItemRenderer.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Returns a legend item for a series.  This default implementation will
 * return <code>null</code> if {@link #isSeriesVisible(int)} or
 * {@link #isSeriesVisibleInLegend(int)} returns <code>false</code>.
 *
 * @param datasetIndex  the dataset index (zero-based).
 * @param series  the series index (zero-based).
 *
 * @return The legend item (possibly <code>null</code>).
 *
 * @see #getLegendItems()
 */
@Override
public LegendItem getLegendItem(int datasetIndex, int series) {

    CategoryPlot p = getPlot();
    if (p == null) {
        return null;
    }

    // check that a legend item needs to be displayed...
    if (!isSeriesVisible(series) || !isSeriesVisibleInLegend(series)) {
        return null;
    }

    CategoryDataset dataset = p.getDataset(datasetIndex);
    String label = this.legendItemLabelGenerator.generateLabel(dataset,
            series);
    String description = label;
    String toolTipText = null;
    if (this.legendItemToolTipGenerator != null) {
        toolTipText = this.legendItemToolTipGenerator.generateLabel(
                dataset, series);
    }
    String urlText = null;
    if (this.legendItemURLGenerator != null) {
        urlText = this.legendItemURLGenerator.generateLabel(dataset,
                series);
    }
    Shape shape = lookupLegendShape(series);
    Paint paint = lookupSeriesPaint(series);
    Paint outlinePaint = lookupSeriesOutlinePaint(series);
    Stroke outlineStroke = lookupSeriesOutlineStroke(series);

    LegendItem item = new LegendItem(label, description, toolTipText,
            urlText, shape, paint, outlineStroke, outlinePaint);
    item.setLabelFont(lookupLegendTextFont(series));
    Paint labelPaint = lookupLegendTextPaint(series);
    if (labelPaint != null) {
        item.setLabelPaint(labelPaint);
    }
    item.setSeriesKey(dataset.getRowKey(series));
    item.setSeriesIndex(series);
    item.setDataset(dataset);
    item.setDatasetIndex(datasetIndex);
    return item;
}
 
Example 14
Source File: BoxAndWhiskerRenderer.java    From ECG-Viewer with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns a legend item for a series.
 *
 * @param datasetIndex  the dataset index (zero-based).
 * @param series  the series index (zero-based).
 *
 * @return The legend item (possibly <code>null</code>).
 */
@Override
public LegendItem getLegendItem(int datasetIndex, int series) {

    CategoryPlot cp = getPlot();
    if (cp == null) {
        return null;
    }

    // check that a legend item needs to be displayed...
    if (!isSeriesVisible(series) || !isSeriesVisibleInLegend(series)) {
        return null;
    }

    CategoryDataset dataset = cp.getDataset(datasetIndex);
    String label = getLegendItemLabelGenerator().generateLabel(dataset,
            series);
    String description = label;
    String toolTipText = null;
    if (getLegendItemToolTipGenerator() != null) {
        toolTipText = getLegendItemToolTipGenerator().generateLabel(
                dataset, series);
    }
    String urlText = null;
    if (getLegendItemURLGenerator() != null) {
        urlText = getLegendItemURLGenerator().generateLabel(dataset,
                series);
    }
    Shape shape = lookupLegendShape(series);
    Paint paint = lookupSeriesPaint(series);
    Paint outlinePaint = lookupSeriesOutlinePaint(series);
    Stroke outlineStroke = lookupSeriesOutlineStroke(series);
    LegendItem result = new LegendItem(label, description, toolTipText,
            urlText, shape, paint, outlineStroke, outlinePaint);
    result.setLabelFont(lookupLegendTextFont(series));
    Paint labelPaint = lookupLegendTextPaint(series);
    if (labelPaint != null) {
        result.setLabelPaint(labelPaint);
    }
    result.setDataset(dataset);
    result.setDatasetIndex(datasetIndex);
    result.setSeriesKey(dataset.getRowKey(series));
    result.setSeriesIndex(series);
    return result;

}
 
Example 15
Source File: CategoryStepRenderer.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns a legend item for a series.
 *
 * @param datasetIndex  the dataset index (zero-based).
 * @param series  the series index (zero-based).
 *
 * @return The legend item.
 */
public LegendItem getLegendItem(int datasetIndex, int series) {

    CategoryPlot p = getPlot();
    if (p == null) {
        return null;
    }

    // check that a legend item needs to be displayed...
    if (!isSeriesVisible(series) || !isSeriesVisibleInLegend(series)) {
        return null;
    }

    CategoryDataset dataset = p.getDataset(datasetIndex);
    String label = getLegendItemLabelGenerator().generateLabel(dataset,
            series);
    String description = label;
    String toolTipText = null;
    if (getLegendItemToolTipGenerator() != null) {
        toolTipText = getLegendItemToolTipGenerator().generateLabel(
                dataset, series);
    }
    String urlText = null;
    if (getLegendItemURLGenerator() != null) {
        urlText = getLegendItemURLGenerator().generateLabel(dataset,
                series);
    }
    Shape shape = lookupLegendShape(series);
    Paint paint = lookupSeriesPaint(series);

    LegendItem item = new LegendItem(label, description, toolTipText,
            urlText, shape, paint);
    item.setLabelFont(lookupLegendTextFont(series));
    Paint labelPaint = lookupLegendTextPaint(series);
    if (labelPaint != null) {
        item.setLabelPaint(labelPaint);
    }
    item.setSeriesKey(dataset.getRowKey(series));
    item.setSeriesIndex(series);
    item.setDataset(dataset);
    item.setDatasetIndex(datasetIndex);
    return item;
}
 
Example 16
Source File: jMutRepair_000_t.java    From coming with MIT License 4 votes vote down vote up
/**
 * Returns a legend item for a series.  This default implementation will
 * return <code>null</code> if {@link #isSeriesVisible(int)} or
 * {@link #isSeriesVisibleInLegend(int)} returns <code>false</code>.
 *
 * @param datasetIndex  the dataset index (zero-based).
 * @param series  the series index (zero-based).
 *
 * @return The legend item (possibly <code>null</code>).
 *
 * @see #getLegendItems()
 */
public LegendItem getLegendItem(int datasetIndex, int series) {

    CategoryPlot p = getPlot();
    if (p == null) {
        return null;
    }

    // check that a legend item needs to be displayed...
    if (!isSeriesVisible(series) || !isSeriesVisibleInLegend(series)) {
        return null;
    }

    CategoryDataset dataset = p.getDataset(datasetIndex);
    String label = this.legendItemLabelGenerator.generateLabel(dataset,
            series);
    String description = label;
    String toolTipText = null;
    if (this.legendItemToolTipGenerator != null) {
        toolTipText = this.legendItemToolTipGenerator.generateLabel(
                dataset, series);
    }
    String urlText = null;
    if (this.legendItemURLGenerator != null) {
        urlText = this.legendItemURLGenerator.generateLabel(dataset,
                series);
    }
    Shape shape = lookupLegendShape(series);
    Paint paint = lookupSeriesPaint(series);
    Paint outlinePaint = lookupSeriesOutlinePaint(series);
    Stroke outlineStroke = lookupSeriesOutlineStroke(series);

    LegendItem item = new LegendItem(label, description, toolTipText,
            urlText, shape, paint, outlineStroke, outlinePaint);
    item.setLabelFont(lookupLegendTextFont(series));
    Paint labelPaint = lookupLegendTextPaint(series);
    if (labelPaint != null) {
        item.setLabelPaint(labelPaint);
    }
    item.setSeriesKey(dataset.getRowKey(series));
    item.setSeriesIndex(series);
    item.setDataset(dataset);
    item.setDatasetIndex(datasetIndex);
    return item;
}
 
Example 17
Source File: ScatterRenderer.java    From openstock with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Returns a legend item for a series.
 *
 * @param datasetIndex  the dataset index (zero-based).
 * @param series  the series index (zero-based).
 *
 * @return The legend item.
 */
@Override
public LegendItem getLegendItem(int datasetIndex, int series) {

    CategoryPlot cp = getPlot();
    if (cp == null) {
        return null;
    }

    if (isSeriesVisible(series) && isSeriesVisibleInLegend(series)) {
        CategoryDataset dataset = cp.getDataset(datasetIndex);
        String label = getLegendItemLabelGenerator().generateLabel(
                dataset, series);
        String description = label;
        String toolTipText = null;
        if (getLegendItemToolTipGenerator() != null) {
            toolTipText = getLegendItemToolTipGenerator().generateLabel(
                    dataset, series);
        }
        String urlText = null;
        if (getLegendItemURLGenerator() != null) {
            urlText = getLegendItemURLGenerator().generateLabel(
                    dataset, series);
        }
        Shape shape = lookupLegendShape(series);
        Paint paint = lookupSeriesPaint(series);
        Paint fillPaint = (this.useFillPaint
                ? getItemFillPaint(series, 0) : paint);
        boolean shapeOutlineVisible = this.drawOutlines;
        Paint outlinePaint = (this.useOutlinePaint
                ? getItemOutlinePaint(series, 0) : paint);
        Stroke outlineStroke = lookupSeriesOutlineStroke(series);
        LegendItem result = new LegendItem(label, description, toolTipText,
                urlText, true, shape, getItemShapeFilled(series, 0),
                fillPaint, shapeOutlineVisible, outlinePaint, outlineStroke,
                false, new Line2D.Double(-7.0, 0.0, 7.0, 0.0),
                getItemStroke(series, 0), getItemPaint(series, 0));
        result.setLabelFont(lookupLegendTextFont(series));
        Paint labelPaint = lookupLegendTextPaint(series);
        if (labelPaint != null) {
            result.setLabelPaint(labelPaint);
        }
        result.setDataset(dataset);
        result.setDatasetIndex(datasetIndex);
        result.setSeriesKey(dataset.getRowKey(series));
        result.setSeriesIndex(series);
        return result;
    }
    return null;

}
 
Example 18
Source File: Elixir_000_t.java    From coming with MIT License 4 votes vote down vote up
/**
 * Returns a legend item for a series.  This default implementation will
 * return <code>null</code> if {@link #isSeriesVisible(int)} or
 * {@link #isSeriesVisibleInLegend(int)} returns <code>false</code>.
 *
 * @param datasetIndex  the dataset index (zero-based).
 * @param series  the series index (zero-based).
 *
 * @return The legend item (possibly <code>null</code>).
 *
 * @see #getLegendItems()
 */
public LegendItem getLegendItem(int datasetIndex, int series) {

    CategoryPlot p = getPlot();
    if (p == null) {
        return null;
    }

    // check that a legend item needs to be displayed...
    if (!isSeriesVisible(series) || !isSeriesVisibleInLegend(series)) {
        return null;
    }

    CategoryDataset dataset = p.getDataset(datasetIndex);
    String label = this.legendItemLabelGenerator.generateLabel(dataset,
            series);
    String description = label;
    String toolTipText = null;
    if (this.legendItemToolTipGenerator != null) {
        toolTipText = this.legendItemToolTipGenerator.generateLabel(
                dataset, series);
    }
    String urlText = null;
    if (this.legendItemURLGenerator != null) {
        urlText = this.legendItemURLGenerator.generateLabel(dataset,
                series);
    }
    Shape shape = lookupLegendShape(series);
    Paint paint = lookupSeriesPaint(series);
    Paint outlinePaint = lookupSeriesOutlinePaint(series);
    Stroke outlineStroke = lookupSeriesOutlineStroke(series);

    LegendItem item = new LegendItem(label, description, toolTipText,
            urlText, shape, paint, outlineStroke, outlinePaint);
    item.setLabelFont(lookupLegendTextFont(series));
    Paint labelPaint = lookupLegendTextPaint(series);
    if (labelPaint != null) {
        item.setLabelPaint(labelPaint);
    }
    item.setSeriesKey(dataset.getRowKey(series));
    item.setSeriesIndex(series);
    item.setDataset(dataset);
    item.setDatasetIndex(datasetIndex);
    return item;
}
 
Example 19
Source File: AbstractCategoryItemRenderer.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns a legend item for a series.  This default implementation will
 * return <code>null</code> if {@link #isSeriesVisible(int)} or
 * {@link #isSeriesVisibleInLegend(int)} returns <code>false</code>.
 *
 * @param datasetIndex  the dataset index (zero-based).
 * @param series  the series index (zero-based).
 *
 * @return The legend item (possibly <code>null</code>).
 *
 * @see #getLegendItems()
 */
public LegendItem getLegendItem(int datasetIndex, int series) {

    CategoryPlot p = getPlot();
    if (p == null) {
        return null;
    }

    // check that a legend item needs to be displayed...
    if (!isSeriesVisible(series) || !isSeriesVisibleInLegend(series)) {
        return null;
    }

    CategoryDataset dataset = p.getDataset(datasetIndex);
    String label = this.legendItemLabelGenerator.generateLabel(dataset,
            series);
    String description = label;
    String toolTipText = null;
    if (this.legendItemToolTipGenerator != null) {
        toolTipText = this.legendItemToolTipGenerator.generateLabel(
                dataset, series);
    }
    String urlText = null;
    if (this.legendItemURLGenerator != null) {
        urlText = this.legendItemURLGenerator.generateLabel(dataset,
                series);
    }
    Shape shape = lookupLegendShape(series);
    Paint paint = lookupSeriesPaint(series);
    Paint outlinePaint = lookupSeriesOutlinePaint(series);
    Stroke outlineStroke = lookupSeriesOutlineStroke(series);

    LegendItem item = new LegendItem(label, description, toolTipText,
            urlText, shape, paint, outlineStroke, outlinePaint);
    item.setLabelFont(lookupLegendTextFont(series));
    Paint labelPaint = lookupLegendTextPaint(series);
    if (labelPaint != null) {
        item.setLabelPaint(labelPaint);
    }
    item.setSeriesKey(dataset.getRowKey(series));
    item.setSeriesIndex(series);
    item.setDataset(dataset);
    item.setDatasetIndex(datasetIndex);
    return item;
}
 
Example 20
Source File: Cardumen_00139_t.java    From coming with MIT License 4 votes vote down vote up
/**
 * Returns a legend item for a series.  This default implementation will
 * return <code>null</code> if {@link #isSeriesVisible(int)} or
 * {@link #isSeriesVisibleInLegend(int)} returns <code>false</code>.
 *
 * @param datasetIndex  the dataset index (zero-based).
 * @param series  the series index (zero-based).
 *
 * @return The legend item (possibly <code>null</code>).
 *
 * @see #getLegendItems()
 */
public LegendItem getLegendItem(int datasetIndex, int series) {

    CategoryPlot p = getPlot();
    if (p == null) {
        return null;
    }

    // check that a legend item needs to be displayed...
    if (!isSeriesVisible(series) || !isSeriesVisibleInLegend(series)) {
        return null;
    }

    CategoryDataset dataset = p.getDataset(datasetIndex);
    String label = this.legendItemLabelGenerator.generateLabel(dataset,
            series);
    String description = label;
    String toolTipText = null;
    if (this.legendItemToolTipGenerator != null) {
        toolTipText = this.legendItemToolTipGenerator.generateLabel(
                dataset, series);
    }
    String urlText = null;
    if (this.legendItemURLGenerator != null) {
        urlText = this.legendItemURLGenerator.generateLabel(dataset,
                series);
    }
    Shape shape = lookupLegendShape(series);
    Paint paint = lookupSeriesPaint(series);
    Paint outlinePaint = lookupSeriesOutlinePaint(series);
    Stroke outlineStroke = lookupSeriesOutlineStroke(series);

    LegendItem item = new LegendItem(label, description, toolTipText,
            urlText, shape, paint, outlineStroke, outlinePaint);
    item.setLabelFont(lookupLegendTextFont(series));
    Paint labelPaint = lookupLegendTextPaint(series);
    if (labelPaint != null) {
        item.setLabelPaint(labelPaint);
    }
    item.setSeriesKey(dataset.getRowKey(series));
    item.setSeriesIndex(series);
    item.setDataset(dataset);
    item.setDatasetIndex(datasetIndex);
    return item;
}