use of org.jfree.chart.LegendItemCollection in project SIMVA-SoS by SESoS.
the class CombinedDomainCategoryPlot method getLegendItems.
/**
* Returns a collection of legend items for the plot.
*
* @return The legend items.
*/
@Override
public LegendItemCollection getLegendItems() {
LegendItemCollection result = getFixedLegendItems();
if (result == null) {
result = new LegendItemCollection();
if (this.subplots != null) {
Iterator iterator = this.subplots.iterator();
while (iterator.hasNext()) {
CategoryPlot plot = (CategoryPlot) iterator.next();
LegendItemCollection more = plot.getLegendItems();
result.addAll(more);
}
}
}
return result;
}
use of org.jfree.chart.LegendItemCollection in project SIMVA-SoS by SESoS.
the class CombinedRangeCategoryPlot method getLegendItems.
/**
* Returns a collection of legend items for the plot.
*
* @return The legend items.
*/
@Override
public LegendItemCollection getLegendItems() {
LegendItemCollection result = getFixedLegendItems();
if (result == null) {
result = new LegendItemCollection();
if (this.subplots != null) {
Iterator iterator = this.subplots.iterator();
while (iterator.hasNext()) {
CategoryPlot plot = (CategoryPlot) iterator.next();
LegendItemCollection more = plot.getLegendItems();
result.addAll(more);
}
}
}
return result;
}
use of org.jfree.chart.LegendItemCollection in project SIMVA-SoS by SESoS.
the class SpiderWebPlot method getLegendItems.
/**
* Returns a collection of legend items for the spider web chart.
*
* @return The legend items (never <code>null</code>).
*/
@Override
public LegendItemCollection getLegendItems() {
LegendItemCollection result = new LegendItemCollection();
if (getDataset() == null) {
return result;
}
List keys = null;
if (this.dataExtractOrder == TableOrder.BY_ROW) {
keys = this.dataset.getRowKeys();
} else if (this.dataExtractOrder == TableOrder.BY_COLUMN) {
keys = this.dataset.getColumnKeys();
}
if (keys == null) {
return result;
}
int series = 0;
Iterator iterator = keys.iterator();
Shape shape = getLegendItemShape();
while (iterator.hasNext()) {
Comparable key = (Comparable) iterator.next();
String label = key.toString();
String description = label;
Paint paint = getSeriesPaint(series);
Paint outlinePaint = getSeriesOutlinePaint(series);
Stroke stroke = getSeriesOutlineStroke(series);
LegendItem item = new LegendItem(label, description, null, null, shape, paint, stroke, outlinePaint);
item.setDataset(getDataset());
item.setSeriesKey(key);
item.setSeriesIndex(series);
result.add(item);
series++;
}
return result;
}
use of org.jfree.chart.LegendItemCollection in project SIMVA-SoS by SESoS.
the class XYPlot method getLegendItems.
/**
* Returns the legend items for the plot. Each legend item is generated by
* the plot's renderer, since the renderer is responsible for the visual
* representation of the data.
*
* @return The legend items.
*/
@Override
public LegendItemCollection getLegendItems() {
if (this.fixedLegendItems != null) {
return this.fixedLegendItems;
}
LegendItemCollection result = new LegendItemCollection();
for (XYDataset dataset : this.datasets.values()) {
if (dataset == null) {
continue;
}
int datasetIndex = indexOf(dataset);
XYItemRenderer renderer = getRenderer(datasetIndex);
if (renderer == null) {
renderer = getRenderer(0);
}
if (renderer != null) {
int seriesCount = dataset.getSeriesCount();
for (int i = 0; i < seriesCount; i++) {
if (renderer.isSeriesVisible(i) && renderer.isSeriesVisibleInLegend(i)) {
LegendItem item = renderer.getLegendItem(datasetIndex, i);
if (item != null) {
result.add(item);
}
}
}
}
}
return result;
}
use of org.jfree.chart.LegendItemCollection in project SIMVA-SoS by SESoS.
the class WaferMapRenderer method getLegendCollection.
/**
* Builds the list of legend entries. called by getLegendItems in
* WaferMapPlot to populate the plot legend.
*
* @return The legend items.
*/
public LegendItemCollection getLegendCollection() {
LegendItemCollection result = new LegendItemCollection();
if (this.paintIndex != null && this.paintIndex.size() > 0) {
if (this.paintIndex.size() <= this.paintLimit) {
for (Iterator i = this.paintIndex.entrySet().iterator(); i.hasNext(); ) {
// in this case, every color has a unique value
Map.Entry entry = (Map.Entry) i.next();
String label = entry.getKey().toString();
String description = label;
Shape shape = new Rectangle2D.Double(1d, 1d, 1d, 1d);
Paint paint = lookupSeriesPaint(((Integer) entry.getValue()).intValue());
Paint outlinePaint = Color.black;
Stroke outlineStroke = DEFAULT_STROKE;
result.add(new LegendItem(label, description, null, null, shape, paint, outlineStroke, outlinePaint));
}
} else {
// in this case, every color has a range of values
Set unique = new HashSet();
for (Iterator i = this.paintIndex.entrySet().iterator(); i.hasNext(); ) {
Map.Entry entry = (Map.Entry) i.next();
if (unique.add(entry.getValue())) {
String label = getMinPaintValue((Integer) entry.getValue()).toString() + " - " + getMaxPaintValue((Integer) entry.getValue()).toString();
String description = label;
Shape shape = new Rectangle2D.Double(1d, 1d, 1d, 1d);
Paint paint = getSeriesPaint(((Integer) entry.getValue()).intValue());
Paint outlinePaint = Color.black;
Stroke outlineStroke = DEFAULT_STROKE;
result.add(new LegendItem(label, description, null, null, shape, paint, outlineStroke, outlinePaint));
}
}
// end foreach map entry
}
// end else
}
return result;
}
Aggregations