* the series index (zero-based).
*
* @return A legend item for the series.
*/
public LegendItem getLegendItem(final int datasetIndex, final int series) {
LegendItem result = null;
final XYPlot xyplot = this.getPlot();
if (xyplot != null) {
final XYDataset dataset = xyplot.getDataset(datasetIndex);
if (dataset != null) {
final String label = this.legendItemLabelGenerator
.generateLabel(dataset, series);
final String description = label;
String toolTipText = null;
if (this.getLegendItemToolTipGenerator() != null) {
toolTipText = this.getLegendItemToolTipGenerator()
.generateLabel(dataset, series);
}
String urlText = null;
if (this.getLegendItemURLGenerator() != null) {
urlText = this.getLegendItemURLGenerator().generateLabel(
dataset, series);
}
final Rectangle shape = this.lookupSeriesShape(series);
final Color paint = this.getSeriesPaint(series);
final Color outlinePaint = this
.lookupSeriesOutlinePaint(series);
final Stroke outlineStroke = this
.lookupSeriesOutlineStroke(series);
result = new LegendItem(label, description, toolTipText,
urlText, shape, paint, outlineStroke, outlinePaint);
result.setSeriesKey(dataset.getSeriesKey(series));
result.setSeriesKey(dataset.getSeriesKey(series));
result.setSeriesIndex(series);
result.setDataset(dataset);
result.setDatasetIndex(datasetIndex);
}
}
return result;
}