* @param series the series index.
*
* @return The legend item.
*/
public LegendItem getLegendItem(int series) {
LegendItem result;
PolarPlot plot = getPlot();
if (plot == null) {
return null;
}
XYDataset dataset = plot.getDataset(plot.getIndexOf(this));
if (dataset == null) {
return null;
}
String toolTipText = null;
if (getLegendItemToolTipGenerator() != null) {
toolTipText = getLegendItemToolTipGenerator().generateLabel(
dataset, series);
}
String urlText = null;
if (getLegendItemURLGenerator() != null) {
urlText = getLegendItemURLGenerator().generateLabel(dataset,
series);
}
Comparable seriesKey = dataset.getSeriesKey(series);
String label = seriesKey.toString();
String description = label;
Shape shape = lookupSeriesShape(series);
Paint paint;
if (this.useFillPaint) {
paint = lookupSeriesFillPaint(series);
}
else {
paint = lookupSeriesPaint(series);
}
Stroke stroke = lookupSeriesStroke(series);
Paint outlinePaint = lookupSeriesOutlinePaint(series);
Stroke outlineStroke = lookupSeriesOutlineStroke(series);
boolean shapeOutlined = isSeriesFilled(series)
&& this.drawOutlineWhenFilled;
result = new LegendItem(label, description, toolTipText, urlText,
getShapesVisible(), shape, /* shapeFilled=*/ true, paint,
shapeOutlined, outlinePaint, outlineStroke,
/* lineVisible= */ true, this.legendLine, stroke, paint);
result.setToolTipText(toolTipText);
result.setURLText(urlText);
result.setDataset(dataset);
result.setSeriesKey(seriesKey);
result.setSeriesIndex(series);
return result;
}