Package org.jfree.chart

Examples of org.jfree.chart.LegendItem


        }
        final String label = key.toString();
        final Paint paint = getSeriesPaint(series);
        final Paint outlinePaint = getSeriesOutlinePaint(series);
        final Stroke stroke = getSeriesOutlineStroke(series);
        final LegendItem item = new LegendItem(label, label,
            null, null, shape, paint, stroke, outlinePaint);
        item.setDataset(getDataset());
        item.setSeriesKey(key);
        item.setSeriesIndex(series);
        result.add(item);
        series++;
      }
      return result;
    }
View Full Code Here


    };
    return supplier;
  }
 
  public LegendItem getLegendItem(JSynopticXYItemRenderer renderer, int datasetIndex, int series) {
    LegendItem ret = renderer.getDefaultLegendItem(datasetIndex,series);
    if (x_ary>1) ret = new XAryLegendItem(ret);
    return ret;
  }
View Full Code Here

        chart.addSubtitle(t);

        // get a reference to the plot for further customisation...
        CategoryPlot plot = (CategoryPlot) chart.getPlot();
        LegendItemCollection items = new LegendItemCollection();
        items.add(new LegendItem("Against all torture", null, null, null,
                new Rectangle2D.Double(-6.0, -3.0, 12.0, 6.0), Color.green));
        items.add(new LegendItem("Some degree permissible", null, null, null,
                new Rectangle2D.Double(-6.0, -3.0, 12.0, 6.0), Color.red));
        plot.setFixedLegendItems(items);
        plot.setInsets(new RectangleInsets(5, 5, 5, 20));
        LegendTitle legend = new LegendTitle(plot);
        legend.setPosition(RectangleEdge.BOTTOM);
View Full Code Here

    if (dataset == null)
    {
      return null;
    }

    LegendItem result = null;
    if (getItemVisible(series, 0))
    {
      final String label = getLegendItemLabelGenerator().generateLabel(dataset,
          series);
      String toolTipText = null;
      if (getLegendItemToolTipGenerator() != null)
      {
        toolTipText = getLegendItemToolTipGenerator().generateLabel(
            dataset, series);
      }
      String urlText = null;
      if (getLegendItemURLGenerator() != null)
      {
        urlText = getLegendItemURLGenerator().generateLabel(
            dataset, series);
      }
      final Paint fillPaint = lookupSeriesPaint(series);
      result = new LegendItem(label, label, toolTipText, urlText,
          getLegendShape(), fillPaint);
      result.setSeriesKey(dataset.getSeriesKey(series));
      result.setSeriesIndex(series);
      result.setDataset(dataset);
      result.setDatasetIndex(datasetIndex);
    }

    return result;

  }
View Full Code Here

        }
        final String label = key.toString();
        final Paint paint = getSeriesPaint(series);
        final Paint outlinePaint = getSeriesOutlinePaint(series);
        final Stroke stroke = getSeriesOutlineStroke(series);
        final LegendItem item = new LegendItem(label, label,
            null, null, shape, paint, stroke, outlinePaint);
        item.setDataset(getDataset());
        item.setSeriesKey(key);
        item.setSeriesIndex(series);
        result.add(item);
        series++;
      }
      return result;
    }
View Full Code Here

                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;
    }
View Full Code Here

        while (iterator.hasNext()) {
            Comparable key = (Comparable) iterator.next();
            String label = key.toString()// TODO: use a generator here
            String description = label;
            Paint paint = (Paint) this.sectionPaints.get(key);
            LegendItem item = new LegendItem(label, description, null,
                    null, getLegendItemShape(), paint,
                    Plot.DEFAULT_OUTLINE_STROKE, paint);
            item.setSeriesKey(key);
            item.setSeriesIndex(section);
            item.setDataset(getDataset());
            result.add(item);
            section++;
        }
        if (this.limit > 0.0) {
            LegendItem a = new LegendItem(this.aggregatedItemsKey.toString(),
                    this.aggregatedItemsKey.toString(), null, null,
                    getLegendItemShape(), this.aggregatedItemsPaint,
                    Plot.DEFAULT_OUTLINE_STROKE, this.aggregatedItemsPaint);
            result.add(a);
        }
View Full Code Here

            XYDataset dataset = getDataset(datasetIndex);
            PolarItemRenderer renderer = getRenderer(datasetIndex);
            if (dataset != null && renderer != null) {
                int seriesCount = dataset.getSeriesCount();
                for (int i = 0; i < seriesCount; i++) {
                    LegendItem item = renderer.getLegendItem(i);
                    result.add(item);
                }
            }
        }
        return result;
View Full Code Here

            MeterInterval mi = (MeterInterval) iterator.next();
            Paint color = mi.getBackgroundPaint();
            if (color == null) {
                color = mi.getOutlinePaint();
            }
            LegendItem item = new LegendItem(mi.getLabel(), mi.getLabel(),
                    null, null, new Rectangle2D.Double(-4.0, -4.0, 8.0, 8.0),
                    color);
            item.setDataset(getDataset());
            result.add(item);
        }
        return result;
    }
View Full Code Here

     * @param series  the series index (zero-based).
     *
     * @return A legend item for the series.
     */
    public LegendItem getLegendItem(int datasetIndex, int series) {
        LegendItem result = null;
        XYPlot xyplot = getPlot();
        if (xyplot != null) {
            XYDataset dataset = xyplot.getDataset(datasetIndex);
            if (dataset != null) {
                XYSeriesLabelGenerator lg = getLegendItemLabelGenerator();
                String label = lg.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 = this.legendBar;
                Paint paint = lookupSeriesPaint(series);
                Paint outlinePaint = lookupSeriesOutlinePaint(series);
                Stroke outlineStroke = lookupSeriesOutlineStroke(series);
                if (this.drawBarOutline) {
                    result = new LegendItem(label, description, toolTipText,
                            urlText, shape, paint, outlineStroke, outlinePaint);
                }
                else {
                    result = new LegendItem(label, description, toolTipText,
                            urlText, shape, paint);
                }
                result.setLabelFont(lookupLegendTextFont(series));
                Paint labelPaint = lookupLegendTextPaint(series);
                if (labelPaint != null) {
                    result.setLabelPaint(labelPaint);
                }
                result.setDataset(dataset);
                result.setDatasetIndex(datasetIndex);
                result.setSeriesKey(dataset.getSeriesKey(series));
                result.setSeriesIndex(series);
                if (getGradientPaintTransformer() != null) {
                    result.setFillPaintTransformer(
                            getGradientPaintTransformer());
                }
            }
        }
        return result;
View Full Code Here

TOP

Related Classes of org.jfree.chart.LegendItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.